diff options
| author | Markus Mittendrein <git@maxmitti.tk> | 2018-03-18 00:40:38 +0100 |
|---|---|---|
| committer | Markus Mittendrein <git@maxmitti.tk> | 2018-03-18 00:40:38 +0100 |
| commit | ff5f5c50bd2ce931a62b2eb1b0aed97c0fa370c5 (patch) | |
| tree | a38bfa6769aa8165b417babd4053834904ce5a89 /DTTransform.c | |
| parent | 9b5d0a3ddf41e686439dcda1edfe11eee51c3b07 (diff) | |
| download | System.c4g-ff5f5c50bd2ce931a62b2eb1b0aed97c0fa370c5.tar.gz System.c4g-ff5f5c50bd2ce931a62b2eb1b0aed97c0fa370c5.zip | |
Update to newest version
DTCallback: Add fast callbacks (only Object/DefinitionCallback() is possible) and restructure CallA() for hopefully better performance
DTCallback: Fix all custom calls to allow overriding in Definition- and Object-context
DTFilterObjects: new addition
DTMenuCompatibility: add Menu_Entry compatibility version due to the new Menu_Entry-API
DTObjectSerializing: small progress, still WIP
DTPlayers: Fix constant enum definitions (thanks to the preprocessor's precalculator)
DTQuickSort: Add custom callback args
DTScopedVars: Fix all custom calls to allow overriding in Definition- and Object-context
DTScopedVars: CustomScopedVar-implementations must now return another less custom ScopedVar instead of a reference (due to _inherited())
DTTransform: disable MirrorZ
DTTransform: fix Matrix3x3Multiply and thus PreTransform
DTTransform: fix whitespace
DTTransform: update comments
DTUTility: Fix indentation and whitespace
DTUtility: Add GetShape, InRect and GetPlayerByID
DTCallback, DTObjectSerializing: Rely on the preprocessor's precalculator
Diffstat (limited to 'DTTransform.c')
| -rw-r--r-- | DTTransform.c | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/DTTransform.c b/DTTransform.c index 07206c2..d155827 100644 --- a/DTTransform.c +++ b/DTTransform.c @@ -5,7 +5,7 @@ global func ResetTransform(overlays) for(var overlay in TransformOverlays(overlays)) { if(!overlay) SetObjDrawTransform(0, 0, 0, 0, 0, 0, this, overlay); - else SetObjDrawTransform(1000, 0, 0, 0, 1000, 0, this, overlay); + else SetObjDrawTransform(1000, 0, 0, 0, 1000, 0, this, overlay); } } @@ -76,7 +76,7 @@ global func TransformOverlays(overlays) } last = overlay; } - + return ret; } else @@ -90,10 +90,10 @@ global func Rotate() { return RotateZ(...); } global func RotateX(int phi, int prec) { prec = prec || 1; - + var cos = Cos(phi, 1000, prec); var sin = Sin(phi, 1000, prec); - + return [ [1000, 0, 0], @@ -105,10 +105,10 @@ global func RotateX(int phi, int prec) global func RotateY(int phi, int prec) { prec = prec || 1; - + var cos = Cos(phi, 1000, prec); var sin = Sin(phi, 1000, prec); - + return [ [ cos, 0, sin], @@ -120,10 +120,10 @@ global func RotateY(int phi, int prec) global func RotateZ(int phi, int prec) { prec = prec || 1; - + var cos = Cos(phi, 1000, prec); var sin = Sin(phi, 1000, prec); - + return [ [cos, -sin, 0], @@ -182,16 +182,6 @@ global func MirrorY() ]; } -global func MirrorZ() // useless? -{ - return - [ - [1000, 0, 0], - [ 0, 1000, 0], - [ 0, 0, -1000] - ]; -} - global func Skew2D(int x, int y) { return @@ -209,13 +199,15 @@ global func Matrix3x3Multiply(array a, array b, int precision) { return [ - [(a[0][2] * b[2][0] + a[0][1] * b[1][0] + a[0][0] * b[0][0]) / precision, (a[0][2] * b[2][1] + a[0][1] * b[1][1] + a[0][0] * b[0][1]) / precision, (a[0][2] * b[2][2] + a[0][1] * b[1][2] + a[0][0] * b[0][2]) / precision], - [(a[1][2] * b[2][0] + a[1][1] * b[1][0] + a[1][0] * b[0][0]) / precision, (a[1][2] * b[2][1] + a[1][1] * b[1][1] + a[1][0] * b[0][1]) / precision, (a[1][2] * b[2][2] + a[1][1] * b[1][2] + a[1][0] * b[0][2]) / precision], - [(a[2][2] * b[2][0] + a[2][1] * b[1][0] + a[2][0] * b[0][0]) / precision, (a[2][2] * b[2][1] + a[2][1] * b[1][1] + a[2][0] * b[0][1]) / precision, (a[2][2] * b[2][2] + a[2][1] * b[1][2] + a[2][0] * b[0][2]) / precision] + [(a[2][0] * b[0][2] + a[1][0] * b[0][1] + a[0][0] * b[0][0]) / precision, (a[2][1] * b[0][2] + a[1][1] * b[0][1] + a[0][1] * b[0][0]) / precision, (a[2][2] * b[0][2] + a[1][2] * b[0][1] + a[0][2] * b[0][0]) / precision], + [(a[2][0] * b[1][2] + a[1][0] * b[1][1] + a[0][0] * b[1][0]) / precision, (a[2][1] * b[1][2] + a[1][1] * b[1][1] + a[0][1] * b[1][0]) / precision, (a[2][2] * b[1][2] + a[1][2] * b[1][1] + a[0][2] * b[1][0]) / precision], + [(a[2][0] * b[2][2] + a[1][0] * b[2][1] + a[0][0] * b[2][0]) / precision, (a[2][1] * b[2][2] + a[1][1] * b[2][1] + a[0][1] * b[2][0]) / precision, (a[2][2] * b[2][2] + a[1][2] * b[2][1] + a[0][2] * b[2][0]) / precision] ]; } -global func PreTransform(array transforms) // funzt nit +// Combines several transforms (as used for SetTransform) into one transform. Returns a single transform (like all other transform functions). +// May be used to cache transforms. For direct application use SetTransform instead, which implicitly uses the native engine implementation of matrix multiplication. +global func PreTransform(array transforms) { if(GetLength(transforms) == 0) { @@ -232,9 +224,12 @@ global func PreTransform(array transforms) // funzt nit } } -// Riesenschädl -// GetCursor(0)->SetTransform([TranslateY(8), RotateX(4), ScaleZ(400), TranslateY(-10)]) +// Examples + +// Clonk with giant head: +// GetCursor0->SetTransform([TranslateY(8), RotateX(4), ScaleZ(400), TranslateY(-10)]) -// Ähnlich Chipakyus Demo +// 3D-Rotating Hut: // Schedule("FindObject(HUT2)->SetTransform([TranslateY(-20), RotateZ(++Global(0)), TranslateY(0), RotateX(-1), TranslateY(20)])", 1, 10000) -// Schedule("GetCursor(0)->SetTransform([TranslateY(-8), RotateZ(++Global(0)), TranslateY(0), RotateX(-2), TranslateY(8)])", 1, 10000) +// 3D-Rotating Clonk: +// Schedule("GetCursor(0)->SetTransform([TranslateY(-8), RotateZ(++Global(0)), TranslateY(0), RotateX(-2), TranslateY(8)])", 1, 10000)
\ No newline at end of file |
