diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2018-03-01 01:51:35 -0600 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2018-03-22 21:53:21 -0500 |
commit | ff97c97c930f80209480c630622b1b64372bd65a (patch) | |
tree | b994272782937c9c08f88011457d9f50c01363d4 /modules/mono/glue/cs_files/Transform.cs | |
parent | c094e90b2531b9ec5554dfc77c1fc613e02b87e5 (diff) | |
download | redot-engine-ff97c97c930f80209480c630622b1b64372bd65a.tar.gz |
Replace float with real_t, default Vectors, other misc C# improvements
Replace float with real_t in most files, defined at the top of each file via using. Objects such as Vector3 now accept doubles as inputs, and convert to real_t internally. I've added default Vectors such as Vector3.Zero. Other misc C# improvements such as Mathf.RoundToInt(). Color continues to use float only because high precision is not needed for 8-bit color math and to keep things simple. Everything seems to compile and work fine, but testing is requested, as this is the first time I've ever contributed to Godot.
Diffstat (limited to 'modules/mono/glue/cs_files/Transform.cs')
-rw-r--r-- | modules/mono/glue/cs_files/Transform.cs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/mono/glue/cs_files/Transform.cs b/modules/mono/glue/cs_files/Transform.cs index 5214100d36..d3126f7edf 100644 --- a/modules/mono/glue/cs_files/Transform.cs +++ b/modules/mono/glue/cs_files/Transform.cs @@ -1,6 +1,12 @@ using System; using System.Runtime.InteropServices; +#if REAL_T_IS_DOUBLE +using real_t = System.Double; +#else +using real_t = System.Single; +#endif + namespace Godot { [StructLayout(LayoutKind.Sequential)] @@ -33,7 +39,7 @@ namespace Godot return new Transform(basis.Orthonormalized(), origin); } - public Transform Rotated(Vector3 axis, float phi) + public Transform Rotated(Vector3 axis, real_t phi) { return new Transform(new Basis(axis, phi), new Vector3()) * this; } @@ -97,7 +103,8 @@ namespace Godot (basis[0, 2] * vInv.x) + (basis[1, 2] * vInv.y) + (basis[2, 2] * vInv.z) ); } - + + // Constructors public Transform(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 origin) { this.basis = Basis.CreateFromAxes(xAxis, yAxis, zAxis); |