C#: Renames to follow .NET naming conventions

Renamed C# types and members to use PascalCase and follow .NET naming conventions.
This commit is contained in:
Raul Santos 2022-12-07 16:11:39 +01:00
parent 4788cb35c1
commit a968e51414
No known key found for this signature in database
GPG Key ID: B532473AE3A803E4
60 changed files with 2885 additions and 2536 deletions

View File

@ -66,7 +66,7 @@
[/gdscript] [/gdscript]
[csharp] [csharp]
// position (-3, 2, 0), size (1, 1, 1) // position (-3, 2, 0), size (1, 1, 1)
var box = new AABB(new Vector3(-3, 2, 0), new Vector3(1, 1, 1)); var box = new Aabb(new Vector3(-3, 2, 0), new Vector3(1, 1, 1));
// position (-3, -1, 0), size (3, 4, 2), so we fit both the original AABB and Vector3(0, -1, 2) // position (-3, -1, 0), size (3, 4, 2), so we fit both the original AABB and Vector3(0, -1, 2)
var box2 = box.Expand(new Vector3(0, -1, 2)); var box2 = box.Expand(new Vector3(0, -1, 2));
[/csharp] [/csharp]

View File

@ -17,11 +17,11 @@
[/gdscript] [/gdscript]
[csharp] [csharp]
AStarGrid2D astarGrid = new AStarGrid2D(); AStarGrid2D astarGrid = new AStarGrid2D();
astarGrid.Size = new Vector2i(32, 32); astarGrid.Size = new Vector2I(32, 32);
astarGrid.CellSize = new Vector2i(16, 16); astarGrid.CellSize = new Vector2I(16, 16);
astarGrid.Update(); astarGrid.Update();
GD.Print(astarGrid.GetIdPath(Vector2i.Zero, new Vector2i(3, 4))); // prints (0, 0), (1, 1), (2, 2), (3, 3), (3, 4) GD.Print(astarGrid.GetIdPath(Vector2I.Zero, new Vector2I(3, 4))); // prints (0, 0), (1, 1), (2, 2), (3, 3), (3, 4)
GD.Print(astarGrid.GetPointPath(Vector2i.Zero, new Vector2i(3, 4))); // prints (0, 0), (16, 16), (32, 32), (48, 48), (48, 64) GD.Print(astarGrid.GetPointPath(Vector2I.Zero, new Vector2I(3, 4))); // prints (0, 0), (16, 16), (32, 32), (48, 48), (48, 64)
[/csharp] [/csharp]
[/codeblocks] [/codeblocks]
</description> </description>

View File

@ -15,7 +15,7 @@
$animation_tree.set("parameters/conditions/idle", is_on_floor and (linear_velocity.x == 0)) $animation_tree.set("parameters/conditions/idle", is_on_floor and (linear_velocity.x == 0))
[/gdscript] [/gdscript]
[csharp] [csharp]
GetNode&lt;AnimationTree&gt;("animation_tree").Set("parameters/conditions/idle", IsOnFloor &amp;&amp; (LinearVelocity.x == 0)); GetNode&lt;AnimationTree&gt;("animation_tree").Set("parameters/conditions/idle", IsOnFloor &amp;&amp; (LinearVelocity.X == 0));
[/csharp] [/csharp]
[/codeblocks] [/codeblocks]
</member> </member>

View File

@ -525,7 +525,7 @@
var img = new Image(); var img = new Image();
img.Create(imgWidth, imgHeight, false, Image.Format.Rgba8); img.Create(imgWidth, imgHeight, false, Image.Format.Rgba8);
img.SetPixelv(new Vector2i(1, 2), Colors.Red); // Sets the color at (1, 2) to red. img.SetPixelv(new Vector2I(1, 2), Colors.Red); // Sets the color at (1, 2) to red.
[/csharp] [/csharp]
[/codeblocks] [/codeblocks]
This is the same as [method set_pixel], but with a [Vector2i] argument instead of two integer arguments. This is the same as [method set_pixel], but with a [Vector2i] argument instead of two integer arguments.

View File

@ -80,9 +80,9 @@
[/gdscript] [/gdscript]
[csharp] [csharp]
// position (-3, 2), size (1, 1) // position (-3, 2), size (1, 1)
var rect = new Rect2i(new Vector2i(-3, 2), new Vector2i(1, 1)); var rect = new Rect2I(new Vector2I(-3, 2), new Vector2I(1, 1));
// position (-3, -1), size (3, 4), so we fit both rect and Vector2i(0, -1) // position (-3, -1), size (3, 4), so we fit both rect and Vector2I(0, -1)
var rect2 = rect.Expand(new Vector2i(0, -1)); var rect2 = rect.Expand(new Vector2I(0, -1));
[/csharp] [/csharp]
[/codeblocks] [/codeblocks]
</description> </description>

View File

@ -770,12 +770,12 @@
var column_number = result.x var column_number = result.x
[/gdscript] [/gdscript]
[csharp] [csharp]
Vector2i result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0); Vector2I result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0);
if (result.Length &gt; 0) if (result.X != -1)
{ {
// Result found. // Result found.
int lineNumber = result.y; int lineNumber = result.Y;
int columnNumber = result.x; int columnNumber = result.X;
} }
[/csharp] [/csharp]
[/codeblocks] [/codeblocks]

View File

@ -60,6 +60,7 @@
#include "mono_gd/gd_mono_cache.h" #include "mono_gd/gd_mono_cache.h"
#include "signal_awaiter_utils.h" #include "signal_awaiter_utils.h"
#include "utils/macros.h" #include "utils/macros.h"
#include "utils/naming_utils.h"
#include "utils/string_utils.h" #include "utils/string_utils.h"
#define CACHED_STRING_NAME(m_var) (CSharpLanguage::get_singleton()->get_string_names().m_var) #define CACHED_STRING_NAME(m_var) (CSharpLanguage::get_singleton()->get_string_names().m_var)
@ -333,7 +334,7 @@ void CSharpLanguage::get_string_delimiters(List<String> *p_delimiters) const {
} }
static String get_base_class_name(const String &p_base_class_name, const String p_class_name) { static String get_base_class_name(const String &p_base_class_name, const String p_class_name) {
String base_class = p_base_class_name; String base_class = pascal_to_pascal_case(p_base_class_name);
if (p_class_name == base_class) { if (p_class_name == base_class) {
base_class = "Godot." + base_class; base_class = "Godot." + base_class;
} }
@ -394,13 +395,18 @@ bool CSharpLanguage::supports_builtin_mode() const {
} }
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
struct VariantCsName {
Variant::Type variant_type;
const String cs_type;
};
static String variant_type_to_managed_name(const String &p_var_type_name) { static String variant_type_to_managed_name(const String &p_var_type_name) {
if (p_var_type_name.is_empty()) { if (p_var_type_name.is_empty()) {
return "Variant"; return "Variant";
} }
if (ClassDB::class_exists(p_var_type_name)) { if (ClassDB::class_exists(p_var_type_name)) {
return p_var_type_name; return pascal_to_pascal_case(p_var_type_name);
} }
if (p_var_type_name == Variant::get_type_name(Variant::OBJECT)) { if (p_var_type_name == Variant::get_type_name(Variant::OBJECT)) {
@ -459,34 +465,34 @@ static String variant_type_to_managed_name(const String &p_var_type_name) {
return "Signal"; return "Signal";
} }
Variant::Type var_types[] = { const VariantCsName var_types[] = {
Variant::BOOL, { Variant::BOOL, "bool" },
Variant::INT, { Variant::INT, "long" },
Variant::VECTOR2, { Variant::VECTOR2, "Vector2" },
Variant::VECTOR2I, { Variant::VECTOR2I, "Vector2I" },
Variant::RECT2, { Variant::RECT2, "Rect2" },
Variant::RECT2I, { Variant::RECT2I, "Rect2I" },
Variant::VECTOR3, { Variant::VECTOR3, "Vector3" },
Variant::VECTOR3I, { Variant::VECTOR3I, "Vector3I" },
Variant::TRANSFORM2D, { Variant::TRANSFORM2D, "Transform2D" },
Variant::VECTOR4, { Variant::VECTOR4, "Vector4" },
Variant::VECTOR4I, { Variant::VECTOR4I, "Vector4I" },
Variant::PLANE, { Variant::PLANE, "Plane" },
Variant::QUATERNION, { Variant::QUATERNION, "Quaternion" },
Variant::AABB, { Variant::AABB, "Aabb" },
Variant::BASIS, { Variant::BASIS, "Basis" },
Variant::TRANSFORM3D, { Variant::TRANSFORM3D, "Transform3D" },
Variant::PROJECTION, { Variant::PROJECTION, "Projection" },
Variant::COLOR, { Variant::COLOR, "Color" },
Variant::STRING_NAME, { Variant::STRING_NAME, "StringName" },
Variant::NODE_PATH, { Variant::NODE_PATH, "NodePath" },
Variant::RID, { Variant::RID, "Rid" },
Variant::CALLABLE { Variant::CALLABLE, "Callable" },
}; };
for (unsigned int i = 0; i < sizeof(var_types) / sizeof(Variant::Type); i++) { for (unsigned int i = 0; i < sizeof(var_types) / sizeof(VariantCsName); i++) {
if (p_var_type_name == Variant::get_type_name(var_types[i])) { if (p_var_type_name == Variant::get_type_name(var_types[i].variant_type)) {
return p_var_type_name; return var_types[i].cs_type;
} }
} }

View File

@ -29,19 +29,19 @@ namespace Godot.SourceGenerators.Sample
// Godot structs // Godot structs
[Export] private Vector2 field_Vector2 = new(10f, 10f); [Export] private Vector2 field_Vector2 = new(10f, 10f);
[Export] private Vector2i field_Vector2i = Vector2i.Up; [Export] private Vector2I field_Vector2I = Vector2I.Up;
[Export] private Rect2 field_Rect2 = new(new Vector2(10f, 10f), new Vector2(10f, 10f)); [Export] private Rect2 field_Rect2 = new(new Vector2(10f, 10f), new Vector2(10f, 10f));
[Export] private Rect2i field_Rect2i = new(new Vector2i(10, 10), new Vector2i(10, 10)); [Export] private Rect2I field_Rect2I = new(new Vector2I(10, 10), new Vector2I(10, 10));
[Export] private Transform2D field_Transform2D = Transform2D.Identity; [Export] private Transform2D field_Transform2D = Transform2D.Identity;
[Export] private Vector3 field_Vector3 = new(10f, 10f, 10f); [Export] private Vector3 field_Vector3 = new(10f, 10f, 10f);
[Export] private Vector3i field_Vector3i = Vector3i.Back; [Export] private Vector3I field_Vector3I = Vector3I.Back;
[Export] private Basis field_Basis = new Basis(Quaternion.Identity); [Export] private Basis field_Basis = new Basis(Quaternion.Identity);
[Export] private Quaternion field_Quaternion = new Quaternion(Basis.Identity); [Export] private Quaternion field_Quaternion = new Quaternion(Basis.Identity);
[Export] private Transform3D field_Transform3D = Transform3D.Identity; [Export] private Transform3D field_Transform3D = Transform3D.Identity;
[Export] private Vector4 field_Vector4 = new(10f, 10f, 10f, 10f); [Export] private Vector4 field_Vector4 = new(10f, 10f, 10f, 10f);
[Export] private Vector4i field_Vector4i = Vector4i.One; [Export] private Vector4I field_Vector4I = Vector4I.One;
[Export] private Projection field_Projection = Projection.Identity; [Export] private Projection field_Projection = Projection.Identity;
[Export] private AABB field_AABB = new AABB(10f, 10f, 10f, new Vector3(1f, 1f, 1f)); [Export] private Aabb field_Aabb = new Aabb(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
[Export] private Color field_Color = Colors.Aquamarine; [Export] private Color field_Color = Colors.Aquamarine;
[Export] private Plane field_Plane = Plane.PlaneXZ; [Export] private Plane field_Plane = Plane.PlaneXZ;
[Export] private Callable field_Callable = new Callable(Engine.GetMainLoop(), "_process"); [Export] private Callable field_Callable = new Callable(Engine.GetMainLoop(), "_process");
@ -83,7 +83,7 @@ namespace Godot.SourceGenerators.Sample
[Export] private Godot.Object[] field_GodotObjectOrDerivedArray = { null }; [Export] private Godot.Object[] field_GodotObjectOrDerivedArray = { null };
[Export] private StringName[] field_StringNameArray = { "foo", "bar" }; [Export] private StringName[] field_StringNameArray = { "foo", "bar" };
[Export] private NodePath[] field_NodePathArray = { "foo", "bar" }; [Export] private NodePath[] field_NodePathArray = { "foo", "bar" };
[Export] private RID[] field_RIDArray = { default, default, default }; [Export] private Rid[] field_RidArray = { default, default, default };
// Note we use Array and not System.Array. This tests the generated namespace qualification. // Note we use Array and not System.Array. This tests the generated namespace qualification.
[Export] private Int32[] field_empty_Int32Array = Array.Empty<Int32>(); [Export] private Int32[] field_empty_Int32Array = Array.Empty<Int32>();
// Note we use List and not System.Collections.Generic. // Note we use List and not System.Collections.Generic.
@ -97,7 +97,7 @@ namespace Godot.SourceGenerators.Sample
[Export] private Godot.Texture field_GodotResourceTexture; [Export] private Godot.Texture field_GodotResourceTexture;
[Export] private StringName field_StringName = new StringName("foo"); [Export] private StringName field_StringName = new StringName("foo");
[Export] private NodePath field_NodePath = new NodePath("foo"); [Export] private NodePath field_NodePath = new NodePath("foo");
[Export] private RID field_RID; [Export] private Rid field_Rid;
[Export] [Export]
private Godot.Collections.Dictionary field_GodotDictionary = private Godot.Collections.Dictionary field_GodotDictionary =

View File

@ -117,19 +117,19 @@ namespace Godot.SourceGenerators.Sample
// Godot structs // Godot structs
[Export] private Vector2 property_Vector2 { get; set; } = new(10f, 10f); [Export] private Vector2 property_Vector2 { get; set; } = new(10f, 10f);
[Export] private Vector2i property_Vector2i { get; set; } = Vector2i.Up; [Export] private Vector2I property_Vector2I { get; set; } = Vector2I.Up;
[Export] private Rect2 property_Rect2 { get; set; } = new(new Vector2(10f, 10f), new Vector2(10f, 10f)); [Export] private Rect2 property_Rect2 { get; set; } = new(new Vector2(10f, 10f), new Vector2(10f, 10f));
[Export] private Rect2i property_Rect2i { get; set; } = new(new Vector2i(10, 10), new Vector2i(10, 10)); [Export] private Rect2I property_Rect2I { get; set; } = new(new Vector2I(10, 10), new Vector2I(10, 10));
[Export] private Transform2D property_Transform2D { get; set; } = Transform2D.Identity; [Export] private Transform2D property_Transform2D { get; set; } = Transform2D.Identity;
[Export] private Vector3 property_Vector3 { get; set; } = new(10f, 10f, 10f); [Export] private Vector3 property_Vector3 { get; set; } = new(10f, 10f, 10f);
[Export] private Vector3i property_Vector3i { get; set; } = Vector3i.Back; [Export] private Vector3I property_Vector3I { get; set; } = Vector3I.Back;
[Export] private Basis property_Basis { get; set; } = new Basis(Quaternion.Identity); [Export] private Basis property_Basis { get; set; } = new Basis(Quaternion.Identity);
[Export] private Quaternion property_Quaternion { get; set; } = new Quaternion(Basis.Identity); [Export] private Quaternion property_Quaternion { get; set; } = new Quaternion(Basis.Identity);
[Export] private Transform3D property_Transform3D { get; set; } = Transform3D.Identity; [Export] private Transform3D property_Transform3D { get; set; } = Transform3D.Identity;
[Export] private Vector4 property_Vector4 { get; set; } = new(10f, 10f, 10f, 10f); [Export] private Vector4 property_Vector4 { get; set; } = new(10f, 10f, 10f, 10f);
[Export] private Vector4i property_Vector4i { get; set; } = Vector4i.One; [Export] private Vector4I property_Vector4I { get; set; } = Vector4I.One;
[Export] private Projection property_Projection { get; set; } = Projection.Identity; [Export] private Projection property_Projection { get; set; } = Projection.Identity;
[Export] private AABB property_AABB { get; set; } = new AABB(10f, 10f, 10f, new Vector3(1f, 1f, 1f)); [Export] private Aabb property_Aabb { get; set; } = new Aabb(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
[Export] private Color property_Color { get; set; } = Colors.Aquamarine; [Export] private Color property_Color { get; set; } = Colors.Aquamarine;
[Export] private Plane property_Plane { get; set; } = Plane.PlaneXZ; [Export] private Plane property_Plane { get; set; } = Plane.PlaneXZ;
[Export] private Callable property_Callable { get; set; } = new Callable(Engine.GetMainLoop(), "_process"); [Export] private Callable property_Callable { get; set; } = new Callable(Engine.GetMainLoop(), "_process");
@ -171,7 +171,7 @@ namespace Godot.SourceGenerators.Sample
[Export] private Godot.Object[] property_GodotObjectOrDerivedArray { get; set; } = { null }; [Export] private Godot.Object[] property_GodotObjectOrDerivedArray { get; set; } = { null };
[Export] private StringName[] field_StringNameArray { get; set; } = { "foo", "bar" }; [Export] private StringName[] field_StringNameArray { get; set; } = { "foo", "bar" };
[Export] private NodePath[] field_NodePathArray { get; set; } = { "foo", "bar" }; [Export] private NodePath[] field_NodePathArray { get; set; } = { "foo", "bar" };
[Export] private RID[] field_RIDArray { get; set; } = { default, default, default }; [Export] private Rid[] field_RidArray { get; set; } = { default, default, default };
// Variant // Variant
[Export] private Variant property_Variant { get; set; } = "foo"; [Export] private Variant property_Variant { get; set; } = "foo";
@ -181,7 +181,7 @@ namespace Godot.SourceGenerators.Sample
[Export] private Godot.Texture property_GodotResourceTexture { get; set; } [Export] private Godot.Texture property_GodotResourceTexture { get; set; }
[Export] private StringName property_StringName { get; set; } = new StringName("foo"); [Export] private StringName property_StringName { get; set; } = new StringName("foo");
[Export] private NodePath property_NodePath { get; set; } = new NodePath("foo"); [Export] private NodePath property_NodePath { get; set; } = new NodePath("foo");
[Export] private RID property_RID { get; set; } [Export] private Rid property_Rid { get; set; }
[Export] [Export]
private Godot.Collections.Dictionary property_GodotDictionary { get; set; } = private Godot.Collections.Dictionary property_GodotDictionary { get; set; } =

View File

@ -10,7 +10,7 @@ namespace Godot.SourceGenerators
public const string ExportSubgroupAttr = "Godot.ExportSubgroupAttribute"; public const string ExportSubgroupAttr = "Godot.ExportSubgroupAttribute";
public const string SignalAttr = "Godot.SignalAttribute"; public const string SignalAttr = "Godot.SignalAttribute";
public const string MustBeVariantAttr = "Godot.MustBeVariantAttribute"; public const string MustBeVariantAttr = "Godot.MustBeVariantAttribute";
public const string GodotClassNameAttr = "Godot.GodotClassName"; public const string GodotClassNameAttr = "Godot.GodotClassNameAttribute";
public const string SystemFlagsAttr = "System.FlagsAttribute"; public const string SystemFlagsAttr = "System.FlagsAttribute";
} }
} }

View File

@ -12,19 +12,19 @@ namespace Godot.SourceGenerators
Float = 3, Float = 3,
String = 4, String = 4,
Vector2 = 5, Vector2 = 5,
Vector2i = 6, Vector2I = 6,
Rect2 = 7, Rect2 = 7,
Rect2i = 8, Rect2I = 8,
Vector3 = 9, Vector3 = 9,
Vector3i = 10, Vector3I = 10,
Transform2d = 11, Transform2D = 11,
Vector4 = 12, Vector4 = 12,
Vector4i = 13, Vector4I = 13,
Plane = 14, Plane = 14,
Quaternion = 15, Quaternion = 15,
Aabb = 16, Aabb = 16,
Basis = 17, Basis = 17,
Transform3d = 18, Transform3D = 18,
Projection = 19, Projection = 19,
Color = 20, Color = 20,
StringName = 21, StringName = 21,
@ -56,12 +56,12 @@ namespace Godot.SourceGenerators
ExpEasing = 4, ExpEasing = 4,
Link = 5, Link = 5,
Flags = 6, Flags = 6,
Layers2dRender = 7, Layers2DRender = 7,
Layers2dPhysics = 8, Layers2DPhysics = 8,
Layers2dNavigation = 9, Layers2DNavigation = 9,
Layers3dRender = 10, Layers3DRender = 10,
Layers3dPhysics = 11, Layers3DPhysics = 11,
Layers3dNavigation = 12, Layers3DNavigation = 12,
File = 13, File = 13,
Dir = 14, Dir = 14,
GlobalFile = 15, GlobalFile = 15,

View File

@ -21,19 +21,19 @@ namespace Godot.SourceGenerators
// Godot structs // Godot structs
Vector2, Vector2,
Vector2i, Vector2I,
Rect2, Rect2,
Rect2i, Rect2I,
Transform2D, Transform2D,
Vector3, Vector3,
Vector3i, Vector3I,
Basis, Basis,
Quaternion, Quaternion,
Transform3D, Transform3D,
Vector4, Vector4,
Vector4i, Vector4I,
Projection, Projection,
AABB, Aabb,
Color, Color,
Plane, Plane,
Callable, Callable,
@ -55,7 +55,7 @@ namespace Godot.SourceGenerators
GodotObjectOrDerivedArray, GodotObjectOrDerivedArray,
SystemArrayOfStringName, SystemArrayOfStringName,
SystemArrayOfNodePath, SystemArrayOfNodePath,
SystemArrayOfRID, SystemArrayOfRid,
// Variant // Variant
Variant, Variant,
@ -64,7 +64,7 @@ namespace Godot.SourceGenerators
GodotObjectOrDerived, GodotObjectOrDerived,
StringName, StringName,
NodePath, NodePath,
RID, Rid,
GodotDictionary, GodotDictionary,
GodotArray, GodotArray,
GodotGenericDictionary, GodotGenericDictionary,

View File

@ -40,19 +40,19 @@ namespace Godot.SourceGenerators
MarshalType.Double => VariantType.Float, MarshalType.Double => VariantType.Float,
MarshalType.String => VariantType.String, MarshalType.String => VariantType.String,
MarshalType.Vector2 => VariantType.Vector2, MarshalType.Vector2 => VariantType.Vector2,
MarshalType.Vector2i => VariantType.Vector2i, MarshalType.Vector2I => VariantType.Vector2I,
MarshalType.Rect2 => VariantType.Rect2, MarshalType.Rect2 => VariantType.Rect2,
MarshalType.Rect2i => VariantType.Rect2i, MarshalType.Rect2I => VariantType.Rect2I,
MarshalType.Transform2D => VariantType.Transform2d, MarshalType.Transform2D => VariantType.Transform2D,
MarshalType.Vector3 => VariantType.Vector3, MarshalType.Vector3 => VariantType.Vector3,
MarshalType.Vector3i => VariantType.Vector3i, MarshalType.Vector3I => VariantType.Vector3I,
MarshalType.Basis => VariantType.Basis, MarshalType.Basis => VariantType.Basis,
MarshalType.Quaternion => VariantType.Quaternion, MarshalType.Quaternion => VariantType.Quaternion,
MarshalType.Transform3D => VariantType.Transform3d, MarshalType.Transform3D => VariantType.Transform3D,
MarshalType.Vector4 => VariantType.Vector4, MarshalType.Vector4 => VariantType.Vector4,
MarshalType.Vector4i => VariantType.Vector4i, MarshalType.Vector4I => VariantType.Vector4I,
MarshalType.Projection => VariantType.Projection, MarshalType.Projection => VariantType.Projection,
MarshalType.AABB => VariantType.Aabb, MarshalType.Aabb => VariantType.Aabb,
MarshalType.Color => VariantType.Color, MarshalType.Color => VariantType.Color,
MarshalType.Plane => VariantType.Plane, MarshalType.Plane => VariantType.Plane,
MarshalType.Callable => VariantType.Callable, MarshalType.Callable => VariantType.Callable,
@ -70,12 +70,12 @@ namespace Godot.SourceGenerators
MarshalType.GodotObjectOrDerivedArray => VariantType.Array, MarshalType.GodotObjectOrDerivedArray => VariantType.Array,
MarshalType.SystemArrayOfStringName => VariantType.Array, MarshalType.SystemArrayOfStringName => VariantType.Array,
MarshalType.SystemArrayOfNodePath => VariantType.Array, MarshalType.SystemArrayOfNodePath => VariantType.Array,
MarshalType.SystemArrayOfRID => VariantType.Array, MarshalType.SystemArrayOfRid => VariantType.Array,
MarshalType.Variant => VariantType.Nil, MarshalType.Variant => VariantType.Nil,
MarshalType.GodotObjectOrDerived => VariantType.Object, MarshalType.GodotObjectOrDerived => VariantType.Object,
MarshalType.StringName => VariantType.StringName, MarshalType.StringName => VariantType.StringName,
MarshalType.NodePath => VariantType.NodePath, MarshalType.NodePath => VariantType.NodePath,
MarshalType.RID => VariantType.Rid, MarshalType.Rid => VariantType.Rid,
MarshalType.GodotDictionary => VariantType.Dictionary, MarshalType.GodotDictionary => VariantType.Dictionary,
MarshalType.GodotArray => VariantType.Array, MarshalType.GodotArray => VariantType.Array,
MarshalType.GodotGenericDictionary => VariantType.Dictionary, MarshalType.GodotGenericDictionary => VariantType.Dictionary,
@ -130,22 +130,22 @@ namespace Godot.SourceGenerators
return type switch return type switch
{ {
{ Name: "Vector2" } => MarshalType.Vector2, { Name: "Vector2" } => MarshalType.Vector2,
{ Name: "Vector2i" } => MarshalType.Vector2i, { Name: "Vector2I" } => MarshalType.Vector2I,
{ Name: "Rect2" } => MarshalType.Rect2, { Name: "Rect2" } => MarshalType.Rect2,
{ Name: "Rect2i" } => MarshalType.Rect2i, { Name: "Rect2I" } => MarshalType.Rect2I,
{ Name: "Transform2D" } => MarshalType.Transform2D, { Name: "Transform2D" } => MarshalType.Transform2D,
{ Name: "Vector3" } => MarshalType.Vector3, { Name: "Vector3" } => MarshalType.Vector3,
{ Name: "Vector3i" } => MarshalType.Vector3i, { Name: "Vector3I" } => MarshalType.Vector3I,
{ Name: "Basis" } => MarshalType.Basis, { Name: "Basis" } => MarshalType.Basis,
{ Name: "Quaternion" } => MarshalType.Quaternion, { Name: "Quaternion" } => MarshalType.Quaternion,
{ Name: "Transform3D" } => MarshalType.Transform3D, { Name: "Transform3D" } => MarshalType.Transform3D,
{ Name: "Vector4" } => MarshalType.Vector4, { Name: "Vector4" } => MarshalType.Vector4,
{ Name: "Vector4i" } => MarshalType.Vector4i, { Name: "Vector4I" } => MarshalType.Vector4I,
{ Name: "Projection" } => MarshalType.Projection, { Name: "Projection" } => MarshalType.Projection,
{ Name: "AABB" } => MarshalType.AABB, { Name: "Aabb" } => MarshalType.Aabb,
{ Name: "Color" } => MarshalType.Color, { Name: "Color" } => MarshalType.Color,
{ Name: "Plane" } => MarshalType.Plane, { Name: "Plane" } => MarshalType.Plane,
{ Name: "RID" } => MarshalType.RID, { Name: "Rid" } => MarshalType.Rid,
{ Name: "Callable" } => MarshalType.Callable, { Name: "Callable" } => MarshalType.Callable,
{ Name: "Signal" } => MarshalType.Signal, { Name: "Signal" } => MarshalType.Signal,
{ Name: "Variant" } => MarshalType.Variant, { Name: "Variant" } => MarshalType.Variant,
@ -196,8 +196,8 @@ namespace Godot.SourceGenerators
return MarshalType.SystemArrayOfStringName; return MarshalType.SystemArrayOfStringName;
case { Name: "NodePath" }: case { Name: "NodePath" }:
return MarshalType.SystemArrayOfNodePath; return MarshalType.SystemArrayOfNodePath;
case { Name: "RID" }: case { Name: "Rid" }:
return MarshalType.SystemArrayOfRID; return MarshalType.SystemArrayOfRid;
} }
} }

View File

@ -23,7 +23,7 @@ namespace GodotTools.Build
public Godot.Collections.Array CustomProperties { get; private set; } = new(); public Godot.Collections.Array CustomProperties { get; private set; } = new();
public string LogsDirPath => public string LogsDirPath =>
Path.Combine(GodotSharpDirs.BuildLogsDirs, $"{Solution.MD5Text()}_{Configuration}"); Path.Combine(GodotSharpDirs.BuildLogsDirs, $"{Solution.Md5Text()}_{Configuration}");
public override bool Equals(object? obj) public override bool Equals(object? obj)
{ {

View File

@ -55,7 +55,7 @@ namespace GodotTools.Build
private static void PrintVerbose(string text) private static void PrintVerbose(string text)
{ {
if (OS.IsStdoutVerbose()) if (OS.IsStdOutVerbose())
GD.Print(text); GD.Print(text);
} }

View File

@ -336,7 +336,7 @@ namespace GodotTools.Build
_ = index; // Unused _ = index; // Unused
_issuesListContextMenu.Clear(); _issuesListContextMenu.Clear();
_issuesListContextMenu.Size = new Vector2i(1, 1); _issuesListContextMenu.Size = new Vector2I(1, 1);
if (_issuesList.IsAnythingSelected()) if (_issuesList.IsAnythingSelected())
{ {
@ -347,7 +347,7 @@ namespace GodotTools.Build
if (_issuesListContextMenu.ItemCount > 0) if (_issuesListContextMenu.ItemCount > 0)
{ {
_issuesListContextMenu.Position = (Vector2i)(_issuesList.GlobalPosition + atPosition); _issuesListContextMenu.Position = (Vector2I)(_issuesList.GlobalPosition + atPosition);
_issuesListContextMenu.Popup(); _issuesListContextMenu.Popup();
} }
} }

View File

@ -28,7 +28,7 @@ namespace GodotTools.Build
string launchMessage = startInfo.GetCommandLineDisplay(new StringBuilder("Running: ")).ToString(); string launchMessage = startInfo.GetCommandLineDisplay(new StringBuilder("Running: ")).ToString();
stdOutHandler?.Invoke(launchMessage); stdOutHandler?.Invoke(launchMessage);
if (Godot.OS.IsStdoutVerbose()) if (Godot.OS.IsStdOutVerbose())
Console.WriteLine(launchMessage); Console.WriteLine(launchMessage);
startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardOutput = true;
@ -89,7 +89,7 @@ namespace GodotTools.Build
string launchMessage = startInfo.GetCommandLineDisplay(new StringBuilder("Running: ")).ToString(); string launchMessage = startInfo.GetCommandLineDisplay(new StringBuilder("Running: ")).ToString();
stdOutHandler?.Invoke(launchMessage); stdOutHandler?.Invoke(launchMessage);
if (Godot.OS.IsStdoutVerbose()) if (Godot.OS.IsStdOutVerbose())
Console.WriteLine(launchMessage); Console.WriteLine(launchMessage);
startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardOutput = true;

View File

@ -122,7 +122,7 @@ namespace GodotTools.Build
{ {
base._Ready(); base._Ready();
CustomMinimumSize = new Vector2i(0, (int)(228 * EditorScale)); CustomMinimumSize = new Vector2(0, 228 * EditorScale);
SizeFlagsVertical = SizeFlags.ExpandFill; SizeFlagsVertical = SizeFlags.ExpandFill;
var toolBarHBox = new HBoxContainer { SizeFlagsHorizontal = SizeFlags.ExpandFill }; var toolBarHBox = new HBoxContainer { SizeFlagsHorizontal = SizeFlags.ExpandFill };

View File

@ -192,7 +192,7 @@ namespace GodotTools
try try
{ {
if (Godot.OS.IsStdoutVerbose()) if (Godot.OS.IsStdOutVerbose())
Console.WriteLine( Console.WriteLine(
$"Running: \"{command}\" {string.Join(" ", args.Select(a => $"\"{a}\""))}"); $"Running: \"{command}\" {string.Join(" ", args.Select(a => $"\"{a}\""))}");
@ -385,7 +385,7 @@ namespace GodotTools
// correct version first (`RegisterDefaults` always picks the latest). // correct version first (`RegisterDefaults` always picks the latest).
if (DotNetFinder.TryFindDotNetSdk(dotNetSdkSearchVersion, out var sdkVersion, out string sdkPath)) if (DotNetFinder.TryFindDotNetSdk(dotNetSdkSearchVersion, out var sdkVersion, out string sdkPath))
{ {
if (Godot.OS.IsStdoutVerbose()) if (Godot.OS.IsStdOutVerbose())
Console.WriteLine($"Found .NET Sdk version '{sdkVersion}': {sdkPath}"); Console.WriteLine($"Found .NET Sdk version '{sdkVersion}': {sdkPath}");
ProjectUtils.MSBuildLocatorRegisterMSBuildPath(sdkPath); ProjectUtils.MSBuildLocatorRegisterMSBuildPath(sdkPath);
@ -395,12 +395,12 @@ namespace GodotTools
try try
{ {
ProjectUtils.MSBuildLocatorRegisterDefaults(out sdkVersion, out sdkPath); ProjectUtils.MSBuildLocatorRegisterDefaults(out sdkVersion, out sdkPath);
if (Godot.OS.IsStdoutVerbose()) if (Godot.OS.IsStdOutVerbose())
Console.WriteLine($"Found .NET Sdk version '{sdkVersion}': {sdkPath}"); Console.WriteLine($"Found .NET Sdk version '{sdkVersion}': {sdkPath}");
} }
catch (InvalidOperationException e) catch (InvalidOperationException e)
{ {
if (Godot.OS.IsStdoutVerbose()) if (Godot.OS.IsStdOutVerbose())
GD.PrintErr(e.ToString()); GD.PrintErr(e.ToString());
GD.PushError($".NET Sdk not found. The required version is '{dotNetSdkSearchVersion}'."); GD.PushError($".NET Sdk not found. The required version is '{dotNetSdkSearchVersion}'.");
} }

View File

@ -11,7 +11,7 @@ namespace GodotTools
public override void _Notification(long what) public override void _Notification(long what)
{ {
if (what == Node.NotificationWmWindowFocusIn) if (what == Node.NotificationWMWindowFocusIn)
{ {
RestartTimer(); RestartTimer();

View File

@ -200,13 +200,13 @@ namespace GodotTools.Ides
{ {
public void LogDebug(string message) public void LogDebug(string message)
{ {
if (OS.IsStdoutVerbose()) if (OS.IsStdOutVerbose())
Console.WriteLine(message); Console.WriteLine(message);
} }
public void LogInfo(string message) public void LogInfo(string message)
{ {
if (OS.IsStdoutVerbose()) if (OS.IsStdOutVerbose())
Console.WriteLine(message); Console.WriteLine(message);
} }

View File

@ -38,10 +38,10 @@
#include "core/io/dir_access.h" #include "core/io/dir_access.h"
#include "core/io/file_access.h" #include "core/io/file_access.h"
#include "core/os/os.h" #include "core/os/os.h"
#include "core/string/ucaps.h"
#include "main/main.h" #include "main/main.h"
#include "../godotsharp_defs.h" #include "../godotsharp_defs.h"
#include "../utils/naming_utils.h"
#include "../utils/path_utils.h" #include "../utils/path_utils.h"
#include "../utils/string_utils.h" #include "../utils/string_utils.h"
@ -146,74 +146,6 @@ static String fix_doc_description(const String &p_bbcode) {
.strip_edges(); .strip_edges();
} }
static String snake_to_pascal_case(const String &p_identifier, bool p_input_is_upper = false) {
String ret;
Vector<String> parts = p_identifier.split("_", true);
for (int i = 0; i < parts.size(); i++) {
String part = parts[i];
if (part.length()) {
part[0] = _find_upper(part[0]);
if (p_input_is_upper) {
for (int j = 1; j < part.length(); j++) {
part[j] = _find_lower(part[j]);
}
}
ret += part;
} else {
if (i == 0 || i == (parts.size() - 1)) {
// Preserve underscores at the beginning and end
ret += "_";
} else {
// Preserve contiguous underscores
if (parts[i - 1].length()) {
ret += "__";
} else {
ret += "_";
}
}
}
}
return ret;
}
static String snake_to_camel_case(const String &p_identifier, bool p_input_is_upper = false) {
String ret;
Vector<String> parts = p_identifier.split("_", true);
for (int i = 0; i < parts.size(); i++) {
String part = parts[i];
if (part.length()) {
if (i != 0) {
part[0] = _find_upper(part[0]);
}
if (p_input_is_upper) {
for (int j = i != 0 ? 1 : 0; j < part.length(); j++) {
part[j] = _find_lower(part[j]);
}
}
ret += part;
} else {
if (i == 0 || i == (parts.size() - 1)) {
// Preserve underscores at the beginning and end
ret += "_";
} else {
// Preserve contiguous underscores
if (parts[i - 1].length()) {
ret += "__";
} else {
ret += "_";
}
}
}
}
return ret;
}
String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterface *p_itype) { String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterface *p_itype) {
// Based on the version in EditorHelp // Based on the version in EditorHelp
@ -967,11 +899,11 @@ void BindingsGenerator::_generate_array_extensions(StringBuilder &p_output) {
ARRAY_ALL(string); ARRAY_ALL(string);
ARRAY_ALL(Color); ARRAY_ALL(Color);
ARRAY_ALL(Vector2); ARRAY_ALL(Vector2);
ARRAY_ALL(Vector2i); ARRAY_ALL(Vector2I);
ARRAY_ALL(Vector3); ARRAY_ALL(Vector3);
ARRAY_ALL(Vector3i); ARRAY_ALL(Vector3I);
ARRAY_ALL(Vector4); ARRAY_ALL(Vector4);
ARRAY_ALL(Vector4i); ARRAY_ALL(Vector4I);
#undef ARRAY_ALL #undef ARRAY_ALL
#undef ARRAY_IS_EMPTY #undef ARRAY_IS_EMPTY
@ -1041,7 +973,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
_log("Declaring global enum '%s' inside struct '%s'\n", enum_proxy_name.utf8().get_data(), enum_class_name.utf8().get_data()); _log("Declaring global enum '%s' inside struct '%s'\n", enum_proxy_name.utf8().get_data(), enum_class_name.utf8().get_data());
p_output.append("\npublic partial struct "); p_output.append("\npublic partial struct ");
p_output.append(enum_class_name); p_output.append(pascal_to_pascal_case(enum_class_name));
p_output.append("\n" OPEN_BLOCK); p_output.append("\n" OPEN_BLOCK);
} }
@ -1050,7 +982,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
} }
p_output.append("\npublic enum "); p_output.append("\npublic enum ");
p_output.append(enum_proxy_name); p_output.append(pascal_to_pascal_case(enum_proxy_name));
p_output.append(" : long"); p_output.append(" : long");
p_output.append("\n" OPEN_BLOCK); p_output.append("\n" OPEN_BLOCK);
@ -1502,7 +1434,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
} }
output.append(MEMBER_BEGIN "public enum "); output.append(MEMBER_BEGIN "public enum ");
output.append(ienum.cname.operator String()); output.append(pascal_to_pascal_case(ienum.cname.operator String()));
output.append(" : long"); output.append(" : long");
output.append(MEMBER_BEGIN OPEN_BLOCK); output.append(MEMBER_BEGIN OPEN_BLOCK);
@ -2896,7 +2828,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(type_cname); ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(type_cname);
TypeInterface itype = TypeInterface::create_object_type(type_cname, api_type); TypeInterface itype = TypeInterface::create_object_type(type_cname, pascal_to_pascal_case(type_cname), api_type);
itype.base_name = ClassDB::get_parent_class(type_cname); itype.base_name = ClassDB::get_parent_class(type_cname);
itype.is_singleton = Engine::get_singleton()->has_singleton(itype.proxy_name); itype.is_singleton = Engine::get_singleton()->has_singleton(itype.proxy_name);
@ -3241,7 +3173,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
for (const KeyValue<StringName, ClassDB::ClassInfo::EnumInfo> &E : enum_map) { for (const KeyValue<StringName, ClassDB::ClassInfo::EnumInfo> &E : enum_map) {
StringName enum_proxy_cname = E.key; StringName enum_proxy_cname = E.key;
String enum_proxy_name = enum_proxy_cname.operator String(); String enum_proxy_name = pascal_to_pascal_case(enum_proxy_cname.operator String());
if (itype.find_property_by_proxy_name(enum_proxy_name) || itype.find_method_by_proxy_name(enum_proxy_name) || itype.find_signal_by_proxy_name(enum_proxy_name)) { if (itype.find_property_by_proxy_name(enum_proxy_name) || itype.find_method_by_proxy_name(enum_proxy_name) || itype.find_signal_by_proxy_name(enum_proxy_name)) {
// In case the enum name conflicts with other PascalCase members, // In case the enum name conflicts with other PascalCase members,
// we append 'Enum' to the enum name in those cases. // we append 'Enum' to the enum name in those cases.
@ -3369,7 +3301,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
} break; } break;
case Variant::AABB: { case Variant::AABB: {
AABB aabb = p_val.operator ::AABB(); AABB aabb = p_val.operator ::AABB();
r_iarg.default_argument = "new AABB(new Vector3" + aabb.position.operator String() + ", new Vector3" + aabb.size.operator String() + ")"; r_iarg.default_argument = "new Aabb(new Vector3" + aabb.position.operator String() + ", new Vector3" + aabb.size.operator String() + ")";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL; r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
} break; } break;
case Variant::RECT2: { case Variant::RECT2: {
@ -3379,7 +3311,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
} break; } break;
case Variant::RECT2I: { case Variant::RECT2I: {
Rect2i rect = p_val.operator Rect2i(); Rect2i rect = p_val.operator Rect2i();
r_iarg.default_argument = "new Rect2i(new Vector2i" + rect.position.operator String() + ", new Vector2i" + rect.size.operator String() + ")"; r_iarg.default_argument = "new Rect2I(new Vector2I" + rect.position.operator String() + ", new Vector2I" + rect.size.operator String() + ")";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL; r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
} break; } break;
case Variant::COLOR: case Variant::COLOR:
@ -3513,32 +3445,30 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
TypeInterface itype; TypeInterface itype;
#define INSERT_STRUCT_TYPE(m_type) \ #define INSERT_STRUCT_TYPE(m_type, m_proxy_name) \
{ \ { \
itype = TypeInterface::create_value_type(String(#m_type)); \ itype = TypeInterface::create_value_type(String(#m_type), String(#m_proxy_name)); \
itype.c_type_in = #m_type "*"; \
itype.c_type_out = itype.cs_type; \
itype.cs_in_expr = "&%0"; \ itype.cs_in_expr = "&%0"; \
itype.cs_in_expr_is_unsafe = true; \ itype.cs_in_expr_is_unsafe = true; \
builtin_types.insert(itype.cname, itype); \ builtin_types.insert(itype.cname, itype); \
} }
INSERT_STRUCT_TYPE(Vector2) INSERT_STRUCT_TYPE(Vector2, Vector2)
INSERT_STRUCT_TYPE(Vector2i) INSERT_STRUCT_TYPE(Vector2i, Vector2I)
INSERT_STRUCT_TYPE(Rect2) INSERT_STRUCT_TYPE(Rect2, Rect2)
INSERT_STRUCT_TYPE(Rect2i) INSERT_STRUCT_TYPE(Rect2i, Rect2I)
INSERT_STRUCT_TYPE(Transform2D) INSERT_STRUCT_TYPE(Transform2D, Transform2D)
INSERT_STRUCT_TYPE(Vector3) INSERT_STRUCT_TYPE(Vector3, Vector3)
INSERT_STRUCT_TYPE(Vector3i) INSERT_STRUCT_TYPE(Vector3i, Vector3I)
INSERT_STRUCT_TYPE(Basis) INSERT_STRUCT_TYPE(Basis, Basis)
INSERT_STRUCT_TYPE(Quaternion) INSERT_STRUCT_TYPE(Quaternion, Quaternion)
INSERT_STRUCT_TYPE(Transform3D) INSERT_STRUCT_TYPE(Transform3D, Transform3D)
INSERT_STRUCT_TYPE(AABB) INSERT_STRUCT_TYPE(AABB, Aabb)
INSERT_STRUCT_TYPE(Color) INSERT_STRUCT_TYPE(Color, Color)
INSERT_STRUCT_TYPE(Plane) INSERT_STRUCT_TYPE(Plane, Plane)
INSERT_STRUCT_TYPE(Vector4) INSERT_STRUCT_TYPE(Vector4, Vector4)
INSERT_STRUCT_TYPE(Vector4i) INSERT_STRUCT_TYPE(Vector4i, Vector4I)
INSERT_STRUCT_TYPE(Projection) INSERT_STRUCT_TYPE(Projection, Projection)
#undef INSERT_STRUCT_TYPE #undef INSERT_STRUCT_TYPE
@ -3677,7 +3607,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
itype = TypeInterface(); itype = TypeInterface();
itype.name = "RID"; itype.name = "RID";
itype.cname = itype.name; itype.cname = itype.name;
itype.proxy_name = "RID"; itype.proxy_name = "Rid";
itype.cs_type = itype.proxy_name; itype.cs_type = itype.proxy_name;
itype.c_arg_in = "&%s"; itype.c_arg_in = "&%s";
itype.c_type = itype.cs_type; itype.c_type = itype.cs_type;
@ -3891,7 +3821,7 @@ void BindingsGenerator::_populate_global_constants() {
enum_itype.is_enum = true; enum_itype.is_enum = true;
enum_itype.name = ienum.cname.operator String(); enum_itype.name = ienum.cname.operator String();
enum_itype.cname = ienum.cname; enum_itype.cname = ienum.cname;
enum_itype.proxy_name = enum_itype.name; enum_itype.proxy_name = pascal_to_pascal_case(enum_itype.name);
TypeInterface::postsetup_enum_type(enum_itype); TypeInterface::postsetup_enum_type(enum_itype);
enum_types.insert(enum_itype.cname, enum_itype); enum_types.insert(enum_itype.cname, enum_itype);
@ -3913,9 +3843,9 @@ void BindingsGenerator::_populate_global_constants() {
// HARDCODED // HARDCODED
List<StringName> hardcoded_enums; List<StringName> hardcoded_enums;
hardcoded_enums.push_back("Vector2.Axis"); hardcoded_enums.push_back("Vector2.Axis");
hardcoded_enums.push_back("Vector2i.Axis"); hardcoded_enums.push_back("Vector2I.Axis");
hardcoded_enums.push_back("Vector3.Axis"); hardcoded_enums.push_back("Vector3.Axis");
hardcoded_enums.push_back("Vector3i.Axis"); hardcoded_enums.push_back("Vector3I.Axis");
for (const StringName &enum_cname : hardcoded_enums) { for (const StringName &enum_cname : hardcoded_enums) {
// These enums are not generated and must be written manually (e.g.: Vector3.Axis) // These enums are not generated and must be written manually (e.g.: Vector3.Axis)
// Here, we assume core types do not begin with underscore // Here, we assume core types do not begin with underscore
@ -3923,7 +3853,7 @@ void BindingsGenerator::_populate_global_constants() {
enum_itype.is_enum = true; enum_itype.is_enum = true;
enum_itype.name = enum_cname.operator String(); enum_itype.name = enum_cname.operator String();
enum_itype.cname = enum_cname; enum_itype.cname = enum_cname;
enum_itype.proxy_name = enum_itype.name; enum_itype.proxy_name = pascal_to_pascal_case(enum_itype.name);
TypeInterface::postsetup_enum_type(enum_itype); TypeInterface::postsetup_enum_type(enum_itype);
enum_types.insert(enum_itype.cname, enum_itype); enum_types.insert(enum_itype.cname, enum_itype);
} }

View File

@ -472,43 +472,88 @@ class BindingsGenerator {
} }
private: private:
static void _init_value_type(TypeInterface &itype) { static DocData::ClassDoc *_get_type_doc(TypeInterface &itype) {
itype.proxy_name = itype.name; String doc_name = itype.name.begins_with("_") ? itype.name.substr(1) : itype.name;
return &EditorHelp::get_doc_data()->class_list[doc_name];
}
static void _init_value_type(TypeInterface &itype) {
if (itype.proxy_name.is_empty()) {
itype.proxy_name = itype.name;
}
itype.c_type = itype.name;
itype.cs_type = itype.proxy_name; itype.cs_type = itype.proxy_name;
itype.c_type_in = itype.proxy_name + "*"; itype.c_type = itype.cs_type;
itype.c_type_out = itype.proxy_name; itype.c_type_in = itype.cs_type + "*";
itype.class_doc = &EditorHelp::get_doc_data()->class_list[itype.proxy_name]; itype.c_type_out = itype.cs_type;
itype.class_doc = _get_type_doc(itype);
}
static void _init_object_type(TypeInterface &itype, ClassDB::APIType p_api_type) {
if (itype.proxy_name.is_empty()) {
itype.proxy_name = itype.name;
}
if (itype.proxy_name.begins_with("_")) {
itype.proxy_name = itype.proxy_name.substr(1);
}
itype.api_type = p_api_type;
itype.is_object_type = true;
itype.class_doc = _get_type_doc(itype);
} }
public: public:
static TypeInterface create_value_type(const String &p_name) { static TypeInterface create_value_type(const String &p_name, const String &p_proxy_name) {
TypeInterface itype; TypeInterface itype;
itype.name = p_name; itype.name = p_name;
itype.cname = StringName(p_name); itype.cname = p_name;
itype.proxy_name = p_proxy_name;
_init_value_type(itype); _init_value_type(itype);
return itype; return itype;
} }
static TypeInterface create_value_type(const StringName &p_name) { static TypeInterface create_value_type(const StringName &p_cname, const String &p_proxy_name) {
TypeInterface itype; TypeInterface itype;
itype.name = p_name.operator String(); itype.name = p_cname;
itype.cname = p_cname;
itype.proxy_name = p_proxy_name;
_init_value_type(itype);
return itype;
}
static TypeInterface create_value_type(const String &p_name) {
TypeInterface itype;
itype.name = p_name;
itype.cname = p_name; itype.cname = p_name;
_init_value_type(itype); _init_value_type(itype);
return itype; return itype;
} }
static TypeInterface create_object_type(const StringName &p_cname, ClassDB::APIType p_api_type) { static TypeInterface create_value_type(const StringName &p_cname) {
TypeInterface itype; TypeInterface itype;
itype.name = p_cname; itype.name = p_cname;
itype.cname = p_cname; itype.cname = p_cname;
itype.proxy_name = itype.name.begins_with("_") ? itype.name.substr(1, itype.name.length()) : itype.name; _init_value_type(itype);
itype.api_type = p_api_type; return itype;
itype.is_object_type = true; }
itype.class_doc = &EditorHelp::get_doc_data()->class_list[itype.proxy_name];
static TypeInterface create_object_type(const StringName &p_cname, const String &p_proxy_name, ClassDB::APIType p_api_type) {
TypeInterface itype;
itype.name = p_cname;
itype.cname = p_cname;
itype.proxy_name = p_proxy_name;
_init_object_type(itype, p_api_type);
return itype;
}
static TypeInterface create_object_type(const StringName &p_cname, ClassDB::APIType p_api_type) {
TypeInterface itype;
itype.name = p_cname;
itype.cname = p_cname;
_init_object_type(itype, p_api_type);
return itype; return itype;
} }

View File

@ -17,22 +17,22 @@ public partial class _CLASS_ : _BASE_
// Add the gravity. // Add the gravity.
if (!IsOnFloor()) if (!IsOnFloor())
velocity.y += gravity * (float)delta; velocity.Y += gravity * (float)delta;
// Handle Jump. // Handle Jump.
if (Input.IsActionJustPressed("ui_accept") && IsOnFloor()) if (Input.IsActionJustPressed("ui_accept") && IsOnFloor())
velocity.y = JumpVelocity; velocity.Y = JumpVelocity;
// Get the input direction and handle the movement/deceleration. // Get the input direction and handle the movement/deceleration.
// As good practice, you should replace UI actions with custom gameplay actions. // As good practice, you should replace UI actions with custom gameplay actions.
Vector2 direction = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down"); Vector2 direction = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
if (direction != Vector2.Zero) if (direction != Vector2.Zero)
{ {
velocity.x = direction.x * Speed; velocity.X = direction.X * Speed;
} }
else else
{ {
velocity.x = Mathf.MoveToward(Velocity.x, 0, Speed); velocity.X = Mathf.MoveToward(Velocity.X, 0, Speed);
} }
Velocity = velocity; Velocity = velocity;

View File

@ -17,25 +17,25 @@ public partial class _CLASS_ : _BASE_
// Add the gravity. // Add the gravity.
if (!IsOnFloor()) if (!IsOnFloor())
velocity.y -= gravity * (float)delta; velocity.Y -= gravity * (float)delta;
// Handle Jump. // Handle Jump.
if (Input.IsActionJustPressed("ui_accept") && IsOnFloor()) if (Input.IsActionJustPressed("ui_accept") && IsOnFloor())
velocity.y = JumpVelocity; velocity.Y = JumpVelocity;
// Get the input direction and handle the movement/deceleration. // Get the input direction and handle the movement/deceleration.
// As good practice, you should replace UI actions with custom gameplay actions. // As good practice, you should replace UI actions with custom gameplay actions.
Vector2 inputDir = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down"); Vector2 inputDir = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
Vector3 direction = (Transform.basis * new Vector3(inputDir.x, 0, inputDir.y)).Normalized(); Vector3 direction = (Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized();
if (direction != Vector3.Zero) if (direction != Vector3.Zero)
{ {
velocity.x = direction.x * Speed; velocity.X = direction.X * Speed;
velocity.z = direction.z * Speed; velocity.Z = direction.Z * Speed;
} }
else else
{ {
velocity.x = Mathf.MoveToward(Velocity.x, 0, Speed); velocity.X = Mathf.MoveToward(Velocity.X, 0, Speed);
velocity.z = Mathf.MoveToward(Velocity.z, 0, Speed); velocity.Z = Mathf.MoveToward(Velocity.Z, 0, Speed);
} }
Velocity = velocity; Velocity = velocity;

View File

@ -9,7 +9,7 @@ namespace Godot
/// </summary> /// </summary>
[Serializable] [Serializable]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct AABB : IEquatable<AABB> public struct Aabb : IEquatable<Aabb>
{ {
private Vector3 _position; private Vector3 _position;
private Vector3 _size; private Vector3 _size;
@ -50,19 +50,19 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns an <see cref="AABB"/> with equivalent position and size, modified so that /// Returns an <see cref="Aabb"/> with equivalent position and size, modified so that
/// the most-negative corner is the origin and the size is positive. /// the most-negative corner is the origin and the size is positive.
/// </summary> /// </summary>
/// <returns>The modified <see cref="AABB"/>.</returns> /// <returns>The modified <see cref="Aabb"/>.</returns>
public readonly AABB Abs() public readonly Aabb Abs()
{ {
Vector3 end = End; Vector3 end = End;
Vector3 topLeft = new Vector3(Mathf.Min(_position.x, end.x), Mathf.Min(_position.y, end.y), Mathf.Min(_position.z, end.z)); Vector3 topLeft = new Vector3(Mathf.Min(_position.X, end.X), Mathf.Min(_position.Y, end.Y), Mathf.Min(_position.Z, end.Z));
return new AABB(topLeft, _size.Abs()); return new Aabb(topLeft, _size.Abs());
} }
/// <summary> /// <summary>
/// Returns the center of the <see cref="AABB"/>, which is equal /// Returns the center of the <see cref="Aabb"/>, which is equal
/// to <see cref="Position"/> + (<see cref="Size"/> / 2). /// to <see cref="Position"/> + (<see cref="Size"/> / 2).
/// </summary> /// </summary>
/// <returns>The center.</returns> /// <returns>The center.</returns>
@ -72,94 +72,94 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if this <see cref="AABB"/> completely encloses another one. /// Returns <see langword="true"/> if this <see cref="Aabb"/> completely encloses another one.
/// </summary> /// </summary>
/// <param name="with">The other <see cref="AABB"/> that may be enclosed.</param> /// <param name="with">The other <see cref="Aabb"/> that may be enclosed.</param>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not this <see cref="AABB"/> encloses <paramref name="with"/>. /// A <see langword="bool"/> for whether or not this <see cref="Aabb"/> encloses <paramref name="with"/>.
/// </returns> /// </returns>
public readonly bool Encloses(AABB with) public readonly bool Encloses(Aabb with)
{ {
Vector3 srcMin = _position; Vector3 srcMin = _position;
Vector3 srcMax = _position + _size; Vector3 srcMax = _position + _size;
Vector3 dstMin = with._position; Vector3 dstMin = with._position;
Vector3 dstMax = with._position + with._size; Vector3 dstMax = with._position + with._size;
return srcMin.x <= dstMin.x && return srcMin.X <= dstMin.X &&
srcMax.x > dstMax.x && srcMax.X > dstMax.X &&
srcMin.y <= dstMin.y && srcMin.Y <= dstMin.Y &&
srcMax.y > dstMax.y && srcMax.Y > dstMax.Y &&
srcMin.z <= dstMin.z && srcMin.Z <= dstMin.Z &&
srcMax.z > dstMax.z; srcMax.Z > dstMax.Z;
} }
/// <summary> /// <summary>
/// Returns this <see cref="AABB"/> expanded to include a given point. /// Returns this <see cref="Aabb"/> expanded to include a given point.
/// </summary> /// </summary>
/// <param name="point">The point to include.</param> /// <param name="point">The point to include.</param>
/// <returns>The expanded <see cref="AABB"/>.</returns> /// <returns>The expanded <see cref="Aabb"/>.</returns>
public readonly AABB Expand(Vector3 point) public readonly Aabb Expand(Vector3 point)
{ {
Vector3 begin = _position; Vector3 begin = _position;
Vector3 end = _position + _size; Vector3 end = _position + _size;
if (point.x < begin.x) if (point.X < begin.X)
{ {
begin.x = point.x; begin.X = point.X;
} }
if (point.y < begin.y) if (point.Y < begin.Y)
{ {
begin.y = point.y; begin.Y = point.Y;
} }
if (point.z < begin.z) if (point.Z < begin.Z)
{ {
begin.z = point.z; begin.Z = point.Z;
} }
if (point.x > end.x) if (point.X > end.X)
{ {
end.x = point.x; end.X = point.X;
} }
if (point.y > end.y) if (point.Y > end.Y)
{ {
end.y = point.y; end.Y = point.Y;
} }
if (point.z > end.z) if (point.Z > end.Z)
{ {
end.z = point.z; end.Z = point.Z;
} }
return new AABB(begin, end - begin); return new Aabb(begin, end - begin);
} }
/// <summary> /// <summary>
/// Gets the position of one of the 8 endpoints of the <see cref="AABB"/>. /// Gets the position of one of the 8 endpoints of the <see cref="Aabb"/>.
/// </summary> /// </summary>
/// <param name="idx">Which endpoint to get.</param> /// <param name="idx">Which endpoint to get.</param>
/// <exception cref="ArgumentOutOfRangeException"> /// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="idx"/> is less than 0 or greater than 7. /// <paramref name="idx"/> is less than 0 or greater than 7.
/// </exception> /// </exception>
/// <returns>An endpoint of the <see cref="AABB"/>.</returns> /// <returns>An endpoint of the <see cref="Aabb"/>.</returns>
public readonly Vector3 GetEndpoint(int idx) public readonly Vector3 GetEndpoint(int idx)
{ {
switch (idx) switch (idx)
{ {
case 0: case 0:
return new Vector3(_position.x, _position.y, _position.z); return new Vector3(_position.X, _position.Y, _position.Z);
case 1: case 1:
return new Vector3(_position.x, _position.y, _position.z + _size.z); return new Vector3(_position.X, _position.Y, _position.Z + _size.Z);
case 2: case 2:
return new Vector3(_position.x, _position.y + _size.y, _position.z); return new Vector3(_position.X, _position.Y + _size.Y, _position.Z);
case 3: case 3:
return new Vector3(_position.x, _position.y + _size.y, _position.z + _size.z); return new Vector3(_position.X, _position.Y + _size.Y, _position.Z + _size.Z);
case 4: case 4:
return new Vector3(_position.x + _size.x, _position.y, _position.z); return new Vector3(_position.X + _size.X, _position.Y, _position.Z);
case 5: case 5:
return new Vector3(_position.x + _size.x, _position.y, _position.z + _size.z); return new Vector3(_position.X + _size.X, _position.Y, _position.Z + _size.Z);
case 6: case 6:
return new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z); return new Vector3(_position.X + _size.X, _position.Y + _size.Y, _position.Z);
case 7: case 7:
return new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z + _size.z); return new Vector3(_position.X + _size.X, _position.Y + _size.Y, _position.Z + _size.Z);
default: default:
{ {
throw new ArgumentOutOfRangeException(nameof(idx), throw new ArgumentOutOfRangeException(nameof(idx),
@ -169,21 +169,21 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns the normalized longest axis of the <see cref="AABB"/>. /// Returns the normalized longest axis of the <see cref="Aabb"/>.
/// </summary> /// </summary>
/// <returns>A vector representing the normalized longest axis of the <see cref="AABB"/>.</returns> /// <returns>A vector representing the normalized longest axis of the <see cref="Aabb"/>.</returns>
public readonly Vector3 GetLongestAxis() public readonly Vector3 GetLongestAxis()
{ {
var axis = new Vector3(1f, 0f, 0f); var axis = new Vector3(1f, 0f, 0f);
real_t maxSize = _size.x; real_t maxSize = _size.X;
if (_size.y > maxSize) if (_size.Y > maxSize)
{ {
axis = new Vector3(0f, 1f, 0f); axis = new Vector3(0f, 1f, 0f);
maxSize = _size.y; maxSize = _size.Y;
} }
if (_size.z > maxSize) if (_size.Z > maxSize)
{ {
axis = new Vector3(0f, 0f, 1f); axis = new Vector3(0f, 0f, 1f);
} }
@ -192,21 +192,21 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns the <see cref="Vector3.Axis"/> index of the longest axis of the <see cref="AABB"/>. /// Returns the <see cref="Vector3.Axis"/> index of the longest axis of the <see cref="Aabb"/>.
/// </summary> /// </summary>
/// <returns>A <see cref="Vector3.Axis"/> index for which axis is longest.</returns> /// <returns>A <see cref="Vector3.Axis"/> index for which axis is longest.</returns>
public readonly Vector3.Axis GetLongestAxisIndex() public readonly Vector3.Axis GetLongestAxisIndex()
{ {
var axis = Vector3.Axis.X; var axis = Vector3.Axis.X;
real_t maxSize = _size.x; real_t maxSize = _size.X;
if (_size.y > maxSize) if (_size.Y > maxSize)
{ {
axis = Vector3.Axis.Y; axis = Vector3.Axis.Y;
maxSize = _size.y; maxSize = _size.Y;
} }
if (_size.z > maxSize) if (_size.Z > maxSize)
{ {
axis = Vector3.Axis.Z; axis = Vector3.Axis.Z;
} }
@ -215,38 +215,38 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns the scalar length of the longest axis of the <see cref="AABB"/>. /// Returns the scalar length of the longest axis of the <see cref="Aabb"/>.
/// </summary> /// </summary>
/// <returns>The scalar length of the longest axis of the <see cref="AABB"/>.</returns> /// <returns>The scalar length of the longest axis of the <see cref="Aabb"/>.</returns>
public readonly real_t GetLongestAxisSize() public readonly real_t GetLongestAxisSize()
{ {
real_t maxSize = _size.x; real_t maxSize = _size.X;
if (_size.y > maxSize) if (_size.Y > maxSize)
maxSize = _size.y; maxSize = _size.Y;
if (_size.z > maxSize) if (_size.Z > maxSize)
maxSize = _size.z; maxSize = _size.Z;
return maxSize; return maxSize;
} }
/// <summary> /// <summary>
/// Returns the normalized shortest axis of the <see cref="AABB"/>. /// Returns the normalized shortest axis of the <see cref="Aabb"/>.
/// </summary> /// </summary>
/// <returns>A vector representing the normalized shortest axis of the <see cref="AABB"/>.</returns> /// <returns>A vector representing the normalized shortest axis of the <see cref="Aabb"/>.</returns>
public readonly Vector3 GetShortestAxis() public readonly Vector3 GetShortestAxis()
{ {
var axis = new Vector3(1f, 0f, 0f); var axis = new Vector3(1f, 0f, 0f);
real_t maxSize = _size.x; real_t maxSize = _size.X;
if (_size.y < maxSize) if (_size.Y < maxSize)
{ {
axis = new Vector3(0f, 1f, 0f); axis = new Vector3(0f, 1f, 0f);
maxSize = _size.y; maxSize = _size.Y;
} }
if (_size.z < maxSize) if (_size.Z < maxSize)
{ {
axis = new Vector3(0f, 0f, 1f); axis = new Vector3(0f, 0f, 1f);
} }
@ -255,21 +255,21 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns the <see cref="Vector3.Axis"/> index of the shortest axis of the <see cref="AABB"/>. /// Returns the <see cref="Vector3.Axis"/> index of the shortest axis of the <see cref="Aabb"/>.
/// </summary> /// </summary>
/// <returns>A <see cref="Vector3.Axis"/> index for which axis is shortest.</returns> /// <returns>A <see cref="Vector3.Axis"/> index for which axis is shortest.</returns>
public readonly Vector3.Axis GetShortestAxisIndex() public readonly Vector3.Axis GetShortestAxisIndex()
{ {
var axis = Vector3.Axis.X; var axis = Vector3.Axis.X;
real_t maxSize = _size.x; real_t maxSize = _size.X;
if (_size.y < maxSize) if (_size.Y < maxSize)
{ {
axis = Vector3.Axis.Y; axis = Vector3.Axis.Y;
maxSize = _size.y; maxSize = _size.Y;
} }
if (_size.z < maxSize) if (_size.Z < maxSize)
{ {
axis = Vector3.Axis.Z; axis = Vector3.Axis.Z;
} }
@ -278,18 +278,18 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns the scalar length of the shortest axis of the <see cref="AABB"/>. /// Returns the scalar length of the shortest axis of the <see cref="Aabb"/>.
/// </summary> /// </summary>
/// <returns>The scalar length of the shortest axis of the <see cref="AABB"/>.</returns> /// <returns>The scalar length of the shortest axis of the <see cref="Aabb"/>.</returns>
public readonly real_t GetShortestAxisSize() public readonly real_t GetShortestAxisSize()
{ {
real_t maxSize = _size.x; real_t maxSize = _size.X;
if (_size.y < maxSize) if (_size.Y < maxSize)
maxSize = _size.y; maxSize = _size.Y;
if (_size.z < maxSize) if (_size.Z < maxSize)
maxSize = _size.z; maxSize = _size.Z;
return maxSize; return maxSize;
} }
@ -306,99 +306,99 @@ namespace Godot
Vector3 ofs = _position + halfExtents; Vector3 ofs = _position + halfExtents;
return ofs + new Vector3( return ofs + new Vector3(
dir.x > 0f ? -halfExtents.x : halfExtents.x, dir.X > 0f ? -halfExtents.X : halfExtents.X,
dir.y > 0f ? -halfExtents.y : halfExtents.y, dir.Y > 0f ? -halfExtents.Y : halfExtents.Y,
dir.z > 0f ? -halfExtents.z : halfExtents.z); dir.Z > 0f ? -halfExtents.Z : halfExtents.Z);
} }
/// <summary> /// <summary>
/// Returns the volume of the <see cref="AABB"/>. /// Returns the volume of the <see cref="Aabb"/>.
/// </summary> /// </summary>
/// <returns>The volume.</returns> /// <returns>The volume.</returns>
public readonly real_t GetVolume() public readonly real_t GetVolume()
{ {
return _size.x * _size.y * _size.z; return _size.X * _size.Y * _size.Z;
} }
/// <summary> /// <summary>
/// Returns a copy of the <see cref="AABB"/> grown a given amount of units towards all the sides. /// Returns a copy of the <see cref="Aabb"/> grown a given amount of units towards all the sides.
/// </summary> /// </summary>
/// <param name="by">The amount to grow by.</param> /// <param name="by">The amount to grow by.</param>
/// <returns>The grown <see cref="AABB"/>.</returns> /// <returns>The grown <see cref="Aabb"/>.</returns>
public readonly AABB Grow(real_t by) public readonly Aabb Grow(real_t by)
{ {
AABB res = this; Aabb res = this;
res._position.x -= by; res._position.X -= by;
res._position.y -= by; res._position.Y -= by;
res._position.z -= by; res._position.Z -= by;
res._size.x += 2.0f * by; res._size.X += 2.0f * by;
res._size.y += 2.0f * by; res._size.Y += 2.0f * by;
res._size.z += 2.0f * by; res._size.Z += 2.0f * by;
return res; return res;
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the <see cref="AABB"/> contains a point, /// Returns <see langword="true"/> if the <see cref="Aabb"/> contains a point,
/// or <see langword="false"/> otherwise. /// or <see langword="false"/> otherwise.
/// </summary> /// </summary>
/// <param name="point">The point to check.</param> /// <param name="point">The point to check.</param>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="AABB"/> contains <paramref name="point"/>. /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> contains <paramref name="point"/>.
/// </returns> /// </returns>
public readonly bool HasPoint(Vector3 point) public readonly bool HasPoint(Vector3 point)
{ {
if (point.x < _position.x) if (point.X < _position.X)
return false; return false;
if (point.y < _position.y) if (point.Y < _position.Y)
return false; return false;
if (point.z < _position.z) if (point.Z < _position.Z)
return false; return false;
if (point.x > _position.x + _size.x) if (point.X > _position.X + _size.X)
return false; return false;
if (point.y > _position.y + _size.y) if (point.Y > _position.Y + _size.Y)
return false; return false;
if (point.z > _position.z + _size.z) if (point.Z > _position.Z + _size.Z)
return false; return false;
return true; return true;
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the <see cref="AABB"/> /// Returns <see langword="true"/> if the <see cref="Aabb"/>
/// has a surface or a length, and <see langword="false"/> /// has a surface or a length, and <see langword="false"/>
/// if the <see cref="AABB"/> is empty (all components /// if the <see cref="Aabb"/> is empty (all components
/// of <see cref="Size"/> are zero or negative). /// of <see cref="Size"/> are zero or negative).
/// </summary> /// </summary>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="AABB"/> has surface. /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> has surface.
/// </returns> /// </returns>
public readonly bool HasSurface() public readonly bool HasSurface()
{ {
return _size.x > 0.0f || _size.y > 0.0f || _size.z > 0.0f; return _size.X > 0.0f || _size.Y > 0.0f || _size.Z > 0.0f;
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the <see cref="AABB"/> has /// Returns <see langword="true"/> if the <see cref="Aabb"/> has
/// area, and <see langword="false"/> if the <see cref="AABB"/> /// area, and <see langword="false"/> if the <see cref="Aabb"/>
/// is linear, empty, or has a negative <see cref="Size"/>. /// is linear, empty, or has a negative <see cref="Size"/>.
/// See also <see cref="GetVolume"/>. /// See also <see cref="GetVolume"/>.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="AABB"/> has volume. /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> has volume.
/// </returns> /// </returns>
public readonly bool HasVolume() public readonly bool HasVolume()
{ {
return _size.x > 0.0f && _size.y > 0.0f && _size.z > 0.0f; return _size.X > 0.0f && _size.Y > 0.0f && _size.Z > 0.0f;
} }
/// <summary> /// <summary>
/// Returns the intersection of this <see cref="AABB"/> and <paramref name="with"/>. /// Returns the intersection of this <see cref="Aabb"/> and <paramref name="with"/>.
/// </summary> /// </summary>
/// <param name="with">The other <see cref="AABB"/>.</param> /// <param name="with">The other <see cref="Aabb"/>.</param>
/// <returns>The clipped <see cref="AABB"/>.</returns> /// <returns>The clipped <see cref="Aabb"/>.</returns>
public readonly AABB Intersection(AABB with) public readonly Aabb Intersection(Aabb with)
{ {
Vector3 srcMin = _position; Vector3 srcMin = _position;
Vector3 srcMax = _position + _size; Vector3 srcMax = _position + _size;
@ -407,78 +407,78 @@ namespace Godot
Vector3 min, max; Vector3 min, max;
if (srcMin.x > dstMax.x || srcMax.x < dstMin.x) if (srcMin.X > dstMax.X || srcMax.X < dstMin.X)
{ {
return new AABB(); return new Aabb();
} }
min.x = srcMin.x > dstMin.x ? srcMin.x : dstMin.x; min.X = srcMin.X > dstMin.X ? srcMin.X : dstMin.X;
max.x = srcMax.x < dstMax.x ? srcMax.x : dstMax.x; max.X = srcMax.X < dstMax.X ? srcMax.X : dstMax.X;
if (srcMin.y > dstMax.y || srcMax.y < dstMin.y) if (srcMin.Y > dstMax.Y || srcMax.Y < dstMin.Y)
{ {
return new AABB(); return new Aabb();
} }
min.y = srcMin.y > dstMin.y ? srcMin.y : dstMin.y; min.Y = srcMin.Y > dstMin.Y ? srcMin.Y : dstMin.Y;
max.y = srcMax.y < dstMax.y ? srcMax.y : dstMax.y; max.Y = srcMax.Y < dstMax.Y ? srcMax.Y : dstMax.Y;
if (srcMin.z > dstMax.z || srcMax.z < dstMin.z) if (srcMin.Z > dstMax.Z || srcMax.Z < dstMin.Z)
{ {
return new AABB(); return new Aabb();
} }
min.z = srcMin.z > dstMin.z ? srcMin.z : dstMin.z; min.Z = srcMin.Z > dstMin.Z ? srcMin.Z : dstMin.Z;
max.z = srcMax.z < dstMax.z ? srcMax.z : dstMax.z; max.Z = srcMax.Z < dstMax.Z ? srcMax.Z : dstMax.Z;
return new AABB(min, max - min); return new Aabb(min, max - min);
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the <see cref="AABB"/> overlaps with <paramref name="with"/> /// Returns <see langword="true"/> if the <see cref="Aabb"/> overlaps with <paramref name="with"/>
/// (i.e. they have at least one point in common). /// (i.e. they have at least one point in common).
/// </summary> /// </summary>
/// <param name="with">The other <see cref="AABB"/> to check for intersections with.</param> /// <param name="with">The other <see cref="Aabb"/> to check for intersections with.</param>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not they are intersecting. /// A <see langword="bool"/> for whether or not they are intersecting.
/// </returns> /// </returns>
public readonly bool Intersects(AABB with) public readonly bool Intersects(Aabb with)
{ {
if (_position.x >= with._position.x + with._size.x) if (_position.X >= with._position.X + with._size.X)
return false; return false;
if (_position.x + _size.x <= with._position.x) if (_position.X + _size.X <= with._position.X)
return false; return false;
if (_position.y >= with._position.y + with._size.y) if (_position.Y >= with._position.Y + with._size.Y)
return false; return false;
if (_position.y + _size.y <= with._position.y) if (_position.Y + _size.Y <= with._position.Y)
return false; return false;
if (_position.z >= with._position.z + with._size.z) if (_position.Z >= with._position.Z + with._size.Z)
return false; return false;
if (_position.z + _size.z <= with._position.z) if (_position.Z + _size.Z <= with._position.Z)
return false; return false;
return true; return true;
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the <see cref="AABB"/> is on both sides of <paramref name="plane"/>. /// Returns <see langword="true"/> if the <see cref="Aabb"/> is on both sides of <paramref name="plane"/>.
/// </summary> /// </summary>
/// <param name="plane">The <see cref="Plane"/> to check for intersection.</param> /// <param name="plane">The <see cref="Plane"/> to check for intersection.</param>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="AABB"/> intersects the <see cref="Plane"/>. /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> intersects the <see cref="Plane"/>.
/// </returns> /// </returns>
public readonly bool IntersectsPlane(Plane plane) public readonly bool IntersectsPlane(Plane plane)
{ {
Vector3[] points = Vector3[] points =
{ {
new Vector3(_position.x, _position.y, _position.z), new Vector3(_position.X, _position.Y, _position.Z),
new Vector3(_position.x, _position.y, _position.z + _size.z), new Vector3(_position.X, _position.Y, _position.Z + _size.Z),
new Vector3(_position.x, _position.y + _size.y, _position.z), new Vector3(_position.X, _position.Y + _size.Y, _position.Z),
new Vector3(_position.x, _position.y + _size.y, _position.z + _size.z), new Vector3(_position.X, _position.Y + _size.Y, _position.Z + _size.Z),
new Vector3(_position.x + _size.x, _position.y, _position.z), new Vector3(_position.X + _size.X, _position.Y, _position.Z),
new Vector3(_position.x + _size.x, _position.y, _position.z + _size.z), new Vector3(_position.X + _size.X, _position.Y, _position.Z + _size.Z),
new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z), new Vector3(_position.X + _size.X, _position.Y + _size.Y, _position.Z),
new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z + _size.z) new Vector3(_position.X + _size.X, _position.Y + _size.Y, _position.Z + _size.Z)
}; };
bool over = false; bool over = false;
@ -500,13 +500,13 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the <see cref="AABB"/> intersects /// Returns <see langword="true"/> if the <see cref="Aabb"/> intersects
/// the line segment between <paramref name="from"/> and <paramref name="to"/>. /// the line segment between <paramref name="from"/> and <paramref name="to"/>.
/// </summary> /// </summary>
/// <param name="from">The start of the line segment.</param> /// <param name="from">The start of the line segment.</param>
/// <param name="to">The end of the line segment.</param> /// <param name="to">The end of the line segment.</param>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="AABB"/> intersects the line segment. /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> intersects the line segment.
/// </returns> /// </returns>
public readonly bool IntersectsSegment(Vector3 from, Vector3 to) public readonly bool IntersectsSegment(Vector3 from, Vector3 to)
{ {
@ -563,7 +563,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if this <see cref="AABB"/> is finite, by calling /// Returns <see langword="true"/> if this <see cref="Aabb"/> is finite, by calling
/// <see cref="Mathf.IsFinite"/> on each component. /// <see cref="Mathf.IsFinite"/> on each component.
/// </summary> /// </summary>
/// <returns>Whether this vector is finite or not.</returns> /// <returns>Whether this vector is finite or not.</returns>
@ -573,73 +573,73 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns a larger <see cref="AABB"/> that contains this <see cref="AABB"/> and <paramref name="with"/>. /// Returns a larger <see cref="Aabb"/> that contains this <see cref="Aabb"/> and <paramref name="with"/>.
/// </summary> /// </summary>
/// <param name="with">The other <see cref="AABB"/>.</param> /// <param name="with">The other <see cref="Aabb"/>.</param>
/// <returns>The merged <see cref="AABB"/>.</returns> /// <returns>The merged <see cref="Aabb"/>.</returns>
public readonly AABB Merge(AABB with) public readonly Aabb Merge(Aabb with)
{ {
Vector3 beg1 = _position; Vector3 beg1 = _position;
Vector3 beg2 = with._position; Vector3 beg2 = with._position;
var end1 = new Vector3(_size.x, _size.y, _size.z) + beg1; var end1 = new Vector3(_size.X, _size.Y, _size.Z) + beg1;
var end2 = new Vector3(with._size.x, with._size.y, with._size.z) + beg2; var end2 = new Vector3(with._size.X, with._size.Y, with._size.Z) + beg2;
var min = new Vector3( var min = new Vector3(
beg1.x < beg2.x ? beg1.x : beg2.x, beg1.X < beg2.X ? beg1.X : beg2.X,
beg1.y < beg2.y ? beg1.y : beg2.y, beg1.Y < beg2.Y ? beg1.Y : beg2.Y,
beg1.z < beg2.z ? beg1.z : beg2.z beg1.Z < beg2.Z ? beg1.Z : beg2.Z
); );
var max = new Vector3( var max = new Vector3(
end1.x > end2.x ? end1.x : end2.x, end1.X > end2.X ? end1.X : end2.X,
end1.y > end2.y ? end1.y : end2.y, end1.Y > end2.Y ? end1.Y : end2.Y,
end1.z > end2.z ? end1.z : end2.z end1.Z > end2.Z ? end1.Z : end2.Z
); );
return new AABB(min, max - min); return new Aabb(min, max - min);
} }
/// <summary> /// <summary>
/// Constructs an <see cref="AABB"/> from a position and size. /// Constructs an <see cref="Aabb"/> from a position and size.
/// </summary> /// </summary>
/// <param name="position">The position.</param> /// <param name="position">The position.</param>
/// <param name="size">The size, typically positive.</param> /// <param name="size">The size, typically positive.</param>
public AABB(Vector3 position, Vector3 size) public Aabb(Vector3 position, Vector3 size)
{ {
_position = position; _position = position;
_size = size; _size = size;
} }
/// <summary> /// <summary>
/// Constructs an <see cref="AABB"/> from a <paramref name="position"/>, /// Constructs an <see cref="Aabb"/> from a <paramref name="position"/>,
/// <paramref name="width"/>, <paramref name="height"/>, and <paramref name="depth"/>. /// <paramref name="width"/>, <paramref name="height"/>, and <paramref name="depth"/>.
/// </summary> /// </summary>
/// <param name="position">The position.</param> /// <param name="position">The position.</param>
/// <param name="width">The width, typically positive.</param> /// <param name="width">The width, typically positive.</param>
/// <param name="height">The height, typically positive.</param> /// <param name="height">The height, typically positive.</param>
/// <param name="depth">The depth, typically positive.</param> /// <param name="depth">The depth, typically positive.</param>
public AABB(Vector3 position, real_t width, real_t height, real_t depth) public Aabb(Vector3 position, real_t width, real_t height, real_t depth)
{ {
_position = position; _position = position;
_size = new Vector3(width, height, depth); _size = new Vector3(width, height, depth);
} }
/// <summary> /// <summary>
/// Constructs an <see cref="AABB"/> from <paramref name="x"/>, /// Constructs an <see cref="Aabb"/> from <paramref name="x"/>,
/// <paramref name="y"/>, <paramref name="z"/>, and <paramref name="size"/>. /// <paramref name="y"/>, <paramref name="z"/>, and <paramref name="size"/>.
/// </summary> /// </summary>
/// <param name="x">The position's X coordinate.</param> /// <param name="x">The position's X coordinate.</param>
/// <param name="y">The position's Y coordinate.</param> /// <param name="y">The position's Y coordinate.</param>
/// <param name="z">The position's Z coordinate.</param> /// <param name="z">The position's Z coordinate.</param>
/// <param name="size">The size, typically positive.</param> /// <param name="size">The size, typically positive.</param>
public AABB(real_t x, real_t y, real_t z, Vector3 size) public Aabb(real_t x, real_t y, real_t z, Vector3 size)
{ {
_position = new Vector3(x, y, z); _position = new Vector3(x, y, z);
_size = size; _size = size;
} }
/// <summary> /// <summary>
/// Constructs an <see cref="AABB"/> from <paramref name="x"/>, /// Constructs an <see cref="Aabb"/> from <paramref name="x"/>,
/// <paramref name="y"/>, <paramref name="z"/>, <paramref name="width"/>, /// <paramref name="y"/>, <paramref name="z"/>, <paramref name="width"/>,
/// <paramref name="height"/>, and <paramref name="depth"/>. /// <paramref name="height"/>, and <paramref name="depth"/>.
/// </summary> /// </summary>
@ -649,7 +649,7 @@ namespace Godot
/// <param name="width">The width, typically positive.</param> /// <param name="width">The width, typically positive.</param>
/// <param name="height">The height, typically positive.</param> /// <param name="height">The height, typically positive.</param>
/// <param name="depth">The depth, typically positive.</param> /// <param name="depth">The depth, typically positive.</param>
public AABB(real_t x, real_t y, real_t z, real_t width, real_t height, real_t depth) public Aabb(real_t x, real_t y, real_t z, real_t width, real_t height, real_t depth)
{ {
_position = new Vector3(x, y, z); _position = new Vector3(x, y, z);
_size = new Vector3(width, height, depth); _size = new Vector3(width, height, depth);
@ -663,7 +663,7 @@ namespace Godot
/// <param name="left">The left AABB.</param> /// <param name="left">The left AABB.</param>
/// <param name="right">The right AABB.</param> /// <param name="right">The right AABB.</param>
/// <returns>Whether or not the AABBs are exactly equal.</returns> /// <returns>Whether or not the AABBs are exactly equal.</returns>
public static bool operator ==(AABB left, AABB right) public static bool operator ==(Aabb left, Aabb right)
{ {
return left.Equals(right); return left.Equals(right);
} }
@ -676,7 +676,7 @@ namespace Godot
/// <param name="left">The left AABB.</param> /// <param name="left">The left AABB.</param>
/// <param name="right">The right AABB.</param> /// <param name="right">The right AABB.</param>
/// <returns>Whether or not the AABBs are not equal.</returns> /// <returns>Whether or not the AABBs are not equal.</returns>
public static bool operator !=(AABB left, AABB right) public static bool operator !=(Aabb left, Aabb right)
{ {
return !left.Equals(right); return !left.Equals(right);
} }
@ -691,7 +691,7 @@ namespace Godot
/// <returns>Whether or not the AABB and the object are equal.</returns> /// <returns>Whether or not the AABB and the object are equal.</returns>
public override readonly bool Equals(object obj) public override readonly bool Equals(object obj)
{ {
return obj is AABB other && Equals(other); return obj is Aabb other && Equals(other);
} }
/// <summary> /// <summary>
@ -701,7 +701,7 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="other">The other AABB.</param> /// <param name="other">The other AABB.</param>
/// <returns>Whether or not the AABBs are exactly equal.</returns> /// <returns>Whether or not the AABBs are exactly equal.</returns>
public readonly bool Equals(AABB other) public readonly bool Equals(Aabb other)
{ {
return _position == other._position && _size == other._size; return _position == other._position && _size == other._size;
} }
@ -712,13 +712,13 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="other">The other AABB to compare.</param> /// <param name="other">The other AABB to compare.</param>
/// <returns>Whether or not the AABBs structures are approximately equal.</returns> /// <returns>Whether or not the AABBs structures are approximately equal.</returns>
public readonly bool IsEqualApprox(AABB other) public readonly bool IsEqualApprox(Aabb other)
{ {
return _position.IsEqualApprox(other._position) && _size.IsEqualApprox(other._size); return _position.IsEqualApprox(other._position) && _size.IsEqualApprox(other._size);
} }
/// <summary> /// <summary>
/// Serves as the hash function for <see cref="AABB"/>. /// Serves as the hash function for <see cref="Aabb"/>.
/// </summary> /// </summary>
/// <returns>A hash code for this AABB.</returns> /// <returns>A hash code for this AABB.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
@ -727,7 +727,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="AABB"/> to a string. /// Converts this <see cref="Aabb"/> to a string.
/// </summary> /// </summary>
/// <returns>A string representation of this AABB.</returns> /// <returns>A string representation of this AABB.</returns>
public override readonly string ToString() public override readonly string ToString()
@ -736,7 +736,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="AABB"/> to a string with the given <paramref name="format"/>. /// Converts this <see cref="Aabb"/> to a string with the given <paramref name="format"/>.
/// </summary> /// </summary>
/// <returns>A string representation of this AABB.</returns> /// <returns>A string representation of this AABB.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)

View File

@ -99,7 +99,7 @@ namespace Godot.Collections
this[i] = array[i]; this[i] = array[i];
} }
public Array(Span<RID> array) : this() public Array(Span<Rid> array) : this()
{ {
if (array == null) if (array == null)
throw new ArgumentNullException(nameof(array)); throw new ArgumentNullException(nameof(array));

View File

@ -0,0 +1,24 @@
using System;
namespace Godot
{
/// <summary>
/// Attribute that specifies the engine class name when it's not the same
/// as the generated C# class name. This allows introspection code to find
/// the name associated with the class. If the attribute is not present,
/// the C# class name can be used instead.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class GodotClassNameAttribute : Attribute
{
/// <summary>
/// Original engine class name.
/// </summary>
public string Name { get; }
public GodotClassNameAttribute(string name)
{
Name = name;
}
}
}

View File

@ -5,16 +5,16 @@ namespace Godot
/// <summary> /// <summary>
/// Attribute that changes the RPC mode for the annotated <c>method</c> to the given <see cref="Mode"/>, /// Attribute that changes the RPC mode for the annotated <c>method</c> to the given <see cref="Mode"/>,
/// optionally specifying the <see cref="TransferMode"/> and <see cref="TransferChannel"/> (on supported peers). /// optionally specifying the <see cref="TransferMode"/> and <see cref="TransferChannel"/> (on supported peers).
/// See <see cref="MultiplayerAPI.RPCMode"/> and <see cref="MultiplayerPeer.TransferModeEnum"/>. /// See <see cref="MultiplayerApi.RpcMode"/> and <see cref="MultiplayerPeer.TransferModeEnum"/>.
/// By default, methods are not exposed to networking (and RPCs). /// By default, methods are not exposed to networking (and RPCs).
/// </summary> /// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class RPCAttribute : Attribute public sealed class RpcAttribute : Attribute
{ {
/// <summary> /// <summary>
/// RPC mode for the annotated method. /// RPC mode for the annotated method.
/// </summary> /// </summary>
public MultiplayerAPI.RPCMode Mode { get; } = MultiplayerAPI.RPCMode.Disabled; public MultiplayerApi.RpcMode Mode { get; } = MultiplayerApi.RpcMode.Disabled;
/// <summary> /// <summary>
/// If the method will also be called locally; otherwise, it is only called remotely. /// If the method will also be called locally; otherwise, it is only called remotely.
@ -32,10 +32,10 @@ namespace Godot
public int TransferChannel { get; init; } = 0; public int TransferChannel { get; init; } = 0;
/// <summary> /// <summary>
/// Constructs a <see cref="RPCAttribute"/> instance. /// Constructs a <see cref="RpcAttribute"/> instance.
/// </summary> /// </summary>
/// <param name="mode">The RPC mode to use.</param> /// <param name="mode">The RPC mode to use.</param>
public RPCAttribute(MultiplayerAPI.RPCMode mode = MultiplayerAPI.RPCMode.Authority) public RpcAttribute(MultiplayerApi.RpcMode mode = MultiplayerApi.RpcMode.Authority)
{ {
Mode = mode; Mode = mode;
} }

View File

@ -27,7 +27,7 @@ namespace Godot
/// The basis matrix's X vector (column 0). /// The basis matrix's X vector (column 0).
/// </summary> /// </summary>
/// <value>Equivalent to <see cref="Column0"/> and array index <c>[0]</c>.</value> /// <value>Equivalent to <see cref="Column0"/> and array index <c>[0]</c>.</value>
public Vector3 x public Vector3 X
{ {
readonly get => Column0; readonly get => Column0;
set => Column0 = value; set => Column0 = value;
@ -37,7 +37,7 @@ namespace Godot
/// The basis matrix's Y vector (column 1). /// The basis matrix's Y vector (column 1).
/// </summary> /// </summary>
/// <value>Equivalent to <see cref="Column1"/> and array index <c>[1]</c>.</value> /// <value>Equivalent to <see cref="Column1"/> and array index <c>[1]</c>.</value>
public Vector3 y public Vector3 Y
{ {
readonly get => Column1; readonly get => Column1;
set => Column1 = value; set => Column1 = value;
@ -47,7 +47,7 @@ namespace Godot
/// The basis matrix's Z vector (column 2). /// The basis matrix's Z vector (column 2).
/// </summary> /// </summary>
/// <value>Equivalent to <see cref="Column2"/> and array index <c>[2]</c>.</value> /// <value>Equivalent to <see cref="Column2"/> and array index <c>[2]</c>.</value>
public Vector3 z public Vector3 Z
{ {
readonly get => Column2; readonly get => Column2;
set => Column2 = value; set => Column2 = value;
@ -77,45 +77,45 @@ namespace Godot
/// <summary> /// <summary>
/// Column 0 of the basis matrix (the X vector). /// Column 0 of the basis matrix (the X vector).
/// </summary> /// </summary>
/// <value>Equivalent to <see cref="x"/> and array index <c>[0]</c>.</value> /// <value>Equivalent to <see cref="X"/> and array index <c>[0]</c>.</value>
public Vector3 Column0 public Vector3 Column0
{ {
readonly get => new Vector3(Row0.x, Row1.x, Row2.x); readonly get => new Vector3(Row0.X, Row1.X, Row2.X);
set set
{ {
Row0.x = value.x; Row0.X = value.X;
Row1.x = value.y; Row1.X = value.Y;
Row2.x = value.z; Row2.X = value.Z;
} }
} }
/// <summary> /// <summary>
/// Column 1 of the basis matrix (the Y vector). /// Column 1 of the basis matrix (the Y vector).
/// </summary> /// </summary>
/// <value>Equivalent to <see cref="y"/> and array index <c>[1]</c>.</value> /// <value>Equivalent to <see cref="Y"/> and array index <c>[1]</c>.</value>
public Vector3 Column1 public Vector3 Column1
{ {
readonly get => new Vector3(Row0.y, Row1.y, Row2.y); readonly get => new Vector3(Row0.Y, Row1.Y, Row2.Y);
set set
{ {
Row0.y = value.x; Row0.Y = value.X;
Row1.y = value.y; Row1.Y = value.Y;
Row2.y = value.z; Row2.Y = value.Z;
} }
} }
/// <summary> /// <summary>
/// Column 2 of the basis matrix (the Z vector). /// Column 2 of the basis matrix (the Z vector).
/// </summary> /// </summary>
/// <value>Equivalent to <see cref="z"/> and array index <c>[2]</c>.</value> /// <value>Equivalent to <see cref="Z"/> and array index <c>[2]</c>.</value>
public Vector3 Column2 public Vector3 Column2
{ {
readonly get => new Vector3(Row0.z, Row1.z, Row2.z); readonly get => new Vector3(Row0.Z, Row1.Z, Row2.Z);
set set
{ {
Row0.z = value.x; Row0.Z = value.X;
Row1.z = value.y; Row1.Z = value.Y;
Row2.z = value.z; Row2.Z = value.Z;
} }
} }
@ -213,9 +213,9 @@ namespace Godot
private void SetDiagonal(Vector3 diagonal) private void SetDiagonal(Vector3 diagonal)
{ {
Row0 = new Vector3(diagonal.x, 0, 0); Row0 = new Vector3(diagonal.X, 0, 0);
Row1 = new Vector3(0, diagonal.y, 0); Row1 = new Vector3(0, diagonal.Y, 0);
Row2 = new Vector3(0, 0, diagonal.z); Row2 = new Vector3(0, 0, diagonal.Z);
} }
/// <summary> /// <summary>
@ -270,29 +270,29 @@ namespace Godot
if (Row1[0] == 0 && Row0[1] == 0 && Row1[2] == 0 && Row2[1] == 0 && Row1[1] == 1) if (Row1[0] == 0 && Row0[1] == 0 && Row1[2] == 0 && Row2[1] == 0 && Row1[1] == 1)
{ {
// return the simplest form (human friendlier in editor and scripts) // return the simplest form (human friendlier in editor and scripts)
euler.x = 0; euler.X = 0;
euler.y = Mathf.Atan2(Row0[2], Row0[0]); euler.Y = Mathf.Atan2(Row0[2], Row0[0]);
euler.z = 0; euler.Z = 0;
} }
else else
{ {
euler.x = Mathf.Atan2(-Row1[2], Row2[2]); euler.X = Mathf.Atan2(-Row1[2], Row2[2]);
euler.y = Mathf.Asin(sy); euler.Y = Mathf.Asin(sy);
euler.z = Mathf.Atan2(-Row0[1], Row0[0]); euler.Z = Mathf.Atan2(-Row0[1], Row0[0]);
} }
} }
else else
{ {
euler.x = Mathf.Atan2(Row2[1], Row1[1]); euler.X = Mathf.Atan2(Row2[1], Row1[1]);
euler.y = -Mathf.Tau / 4.0f; euler.Y = -Mathf.Tau / 4.0f;
euler.z = 0.0f; euler.Z = 0.0f;
} }
} }
else else
{ {
euler.x = Mathf.Atan2(Row2[1], Row1[1]); euler.X = Mathf.Atan2(Row2[1], Row1[1]);
euler.y = Mathf.Tau / 4.0f; euler.Y = Mathf.Tau / 4.0f;
euler.z = 0.0f; euler.Z = 0.0f;
} }
return euler; return euler;
} }
@ -310,24 +310,24 @@ namespace Godot
{ {
if (sz > -(1.0f - Mathf.Epsilon)) if (sz > -(1.0f - Mathf.Epsilon))
{ {
euler.x = Mathf.Atan2(Row2[1], Row1[1]); euler.X = Mathf.Atan2(Row2[1], Row1[1]);
euler.y = Mathf.Atan2(Row0[2], Row0[0]); euler.Y = Mathf.Atan2(Row0[2], Row0[0]);
euler.z = Mathf.Asin(-sz); euler.Z = Mathf.Asin(-sz);
} }
else else
{ {
// It's -1 // It's -1
euler.x = -Mathf.Atan2(Row1[2], Row2[2]); euler.X = -Mathf.Atan2(Row1[2], Row2[2]);
euler.y = 0.0f; euler.Y = 0.0f;
euler.z = Mathf.Tau / 4.0f; euler.Z = Mathf.Tau / 4.0f;
} }
} }
else else
{ {
// It's 1 // It's 1
euler.x = -Mathf.Atan2(Row1[2], Row2[2]); euler.X = -Mathf.Atan2(Row1[2], Row2[2]);
euler.y = 0.0f; euler.Y = 0.0f;
euler.z = -Mathf.Tau / 4.0f; euler.Z = -Mathf.Tau / 4.0f;
} }
return euler; return euler;
} }
@ -349,29 +349,29 @@ namespace Godot
if (Row1[0] == 0 && Row0[1] == 0 && Row0[2] == 0 && Row2[0] == 0 && Row0[0] == 1) if (Row1[0] == 0 && Row0[1] == 0 && Row0[2] == 0 && Row2[0] == 0 && Row0[0] == 1)
{ {
// return the simplest form (human friendlier in editor and scripts) // return the simplest form (human friendlier in editor and scripts)
euler.x = Mathf.Atan2(-m12, Row1[1]); euler.X = Mathf.Atan2(-m12, Row1[1]);
euler.y = 0; euler.Y = 0;
euler.z = 0; euler.Z = 0;
} }
else else
{ {
euler.x = Mathf.Asin(-m12); euler.X = Mathf.Asin(-m12);
euler.y = Mathf.Atan2(Row0[2], Row2[2]); euler.Y = Mathf.Atan2(Row0[2], Row2[2]);
euler.z = Mathf.Atan2(Row1[0], Row1[1]); euler.Z = Mathf.Atan2(Row1[0], Row1[1]);
} }
} }
else else
{ // m12 == -1 { // m12 == -1
euler.x = Mathf.Tau / 4.0f; euler.X = Mathf.Tau / 4.0f;
euler.y = Mathf.Atan2(Row0[1], Row0[0]); euler.Y = Mathf.Atan2(Row0[1], Row0[0]);
euler.z = 0; euler.Z = 0;
} }
} }
else else
{ // m12 == 1 { // m12 == 1
euler.x = -Mathf.Tau / 4.0f; euler.X = -Mathf.Tau / 4.0f;
euler.y = -Mathf.Atan2(Row0[1], Row0[0]); euler.Y = -Mathf.Atan2(Row0[1], Row0[0]);
euler.z = 0; euler.Z = 0;
} }
return euler; return euler;
@ -390,24 +390,24 @@ namespace Godot
{ {
if (sz > -(1.0f - Mathf.Epsilon)) if (sz > -(1.0f - Mathf.Epsilon))
{ {
euler.x = Mathf.Atan2(-Row1[2], Row1[1]); euler.X = Mathf.Atan2(-Row1[2], Row1[1]);
euler.y = Mathf.Atan2(-Row2[0], Row0[0]); euler.Y = Mathf.Atan2(-Row2[0], Row0[0]);
euler.z = Mathf.Asin(sz); euler.Z = Mathf.Asin(sz);
} }
else else
{ {
// It's -1 // It's -1
euler.x = Mathf.Atan2(Row2[1], Row2[2]); euler.X = Mathf.Atan2(Row2[1], Row2[2]);
euler.y = 0.0f; euler.Y = 0.0f;
euler.z = -Mathf.Tau / 4.0f; euler.Z = -Mathf.Tau / 4.0f;
} }
} }
else else
{ {
// It's 1 // It's 1
euler.x = Mathf.Atan2(Row2[1], Row2[2]); euler.X = Mathf.Atan2(Row2[1], Row2[2]);
euler.y = 0.0f; euler.Y = 0.0f;
euler.z = Mathf.Tau / 4.0f; euler.Z = Mathf.Tau / 4.0f;
} }
return euler; return euler;
} }
@ -425,24 +425,24 @@ namespace Godot
{ {
if (sx > -(1.0f - Mathf.Epsilon)) if (sx > -(1.0f - Mathf.Epsilon))
{ {
euler.x = Mathf.Asin(sx); euler.X = Mathf.Asin(sx);
euler.y = Mathf.Atan2(-Row2[0], Row2[2]); euler.Y = Mathf.Atan2(-Row2[0], Row2[2]);
euler.z = Mathf.Atan2(-Row0[1], Row1[1]); euler.Z = Mathf.Atan2(-Row0[1], Row1[1]);
} }
else else
{ {
// It's -1 // It's -1
euler.x = -Mathf.Tau / 4.0f; euler.X = -Mathf.Tau / 4.0f;
euler.y = Mathf.Atan2(Row0[2], Row0[0]); euler.Y = Mathf.Atan2(Row0[2], Row0[0]);
euler.z = 0; euler.Z = 0;
} }
} }
else else
{ {
// It's 1 // It's 1
euler.x = Mathf.Tau / 4.0f; euler.X = Mathf.Tau / 4.0f;
euler.y = Mathf.Atan2(Row0[2], Row0[0]); euler.Y = Mathf.Atan2(Row0[2], Row0[0]);
euler.z = 0; euler.Z = 0;
} }
return euler; return euler;
} }
@ -460,24 +460,24 @@ namespace Godot
{ {
if (sy > -(1.0f - Mathf.Epsilon)) if (sy > -(1.0f - Mathf.Epsilon))
{ {
euler.x = Mathf.Atan2(Row2[1], Row2[2]); euler.X = Mathf.Atan2(Row2[1], Row2[2]);
euler.y = Mathf.Asin(-sy); euler.Y = Mathf.Asin(-sy);
euler.z = Mathf.Atan2(Row1[0], Row0[0]); euler.Z = Mathf.Atan2(Row1[0], Row0[0]);
} }
else else
{ {
// It's -1 // It's -1
euler.x = 0; euler.X = 0;
euler.y = Mathf.Tau / 4.0f; euler.Y = Mathf.Tau / 4.0f;
euler.z = -Mathf.Atan2(Row0[1], Row1[1]); euler.Z = -Mathf.Atan2(Row0[1], Row1[1]);
} }
} }
else else
{ {
// It's 1 // It's 1
euler.x = 0; euler.X = 0;
euler.y = -Mathf.Tau / 4.0f; euler.Y = -Mathf.Tau / 4.0f;
euler.z = -Mathf.Atan2(Row0[1], Row1[1]); euler.Z = -Mathf.Atan2(Row0[1], Row1[1]);
} }
return euler; return euler;
} }
@ -653,9 +653,9 @@ namespace Godot
public readonly Basis Scaled(Vector3 scale) public readonly Basis Scaled(Vector3 scale)
{ {
Basis b = this; Basis b = this;
b.Row0 *= scale.x; b.Row0 *= scale.X;
b.Row1 *= scale.y; b.Row1 *= scale.Y;
b.Row2 *= scale.z; b.Row2 *= scale.Z;
return b; return b;
} }
@ -792,18 +792,18 @@ namespace Godot
{ {
real_t s = 2.0f / quaternion.LengthSquared(); real_t s = 2.0f / quaternion.LengthSquared();
real_t xs = quaternion.x * s; real_t xs = quaternion.X * s;
real_t ys = quaternion.y * s; real_t ys = quaternion.Y * s;
real_t zs = quaternion.z * s; real_t zs = quaternion.Z * s;
real_t wx = quaternion.w * xs; real_t wx = quaternion.W * xs;
real_t wy = quaternion.w * ys; real_t wy = quaternion.W * ys;
real_t wz = quaternion.w * zs; real_t wz = quaternion.W * zs;
real_t xx = quaternion.x * xs; real_t xx = quaternion.X * xs;
real_t xy = quaternion.x * ys; real_t xy = quaternion.X * ys;
real_t xz = quaternion.x * zs; real_t xz = quaternion.X * zs;
real_t yy = quaternion.y * ys; real_t yy = quaternion.Y * ys;
real_t yz = quaternion.y * zs; real_t yz = quaternion.Y * zs;
real_t zz = quaternion.z * zs; real_t zz = quaternion.Z * zs;
Row0 = new Vector3(1.0f - (yy + zz), xy - wz, xz + wy); Row0 = new Vector3(1.0f - (yy + zz), xy - wz, xz + wy);
Row1 = new Vector3(xy + wz, 1.0f - (xx + zz), yz - wx); Row1 = new Vector3(xy + wz, 1.0f - (xx + zz), yz - wx);
@ -818,29 +818,29 @@ namespace Godot
/// <param name="angle">The angle to rotate, in radians.</param> /// <param name="angle">The angle to rotate, in radians.</param>
public Basis(Vector3 axis, real_t angle) public Basis(Vector3 axis, real_t angle)
{ {
Vector3 axisSq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z); Vector3 axisSq = new Vector3(axis.X * axis.X, axis.Y * axis.Y, axis.Z * axis.Z);
(real_t sin, real_t cos) = Mathf.SinCos(angle); (real_t sin, real_t cos) = Mathf.SinCos(angle);
Row0.x = axisSq.x + cos * (1.0f - axisSq.x); Row0.X = axisSq.X + cos * (1.0f - axisSq.X);
Row1.y = axisSq.y + cos * (1.0f - axisSq.y); Row1.Y = axisSq.Y + cos * (1.0f - axisSq.Y);
Row2.z = axisSq.z + cos * (1.0f - axisSq.z); Row2.Z = axisSq.Z + cos * (1.0f - axisSq.Z);
real_t t = 1.0f - cos; real_t t = 1.0f - cos;
real_t xyzt = axis.x * axis.y * t; real_t xyzt = axis.X * axis.Y * t;
real_t zyxs = axis.z * sin; real_t zyxs = axis.Z * sin;
Row0.y = xyzt - zyxs; Row0.Y = xyzt - zyxs;
Row1.x = xyzt + zyxs; Row1.X = xyzt + zyxs;
xyzt = axis.x * axis.z * t; xyzt = axis.X * axis.Z * t;
zyxs = axis.y * sin; zyxs = axis.Y * sin;
Row0.z = xyzt + zyxs; Row0.Z = xyzt + zyxs;
Row2.x = xyzt - zyxs; Row2.X = xyzt - zyxs;
xyzt = axis.y * axis.z * t; xyzt = axis.Y * axis.Z * t;
zyxs = axis.x * sin; zyxs = axis.X * sin;
Row1.z = xyzt - zyxs; Row1.Z = xyzt - zyxs;
Row2.y = xyzt + zyxs; Row2.Y = xyzt + zyxs;
} }
/// <summary> /// <summary>
@ -851,9 +851,9 @@ namespace Godot
/// <param name="column2">The Z vector, or Column2.</param> /// <param name="column2">The Z vector, or Column2.</param>
public Basis(Vector3 column0, Vector3 column1, Vector3 column2) public Basis(Vector3 column0, Vector3 column1, Vector3 column2)
{ {
Row0 = new Vector3(column0.x, column1.x, column2.x); Row0 = new Vector3(column0.X, column1.X, column2.X);
Row1 = new Vector3(column0.y, column1.y, column2.y); Row1 = new Vector3(column0.Y, column1.Y, column2.Y);
Row2 = new Vector3(column0.z, column1.z, column2.z); Row2 = new Vector3(column0.Z, column1.Z, column2.Z);
// Same as: // Same as:
// Column0 = column0; // Column0 = column0;
// Column1 = column1; // Column1 = column1;
@ -863,17 +863,17 @@ namespace Godot
/// <summary> /// <summary>
/// Constructs a transformation matrix from the given components. /// Constructs a transformation matrix from the given components.
/// Arguments are named such that xy is equal to calling <c>x.y</c>. /// Arguments are named such that xy is equal to calling <c>X.Y</c>.
/// </summary> /// </summary>
/// <param name="xx">The X component of the X column vector, accessed via <c>b.x.x</c> or <c>[0][0]</c>.</param> /// <param name="xx">The X component of the X column vector, accessed via <c>b.X.X</c> or <c>[0][0]</c>.</param>
/// <param name="yx">The X component of the Y column vector, accessed via <c>b.y.x</c> or <c>[1][0]</c>.</param> /// <param name="yx">The X component of the Y column vector, accessed via <c>b.Y.X</c> or <c>[1][0]</c>.</param>
/// <param name="zx">The X component of the Z column vector, accessed via <c>b.z.x</c> or <c>[2][0]</c>.</param> /// <param name="zx">The X component of the Z column vector, accessed via <c>b.Z.X</c> or <c>[2][0]</c>.</param>
/// <param name="xy">The Y component of the X column vector, accessed via <c>b.x.y</c> or <c>[0][1]</c>.</param> /// <param name="xy">The Y component of the X column vector, accessed via <c>b.X.Y</c> or <c>[0][1]</c>.</param>
/// <param name="yy">The Y component of the Y column vector, accessed via <c>b.y.y</c> or <c>[1][1]</c>.</param> /// <param name="yy">The Y component of the Y column vector, accessed via <c>b.Y.Y</c> or <c>[1][1]</c>.</param>
/// <param name="zy">The Y component of the Z column vector, accessed via <c>b.y.y</c> or <c>[2][1]</c>.</param> /// <param name="zy">The Y component of the Z column vector, accessed via <c>b.Y.Y</c> or <c>[2][1]</c>.</param>
/// <param name="xz">The Z component of the X column vector, accessed via <c>b.x.y</c> or <c>[0][2]</c>.</param> /// <param name="xz">The Z component of the X column vector, accessed via <c>b.X.Y</c> or <c>[0][2]</c>.</param>
/// <param name="yz">The Z component of the Y column vector, accessed via <c>b.y.y</c> or <c>[1][2]</c>.</param> /// <param name="yz">The Z component of the Y column vector, accessed via <c>b.Y.Y</c> or <c>[1][2]</c>.</param>
/// <param name="zz">The Z component of the Z column vector, accessed via <c>b.y.y</c> or <c>[2][2]</c>.</param> /// <param name="zz">The Z component of the Z column vector, accessed via <c>b.Y.Y</c> or <c>[2][2]</c>.</param>
public Basis(real_t xx, real_t yx, real_t zx, real_t xy, real_t yy, real_t zy, real_t xz, real_t yz, real_t zz) public Basis(real_t xx, real_t yx, real_t zx, real_t xy, real_t yy, real_t zy, real_t xz, real_t yz, real_t zz)
{ {
Row0 = new Vector3(xx, yx, zx); Row0 = new Vector3(xx, yx, zx);
@ -888,7 +888,7 @@ namespace Godot
/// <param name="order">The order to compose the Euler angles.</param> /// <param name="order">The order to compose the Euler angles.</param>
public static Basis FromEuler(Vector3 euler, EulerOrder order = EulerOrder.Yxz) public static Basis FromEuler(Vector3 euler, EulerOrder order = EulerOrder.Yxz)
{ {
(real_t sin, real_t cos) = Mathf.SinCos(euler.x); (real_t sin, real_t cos) = Mathf.SinCos(euler.X);
Basis xmat = new Basis Basis xmat = new Basis
( (
new Vector3(1, 0, 0), new Vector3(1, 0, 0),
@ -896,7 +896,7 @@ namespace Godot
new Vector3(0, -sin, cos) new Vector3(0, -sin, cos)
); );
(sin, cos) = Mathf.SinCos(euler.y); (sin, cos) = Mathf.SinCos(euler.Y);
Basis ymat = new Basis Basis ymat = new Basis
( (
new Vector3(cos, 0, -sin), new Vector3(cos, 0, -sin),
@ -904,7 +904,7 @@ namespace Godot
new Vector3(sin, 0, cos) new Vector3(sin, 0, cos)
); );
(sin, cos) = Mathf.SinCos(euler.z); (sin, cos) = Mathf.SinCos(euler.Z);
Basis zmat = new Basis Basis zmat = new Basis
( (
new Vector3(cos, sin, 0), new Vector3(cos, sin, 0),
@ -941,9 +941,9 @@ namespace Godot
public static Basis FromScale(Vector3 scale) public static Basis FromScale(Vector3 scale)
{ {
return new Basis( return new Basis(
scale.x, 0, 0, scale.X, 0, 0,
0, scale.y, 0, 0, scale.Y, 0,
0, 0, scale.z 0, 0, scale.Z
); );
} }
@ -994,9 +994,9 @@ namespace Godot
{ {
return new Vector3 return new Vector3
( (
basis.Row0[0] * vector.x + basis.Row1[0] * vector.y + basis.Row2[0] * vector.z, basis.Row0[0] * vector.X + basis.Row1[0] * vector.Y + basis.Row2[0] * vector.Z,
basis.Row0[1] * vector.x + basis.Row1[1] * vector.y + basis.Row2[1] * vector.z, basis.Row0[1] * vector.X + basis.Row1[1] * vector.Y + basis.Row2[1] * vector.Z,
basis.Row0[2] * vector.x + basis.Row1[2] * vector.y + basis.Row2[2] * vector.z basis.Row0[2] * vector.X + basis.Row1[2] * vector.Y + basis.Row2[2] * vector.Z
); );
} }
@ -1077,7 +1077,7 @@ namespace Godot
/// <returns>A string representation of this basis.</returns> /// <returns>A string representation of this basis.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"[X: {x}, Y: {y}, Z: {z}]"; return $"[X: {X}, Y: {Y}, Z: {Z}]";
} }
/// <summary> /// <summary>
@ -1086,7 +1086,7 @@ namespace Godot
/// <returns>A string representation of this basis.</returns> /// <returns>A string representation of this basis.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"[X: {x.ToString(format)}, Y: {y.ToString(format)}, Z: {z.ToString(format)}]"; return $"[X: {X.ToString(format)}, Y: {Y.ToString(format)}, Z: {Z.ToString(format)}]";
} }
} }
} }

View File

@ -48,7 +48,7 @@ public sealed class GodotSerializationInfo : IDisposable
{ {
_signalEvents[name] = serializedData; _signalEvents[name] = serializedData;
} }
else if (OS.IsStdoutVerbose()) else if (OS.IsStdOutVerbose())
{ {
Console.WriteLine($"Failed to serialize event signal delegate: {name}"); Console.WriteLine($"Failed to serialize event signal delegate: {name}");
} }
@ -72,7 +72,7 @@ public sealed class GodotSerializationInfo : IDisposable
return true; return true;
} }
else if (OS.IsStdoutVerbose()) else if (OS.IsStdOutVerbose())
{ {
Console.WriteLine($"Failed to deserialize event signal delegate: {name}"); Console.WriteLine($"Failed to deserialize event signal delegate: {name}");
} }

View File

@ -650,7 +650,7 @@ namespace Godot.Bridge
continue; continue;
var rpcAttr = method.GetCustomAttributes(inherit: false) var rpcAttr = method.GetCustomAttributes(inherit: false)
.OfType<RPCAttribute>().FirstOrDefault(); .OfType<RpcAttribute>().FirstOrDefault();
if (rpcAttr == null) if (rpcAttr == null)
continue; continue;

View File

@ -21,97 +21,97 @@ namespace Godot
/// <summary> /// <summary>
/// The color's red component, typically on the range of 0 to 1. /// The color's red component, typically on the range of 0 to 1.
/// </summary> /// </summary>
public float r; public float R;
/// <summary> /// <summary>
/// The color's green component, typically on the range of 0 to 1. /// The color's green component, typically on the range of 0 to 1.
/// </summary> /// </summary>
public float g; public float G;
/// <summary> /// <summary>
/// The color's blue component, typically on the range of 0 to 1. /// The color's blue component, typically on the range of 0 to 1.
/// </summary> /// </summary>
public float b; public float B;
/// <summary> /// <summary>
/// The color's alpha (transparency) component, typically on the range of 0 to 1. /// The color's alpha (transparency) component, typically on the range of 0 to 1.
/// </summary> /// </summary>
public float a; public float A;
/// <summary> /// <summary>
/// Wrapper for <see cref="r"/> that uses the range 0 to 255 instead of 0 to 1. /// Wrapper for <see cref="R"/> that uses the range 0 to 255 instead of 0 to 1.
/// </summary> /// </summary>
/// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value> /// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value>
public int r8 public int R8
{ {
readonly get readonly get
{ {
return (int)Math.Round(r * 255.0f); return (int)Math.Round(R * 255.0f);
} }
set set
{ {
r = value / 255.0f; R = value / 255.0f;
} }
} }
/// <summary> /// <summary>
/// Wrapper for <see cref="g"/> that uses the range 0 to 255 instead of 0 to 1. /// Wrapper for <see cref="G"/> that uses the range 0 to 255 instead of 0 to 1.
/// </summary> /// </summary>
/// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value> /// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value>
public int g8 public int G8
{ {
readonly get readonly get
{ {
return (int)Math.Round(g * 255.0f); return (int)Math.Round(G * 255.0f);
} }
set set
{ {
g = value / 255.0f; G = value / 255.0f;
} }
} }
/// <summary> /// <summary>
/// Wrapper for <see cref="b"/> that uses the range 0 to 255 instead of 0 to 1. /// Wrapper for <see cref="B"/> that uses the range 0 to 255 instead of 0 to 1.
/// </summary> /// </summary>
/// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value> /// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value>
public int b8 public int B8
{ {
readonly get readonly get
{ {
return (int)Math.Round(b * 255.0f); return (int)Math.Round(B * 255.0f);
} }
set set
{ {
b = value / 255.0f; B = value / 255.0f;
} }
} }
/// <summary> /// <summary>
/// Wrapper for <see cref="a"/> that uses the range 0 to 255 instead of 0 to 1. /// Wrapper for <see cref="A"/> that uses the range 0 to 255 instead of 0 to 1.
/// </summary> /// </summary>
/// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value> /// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value>
public int a8 public int A8
{ {
readonly get readonly get
{ {
return (int)Math.Round(a * 255.0f); return (int)Math.Round(A * 255.0f);
} }
set set
{ {
a = value / 255.0f; A = value / 255.0f;
} }
} }
/// <summary> /// <summary>
/// The HSV hue of this color, on the range 0 to 1. /// The HSV hue of this color, on the range 0 to 1.
/// </summary> /// </summary>
/// <value>Getting is a long process, refer to the source code for details. Setting uses <see cref="FromHSV"/>.</value> /// <value>Getting is a long process, refer to the source code for details. Setting uses <see cref="FromHsv"/>.</value>
public float h public float H
{ {
readonly get readonly get
{ {
float max = Math.Max(r, Math.Max(g, b)); float max = Math.Max(R, Math.Max(G, B));
float min = Math.Min(r, Math.Min(g, b)); float min = Math.Min(R, Math.Min(G, B));
float delta = max - min; float delta = max - min;
@ -122,17 +122,17 @@ namespace Godot
float h; float h;
if (r == max) if (R == max)
{ {
h = (g - b) / delta; // Between yellow & magenta h = (G - B) / delta; // Between yellow & magenta
} }
else if (g == max) else if (G == max)
{ {
h = 2 + ((b - r) / delta); // Between cyan & yellow h = 2 + ((B - R) / delta); // Between cyan & yellow
} }
else else
{ {
h = 4 + ((r - g) / delta); // Between magenta & cyan h = 4 + ((R - G) / delta); // Between magenta & cyan
} }
h /= 6.0f; h /= 6.0f;
@ -146,20 +146,20 @@ namespace Godot
} }
set set
{ {
this = FromHSV(value, s, v, a); this = FromHsv(value, S, V, A);
} }
} }
/// <summary> /// <summary>
/// The HSV saturation of this color, on the range 0 to 1. /// The HSV saturation of this color, on the range 0 to 1.
/// </summary> /// </summary>
/// <value>Getting is equivalent to the ratio between the min and max RGB value. Setting uses <see cref="FromHSV"/>.</value> /// <value>Getting is equivalent to the ratio between the min and max RGB value. Setting uses <see cref="FromHsv"/>.</value>
public float s public float S
{ {
readonly get readonly get
{ {
float max = Math.Max(r, Math.Max(g, b)); float max = Math.Max(R, Math.Max(G, B));
float min = Math.Min(r, Math.Min(g, b)); float min = Math.Min(R, Math.Min(G, B));
float delta = max - min; float delta = max - min;
@ -167,23 +167,23 @@ namespace Godot
} }
set set
{ {
this = FromHSV(h, value, v, a); this = FromHsv(H, value, V, A);
} }
} }
/// <summary> /// <summary>
/// The HSV value (brightness) of this color, on the range 0 to 1. /// The HSV value (brightness) of this color, on the range 0 to 1.
/// </summary> /// </summary>
/// <value>Getting is equivalent to using <see cref="Math.Max(float, float)"/> on the RGB components. Setting uses <see cref="FromHSV"/>.</value> /// <value>Getting is equivalent to using <see cref="Math.Max(float, float)"/> on the RGB components. Setting uses <see cref="FromHsv"/>.</value>
public float v public float V
{ {
readonly get readonly get
{ {
return Math.Max(r, Math.Max(g, b)); return Math.Max(R, Math.Max(G, B));
} }
set set
{ {
this = FromHSV(h, s, value, a); this = FromHsv(H, S, value, A);
} }
} }
@ -197,17 +197,17 @@ namespace Godot
/// </summary> /// </summary>
public readonly float Luminance public readonly float Luminance
{ {
get { return 0.2126f * r + 0.7152f * g + 0.0722f * b; } get { return 0.2126f * R + 0.7152f * G + 0.0722f * B; }
} }
/// <summary> /// <summary>
/// Access color components using their index. /// Access color components using their index.
/// </summary> /// </summary>
/// <value> /// <value>
/// <c>[0]</c> is equivalent to <see cref="r"/>, /// <c>[0]</c> is equivalent to <see cref="R"/>,
/// <c>[1]</c> is equivalent to <see cref="g"/>, /// <c>[1]</c> is equivalent to <see cref="G"/>,
/// <c>[2]</c> is equivalent to <see cref="b"/>, /// <c>[2]</c> is equivalent to <see cref="B"/>,
/// <c>[3]</c> is equivalent to <see cref="a"/>. /// <c>[3]</c> is equivalent to <see cref="A"/>.
/// </value> /// </value>
public float this[int index] public float this[int index]
{ {
@ -216,13 +216,13 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
return r; return R;
case 1: case 1:
return g; return G;
case 2: case 2:
return b; return B;
case 3: case 3:
return a; return A;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
} }
@ -232,16 +232,16 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
r = value; R = value;
return; return;
case 1: case 1:
g = value; G = value;
return; return;
case 2: case 2:
b = value; B = value;
return; return;
case 3: case 3:
a = value; A = value;
return; return;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
@ -260,17 +260,17 @@ namespace Godot
{ {
Color res; Color res;
float sa = 1.0f - over.a; float sa = 1.0f - over.A;
res.a = (a * sa) + over.a; res.A = (A * sa) + over.A;
if (res.a == 0) if (res.A == 0)
{ {
return new Color(0, 0, 0, 0); return new Color(0, 0, 0, 0);
} }
res.r = ((r * a * sa) + (over.r * over.a)) / res.a; res.R = ((R * A * sa) + (over.R * over.A)) / res.A;
res.g = ((g * a * sa) + (over.g * over.a)) / res.a; res.G = ((G * A * sa) + (over.G * over.A)) / res.A;
res.b = ((b * a * sa) + (over.b * over.a)) / res.a; res.B = ((B * A * sa) + (over.B * over.A)) / res.A;
return res; return res;
} }
@ -289,10 +289,10 @@ namespace Godot
Color maximum = max ?? new Color(1, 1, 1, 1); Color maximum = max ?? new Color(1, 1, 1, 1);
return new Color return new Color
( (
(float)Mathf.Clamp(r, minimum.r, maximum.r), (float)Mathf.Clamp(R, minimum.R, maximum.R),
(float)Mathf.Clamp(g, minimum.g, maximum.g), (float)Mathf.Clamp(G, minimum.G, maximum.G),
(float)Mathf.Clamp(b, minimum.b, maximum.b), (float)Mathf.Clamp(B, minimum.B, maximum.B),
(float)Mathf.Clamp(a, minimum.a, maximum.a) (float)Mathf.Clamp(A, minimum.A, maximum.A)
); );
} }
@ -305,9 +305,9 @@ namespace Godot
public readonly Color Darkened(float amount) public readonly Color Darkened(float amount)
{ {
Color res = this; Color res = this;
res.r *= 1.0f - amount; res.R *= 1.0f - amount;
res.g *= 1.0f - amount; res.G *= 1.0f - amount;
res.b *= 1.0f - amount; res.B *= 1.0f - amount;
return res; return res;
} }
@ -318,10 +318,10 @@ namespace Godot
public readonly Color Inverted() public readonly Color Inverted()
{ {
return new Color( return new Color(
1.0f - r, 1.0f - R,
1.0f - g, 1.0f - G,
1.0f - b, 1.0f - B,
a A
); );
} }
@ -334,9 +334,9 @@ namespace Godot
public readonly Color Lightened(float amount) public readonly Color Lightened(float amount)
{ {
Color res = this; Color res = this;
res.r += (1.0f - res.r) * amount; res.R += (1.0f - res.R) * amount;
res.g += (1.0f - res.g) * amount; res.G += (1.0f - res.G) * amount;
res.b += (1.0f - res.b) * amount; res.B += (1.0f - res.B) * amount;
return res; return res;
} }
@ -351,10 +351,10 @@ namespace Godot
{ {
return new Color return new Color
( (
(float)Mathf.Lerp(r, to.r, weight), (float)Mathf.Lerp(R, to.R, weight),
(float)Mathf.Lerp(g, to.g, weight), (float)Mathf.Lerp(G, to.G, weight),
(float)Mathf.Lerp(b, to.b, weight), (float)Mathf.Lerp(B, to.B, weight),
(float)Mathf.Lerp(a, to.a, weight) (float)Mathf.Lerp(A, to.A, weight)
); );
} }
@ -367,9 +367,9 @@ namespace Godot
public readonly Color LinearToSrgb() public readonly Color LinearToSrgb()
{ {
return new Color( return new Color(
r < 0.0031308f ? 12.92f * r : (1.0f + 0.055f) * (float)Mathf.Pow(r, 1.0f / 2.4f) - 0.055f, R < 0.0031308f ? 12.92f * R : (1.0f + 0.055f) * (float)Mathf.Pow(R, 1.0f / 2.4f) - 0.055f,
g < 0.0031308f ? 12.92f * g : (1.0f + 0.055f) * (float)Mathf.Pow(g, 1.0f / 2.4f) - 0.055f, G < 0.0031308f ? 12.92f * G : (1.0f + 0.055f) * (float)Mathf.Pow(G, 1.0f / 2.4f) - 0.055f,
b < 0.0031308f ? 12.92f * b : (1.0f + 0.055f) * (float)Mathf.Pow(b, 1.0f / 2.4f) - 0.055f, a); B < 0.0031308f ? 12.92f * B : (1.0f + 0.055f) * (float)Mathf.Pow(B, 1.0f / 2.4f) - 0.055f, A);
} }
/// <summary> /// <summary>
@ -381,10 +381,10 @@ namespace Godot
public readonly Color SrgbToLinear() public readonly Color SrgbToLinear()
{ {
return new Color( return new Color(
r < 0.04045f ? r * (1.0f / 12.92f) : (float)Mathf.Pow((r + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f), R < 0.04045f ? R * (1.0f / 12.92f) : (float)Mathf.Pow((R + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f),
g < 0.04045f ? g * (1.0f / 12.92f) : (float)Mathf.Pow((g + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f), G < 0.04045f ? G * (1.0f / 12.92f) : (float)Mathf.Pow((G + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f),
b < 0.04045f ? b * (1.0f / 12.92f) : (float)Mathf.Pow((b + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f), B < 0.04045f ? B * (1.0f / 12.92f) : (float)Mathf.Pow((B + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f),
a); A);
} }
/// <summary> /// <summary>
@ -395,13 +395,13 @@ namespace Godot
/// <returns>A <see langword="uint"/> representing this color in ABGR32 format.</returns> /// <returns>A <see langword="uint"/> representing this color in ABGR32 format.</returns>
public readonly uint ToAbgr32() public readonly uint ToAbgr32()
{ {
uint c = (byte)Math.Round(a * 255); uint c = (byte)Math.Round(A * 255);
c <<= 8; c <<= 8;
c |= (byte)Math.Round(b * 255); c |= (byte)Math.Round(B * 255);
c <<= 8; c <<= 8;
c |= (byte)Math.Round(g * 255); c |= (byte)Math.Round(G * 255);
c <<= 8; c <<= 8;
c |= (byte)Math.Round(r * 255); c |= (byte)Math.Round(R * 255);
return c; return c;
} }
@ -414,13 +414,13 @@ namespace Godot
/// <returns>A <see langword="ulong"/> representing this color in ABGR64 format.</returns> /// <returns>A <see langword="ulong"/> representing this color in ABGR64 format.</returns>
public readonly ulong ToAbgr64() public readonly ulong ToAbgr64()
{ {
ulong c = (ushort)Math.Round(a * 65535); ulong c = (ushort)Math.Round(A * 65535);
c <<= 16; c <<= 16;
c |= (ushort)Math.Round(b * 65535); c |= (ushort)Math.Round(B * 65535);
c <<= 16; c <<= 16;
c |= (ushort)Math.Round(g * 65535); c |= (ushort)Math.Round(G * 65535);
c <<= 16; c <<= 16;
c |= (ushort)Math.Round(r * 65535); c |= (ushort)Math.Round(R * 65535);
return c; return c;
} }
@ -433,13 +433,13 @@ namespace Godot
/// <returns>A <see langword="uint"/> representing this color in ARGB32 format.</returns> /// <returns>A <see langword="uint"/> representing this color in ARGB32 format.</returns>
public readonly uint ToArgb32() public readonly uint ToArgb32()
{ {
uint c = (byte)Math.Round(a * 255); uint c = (byte)Math.Round(A * 255);
c <<= 8; c <<= 8;
c |= (byte)Math.Round(r * 255); c |= (byte)Math.Round(R * 255);
c <<= 8; c <<= 8;
c |= (byte)Math.Round(g * 255); c |= (byte)Math.Round(G * 255);
c <<= 8; c <<= 8;
c |= (byte)Math.Round(b * 255); c |= (byte)Math.Round(B * 255);
return c; return c;
} }
@ -452,13 +452,13 @@ namespace Godot
/// <returns>A <see langword="ulong"/> representing this color in ARGB64 format.</returns> /// <returns>A <see langword="ulong"/> representing this color in ARGB64 format.</returns>
public readonly ulong ToArgb64() public readonly ulong ToArgb64()
{ {
ulong c = (ushort)Math.Round(a * 65535); ulong c = (ushort)Math.Round(A * 65535);
c <<= 16; c <<= 16;
c |= (ushort)Math.Round(r * 65535); c |= (ushort)Math.Round(R * 65535);
c <<= 16; c <<= 16;
c |= (ushort)Math.Round(g * 65535); c |= (ushort)Math.Round(G * 65535);
c <<= 16; c <<= 16;
c |= (ushort)Math.Round(b * 65535); c |= (ushort)Math.Round(B * 65535);
return c; return c;
} }
@ -471,13 +471,13 @@ namespace Godot
/// <returns>A <see langword="uint"/> representing this color in RGBA32 format.</returns> /// <returns>A <see langword="uint"/> representing this color in RGBA32 format.</returns>
public readonly uint ToRgba32() public readonly uint ToRgba32()
{ {
uint c = (byte)Math.Round(r * 255); uint c = (byte)Math.Round(R * 255);
c <<= 8; c <<= 8;
c |= (byte)Math.Round(g * 255); c |= (byte)Math.Round(G * 255);
c <<= 8; c <<= 8;
c |= (byte)Math.Round(b * 255); c |= (byte)Math.Round(B * 255);
c <<= 8; c <<= 8;
c |= (byte)Math.Round(a * 255); c |= (byte)Math.Round(A * 255);
return c; return c;
} }
@ -490,13 +490,13 @@ namespace Godot
/// <returns>A <see langword="ulong"/> representing this color in RGBA64 format.</returns> /// <returns>A <see langword="ulong"/> representing this color in RGBA64 format.</returns>
public readonly ulong ToRgba64() public readonly ulong ToRgba64()
{ {
ulong c = (ushort)Math.Round(r * 65535); ulong c = (ushort)Math.Round(R * 65535);
c <<= 16; c <<= 16;
c |= (ushort)Math.Round(g * 65535); c |= (ushort)Math.Round(G * 65535);
c <<= 16; c <<= 16;
c |= (ushort)Math.Round(b * 65535); c |= (ushort)Math.Round(B * 65535);
c <<= 16; c <<= 16;
c |= (ushort)Math.Round(a * 65535); c |= (ushort)Math.Round(A * 65535);
return c; return c;
} }
@ -508,17 +508,17 @@ namespace Godot
/// Whether or not to include alpha. If <see langword="false"/>, the color is RGB instead of RGBA. /// Whether or not to include alpha. If <see langword="false"/>, the color is RGB instead of RGBA.
/// </param> /// </param>
/// <returns>A string for the HTML hexadecimal representation of this color.</returns> /// <returns>A string for the HTML hexadecimal representation of this color.</returns>
public readonly string ToHTML(bool includeAlpha = true) public readonly string ToHtml(bool includeAlpha = true)
{ {
string txt = string.Empty; string txt = string.Empty;
txt += ToHex32(r); txt += ToHex32(R);
txt += ToHex32(g); txt += ToHex32(G);
txt += ToHex32(b); txt += ToHex32(B);
if (includeAlpha) if (includeAlpha)
{ {
txt += ToHex32(a); txt += ToHex32(A);
} }
return txt; return txt;
@ -533,10 +533,10 @@ namespace Godot
/// <param name="a">The color's alpha (transparency) value, typically on the range of 0 to 1. Default: 1.</param> /// <param name="a">The color's alpha (transparency) value, typically on the range of 0 to 1. Default: 1.</param>
public Color(float r, float g, float b, float a = 1.0f) public Color(float r, float g, float b, float a = 1.0f)
{ {
this.r = r; R = r;
this.g = g; G = g;
this.b = b; B = b;
this.a = a; A = a;
} }
/// <summary> /// <summary>
@ -546,10 +546,10 @@ namespace Godot
/// <param name="a">The color's alpha (transparency) value, typically on the range of 0 to 1. Default: 1.</param> /// <param name="a">The color's alpha (transparency) value, typically on the range of 0 to 1. Default: 1.</param>
public Color(Color c, float a = 1.0f) public Color(Color c, float a = 1.0f)
{ {
r = c.r; R = c.R;
g = c.g; G = c.G;
b = c.b; B = c.B;
this.a = a; A = a;
} }
/// <summary> /// <summary>
@ -559,13 +559,13 @@ namespace Godot
/// <param name="rgba">The <see langword="uint"/> representing the color.</param> /// <param name="rgba">The <see langword="uint"/> representing the color.</param>
public Color(uint rgba) public Color(uint rgba)
{ {
a = (rgba & 0xFF) / 255.0f; A = (rgba & 0xFF) / 255.0f;
rgba >>= 8; rgba >>= 8;
b = (rgba & 0xFF) / 255.0f; B = (rgba & 0xFF) / 255.0f;
rgba >>= 8; rgba >>= 8;
g = (rgba & 0xFF) / 255.0f; G = (rgba & 0xFF) / 255.0f;
rgba >>= 8; rgba >>= 8;
r = (rgba & 0xFF) / 255.0f; R = (rgba & 0xFF) / 255.0f;
} }
/// <summary> /// <summary>
@ -575,13 +575,13 @@ namespace Godot
/// <param name="rgba">The <see langword="ulong"/> representing the color.</param> /// <param name="rgba">The <see langword="ulong"/> representing the color.</param>
public Color(ulong rgba) public Color(ulong rgba)
{ {
a = (rgba & 0xFFFF) / 65535.0f; A = (rgba & 0xFFFF) / 65535.0f;
rgba >>= 16; rgba >>= 16;
b = (rgba & 0xFFFF) / 65535.0f; B = (rgba & 0xFFFF) / 65535.0f;
rgba >>= 16; rgba >>= 16;
g = (rgba & 0xFFFF) / 65535.0f; G = (rgba & 0xFFFF) / 65535.0f;
rgba >>= 16; rgba >>= 16;
r = (rgba & 0xFFFF) / 65535.0f; R = (rgba & 0xFFFF) / 65535.0f;
} }
/// <summary> /// <summary>
@ -598,7 +598,7 @@ namespace Godot
{ {
if (HtmlIsValid(code)) if (HtmlIsValid(code))
{ {
this = FromHTML(code); this = FromHtml(code);
} }
else else
{ {
@ -616,7 +616,7 @@ namespace Godot
public Color(string code, float alpha) public Color(string code, float alpha)
{ {
this = new Color(code); this = new Color(code);
a = alpha; A = alpha;
} }
/// <summary> /// <summary>
@ -626,15 +626,15 @@ namespace Godot
/// <exception name="ArgumentOutOfRangeException"> /// <exception name="ArgumentOutOfRangeException">
/// <paramref name="rgba"/> color code is invalid. /// <paramref name="rgba"/> color code is invalid.
/// </exception> /// </exception>
public static Color FromHTML(ReadOnlySpan<char> rgba) public static Color FromHtml(ReadOnlySpan<char> rgba)
{ {
Color c; Color c;
if (rgba.Length == 0) if (rgba.Length == 0)
{ {
c.r = 0f; c.R = 0f;
c.g = 0f; c.G = 0f;
c.b = 0f; c.B = 0f;
c.a = 1.0f; c.A = 1.0f;
return c; return c;
} }
@ -670,44 +670,44 @@ namespace Godot
$"Invalid color code. Length is {rgba.Length}, but a length of 6 or 8 is expected: {rgba}"); $"Invalid color code. Length is {rgba.Length}, but a length of 6 or 8 is expected: {rgba}");
} }
c.a = 1.0f; c.A = 1.0f;
if (isShorthand) if (isShorthand)
{ {
c.r = ParseCol4(rgba, 0) / 15f; c.R = ParseCol4(rgba, 0) / 15f;
c.g = ParseCol4(rgba, 1) / 15f; c.G = ParseCol4(rgba, 1) / 15f;
c.b = ParseCol4(rgba, 2) / 15f; c.B = ParseCol4(rgba, 2) / 15f;
if (alpha) if (alpha)
{ {
c.a = ParseCol4(rgba, 3) / 15f; c.A = ParseCol4(rgba, 3) / 15f;
} }
} }
else else
{ {
c.r = ParseCol8(rgba, 0) / 255f; c.R = ParseCol8(rgba, 0) / 255f;
c.g = ParseCol8(rgba, 2) / 255f; c.G = ParseCol8(rgba, 2) / 255f;
c.b = ParseCol8(rgba, 4) / 255f; c.B = ParseCol8(rgba, 4) / 255f;
if (alpha) if (alpha)
{ {
c.a = ParseCol8(rgba, 6) / 255f; c.A = ParseCol8(rgba, 6) / 255f;
} }
} }
if (c.r < 0) if (c.R < 0)
{ {
throw new ArgumentOutOfRangeException($"Invalid color code. Red part is not valid hexadecimal: {rgba}"); throw new ArgumentOutOfRangeException($"Invalid color code. Red part is not valid hexadecimal: {rgba}");
} }
if (c.g < 0) if (c.G < 0)
{ {
throw new ArgumentOutOfRangeException($"Invalid color code. Green part is not valid hexadecimal: {rgba}"); throw new ArgumentOutOfRangeException($"Invalid color code. Green part is not valid hexadecimal: {rgba}");
} }
if (c.b < 0) if (c.B < 0)
{ {
throw new ArgumentOutOfRangeException($"Invalid color code. Blue part is not valid hexadecimal: {rgba}"); throw new ArgumentOutOfRangeException($"Invalid color code. Blue part is not valid hexadecimal: {rgba}");
} }
if (c.a < 0) if (c.A < 0)
{ {
throw new ArgumentOutOfRangeException($"Invalid color code. Alpha part is not valid hexadecimal: {rgba}"); throw new ArgumentOutOfRangeException($"Invalid color code. Alpha part is not valid hexadecimal: {rgba}");
} }
@ -793,7 +793,7 @@ namespace Godot
/// <param name="value">The HSV value (brightness), typically on the range of 0 to 1.</param> /// <param name="value">The HSV value (brightness), typically on the range of 0 to 1.</param>
/// <param name="alpha">The alpha (transparency) value, typically on the range of 0 to 1.</param> /// <param name="alpha">The alpha (transparency) value, typically on the range of 0 to 1.</param>
/// <returns>The constructed color.</returns> /// <returns>The constructed color.</returns>
public static Color FromHSV(float hue, float saturation, float value, float alpha = 1.0f) public static Color FromHsv(float hue, float saturation, float value, float alpha = 1.0f)
{ {
if (saturation == 0) if (saturation == 0)
{ {
@ -837,10 +837,10 @@ namespace Godot
/// <param name="hue">Output parameter for the HSV hue.</param> /// <param name="hue">Output parameter for the HSV hue.</param>
/// <param name="saturation">Output parameter for the HSV saturation.</param> /// <param name="saturation">Output parameter for the HSV saturation.</param>
/// <param name="value">Output parameter for the HSV value.</param> /// <param name="value">Output parameter for the HSV value.</param>
public readonly void ToHSV(out float hue, out float saturation, out float value) public readonly void ToHsv(out float hue, out float saturation, out float value)
{ {
float max = (float)Mathf.Max(r, Mathf.Max(g, b)); float max = (float)Mathf.Max(R, Mathf.Max(G, B));
float min = (float)Mathf.Min(r, Mathf.Min(g, b)); float min = (float)Mathf.Min(R, Mathf.Min(G, B));
float delta = max - min; float delta = max - min;
@ -850,17 +850,17 @@ namespace Godot
} }
else else
{ {
if (r == max) if (R == max)
{ {
hue = (g - b) / delta; // Between yellow & magenta hue = (G - B) / delta; // Between yellow & magenta
} }
else if (g == max) else if (G == max)
{ {
hue = 2 + ((b - r) / delta); // Between cyan & yellow hue = 2 + ((B - R) / delta); // Between cyan & yellow
} }
else else
{ {
hue = 4 + ((r - g) / delta); // Between magenta & cyan hue = 4 + ((R - G) / delta); // Between magenta & cyan
} }
hue /= 6.0f; hue /= 6.0f;
@ -950,7 +950,7 @@ namespace Godot
{ {
if (HtmlIsValid(str)) if (HtmlIsValid(str))
{ {
return FromHTML(str); return FromHtml(str);
} }
else else
{ {
@ -1012,10 +1012,10 @@ namespace Godot
/// <returns>The added color.</returns> /// <returns>The added color.</returns>
public static Color operator +(Color left, Color right) public static Color operator +(Color left, Color right)
{ {
left.r += right.r; left.R += right.R;
left.g += right.g; left.G += right.G;
left.b += right.b; left.B += right.B;
left.a += right.a; left.A += right.A;
return left; return left;
} }
@ -1028,17 +1028,17 @@ namespace Godot
/// <returns>The subtracted color.</returns> /// <returns>The subtracted color.</returns>
public static Color operator -(Color left, Color right) public static Color operator -(Color left, Color right)
{ {
left.r -= right.r; left.R -= right.R;
left.g -= right.g; left.G -= right.G;
left.b -= right.b; left.B -= right.B;
left.a -= right.a; left.A -= right.A;
return left; return left;
} }
/// <summary> /// <summary>
/// Inverts the given color. This is equivalent to /// Inverts the given color. This is equivalent to
/// <c>Colors.White - c</c> or /// <c>Colors.White - c</c> or
/// <c>new Color(1 - c.r, 1 - c.g, 1 - c.b, 1 - c.a)</c>. /// <c>new Color(1 - c.R, 1 - c.G, 1 - c.B, 1 - c.A)</c>.
/// </summary> /// </summary>
/// <param name="color">The color to invert.</param> /// <param name="color">The color to invert.</param>
/// <returns>The inverted color.</returns> /// <returns>The inverted color.</returns>
@ -1056,10 +1056,10 @@ namespace Godot
/// <returns>The multiplied color.</returns> /// <returns>The multiplied color.</returns>
public static Color operator *(Color color, float scale) public static Color operator *(Color color, float scale)
{ {
color.r *= scale; color.R *= scale;
color.g *= scale; color.G *= scale;
color.b *= scale; color.B *= scale;
color.a *= scale; color.A *= scale;
return color; return color;
} }
@ -1072,10 +1072,10 @@ namespace Godot
/// <returns>The multiplied color.</returns> /// <returns>The multiplied color.</returns>
public static Color operator *(float scale, Color color) public static Color operator *(float scale, Color color)
{ {
color.r *= scale; color.R *= scale;
color.g *= scale; color.G *= scale;
color.b *= scale; color.B *= scale;
color.a *= scale; color.A *= scale;
return color; return color;
} }
@ -1088,10 +1088,10 @@ namespace Godot
/// <returns>The multiplied color.</returns> /// <returns>The multiplied color.</returns>
public static Color operator *(Color left, Color right) public static Color operator *(Color left, Color right)
{ {
left.r *= right.r; left.R *= right.R;
left.g *= right.g; left.G *= right.G;
left.b *= right.b; left.B *= right.B;
left.a *= right.a; left.A *= right.A;
return left; return left;
} }
@ -1104,10 +1104,10 @@ namespace Godot
/// <returns>The divided color.</returns> /// <returns>The divided color.</returns>
public static Color operator /(Color color, float scale) public static Color operator /(Color color, float scale)
{ {
color.r /= scale; color.R /= scale;
color.g /= scale; color.G /= scale;
color.b /= scale; color.B /= scale;
color.a /= scale; color.A /= scale;
return color; return color;
} }
@ -1120,10 +1120,10 @@ namespace Godot
/// <returns>The divided color.</returns> /// <returns>The divided color.</returns>
public static Color operator /(Color left, Color right) public static Color operator /(Color left, Color right)
{ {
left.r /= right.r; left.R /= right.R;
left.g /= right.g; left.G /= right.G;
left.b /= right.b; left.B /= right.B;
left.a /= right.a; left.A /= right.A;
return left; return left;
} }
@ -1167,19 +1167,19 @@ namespace Godot
/// <returns>Whether or not the left is less than the right.</returns> /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Color left, Color right) public static bool operator <(Color left, Color right)
{ {
if (left.r == right.r) if (left.R == right.R)
{ {
if (left.g == right.g) if (left.G == right.G)
{ {
if (left.b == right.b) if (left.B == right.B)
{ {
return left.a < right.a; return left.A < right.A;
} }
return left.b < right.b; return left.B < right.B;
} }
return left.g < right.g; return left.G < right.G;
} }
return left.r < right.r; return left.R < right.R;
} }
/// <summary> /// <summary>
@ -1196,19 +1196,19 @@ namespace Godot
/// <returns>Whether or not the left is greater than the right.</returns> /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Color left, Color right) public static bool operator >(Color left, Color right)
{ {
if (left.r == right.r) if (left.R == right.R)
{ {
if (left.g == right.g) if (left.G == right.G)
{ {
if (left.b == right.b) if (left.B == right.B)
{ {
return left.a > right.a; return left.A > right.A;
} }
return left.b > right.b; return left.B > right.B;
} }
return left.g > right.g; return left.G > right.G;
} }
return left.r > right.r; return left.R > right.R;
} }
/// <summary> /// <summary>
@ -1225,19 +1225,19 @@ namespace Godot
/// <returns>Whether or not the left is less than or equal to the right.</returns> /// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Color left, Color right) public static bool operator <=(Color left, Color right)
{ {
if (left.r == right.r) if (left.R == right.R)
{ {
if (left.g == right.g) if (left.G == right.G)
{ {
if (left.b == right.b) if (left.B == right.B)
{ {
return left.a <= right.a; return left.A <= right.A;
} }
return left.b < right.b; return left.B < right.B;
} }
return left.g < right.g; return left.G < right.G;
} }
return left.r < right.r; return left.R < right.R;
} }
/// <summary> /// <summary>
@ -1254,19 +1254,19 @@ namespace Godot
/// <returns>Whether or not the left is greater than or equal to the right.</returns> /// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Color left, Color right) public static bool operator >=(Color left, Color right)
{ {
if (left.r == right.r) if (left.R == right.R)
{ {
if (left.g == right.g) if (left.G == right.G)
{ {
if (left.b == right.b) if (left.B == right.B)
{ {
return left.a >= right.a; return left.A >= right.A;
} }
return left.b > right.b; return left.B > right.B;
} }
return left.g > right.g; return left.G > right.G;
} }
return left.r > right.r; return left.R > right.R;
} }
/// <summary> /// <summary>
@ -1288,7 +1288,7 @@ namespace Godot
/// <returns>Whether or not the colors are equal.</returns> /// <returns>Whether or not the colors are equal.</returns>
public readonly bool Equals(Color other) public readonly bool Equals(Color other)
{ {
return r == other.r && g == other.g && b == other.b && a == other.a; return R == other.R && G == other.G && B == other.B && A == other.A;
} }
/// <summary> /// <summary>
@ -1299,7 +1299,7 @@ namespace Godot
/// <returns>Whether or not the colors are approximately equal.</returns> /// <returns>Whether or not the colors are approximately equal.</returns>
public readonly bool IsEqualApprox(Color other) public readonly bool IsEqualApprox(Color other)
{ {
return Mathf.IsEqualApprox(r, other.r) && Mathf.IsEqualApprox(g, other.g) && Mathf.IsEqualApprox(b, other.b) && Mathf.IsEqualApprox(a, other.a); return Mathf.IsEqualApprox(R, other.R) && Mathf.IsEqualApprox(G, other.G) && Mathf.IsEqualApprox(B, other.B) && Mathf.IsEqualApprox(A, other.A);
} }
/// <summary> /// <summary>
@ -1308,7 +1308,7 @@ namespace Godot
/// <returns>A hash code for this color.</returns> /// <returns>A hash code for this color.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return r.GetHashCode() ^ g.GetHashCode() ^ b.GetHashCode() ^ a.GetHashCode(); return R.GetHashCode() ^ G.GetHashCode() ^ B.GetHashCode() ^ A.GetHashCode();
} }
/// <summary> /// <summary>
@ -1317,7 +1317,7 @@ namespace Godot
/// <returns>A string representation of this color.</returns> /// <returns>A string representation of this color.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"({r}, {g}, {b}, {a})"; return $"({R}, {G}, {B}, {A})";
} }
/// <summary> /// <summary>
@ -1326,7 +1326,7 @@ namespace Godot
/// <returns>A string representation of this color.</returns> /// <returns>A string representation of this color.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"({r.ToString(format)}, {g.ToString(format)}, {b.ToString(format)}, {a.ToString(format)})"; return $"({R.ToString(format)}, {G.ToString(format)}, {B.ToString(format)}, {A.ToString(format)})";
} }
} }
} }

View File

@ -581,31 +581,31 @@ namespace Godot
return VariantUtils.CreateFrom(@double); return VariantUtils.CreateFrom(@double);
case Vector2 vector2: case Vector2 vector2:
return VariantUtils.CreateFrom(vector2); return VariantUtils.CreateFrom(vector2);
case Vector2i vector2I: case Vector2I vector2I:
return VariantUtils.CreateFrom(vector2I); return VariantUtils.CreateFrom(vector2I);
case Rect2 rect2: case Rect2 rect2:
return VariantUtils.CreateFrom(rect2); return VariantUtils.CreateFrom(rect2);
case Rect2i rect2I: case Rect2I rect2I:
return VariantUtils.CreateFrom(rect2I); return VariantUtils.CreateFrom(rect2I);
case Transform2D transform2D: case Transform2D transform2D:
return VariantUtils.CreateFrom(transform2D); return VariantUtils.CreateFrom(transform2D);
case Vector3 vector3: case Vector3 vector3:
return VariantUtils.CreateFrom(vector3); return VariantUtils.CreateFrom(vector3);
case Vector3i vector3I: case Vector3I vector3I:
return VariantUtils.CreateFrom(vector3I); return VariantUtils.CreateFrom(vector3I);
case Vector4 vector4: case Vector4 vector4:
return VariantUtils.CreateFrom(vector4); return VariantUtils.CreateFrom(vector4);
case Vector4i vector4I: case Vector4I vector4I:
return VariantUtils.CreateFrom(vector4I); return VariantUtils.CreateFrom(vector4I);
case Basis basis: case Basis basis:
return VariantUtils.CreateFrom(basis); return VariantUtils.CreateFrom(basis);
case Quaternion quaternion: case Quaternion quaternion:
return VariantUtils.CreateFrom(quaternion); return VariantUtils.CreateFrom(quaternion);
case Transform3D transform3d: case Transform3D transform3D:
return VariantUtils.CreateFrom(transform3d); return VariantUtils.CreateFrom(transform3D);
case Projection projection: case Projection projection:
return VariantUtils.CreateFrom(projection); return VariantUtils.CreateFrom(projection);
case AABB aabb: case Aabb aabb:
return VariantUtils.CreateFrom(aabb); return VariantUtils.CreateFrom(aabb);
case Color color: case Color color:
return VariantUtils.CreateFrom(color); return VariantUtils.CreateFrom(color);
@ -639,7 +639,7 @@ namespace Godot
return VariantUtils.CreateFrom(stringNameArray); return VariantUtils.CreateFrom(stringNameArray);
case NodePath[] nodePathArray: case NodePath[] nodePathArray:
return VariantUtils.CreateFrom(nodePathArray); return VariantUtils.CreateFrom(nodePathArray);
case RID[] ridArray: case Rid[] ridArray:
return VariantUtils.CreateFrom(ridArray); return VariantUtils.CreateFrom(ridArray);
case Godot.Object[] godotObjectArray: case Godot.Object[] godotObjectArray:
return VariantUtils.CreateFrom(godotObjectArray); return VariantUtils.CreateFrom(godotObjectArray);
@ -647,7 +647,7 @@ namespace Godot
return VariantUtils.CreateFrom(stringName); return VariantUtils.CreateFrom(stringName);
case NodePath nodePath: case NodePath nodePath:
return VariantUtils.CreateFrom(nodePath); return VariantUtils.CreateFrom(nodePath);
case RID rid: case Rid rid:
return VariantUtils.CreateFrom(rid); return VariantUtils.CreateFrom(rid);
case Collections.Dictionary godotDictionary: case Collections.Dictionary godotDictionary:
return VariantUtils.CreateFrom(godotDictionary); return VariantUtils.CreateFrom(godotDictionary);
@ -690,18 +690,18 @@ namespace Godot
[typeof(float)] = (in godot_variant variant) => VariantUtils.ConvertTo<float>(variant), [typeof(float)] = (in godot_variant variant) => VariantUtils.ConvertTo<float>(variant),
[typeof(double)] = (in godot_variant variant) => VariantUtils.ConvertTo<double>(variant), [typeof(double)] = (in godot_variant variant) => VariantUtils.ConvertTo<double>(variant),
[typeof(Vector2)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector2>(variant), [typeof(Vector2)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector2>(variant),
[typeof(Vector2i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector2i>(variant), [typeof(Vector2I)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector2I>(variant),
[typeof(Rect2)] = (in godot_variant variant) => VariantUtils.ConvertTo<Rect2>(variant), [typeof(Rect2)] = (in godot_variant variant) => VariantUtils.ConvertTo<Rect2>(variant),
[typeof(Rect2i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Rect2i>(variant), [typeof(Rect2I)] = (in godot_variant variant) => VariantUtils.ConvertTo<Rect2I>(variant),
[typeof(Transform2D)] = (in godot_variant variant) => VariantUtils.ConvertTo<Transform2D>(variant), [typeof(Transform2D)] = (in godot_variant variant) => VariantUtils.ConvertTo<Transform2D>(variant),
[typeof(Vector3)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector3>(variant), [typeof(Vector3)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector3>(variant),
[typeof(Vector3i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector3i>(variant), [typeof(Vector3I)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector3I>(variant),
[typeof(Basis)] = (in godot_variant variant) => VariantUtils.ConvertTo<Basis>(variant), [typeof(Basis)] = (in godot_variant variant) => VariantUtils.ConvertTo<Basis>(variant),
[typeof(Quaternion)] = (in godot_variant variant) => VariantUtils.ConvertTo<Quaternion>(variant), [typeof(Quaternion)] = (in godot_variant variant) => VariantUtils.ConvertTo<Quaternion>(variant),
[typeof(Transform3D)] = (in godot_variant variant) => VariantUtils.ConvertTo<Transform3D>(variant), [typeof(Transform3D)] = (in godot_variant variant) => VariantUtils.ConvertTo<Transform3D>(variant),
[typeof(Vector4)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector4>(variant), [typeof(Vector4)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector4>(variant),
[typeof(Vector4i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector4i>(variant), [typeof(Vector4I)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector4I>(variant),
[typeof(AABB)] = (in godot_variant variant) => VariantUtils.ConvertTo<AABB>(variant), [typeof(Aabb)] = (in godot_variant variant) => VariantUtils.ConvertTo<Aabb>(variant),
[typeof(Color)] = (in godot_variant variant) => VariantUtils.ConvertTo<Color>(variant), [typeof(Color)] = (in godot_variant variant) => VariantUtils.ConvertTo<Color>(variant),
[typeof(Plane)] = (in godot_variant variant) => VariantUtils.ConvertTo<Plane>(variant), [typeof(Plane)] = (in godot_variant variant) => VariantUtils.ConvertTo<Plane>(variant),
[typeof(Callable)] = (in godot_variant variant) => VariantUtils.ConvertTo<Callable>(variant), [typeof(Callable)] = (in godot_variant variant) => VariantUtils.ConvertTo<Callable>(variant),
@ -719,10 +719,10 @@ namespace Godot
[typeof(StringName[])] = [typeof(StringName[])] =
(in godot_variant variant) => VariantUtils.ConvertTo<StringName[]>(variant), (in godot_variant variant) => VariantUtils.ConvertTo<StringName[]>(variant),
[typeof(NodePath[])] = (in godot_variant variant) => VariantUtils.ConvertTo<NodePath[]>(variant), [typeof(NodePath[])] = (in godot_variant variant) => VariantUtils.ConvertTo<NodePath[]>(variant),
[typeof(RID[])] = (in godot_variant variant) => VariantUtils.ConvertTo<RID[]>(variant), [typeof(Rid[])] = (in godot_variant variant) => VariantUtils.ConvertTo<Rid[]>(variant),
[typeof(StringName)] = (in godot_variant variant) => VariantUtils.ConvertTo<StringName>(variant), [typeof(StringName)] = (in godot_variant variant) => VariantUtils.ConvertTo<StringName>(variant),
[typeof(NodePath)] = (in godot_variant variant) => VariantUtils.ConvertTo<NodePath>(variant), [typeof(NodePath)] = (in godot_variant variant) => VariantUtils.ConvertTo<NodePath>(variant),
[typeof(RID)] = (in godot_variant variant) => VariantUtils.ConvertTo<RID>(variant), [typeof(Rid)] = (in godot_variant variant) => VariantUtils.ConvertTo<Rid>(variant),
[typeof(Godot.Collections.Dictionary)] = (in godot_variant variant) => [typeof(Godot.Collections.Dictionary)] = (in godot_variant variant) =>
VariantUtils.ConvertTo<Godot.Collections.Dictionary>(variant), VariantUtils.ConvertTo<Godot.Collections.Dictionary>(variant),
[typeof(Godot.Collections.Array)] = [typeof(Godot.Collections.Array)] =

View File

@ -28,7 +28,7 @@ namespace Godot
try try
{ {
isStdoutVerbose = OS.IsStdoutVerbose(); isStdoutVerbose = OS.IsStdOutVerbose();
} }
catch (ObjectDisposedException) catch (ObjectDisposedException)
{ {

View File

@ -126,10 +126,10 @@ namespace Godot.NativeInterop
[FieldOffset(0)] public godot_bool _bool; [FieldOffset(0)] public godot_bool _bool;
[FieldOffset(0)] public long _int; [FieldOffset(0)] public long _int;
[FieldOffset(0)] public double _float; [FieldOffset(0)] public double _float;
[FieldOffset(0)] public Transform2D* _transform2D; [FieldOffset(0)] public Transform2D* _transform2d;
[FieldOffset(0)] public AABB* _aabb; [FieldOffset(0)] public Aabb* _aabb;
[FieldOffset(0)] public Basis* _basis; [FieldOffset(0)] public Basis* _basis;
[FieldOffset(0)] public Transform3D* _transform3D; [FieldOffset(0)] public Transform3D* _transform3d;
[FieldOffset(0)] public Projection* _projection; [FieldOffset(0)] public Projection* _projection;
[FieldOffset(0)] private godot_variant_data_mem _mem; [FieldOffset(0)] private godot_variant_data_mem _mem;
@ -137,18 +137,18 @@ namespace Godot.NativeInterop
[FieldOffset(0)] public godot_string_name _m_string_name; [FieldOffset(0)] public godot_string_name _m_string_name;
[FieldOffset(0)] public godot_string _m_string; [FieldOffset(0)] public godot_string _m_string;
[FieldOffset(0)] public Vector4 _m_vector4; [FieldOffset(0)] public Vector4 _m_vector4;
[FieldOffset(0)] public Vector4i _m_vector4i; [FieldOffset(0)] public Vector4I _m_vector4i;
[FieldOffset(0)] public Vector3 _m_vector3; [FieldOffset(0)] public Vector3 _m_vector3;
[FieldOffset(0)] public Vector3i _m_vector3i; [FieldOffset(0)] public Vector3I _m_vector3i;
[FieldOffset(0)] public Vector2 _m_vector2; [FieldOffset(0)] public Vector2 _m_vector2;
[FieldOffset(0)] public Vector2i _m_vector2i; [FieldOffset(0)] public Vector2I _m_vector2i;
[FieldOffset(0)] public Rect2 _m_rect2; [FieldOffset(0)] public Rect2 _m_rect2;
[FieldOffset(0)] public Rect2i _m_rect2i; [FieldOffset(0)] public Rect2I _m_rect2i;
[FieldOffset(0)] public Plane _m_plane; [FieldOffset(0)] public Plane _m_plane;
[FieldOffset(0)] public Quaternion _m_quaternion; [FieldOffset(0)] public Quaternion _m_quaternion;
[FieldOffset(0)] public Color _m_color; [FieldOffset(0)] public Color _m_color;
[FieldOffset(0)] public godot_node_path _m_node_path; [FieldOffset(0)] public godot_node_path _m_node_path;
[FieldOffset(0)] public RID _m_rid; [FieldOffset(0)] public Rid _m_rid;
[FieldOffset(0)] public godot_variant_obj_data _m_obj_data; [FieldOffset(0)] public godot_variant_obj_data _m_obj_data;
[FieldOffset(0)] public godot_callable _m_callable; [FieldOffset(0)] public godot_callable _m_callable;
[FieldOffset(0)] public godot_signal _m_signal; [FieldOffset(0)] public godot_signal _m_signal;
@ -211,10 +211,10 @@ namespace Godot.NativeInterop
public readonly unsafe Transform2D* Transform2D public readonly unsafe Transform2D* Transform2D
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _data._transform2D; get => _data._transform2d;
} }
public readonly unsafe AABB* AABB public readonly unsafe Aabb* Aabb
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _data._aabb; get => _data._aabb;
@ -229,7 +229,7 @@ namespace Godot.NativeInterop
public readonly unsafe Transform3D* Transform3D public readonly unsafe Transform3D* Transform3D
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _data._transform3D; get => _data._transform3d;
} }
public readonly unsafe Projection* Projection public readonly unsafe Projection* Projection
@ -262,7 +262,7 @@ namespace Godot.NativeInterop
set => _data._m_vector4 = value; set => _data._m_vector4 = value;
} }
public Vector4i Vector4i public Vector4I Vector4I
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
readonly get => _data._m_vector4i; readonly get => _data._m_vector4i;
@ -278,7 +278,7 @@ namespace Godot.NativeInterop
set => _data._m_vector3 = value; set => _data._m_vector3 = value;
} }
public Vector3i Vector3i public Vector3I Vector3I
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
readonly get => _data._m_vector3i; readonly get => _data._m_vector3i;
@ -294,7 +294,7 @@ namespace Godot.NativeInterop
set => _data._m_vector2 = value; set => _data._m_vector2 = value;
} }
public Vector2i Vector2i public Vector2I Vector2I
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
readonly get => _data._m_vector2i; readonly get => _data._m_vector2i;
@ -310,7 +310,7 @@ namespace Godot.NativeInterop
set => _data._m_rect2 = value; set => _data._m_rect2 = value;
} }
public Rect2i Rect2i public Rect2I Rect2I
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
readonly get => _data._m_rect2i; readonly get => _data._m_rect2i;
@ -350,7 +350,7 @@ namespace Godot.NativeInterop
set => _data._m_node_path = value; set => _data._m_node_path = value;
} }
public RID RID public Rid Rid
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
readonly get => _data._m_rid; readonly get => _data._m_rid;
@ -405,13 +405,13 @@ namespace Godot.NativeInterop
case Variant.Type.Int: case Variant.Type.Int:
case Variant.Type.Float: case Variant.Type.Float:
case Variant.Type.Vector2: case Variant.Type.Vector2:
case Variant.Type.Vector2i: case Variant.Type.Vector2I:
case Variant.Type.Rect2: case Variant.Type.Rect2:
case Variant.Type.Rect2i: case Variant.Type.Rect2I:
case Variant.Type.Vector3: case Variant.Type.Vector3:
case Variant.Type.Vector3i: case Variant.Type.Vector3I:
case Variant.Type.Vector4: case Variant.Type.Vector4:
case Variant.Type.Vector4i: case Variant.Type.Vector4I:
case Variant.Type.Plane: case Variant.Type.Plane:
case Variant.Type.Quaternion: case Variant.Type.Quaternion:
case Variant.Type.Color: case Variant.Type.Color:

View File

@ -51,29 +51,29 @@ namespace Godot.NativeInterop
if (type == typeof(Vector2)) if (type == typeof(Vector2))
return Variant.Type.Vector2; return Variant.Type.Vector2;
if (type == typeof(Vector2i)) if (type == typeof(Vector2I))
return Variant.Type.Vector2i; return Variant.Type.Vector2I;
if (type == typeof(Rect2)) if (type == typeof(Rect2))
return Variant.Type.Rect2; return Variant.Type.Rect2;
if (type == typeof(Rect2i)) if (type == typeof(Rect2I))
return Variant.Type.Rect2i; return Variant.Type.Rect2I;
if (type == typeof(Transform2D)) if (type == typeof(Transform2D))
return Variant.Type.Transform2d; return Variant.Type.Transform2D;
if (type == typeof(Vector3)) if (type == typeof(Vector3))
return Variant.Type.Vector3; return Variant.Type.Vector3;
if (type == typeof(Vector3i)) if (type == typeof(Vector3I))
return Variant.Type.Vector3i; return Variant.Type.Vector3I;
if (type == typeof(Vector4)) if (type == typeof(Vector4))
return Variant.Type.Vector4; return Variant.Type.Vector4;
if (type == typeof(Vector4i)) if (type == typeof(Vector4I))
return Variant.Type.Vector4i; return Variant.Type.Vector4I;
if (type == typeof(Basis)) if (type == typeof(Basis))
return Variant.Type.Basis; return Variant.Type.Basis;
@ -82,12 +82,12 @@ namespace Godot.NativeInterop
return Variant.Type.Quaternion; return Variant.Type.Quaternion;
if (type == typeof(Transform3D)) if (type == typeof(Transform3D))
return Variant.Type.Transform3d; return Variant.Type.Transform3D;
if (type == typeof(Projection)) if (type == typeof(Projection))
return Variant.Type.Projection; return Variant.Type.Projection;
if (type == typeof(AABB)) if (type == typeof(Aabb))
return Variant.Type.Aabb; return Variant.Type.Aabb;
if (type == typeof(Color)) if (type == typeof(Color))
@ -140,7 +140,7 @@ namespace Godot.NativeInterop
if (type == typeof(NodePath[])) if (type == typeof(NodePath[]))
return Variant.Type.Array; return Variant.Type.Array;
if (type == typeof(RID[])) if (type == typeof(Rid[]))
return Variant.Type.Array; return Variant.Type.Array;
if (typeof(Godot.Object[]).IsAssignableFrom(type)) if (typeof(Godot.Object[]).IsAssignableFrom(type))
@ -176,7 +176,7 @@ namespace Godot.NativeInterop
if (typeof(NodePath) == type) if (typeof(NodePath) == type)
return Variant.Type.NodePath; return Variant.Type.NodePath;
if (typeof(RID) == type) if (typeof(Rid) == type)
return Variant.Type.Rid; return Variant.Type.Rid;
if (typeof(Collections.Dictionary) == type) if (typeof(Collections.Dictionary) == type)
@ -361,16 +361,16 @@ namespace Godot.NativeInterop
return ret; return ret;
} }
internal static RID[] ConvertNativeGodotArrayToSystemArrayOfRID(in godot_array p_array) internal static Rid[] ConvertNativeGodotArrayToSystemArrayOfRid(in godot_array p_array)
{ {
var array = Collections.Array.CreateTakingOwnershipOfDisposableValue( var array = Collections.Array.CreateTakingOwnershipOfDisposableValue(
NativeFuncs.godotsharp_array_new_copy(p_array)); NativeFuncs.godotsharp_array_new_copy(p_array));
int length = array.Count; int length = array.Count;
var ret = new RID[length]; var ret = new Rid[length];
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
ret[i] = array[i].AsRID(); ret[i] = array[i].AsRid();
return ret; return ret;
} }

View File

@ -184,7 +184,7 @@ namespace Godot.NativeInterop
public static partial void godotsharp_variant_new_projection(out godot_variant r_dest, in Projection p_proj); public static partial void godotsharp_variant_new_projection(out godot_variant r_dest, in Projection p_proj);
public static partial void godotsharp_variant_new_aabb(out godot_variant r_dest, in AABB p_aabb); public static partial void godotsharp_variant_new_aabb(out godot_variant r_dest, in Aabb p_aabb);
public static partial void godotsharp_variant_new_dictionary(out godot_variant r_dest, public static partial void godotsharp_variant_new_dictionary(out godot_variant r_dest,
in godot_dictionary p_dict); in godot_dictionary p_dict);
@ -228,27 +228,27 @@ namespace Godot.NativeInterop
public static partial Vector2 godotsharp_variant_as_vector2(in godot_variant p_self); public static partial Vector2 godotsharp_variant_as_vector2(in godot_variant p_self);
public static partial Vector2i godotsharp_variant_as_vector2i(in godot_variant p_self); public static partial Vector2I godotsharp_variant_as_vector2i(in godot_variant p_self);
public static partial Rect2 godotsharp_variant_as_rect2(in godot_variant p_self); public static partial Rect2 godotsharp_variant_as_rect2(in godot_variant p_self);
public static partial Rect2i godotsharp_variant_as_rect2i(in godot_variant p_self); public static partial Rect2I godotsharp_variant_as_rect2i(in godot_variant p_self);
public static partial Vector3 godotsharp_variant_as_vector3(in godot_variant p_self); public static partial Vector3 godotsharp_variant_as_vector3(in godot_variant p_self);
public static partial Vector3i godotsharp_variant_as_vector3i(in godot_variant p_self); public static partial Vector3I godotsharp_variant_as_vector3i(in godot_variant p_self);
public static partial Transform2D godotsharp_variant_as_transform2d(in godot_variant p_self); public static partial Transform2D godotsharp_variant_as_transform2d(in godot_variant p_self);
public static partial Vector4 godotsharp_variant_as_vector4(in godot_variant p_self); public static partial Vector4 godotsharp_variant_as_vector4(in godot_variant p_self);
public static partial Vector4i godotsharp_variant_as_vector4i(in godot_variant p_self); public static partial Vector4I godotsharp_variant_as_vector4i(in godot_variant p_self);
public static partial Plane godotsharp_variant_as_plane(in godot_variant p_self); public static partial Plane godotsharp_variant_as_plane(in godot_variant p_self);
public static partial Quaternion godotsharp_variant_as_quaternion(in godot_variant p_self); public static partial Quaternion godotsharp_variant_as_quaternion(in godot_variant p_self);
public static partial AABB godotsharp_variant_as_aabb(in godot_variant p_self); public static partial Aabb godotsharp_variant_as_aabb(in godot_variant p_self);
public static partial Basis godotsharp_variant_as_basis(in godot_variant p_self); public static partial Basis godotsharp_variant_as_basis(in godot_variant p_self);
@ -262,7 +262,7 @@ namespace Godot.NativeInterop
public static partial godot_node_path godotsharp_variant_as_node_path(in godot_variant p_self); public static partial godot_node_path godotsharp_variant_as_node_path(in godot_variant p_self);
public static partial RID godotsharp_variant_as_rid(in godot_variant p_self); public static partial Rid godotsharp_variant_as_rid(in godot_variant p_self);
public static partial godot_callable godotsharp_variant_as_callable(in godot_variant p_self); public static partial godot_callable godotsharp_variant_as_callable(in godot_variant p_self);

View File

@ -18,20 +18,20 @@ namespace Godot.NativeInterop
return new godot_variant() { Float = src.Float, Type = Variant.Type.Float }; return new godot_variant() { Float = src.Float, Type = Variant.Type.Float };
case Variant.Type.Vector2: case Variant.Type.Vector2:
return new godot_variant() { Vector2 = src.Vector2, Type = Variant.Type.Vector2 }; return new godot_variant() { Vector2 = src.Vector2, Type = Variant.Type.Vector2 };
case Variant.Type.Vector2i: case Variant.Type.Vector2I:
return new godot_variant() { Vector2i = src.Vector2i, Type = Variant.Type.Vector2i }; return new godot_variant() { Vector2I = src.Vector2I, Type = Variant.Type.Vector2I };
case Variant.Type.Rect2: case Variant.Type.Rect2:
return new godot_variant() { Rect2 = src.Rect2, Type = Variant.Type.Rect2 }; return new godot_variant() { Rect2 = src.Rect2, Type = Variant.Type.Rect2 };
case Variant.Type.Rect2i: case Variant.Type.Rect2I:
return new godot_variant() { Rect2i = src.Rect2i, Type = Variant.Type.Rect2i }; return new godot_variant() { Rect2I = src.Rect2I, Type = Variant.Type.Rect2I };
case Variant.Type.Vector3: case Variant.Type.Vector3:
return new godot_variant() { Vector3 = src.Vector3, Type = Variant.Type.Vector3 }; return new godot_variant() { Vector3 = src.Vector3, Type = Variant.Type.Vector3 };
case Variant.Type.Vector3i: case Variant.Type.Vector3I:
return new godot_variant() { Vector3i = src.Vector3i, Type = Variant.Type.Vector3i }; return new godot_variant() { Vector3I = src.Vector3I, Type = Variant.Type.Vector3I };
case Variant.Type.Vector4: case Variant.Type.Vector4:
return new godot_variant() { Vector4 = src.Vector4, Type = Variant.Type.Vector4 }; return new godot_variant() { Vector4 = src.Vector4, Type = Variant.Type.Vector4 };
case Variant.Type.Vector4i: case Variant.Type.Vector4I:
return new godot_variant() { Vector4i = src.Vector4i, Type = Variant.Type.Vector4i }; return new godot_variant() { Vector4I = src.Vector4I, Type = Variant.Type.Vector4I };
case Variant.Type.Plane: case Variant.Type.Plane:
return new godot_variant() { Plane = src.Plane, Type = Variant.Type.Plane }; return new godot_variant() { Plane = src.Plane, Type = Variant.Type.Plane };
case Variant.Type.Quaternion: case Variant.Type.Quaternion:
@ -39,7 +39,7 @@ namespace Godot.NativeInterop
case Variant.Type.Color: case Variant.Type.Color:
return new godot_variant() { Color = src.Color, Type = Variant.Type.Color }; return new godot_variant() { Color = src.Color, Type = Variant.Type.Color };
case Variant.Type.Rid: case Variant.Type.Rid:
return new godot_variant() { RID = src.RID, Type = Variant.Type.Rid }; return new godot_variant() { Rid = src.Rid, Type = Variant.Type.Rid };
} }
godotsharp_variant_new_copy(out godot_variant ret, src); godotsharp_variant_new_copy(out godot_variant ret, src);

View File

@ -10,8 +10,8 @@ namespace Godot.NativeInterop
{ {
public static partial class VariantUtils public static partial class VariantUtils
{ {
public static godot_variant CreateFromRID(RID from) public static godot_variant CreateFromRid(Rid from)
=> new() { Type = Variant.Type.Rid, RID = from }; => new() { Type = Variant.Type.Rid, Rid = from };
public static godot_variant CreateFromBool(bool from) public static godot_variant CreateFromBool(bool from)
=> new() { Type = Variant.Type.Bool, Bool = from.ToGodotBool() }; => new() { Type = Variant.Type.Bool, Bool = from.ToGodotBool() };
@ -28,26 +28,26 @@ namespace Godot.NativeInterop
public static godot_variant CreateFromVector2(Vector2 from) public static godot_variant CreateFromVector2(Vector2 from)
=> new() { Type = Variant.Type.Vector2, Vector2 = from }; => new() { Type = Variant.Type.Vector2, Vector2 = from };
public static godot_variant CreateFromVector2i(Vector2i from) public static godot_variant CreateFromVector2I(Vector2I from)
=> new() { Type = Variant.Type.Vector2i, Vector2i = from }; => new() { Type = Variant.Type.Vector2I, Vector2I = from };
public static godot_variant CreateFromVector3(Vector3 from) public static godot_variant CreateFromVector3(Vector3 from)
=> new() { Type = Variant.Type.Vector3, Vector3 = from }; => new() { Type = Variant.Type.Vector3, Vector3 = from };
public static godot_variant CreateFromVector3i(Vector3i from) public static godot_variant CreateFromVector3I(Vector3I from)
=> new() { Type = Variant.Type.Vector3i, Vector3i = from }; => new() { Type = Variant.Type.Vector3I, Vector3I = from };
public static godot_variant CreateFromVector4(Vector4 from) public static godot_variant CreateFromVector4(Vector4 from)
=> new() { Type = Variant.Type.Vector4, Vector4 = from }; => new() { Type = Variant.Type.Vector4, Vector4 = from };
public static godot_variant CreateFromVector4i(Vector4i from) public static godot_variant CreateFromVector4I(Vector4I from)
=> new() { Type = Variant.Type.Vector4i, Vector4i = from }; => new() { Type = Variant.Type.Vector4I, Vector4I = from };
public static godot_variant CreateFromRect2(Rect2 from) public static godot_variant CreateFromRect2(Rect2 from)
=> new() { Type = Variant.Type.Rect2, Rect2 = from }; => new() { Type = Variant.Type.Rect2, Rect2 = from };
public static godot_variant CreateFromRect2i(Rect2i from) public static godot_variant CreateFromRect2I(Rect2I from)
=> new() { Type = Variant.Type.Rect2i, Rect2i = from }; => new() { Type = Variant.Type.Rect2I, Rect2I = from };
public static godot_variant CreateFromQuaternion(Quaternion from) public static godot_variant CreateFromQuaternion(Quaternion from)
=> new() { Type = Variant.Type.Quaternion, Quaternion = from }; => new() { Type = Variant.Type.Quaternion, Quaternion = from };
@ -82,7 +82,7 @@ namespace Godot.NativeInterop
return ret; return ret;
} }
public static godot_variant CreateFromAABB(AABB from) public static godot_variant CreateFromAabb(Aabb from)
{ {
NativeFuncs.godotsharp_variant_new_aabb(out godot_variant ret, from); NativeFuncs.godotsharp_variant_new_aabb(out godot_variant ret, from);
return ret; return ret;
@ -237,7 +237,7 @@ namespace Godot.NativeInterop
public static godot_variant CreateFromSystemArrayOfNodePath(Span<NodePath> from) public static godot_variant CreateFromSystemArrayOfNodePath(Span<NodePath> from)
=> CreateFromArray(new Collections.Array(from)); => CreateFromArray(new Collections.Array(from));
public static godot_variant CreateFromSystemArrayOfRID(Span<RID> from) public static godot_variant CreateFromSystemArrayOfRid(Span<Rid> from)
=> CreateFromArray(new Collections.Array(from)); => CreateFromArray(new Collections.Array(from));
// ReSharper disable once RedundantNameQualifier // ReSharper disable once RedundantNameQualifier
@ -375,9 +375,9 @@ namespace Godot.NativeInterop
p_var.Vector2 : p_var.Vector2 :
NativeFuncs.godotsharp_variant_as_vector2(p_var); NativeFuncs.godotsharp_variant_as_vector2(p_var);
public static Vector2i ConvertToVector2i(in godot_variant p_var) public static Vector2I ConvertToVector2I(in godot_variant p_var)
=> p_var.Type == Variant.Type.Vector2i ? => p_var.Type == Variant.Type.Vector2I ?
p_var.Vector2i : p_var.Vector2I :
NativeFuncs.godotsharp_variant_as_vector2i(p_var); NativeFuncs.godotsharp_variant_as_vector2i(p_var);
public static Rect2 ConvertToRect2(in godot_variant p_var) public static Rect2 ConvertToRect2(in godot_variant p_var)
@ -385,13 +385,13 @@ namespace Godot.NativeInterop
p_var.Rect2 : p_var.Rect2 :
NativeFuncs.godotsharp_variant_as_rect2(p_var); NativeFuncs.godotsharp_variant_as_rect2(p_var);
public static Rect2i ConvertToRect2i(in godot_variant p_var) public static Rect2I ConvertToRect2I(in godot_variant p_var)
=> p_var.Type == Variant.Type.Rect2i ? => p_var.Type == Variant.Type.Rect2I ?
p_var.Rect2i : p_var.Rect2I :
NativeFuncs.godotsharp_variant_as_rect2i(p_var); NativeFuncs.godotsharp_variant_as_rect2i(p_var);
public static unsafe Transform2D ConvertToTransform2D(in godot_variant p_var) public static unsafe Transform2D ConvertToTransform2D(in godot_variant p_var)
=> p_var.Type == Variant.Type.Transform2d ? => p_var.Type == Variant.Type.Transform2D ?
*p_var.Transform2D : *p_var.Transform2D :
NativeFuncs.godotsharp_variant_as_transform2d(p_var); NativeFuncs.godotsharp_variant_as_transform2d(p_var);
@ -400,9 +400,9 @@ namespace Godot.NativeInterop
p_var.Vector3 : p_var.Vector3 :
NativeFuncs.godotsharp_variant_as_vector3(p_var); NativeFuncs.godotsharp_variant_as_vector3(p_var);
public static Vector3i ConvertToVector3i(in godot_variant p_var) public static Vector3I ConvertToVector3I(in godot_variant p_var)
=> p_var.Type == Variant.Type.Vector3i ? => p_var.Type == Variant.Type.Vector3I ?
p_var.Vector3i : p_var.Vector3I :
NativeFuncs.godotsharp_variant_as_vector3i(p_var); NativeFuncs.godotsharp_variant_as_vector3i(p_var);
public static unsafe Vector4 ConvertToVector4(in godot_variant p_var) public static unsafe Vector4 ConvertToVector4(in godot_variant p_var)
@ -410,9 +410,9 @@ namespace Godot.NativeInterop
p_var.Vector4 : p_var.Vector4 :
NativeFuncs.godotsharp_variant_as_vector4(p_var); NativeFuncs.godotsharp_variant_as_vector4(p_var);
public static unsafe Vector4i ConvertToVector4i(in godot_variant p_var) public static unsafe Vector4I ConvertToVector4I(in godot_variant p_var)
=> p_var.Type == Variant.Type.Vector4i ? => p_var.Type == Variant.Type.Vector4I ?
p_var.Vector4i : p_var.Vector4I :
NativeFuncs.godotsharp_variant_as_vector4i(p_var); NativeFuncs.godotsharp_variant_as_vector4i(p_var);
public static unsafe Basis ConvertToBasis(in godot_variant p_var) public static unsafe Basis ConvertToBasis(in godot_variant p_var)
@ -426,7 +426,7 @@ namespace Godot.NativeInterop
NativeFuncs.godotsharp_variant_as_quaternion(p_var); NativeFuncs.godotsharp_variant_as_quaternion(p_var);
public static unsafe Transform3D ConvertToTransform3D(in godot_variant p_var) public static unsafe Transform3D ConvertToTransform3D(in godot_variant p_var)
=> p_var.Type == Variant.Type.Transform3d ? => p_var.Type == Variant.Type.Transform3D ?
*p_var.Transform3D : *p_var.Transform3D :
NativeFuncs.godotsharp_variant_as_transform3d(p_var); NativeFuncs.godotsharp_variant_as_transform3d(p_var);
@ -435,9 +435,9 @@ namespace Godot.NativeInterop
*p_var.Projection : *p_var.Projection :
NativeFuncs.godotsharp_variant_as_projection(p_var); NativeFuncs.godotsharp_variant_as_projection(p_var);
public static unsafe AABB ConvertToAABB(in godot_variant p_var) public static unsafe Aabb ConvertToAabb(in godot_variant p_var)
=> p_var.Type == Variant.Type.Aabb ? => p_var.Type == Variant.Type.Aabb ?
*p_var.AABB : *p_var.Aabb :
NativeFuncs.godotsharp_variant_as_aabb(p_var); NativeFuncs.godotsharp_variant_as_aabb(p_var);
public static Color ConvertToColor(in godot_variant p_var) public static Color ConvertToColor(in godot_variant p_var)
@ -450,9 +450,9 @@ namespace Godot.NativeInterop
p_var.Plane : p_var.Plane :
NativeFuncs.godotsharp_variant_as_plane(p_var); NativeFuncs.godotsharp_variant_as_plane(p_var);
public static RID ConvertToRID(in godot_variant p_var) public static Rid ConvertToRid(in godot_variant p_var)
=> p_var.Type == Variant.Type.Rid ? => p_var.Type == Variant.Type.Rid ?
p_var.RID : p_var.Rid :
NativeFuncs.godotsharp_variant_as_rid(p_var); NativeFuncs.godotsharp_variant_as_rid(p_var);
public static IntPtr ConvertToGodotObjectPtr(in godot_variant p_var) public static IntPtr ConvertToGodotObjectPtr(in godot_variant p_var)
@ -608,10 +608,10 @@ namespace Godot.NativeInterop
return Marshaling.ConvertNativeGodotArrayToSystemArrayOfNodePath(godotArray); return Marshaling.ConvertNativeGodotArrayToSystemArrayOfNodePath(godotArray);
} }
public static RID[] ConvertToSystemArrayOfRID(in godot_variant p_var) public static Rid[] ConvertToSystemArrayOfRid(in godot_variant p_var)
{ {
using var godotArray = NativeFuncs.godotsharp_variant_as_array(p_var); using var godotArray = NativeFuncs.godotsharp_variant_as_array(p_var);
return Marshaling.ConvertNativeGodotArrayToSystemArrayOfRID(godotArray); return Marshaling.ConvertNativeGodotArrayToSystemArrayOfRid(godotArray);
} }
public static T[] ConvertToSystemArrayOfGodotObject<T>(in godot_variant p_var) public static T[] ConvertToSystemArrayOfGodotObject<T>(in godot_variant p_var)

View File

@ -80,14 +80,14 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector2)) if (typeof(T) == typeof(Vector2))
return CreateFromVector2(UnsafeAs<Vector2>(from)); return CreateFromVector2(UnsafeAs<Vector2>(from));
if (typeof(T) == typeof(Vector2i)) if (typeof(T) == typeof(Vector2I))
return CreateFromVector2i(UnsafeAs<Vector2i>(from)); return CreateFromVector2I(UnsafeAs<Vector2I>(from));
if (typeof(T) == typeof(Rect2)) if (typeof(T) == typeof(Rect2))
return CreateFromRect2(UnsafeAs<Rect2>(from)); return CreateFromRect2(UnsafeAs<Rect2>(from));
if (typeof(T) == typeof(Rect2i)) if (typeof(T) == typeof(Rect2I))
return CreateFromRect2i(UnsafeAs<Rect2i>(from)); return CreateFromRect2I(UnsafeAs<Rect2I>(from));
if (typeof(T) == typeof(Transform2D)) if (typeof(T) == typeof(Transform2D))
return CreateFromTransform2D(UnsafeAs<Transform2D>(from)); return CreateFromTransform2D(UnsafeAs<Transform2D>(from));
@ -98,8 +98,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector3)) if (typeof(T) == typeof(Vector3))
return CreateFromVector3(UnsafeAs<Vector3>(from)); return CreateFromVector3(UnsafeAs<Vector3>(from));
if (typeof(T) == typeof(Vector3i)) if (typeof(T) == typeof(Vector3I))
return CreateFromVector3i(UnsafeAs<Vector3i>(from)); return CreateFromVector3I(UnsafeAs<Vector3I>(from));
if (typeof(T) == typeof(Basis)) if (typeof(T) == typeof(Basis))
return CreateFromBasis(UnsafeAs<Basis>(from)); return CreateFromBasis(UnsafeAs<Basis>(from));
@ -113,11 +113,11 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector4)) if (typeof(T) == typeof(Vector4))
return CreateFromVector4(UnsafeAs<Vector4>(from)); return CreateFromVector4(UnsafeAs<Vector4>(from));
if (typeof(T) == typeof(Vector4i)) if (typeof(T) == typeof(Vector4I))
return CreateFromVector4i(UnsafeAs<Vector4i>(from)); return CreateFromVector4I(UnsafeAs<Vector4I>(from));
if (typeof(T) == typeof(AABB)) if (typeof(T) == typeof(Aabb))
return CreateFromAABB(UnsafeAs<AABB>(from)); return CreateFromAabb(UnsafeAs<Aabb>(from));
if (typeof(T) == typeof(Color)) if (typeof(T) == typeof(Color))
return CreateFromColor(UnsafeAs<Color>(from)); return CreateFromColor(UnsafeAs<Color>(from));
@ -167,8 +167,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(NodePath[])) if (typeof(T) == typeof(NodePath[]))
return CreateFromSystemArrayOfNodePath(UnsafeAs<NodePath[]>(from)); return CreateFromSystemArrayOfNodePath(UnsafeAs<NodePath[]>(from));
if (typeof(T) == typeof(RID[])) if (typeof(T) == typeof(Rid[]))
return CreateFromSystemArrayOfRID(UnsafeAs<RID[]>(from)); return CreateFromSystemArrayOfRid(UnsafeAs<Rid[]>(from));
if (typeof(T) == typeof(StringName)) if (typeof(T) == typeof(StringName))
return CreateFromStringName(UnsafeAs<StringName>(from)); return CreateFromStringName(UnsafeAs<StringName>(from));
@ -176,8 +176,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(NodePath)) if (typeof(T) == typeof(NodePath))
return CreateFromNodePath(UnsafeAs<NodePath>(from)); return CreateFromNodePath(UnsafeAs<NodePath>(from));
if (typeof(T) == typeof(RID)) if (typeof(T) == typeof(Rid))
return CreateFromRID(UnsafeAs<RID>(from)); return CreateFromRid(UnsafeAs<Rid>(from));
if (typeof(T) == typeof(Godot.Collections.Dictionary)) if (typeof(T) == typeof(Godot.Collections.Dictionary))
return CreateFromDictionary(UnsafeAs<Godot.Collections.Dictionary>(from)); return CreateFromDictionary(UnsafeAs<Godot.Collections.Dictionary>(from));
@ -269,14 +269,14 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector2)) if (typeof(T) == typeof(Vector2))
return UnsafeAsT(ConvertToVector2(variant)); return UnsafeAsT(ConvertToVector2(variant));
if (typeof(T) == typeof(Vector2i)) if (typeof(T) == typeof(Vector2I))
return UnsafeAsT(ConvertToVector2i(variant)); return UnsafeAsT(ConvertToVector2I(variant));
if (typeof(T) == typeof(Rect2)) if (typeof(T) == typeof(Rect2))
return UnsafeAsT(ConvertToRect2(variant)); return UnsafeAsT(ConvertToRect2(variant));
if (typeof(T) == typeof(Rect2i)) if (typeof(T) == typeof(Rect2I))
return UnsafeAsT(ConvertToRect2i(variant)); return UnsafeAsT(ConvertToRect2I(variant));
if (typeof(T) == typeof(Transform2D)) if (typeof(T) == typeof(Transform2D))
return UnsafeAsT(ConvertToTransform2D(variant)); return UnsafeAsT(ConvertToTransform2D(variant));
@ -284,8 +284,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector3)) if (typeof(T) == typeof(Vector3))
return UnsafeAsT(ConvertToVector3(variant)); return UnsafeAsT(ConvertToVector3(variant));
if (typeof(T) == typeof(Vector3i)) if (typeof(T) == typeof(Vector3I))
return UnsafeAsT(ConvertToVector3i(variant)); return UnsafeAsT(ConvertToVector3I(variant));
if (typeof(T) == typeof(Basis)) if (typeof(T) == typeof(Basis))
return UnsafeAsT(ConvertToBasis(variant)); return UnsafeAsT(ConvertToBasis(variant));
@ -302,11 +302,11 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector4)) if (typeof(T) == typeof(Vector4))
return UnsafeAsT(ConvertToVector4(variant)); return UnsafeAsT(ConvertToVector4(variant));
if (typeof(T) == typeof(Vector4i)) if (typeof(T) == typeof(Vector4I))
return UnsafeAsT(ConvertToVector4i(variant)); return UnsafeAsT(ConvertToVector4I(variant));
if (typeof(T) == typeof(AABB)) if (typeof(T) == typeof(Aabb))
return UnsafeAsT(ConvertToAABB(variant)); return UnsafeAsT(ConvertToAabb(variant));
if (typeof(T) == typeof(Color)) if (typeof(T) == typeof(Color))
return UnsafeAsT(ConvertToColor(variant)); return UnsafeAsT(ConvertToColor(variant));
@ -356,8 +356,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(NodePath[])) if (typeof(T) == typeof(NodePath[]))
return UnsafeAsT(ConvertToSystemArrayOfNodePath(variant)); return UnsafeAsT(ConvertToSystemArrayOfNodePath(variant));
if (typeof(T) == typeof(RID[])) if (typeof(T) == typeof(Rid[]))
return UnsafeAsT(ConvertToSystemArrayOfRID(variant)); return UnsafeAsT(ConvertToSystemArrayOfRid(variant));
if (typeof(T) == typeof(StringName)) if (typeof(T) == typeof(StringName))
return UnsafeAsT(ConvertToStringName(variant)); return UnsafeAsT(ConvertToStringName(variant));
@ -365,8 +365,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(NodePath)) if (typeof(T) == typeof(NodePath))
return UnsafeAsT(ConvertToNodePath(variant)); return UnsafeAsT(ConvertToNodePath(variant));
if (typeof(T) == typeof(RID)) if (typeof(T) == typeof(Rid))
return UnsafeAsT(ConvertToRID(variant)); return UnsafeAsT(ConvertToRid(variant));
if (typeof(T) == typeof(Godot.Collections.Dictionary)) if (typeof(T) == typeof(Godot.Collections.Dictionary))
return UnsafeAsT(ConvertToDictionary(variant)); return UnsafeAsT(ConvertToDictionary(variant));

View File

@ -13,67 +13,20 @@ namespace Godot
public struct Plane : IEquatable<Plane> public struct Plane : IEquatable<Plane>
{ {
private Vector3 _normal; private Vector3 _normal;
private real_t _d;
/// <summary> /// <summary>
/// The normal of the plane, which must be a unit vector. /// The normal of the plane, which must be a unit vector.
/// In the scalar equation of the plane <c>ax + by + cz = d</c>, this is /// In the scalar equation of the plane <c>ax + by + cz = d</c>, this is
/// the vector <c>(a, b, c)</c>, where <c>d</c> is the <see cref="D"/> property. /// the vector <c>(a, b, c)</c>, where <c>d</c> is the <see cref="D"/> property.
/// </summary> /// </summary>
/// <value>Equivalent to <see cref="x"/>, <see cref="y"/>, and <see cref="z"/>.</value> /// <value>Equivalent to <see cref="X"/>, <see cref="Y"/>, and <see cref="Z"/>.</value>
public Vector3 Normal public Vector3 Normal
{ {
readonly get { return _normal; } readonly get { return _normal; }
set { _normal = value; } set { _normal = value; }
} }
/// <summary>
/// The X component of the plane's normal vector.
/// </summary>
/// <value>Equivalent to <see cref="Normal"/>'s X value.</value>
public real_t x
{
readonly get
{
return _normal.x;
}
set
{
_normal.x = value;
}
}
/// <summary>
/// The Y component of the plane's normal vector.
/// </summary>
/// <value>Equivalent to <see cref="Normal"/>'s Y value.</value>
public real_t y
{
readonly get
{
return _normal.y;
}
set
{
_normal.y = value;
}
}
/// <summary>
/// The Z component of the plane's normal vector.
/// </summary>
/// <value>Equivalent to <see cref="Normal"/>'s Z value.</value>
public real_t z
{
readonly get
{
return _normal.z;
}
set
{
_normal.z = value;
}
}
/// <summary> /// <summary>
/// The distance from the origin to the plane (in the direction of /// The distance from the origin to the plane (in the direction of
/// <see cref="Normal"/>). This value is typically non-negative. /// <see cref="Normal"/>). This value is typically non-negative.
@ -82,7 +35,59 @@ namespace Godot
/// by the <see cref="Normal"/> property. /// by the <see cref="Normal"/> property.
/// </summary> /// </summary>
/// <value>The plane's distance from the origin.</value> /// <value>The plane's distance from the origin.</value>
public real_t D { get; set; } public real_t D
{
readonly get { return _d; }
set { _d = value; }
}
/// <summary>
/// The X component of the plane's normal vector.
/// </summary>
/// <value>Equivalent to <see cref="Normal"/>'s X value.</value>
public real_t X
{
readonly get
{
return _normal.X;
}
set
{
_normal.X = value;
}
}
/// <summary>
/// The Y component of the plane's normal vector.
/// </summary>
/// <value>Equivalent to <see cref="Normal"/>'s Y value.</value>
public real_t Y
{
readonly get
{
return _normal.Y;
}
set
{
_normal.Y = value;
}
}
/// <summary>
/// The Z component of the plane's normal vector.
/// </summary>
/// <value>Equivalent to <see cref="Normal"/>'s Z value.</value>
public real_t Z
{
readonly get
{
return _normal.Z;
}
set
{
_normal.Z = value;
}
}
/// <summary> /// <summary>
/// Returns the shortest distance from this plane to the position <paramref name="point"/>. /// Returns the shortest distance from this plane to the position <paramref name="point"/>.
@ -91,7 +96,7 @@ namespace Godot
/// <returns>The shortest distance.</returns> /// <returns>The shortest distance.</returns>
public readonly real_t DistanceTo(Vector3 point) public readonly real_t DistanceTo(Vector3 point)
{ {
return _normal.Dot(point) - D; return _normal.Dot(point) - _d;
} }
/// <summary> /// <summary>
@ -101,7 +106,7 @@ namespace Godot
/// <value>Equivalent to <see cref="Normal"/> multiplied by <see cref="D"/>.</value> /// <value>Equivalent to <see cref="Normal"/> multiplied by <see cref="D"/>.</value>
public readonly Vector3 GetCenter() public readonly Vector3 GetCenter()
{ {
return _normal * D; return _normal * _d;
} }
/// <summary> /// <summary>
@ -113,7 +118,7 @@ namespace Godot
/// <returns>A <see langword="bool"/> for whether or not the plane has the point.</returns> /// <returns>A <see langword="bool"/> for whether or not the plane has the point.</returns>
public readonly bool HasPoint(Vector3 point, real_t tolerance = Mathf.Epsilon) public readonly bool HasPoint(Vector3 point, real_t tolerance = Mathf.Epsilon)
{ {
real_t dist = _normal.Dot(point) - D; real_t dist = _normal.Dot(point) - _d;
return Mathf.Abs(dist) <= tolerance; return Mathf.Abs(dist) <= tolerance;
} }
@ -133,9 +138,9 @@ namespace Godot
return null; return null;
} }
Vector3 result = (b._normal.Cross(c._normal) * D) + Vector3 result = (b._normal.Cross(c._normal) * _d) +
(c._normal.Cross(_normal) * b.D) + (c._normal.Cross(_normal) * b._d) +
(_normal.Cross(b._normal) * c.D); (_normal.Cross(b._normal) * c._d);
return result / denom; return result / denom;
} }
@ -157,7 +162,7 @@ namespace Godot
return null; return null;
} }
real_t dist = (_normal.Dot(from) - D) / den; real_t dist = (_normal.Dot(from) - _d) / den;
// This is a ray, before the emitting pos (from) does not exist // This is a ray, before the emitting pos (from) does not exist
if (dist > Mathf.Epsilon) if (dist > Mathf.Epsilon)
@ -186,7 +191,7 @@ namespace Godot
return null; return null;
} }
real_t dist = (_normal.Dot(begin) - D) / den; real_t dist = (_normal.Dot(begin) - _d) / den;
// Only allow dist to be in the range of 0 to 1, with tolerance. // Only allow dist to be in the range of 0 to 1, with tolerance.
if (dist < -Mathf.Epsilon || dist > 1.0f + Mathf.Epsilon) if (dist < -Mathf.Epsilon || dist > 1.0f + Mathf.Epsilon)
@ -214,7 +219,7 @@ namespace Godot
/// <returns>A <see langword="bool"/> for whether or not the point is above the plane.</returns> /// <returns>A <see langword="bool"/> for whether or not the point is above the plane.</returns>
public readonly bool IsPointOver(Vector3 point) public readonly bool IsPointOver(Vector3 point)
{ {
return _normal.Dot(point) > D; return _normal.Dot(point) > _d;
} }
/// <summary> /// <summary>
@ -230,7 +235,7 @@ namespace Godot
return new Plane(0, 0, 0, 0); return new Plane(0, 0, 0, 0);
} }
return new Plane(_normal / len, D / len); return new Plane(_normal / len, _d / len);
} }
/// <summary> /// <summary>
@ -279,7 +284,7 @@ namespace Godot
public Plane(real_t a, real_t b, real_t c, real_t d) public Plane(real_t a, real_t b, real_t c, real_t d)
{ {
_normal = new Vector3(a, b, c); _normal = new Vector3(a, b, c);
D = d; _d = d;
} }
/// <summary> /// <summary>
@ -290,7 +295,7 @@ namespace Godot
public Plane(Vector3 normal) public Plane(Vector3 normal)
{ {
_normal = normal; _normal = normal;
D = 0; _d = 0;
} }
/// <summary> /// <summary>
@ -302,7 +307,7 @@ namespace Godot
public Plane(Vector3 normal, real_t d) public Plane(Vector3 normal, real_t d)
{ {
_normal = normal; _normal = normal;
D = d; _d = d;
} }
/// <summary> /// <summary>
@ -314,7 +319,7 @@ namespace Godot
public Plane(Vector3 normal, Vector3 point) public Plane(Vector3 normal, Vector3 point)
{ {
_normal = normal; _normal = normal;
D = _normal.Dot(point); _d = _normal.Dot(point);
} }
/// <summary> /// <summary>
@ -327,7 +332,7 @@ namespace Godot
{ {
_normal = (v1 - v3).Cross(v1 - v2); _normal = (v1 - v3).Cross(v1 - v2);
_normal.Normalize(); _normal.Normalize();
D = _normal.Dot(v1); _d = _normal.Dot(v1);
} }
/// <summary> /// <summary>
@ -341,7 +346,7 @@ namespace Godot
/// <returns>The negated/flipped plane.</returns> /// <returns>The negated/flipped plane.</returns>
public static Plane operator -(Plane plane) public static Plane operator -(Plane plane)
{ {
return new Plane(-plane._normal, -plane.D); return new Plane(-plane._normal, -plane._d);
} }
/// <summary> /// <summary>
@ -389,7 +394,7 @@ namespace Godot
/// <returns>Whether or not the planes are exactly equal.</returns> /// <returns>Whether or not the planes are exactly equal.</returns>
public readonly bool Equals(Plane other) public readonly bool Equals(Plane other)
{ {
return _normal == other._normal && D == other.D; return _normal == other._normal && _d == other._d;
} }
/// <summary> /// <summary>
@ -400,7 +405,7 @@ namespace Godot
/// <returns>Whether or not the planes are approximately equal.</returns> /// <returns>Whether or not the planes are approximately equal.</returns>
public readonly bool IsEqualApprox(Plane other) public readonly bool IsEqualApprox(Plane other)
{ {
return _normal.IsEqualApprox(other._normal) && Mathf.IsEqualApprox(D, other.D); return _normal.IsEqualApprox(other._normal) && Mathf.IsEqualApprox(_d, other._d);
} }
/// <summary> /// <summary>
@ -409,7 +414,7 @@ namespace Godot
/// <returns>A hash code for this plane.</returns> /// <returns>A hash code for this plane.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return _normal.GetHashCode() ^ D.GetHashCode(); return _normal.GetHashCode() ^ _d.GetHashCode();
} }
/// <summary> /// <summary>
@ -418,7 +423,7 @@ namespace Godot
/// <returns>A string representation of this plane.</returns> /// <returns>A string representation of this plane.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"{_normal}, {D}"; return $"{_normal}, {_d}";
} }
/// <summary> /// <summary>
@ -427,7 +432,7 @@ namespace Godot
/// <returns>A string representation of this plane.</returns> /// <returns>A string representation of this plane.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"{_normal.ToString(format)}, {D.ToString(format)}"; return $"{_normal.ToString(format)}, {_d.ToString(format)}";
} }
} }
} }

View File

@ -49,22 +49,22 @@ namespace Godot
/// <summary> /// <summary>
/// The projection's X column. Also accessible by using the index position <c>[0]</c>. /// The projection's X column. Also accessible by using the index position <c>[0]</c>.
/// </summary> /// </summary>
public Vector4 x; public Vector4 X;
/// <summary> /// <summary>
/// The projection's Y column. Also accessible by using the index position <c>[1]</c>. /// The projection's Y column. Also accessible by using the index position <c>[1]</c>.
/// </summary> /// </summary>
public Vector4 y; public Vector4 Y;
/// <summary> /// <summary>
/// The projection's Z column. Also accessible by using the index position <c>[2]</c>. /// The projection's Z column. Also accessible by using the index position <c>[2]</c>.
/// </summary> /// </summary>
public Vector4 z; public Vector4 Z;
/// <summary> /// <summary>
/// The projection's W column. Also accessible by using the index position <c>[3]</c>. /// The projection's W column. Also accessible by using the index position <c>[3]</c>.
/// </summary> /// </summary>
public Vector4 w; public Vector4 W;
/// <summary> /// <summary>
/// Access whole columns in the form of <see cref="Vector4"/>. /// Access whole columns in the form of <see cref="Vector4"/>.
@ -80,13 +80,13 @@ namespace Godot
switch (column) switch (column)
{ {
case 0: case 0:
return x; return X;
case 1: case 1:
return y; return Y;
case 2: case 2:
return z; return Z;
case 3: case 3:
return w; return W;
default: default:
throw new ArgumentOutOfRangeException(nameof(column)); throw new ArgumentOutOfRangeException(nameof(column));
} }
@ -96,16 +96,16 @@ namespace Godot
switch (column) switch (column)
{ {
case 0: case 0:
x = value; X = value;
return; return;
case 1: case 1:
y = value; Y = value;
return; return;
case 2: case 2:
z = value; Z = value;
return; return;
case 3: case 3:
w = value; W = value;
return; return;
default: default:
throw new ArgumentOutOfRangeException(nameof(column)); throw new ArgumentOutOfRangeException(nameof(column));
@ -128,13 +128,13 @@ namespace Godot
switch (column) switch (column)
{ {
case 0: case 0:
return x[row]; return X[row];
case 1: case 1:
return y[row]; return Y[row];
case 2: case 2:
return z[row]; return Z[row];
case 3: case 3:
return w[row]; return W[row];
default: default:
throw new ArgumentOutOfRangeException(nameof(column)); throw new ArgumentOutOfRangeException(nameof(column));
} }
@ -144,16 +144,16 @@ namespace Godot
switch (column) switch (column)
{ {
case 0: case 0:
x[row] = value; X[row] = value;
return; return;
case 1: case 1:
y[row] = value; Y[row] = value;
return; return;
case 2: case 2:
z[row] = value; Z[row] = value;
return; return;
case 3: case 3:
w[row] = value; W[row] = value;
return; return;
default: default:
throw new ArgumentOutOfRangeException(nameof(column)); throw new ArgumentOutOfRangeException(nameof(column));
@ -180,20 +180,20 @@ namespace Godot
/// <summary> /// <summary>
/// Creates a new <see cref="Projection"/> that scales a given projection to fit around /// Creates a new <see cref="Projection"/> that scales a given projection to fit around
/// a given <see cref="AABB"/> in projection space. /// a given <see cref="Aabb"/> in projection space.
/// </summary> /// </summary>
/// <param name="aabb">The AABB to fit the projection around.</param> /// <param name="aabb">The Aabb to fit the projection around.</param>
/// <returns>The created projection.</returns> /// <returns>The created projection.</returns>
public static Projection CreateFitAabb(AABB aabb) public static Projection CreateFitAabb(Aabb aabb)
{ {
Vector3 min = aabb.Position; Vector3 min = aabb.Position;
Vector3 max = aabb.Position + aabb.Size; Vector3 max = aabb.Position + aabb.Size;
return new Projection( return new Projection(
new Vector4(2 / (max.x - min.x), 0, 0, 0), new Vector4(2 / (max.X - min.X), 0, 0, 0),
new Vector4(0, 2 / (max.y - min.y), 0, 0), new Vector4(0, 2 / (max.Y - min.Y), 0, 0),
new Vector4(0, 0, 2 / (max.z - min.z), 0), new Vector4(0, 0, 2 / (max.Z - min.Z), 0),
new Vector4(-(max.x + min.x) / (max.x - min.x), -(max.y + min.y) / (max.y - min.y), -(max.z + min.z) / (max.z - min.z), 1) new Vector4(-(max.X + min.X) / (max.X - min.X), -(max.Y + min.Y) / (max.Y - min.Y), -(max.Z + min.Z) / (max.Z - min.Z), 1)
); );
} }
@ -300,7 +300,7 @@ namespace Godot
{ {
size *= aspect; size *= aspect;
} }
return CreateFrustum(-size / 2 + offset.x, +size / 2 + offset.x, -size / aspect / 2 + offset.y, +size / aspect / 2 + offset.y, near, far); return CreateFrustum(-size / 2 + offset.X, +size / 2 + offset.X, -size / aspect / 2 + offset.Y, +size / aspect / 2 + offset.Y, near, far);
} }
/// <summary> /// <summary>
@ -311,10 +311,10 @@ namespace Godot
public static Projection CreateLightAtlasRect(Rect2 rect) public static Projection CreateLightAtlasRect(Rect2 rect)
{ {
return new Projection( return new Projection(
new Vector4(rect.Size.x, 0, 0, 0), new Vector4(rect.Size.X, 0, 0, 0),
new Vector4(0, rect.Size.y, 0, 0), new Vector4(0, rect.Size.Y, 0, 0),
new Vector4(0, 0, 1, 0), new Vector4(0, 0, 1, 0),
new Vector4(rect.Position.x, rect.Position.y, 0, 1) new Vector4(rect.Position.X, rect.Position.Y, 0, 1)
); );
} }
@ -332,13 +332,13 @@ namespace Godot
public static Projection CreateOrthogonal(real_t left, real_t right, real_t bottom, real_t top, real_t zNear, real_t zFar) public static Projection CreateOrthogonal(real_t left, real_t right, real_t bottom, real_t top, real_t zNear, real_t zFar)
{ {
Projection proj = Projection.Identity; Projection proj = Projection.Identity;
proj.x.x = (real_t)2.0 / (right - left); proj.X.X = (real_t)2.0 / (right - left);
proj.w.x = -((right + left) / (right - left)); proj.W.X = -((right + left) / (right - left));
proj.y.y = (real_t)2.0 / (top - bottom); proj.Y.Y = (real_t)2.0 / (top - bottom);
proj.w.y = -((top + bottom) / (top - bottom)); proj.W.Y = -((top + bottom) / (top - bottom));
proj.z.z = (real_t)(-2.0) / (zFar - zNear); proj.Z.Z = (real_t)(-2.0) / (zFar - zNear);
proj.w.z = -((zFar + zNear) / (zFar - zNear)); proj.W.Z = -((zFar + zNear) / (zFar - zNear));
proj.w.w = (real_t)1.0; proj.W.W = (real_t)1.0;
return proj; return proj;
} }
@ -392,12 +392,12 @@ namespace Godot
Projection proj = Projection.Identity; Projection proj = Projection.Identity;
proj.x.x = cotangent / aspect; proj.X.X = cotangent / aspect;
proj.y.y = cotangent; proj.Y.Y = cotangent;
proj.z.z = -(zFar + zNear) / deltaZ; proj.Z.Z = -(zFar + zNear) / deltaZ;
proj.z.w = -1; proj.Z.W = -1;
proj.w.z = -2 * zNear * zFar / deltaZ; proj.W.Z = -2 * zNear * zFar / deltaZ;
proj.w.w = 0; proj.W.W = 0;
return proj; return proj;
} }
@ -456,7 +456,7 @@ namespace Godot
} }
Projection proj = CreateFrustum(left, right, -ymax, ymax, zNear, zFar); Projection proj = CreateFrustum(left, right, -ymax, ymax, zNear, zFar);
Projection cm = Projection.Identity; Projection cm = Projection.Identity;
cm.w.x = modeltranslation; cm.W.X = modeltranslation;
return proj * cm; return proj * cm;
} }
@ -469,18 +469,18 @@ namespace Godot
/// <returns>The determinant calculated from this projection.</returns> /// <returns>The determinant calculated from this projection.</returns>
public readonly real_t Determinant() public readonly real_t Determinant()
{ {
return x.w * y.z * z.y * w.x - x.z * y.w * z.y * w.x - return X.W * Y.Z * Z.Y * W.X - X.Z * Y.W * Z.Y * W.X -
x.w * y.y * z.z * w.x + x.y * y.w * z.z * w.x + X.W * Y.Y * Z.Z * W.X + X.Y * Y.W * Z.Z * W.X +
x.z * y.y * z.w * w.x - x.y * y.z * z.w * w.x - X.Z * Y.Y * Z.W * W.X - X.Y * Y.Z * Z.W * W.X -
x.w * y.z * z.x * w.y + x.z * y.w * z.x * w.y + X.W * Y.Z * Z.X * W.Y + X.Z * Y.W * Z.X * W.Y +
x.w * y.x * z.z * w.y - x.x * y.w * z.z * w.y - X.W * Y.X * Z.Z * W.Y - X.X * Y.W * Z.Z * W.Y -
x.z * y.x * z.w * w.y + x.x * y.z * z.w * w.y + X.Z * Y.X * Z.W * W.Y + X.X * Y.Z * Z.W * W.Y +
x.w * y.y * z.x * w.z - x.y * y.w * z.x * w.z - X.W * Y.Y * Z.X * W.Z - X.Y * Y.W * Z.X * W.Z -
x.w * y.x * z.y * w.z + x.x * y.w * z.y * w.z + X.W * Y.X * Z.Y * W.Z + X.X * Y.W * Z.Y * W.Z +
x.y * y.x * z.w * w.z - x.x * y.y * z.w * w.z - X.Y * Y.X * Z.W * W.Z - X.X * Y.Y * Z.W * W.Z -
x.z * y.y * z.x * w.w + x.y * y.z * z.x * w.w + X.Z * Y.Y * Z.X * W.W + X.Y * Y.Z * Z.X * W.W +
x.z * y.x * z.y * w.w - x.x * y.z * z.y * w.w - X.Z * Y.X * Z.Y * W.W - X.X * Y.Z * Z.Y * W.W -
x.y * y.x * z.z * w.w + x.x * y.y * z.z * w.w; X.Y * Y.X * Z.Z * W.W + X.X * Y.Y * Z.Z * W.W;
} }
/// <summary> /// <summary>
@ -490,7 +490,7 @@ namespace Godot
public readonly real_t GetAspect() public readonly real_t GetAspect()
{ {
Vector2 vpHe = GetViewportHalfExtents(); Vector2 vpHe = GetViewportHalfExtents();
return vpHe.x / vpHe.y; return vpHe.X / vpHe.Y;
} }
/// <summary> /// <summary>
@ -499,15 +499,15 @@ namespace Godot
/// <returns>The horizontal field of view of this projection.</returns> /// <returns>The horizontal field of view of this projection.</returns>
public readonly real_t GetFov() public readonly real_t GetFov()
{ {
Plane rightPlane = new Plane(x.w - x.x, y.w - y.x, z.w - z.x, -w.w + w.x).Normalized(); Plane rightPlane = new Plane(X.W - X.X, Y.W - Y.X, Z.W - Z.X, -W.W + W.X).Normalized();
if (z.x == 0 && z.y == 0) if (Z.X == 0 && Z.Y == 0)
{ {
return Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.x))) * (real_t)2.0; return Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.X))) * (real_t)2.0;
} }
else else
{ {
Plane leftPlane = new Plane(x.w + x.x, y.w + y.x, z.w + z.x, w.w + w.x).Normalized(); Plane leftPlane = new Plane(X.W + X.X, Y.W + Y.X, Z.W + Z.X, W.W + W.X).Normalized();
return Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(leftPlane.Normal.x))) + Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.x))); return Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(leftPlane.Normal.X))) + Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.X)));
} }
} }
@ -531,12 +531,12 @@ namespace Godot
{ {
if (IsOrthogonal()) if (IsOrthogonal())
{ {
return GetViewportHalfExtents().x; return GetViewportHalfExtents().X;
} }
else else
{ {
real_t zn = GetZNear(); real_t zn = GetZNear();
real_t width = GetViewportHalfExtents().x * (real_t)2.0; real_t width = GetViewportHalfExtents().X * (real_t)2.0;
return (real_t)1.0 / (zn / width); return (real_t)1.0 / (zn / width);
} }
} }
@ -551,7 +551,7 @@ namespace Godot
{ {
Vector3 result = this * new Vector3(1, 0, -1); Vector3 result = this * new Vector3(1, 0, -1);
return (int)((result.x * (real_t)0.5 + (real_t)0.5) * forPixelWidth); return (int)((result.X * (real_t)0.5 + (real_t)0.5) * forPixelWidth);
} }
/// <summary> /// <summary>
@ -567,12 +567,12 @@ namespace Godot
{ {
Plane newPlane = plane switch Plane newPlane = plane switch
{ {
Planes.Near => new Plane(x.w + x.z, y.w + y.z, z.w + z.z, w.w + w.z), Planes.Near => new Plane(X.W + X.Z, Y.W + Y.Z, Z.W + Z.Z, W.W + W.Z),
Planes.Far => new Plane(x.w - x.z, y.w - y.z, z.w - z.z, w.w - w.z), Planes.Far => new Plane(X.W - X.Z, Y.W - Y.Z, Z.W - Z.Z, W.W - W.Z),
Planes.Left => new Plane(x.w + x.x, y.w + y.x, z.w + z.x, w.w + w.x), Planes.Left => new Plane(X.W + X.X, Y.W + Y.X, Z.W + Z.X, W.W + W.X),
Planes.Top => new Plane(x.w - x.y, y.w - y.y, z.w - z.y, w.w - w.y), Planes.Top => new Plane(X.W - X.Y, Y.W - Y.Y, Z.W - Z.Y, W.W - W.Y),
Planes.Right => new Plane(x.w - x.x, y.w - y.x, z.w - z.x, w.w - w.x), Planes.Right => new Plane(X.W - X.X, Y.W - Y.X, Z.W - Z.X, W.W - W.X),
Planes.Bottom => new Plane(x.w + x.y, y.w + y.y, z.w + z.y, w.w + w.y), Planes.Bottom => new Plane(X.W + X.Y, Y.W + Y.Y, Z.W + Z.Y, W.W + W.Y),
_ => new Plane(), _ => new Plane(),
}; };
newPlane.Normal = -newPlane.Normal; newPlane.Normal = -newPlane.Normal;
@ -586,7 +586,7 @@ namespace Godot
public readonly Vector2 GetFarPlaneHalfExtents() public readonly Vector2 GetFarPlaneHalfExtents()
{ {
var res = GetProjectionPlane(Planes.Far).Intersect3(GetProjectionPlane(Planes.Right), GetProjectionPlane(Planes.Top)); var res = GetProjectionPlane(Planes.Far).Intersect3(GetProjectionPlane(Planes.Right), GetProjectionPlane(Planes.Top));
return new Vector2(res.Value.x, res.Value.y); return new Vector2(res.Value.X, res.Value.Y);
} }
/// <summary> /// <summary>
@ -597,7 +597,7 @@ namespace Godot
public readonly Vector2 GetViewportHalfExtents() public readonly Vector2 GetViewportHalfExtents()
{ {
var res = GetProjectionPlane(Planes.Near).Intersect3(GetProjectionPlane(Planes.Right), GetProjectionPlane(Planes.Top)); var res = GetProjectionPlane(Planes.Near).Intersect3(GetProjectionPlane(Planes.Right), GetProjectionPlane(Planes.Top));
return new Vector2(res.Value.x, res.Value.y); return new Vector2(res.Value.X, res.Value.Y);
} }
/// <summary> /// <summary>
@ -625,7 +625,7 @@ namespace Godot
public readonly Projection FlippedY() public readonly Projection FlippedY()
{ {
Projection proj = this; Projection proj = this;
proj.y = -proj.y; proj.Y = -proj.Y;
return proj; return proj;
} }
@ -642,8 +642,8 @@ namespace Godot
real_t zFar = GetZFar(); real_t zFar = GetZFar();
real_t zNear = newZNear; real_t zNear = newZNear;
real_t deltaZ = zFar - zNear; real_t deltaZ = zFar - zNear;
proj.z.z = -(zFar + zNear) / deltaZ; proj.Z.Z = -(zFar + zNear) / deltaZ;
proj.w.z = -2 * zNear * zFar / deltaZ; proj.W.Z = -2 * zNear * zFar / deltaZ;
return proj; return proj;
} }
@ -656,8 +656,8 @@ namespace Godot
public readonly Projection JitterOffseted(Vector2 offset) public readonly Projection JitterOffseted(Vector2 offset)
{ {
Projection proj = this; Projection proj = this;
proj.w.x += offset.x; proj.W.X += offset.X;
proj.w.y += offset.y; proj.W.Y += offset.Y;
return proj; return proj;
} }
@ -795,7 +795,7 @@ namespace Godot
/// <returns>If the projection performs an orthogonal projection.</returns> /// <returns>If the projection performs an orthogonal projection.</returns>
public readonly bool IsOrthogonal() public readonly bool IsOrthogonal()
{ {
return w.w == (real_t)1.0; return W.W == (real_t)1.0;
} }
// Constants // Constants
@ -835,10 +835,10 @@ namespace Godot
/// <param name="w">The W column, or column index 3.</param> /// <param name="w">The W column, or column index 3.</param>
public Projection(Vector4 x, Vector4 y, Vector4 z, Vector4 w) public Projection(Vector4 x, Vector4 y, Vector4 z, Vector4 w)
{ {
this.x = x; X = x;
this.y = y; Y = y;
this.z = z; Z = z;
this.w = w; W = w;
} }
/// <summary> /// <summary>
@ -847,10 +847,10 @@ namespace Godot
/// <param name="transform">The <see cref="Transform3D"/>.</param> /// <param name="transform">The <see cref="Transform3D"/>.</param>
public Projection(Transform3D transform) public Projection(Transform3D transform)
{ {
x = new Vector4(transform.basis.Row0.x, transform.basis.Row1.x, transform.basis.Row2.x, 0); X = new Vector4(transform.Basis.Row0.X, transform.Basis.Row1.X, transform.Basis.Row2.X, 0);
y = new Vector4(transform.basis.Row0.y, transform.basis.Row1.y, transform.basis.Row2.y, 0); Y = new Vector4(transform.Basis.Row0.Y, transform.Basis.Row1.Y, transform.Basis.Row2.Y, 0);
z = new Vector4(transform.basis.Row0.z, transform.basis.Row1.z, transform.basis.Row2.z, 0); Z = new Vector4(transform.Basis.Row0.Z, transform.Basis.Row1.Z, transform.Basis.Row2.Z, 0);
w = new Vector4(transform.origin.x, transform.origin.y, transform.origin.z, 1); W = new Vector4(transform.Origin.X, transform.Origin.Y, transform.Origin.Z, 1);
} }
/// <summary> /// <summary>
@ -865,25 +865,25 @@ namespace Godot
{ {
return new Projection( return new Projection(
new Vector4( new Vector4(
left.x.x * right.x.x + left.y.x * right.x.y + left.z.x * right.x.z + left.w.x * right.x.w, left.X.X * right.X.X + left.Y.X * right.X.Y + left.Z.X * right.X.Z + left.W.X * right.X.W,
left.x.y * right.x.x + left.y.y * right.x.y + left.z.y * right.x.z + left.w.y * right.x.w, left.X.Y * right.X.X + left.Y.Y * right.X.Y + left.Z.Y * right.X.Z + left.W.Y * right.X.W,
left.x.z * right.x.x + left.y.z * right.x.y + left.z.z * right.x.z + left.w.z * right.x.w, left.X.Z * right.X.X + left.Y.Z * right.X.Y + left.Z.Z * right.X.Z + left.W.Z * right.X.W,
left.x.w * right.x.x + left.y.w * right.x.y + left.z.w * right.x.z + left.w.w * right.x.w left.X.W * right.X.X + left.Y.W * right.X.Y + left.Z.W * right.X.Z + left.W.W * right.X.W
), new Vector4( ), new Vector4(
left.x.x * right.y.x + left.y.x * right.y.y + left.z.x * right.y.z + left.w.x * right.y.w, left.X.X * right.Y.X + left.Y.X * right.Y.Y + left.Z.X * right.Y.Z + left.W.X * right.Y.W,
left.x.y * right.y.x + left.y.y * right.y.y + left.z.y * right.y.z + left.w.y * right.y.w, left.X.Y * right.Y.X + left.Y.Y * right.Y.Y + left.Z.Y * right.Y.Z + left.W.Y * right.Y.W,
left.x.z * right.y.x + left.y.z * right.y.y + left.z.z * right.y.z + left.w.z * right.y.w, left.X.Z * right.Y.X + left.Y.Z * right.Y.Y + left.Z.Z * right.Y.Z + left.W.Z * right.Y.W,
left.x.w * right.y.x + left.y.w * right.y.y + left.z.w * right.y.z + left.w.w * right.y.w left.X.W * right.Y.X + left.Y.W * right.Y.Y + left.Z.W * right.Y.Z + left.W.W * right.Y.W
), new Vector4( ), new Vector4(
left.x.x * right.z.x + left.y.x * right.z.y + left.z.x * right.z.z + left.w.x * right.z.w, left.X.X * right.Z.X + left.Y.X * right.Z.Y + left.Z.X * right.Z.Z + left.W.X * right.Z.W,
left.x.y * right.z.x + left.y.y * right.z.y + left.z.y * right.z.z + left.w.y * right.z.w, left.X.Y * right.Z.X + left.Y.Y * right.Z.Y + left.Z.Y * right.Z.Z + left.W.Y * right.Z.W,
left.x.z * right.z.x + left.y.z * right.z.y + left.z.z * right.z.z + left.w.z * right.z.w, left.X.Z * right.Z.X + left.Y.Z * right.Z.Y + left.Z.Z * right.Z.Z + left.W.Z * right.Z.W,
left.x.w * right.z.x + left.y.w * right.z.y + left.z.w * right.z.z + left.w.w * right.z.w left.X.W * right.Z.X + left.Y.W * right.Z.Y + left.Z.W * right.Z.Z + left.W.W * right.Z.W
), new Vector4( ), new Vector4(
left.x.x * right.w.x + left.y.x * right.w.y + left.z.x * right.w.z + left.w.x * right.w.w, left.X.X * right.W.X + left.Y.X * right.W.Y + left.Z.X * right.W.Z + left.W.X * right.W.W,
left.x.y * right.w.x + left.y.y * right.w.y + left.z.y * right.w.z + left.w.y * right.w.w, left.X.Y * right.W.X + left.Y.Y * right.W.Y + left.Z.Y * right.W.Z + left.W.Y * right.W.W,
left.x.z * right.w.x + left.y.z * right.w.y + left.z.z * right.w.z + left.w.z * right.w.w, left.X.Z * right.W.X + left.Y.Z * right.W.Y + left.Z.Z * right.W.Z + left.W.Z * right.W.W,
left.x.w * right.w.x + left.y.w * right.w.y + left.z.w * right.w.z + left.w.w * right.w.w left.X.W * right.W.X + left.Y.W * right.W.Y + left.Z.W * right.W.Z + left.W.W * right.W.W
) )
); );
} }
@ -897,10 +897,10 @@ namespace Godot
public static Vector4 operator *(Projection proj, Vector4 vector) public static Vector4 operator *(Projection proj, Vector4 vector)
{ {
return new Vector4( return new Vector4(
proj.x.x * vector.x + proj.y.x * vector.y + proj.z.x * vector.z + proj.w.x * vector.w, proj.X.X * vector.X + proj.Y.X * vector.Y + proj.Z.X * vector.Z + proj.W.X * vector.W,
proj.x.y * vector.x + proj.y.y * vector.y + proj.z.y * vector.z + proj.w.y * vector.w, proj.X.Y * vector.X + proj.Y.Y * vector.Y + proj.Z.Y * vector.Z + proj.W.Y * vector.W,
proj.x.z * vector.x + proj.y.z * vector.y + proj.z.z * vector.z + proj.w.z * vector.w, proj.X.Z * vector.X + proj.Y.Z * vector.Y + proj.Z.Z * vector.Z + proj.W.Z * vector.W,
proj.x.w * vector.x + proj.y.w * vector.y + proj.z.w * vector.z + proj.w.w * vector.w proj.X.W * vector.X + proj.Y.W * vector.Y + proj.Z.W * vector.Z + proj.W.W * vector.W
); );
} }
@ -913,10 +913,10 @@ namespace Godot
public static Vector4 operator *(Vector4 vector, Projection proj) public static Vector4 operator *(Vector4 vector, Projection proj)
{ {
return new Vector4( return new Vector4(
proj.x.x * vector.x + proj.x.y * vector.y + proj.x.z * vector.z + proj.x.w * vector.w, proj.X.X * vector.X + proj.X.Y * vector.Y + proj.X.Z * vector.Z + proj.X.W * vector.W,
proj.y.x * vector.x + proj.y.y * vector.y + proj.y.z * vector.z + proj.y.w * vector.w, proj.Y.X * vector.X + proj.Y.Y * vector.Y + proj.Y.Z * vector.Z + proj.Y.W * vector.W,
proj.z.x * vector.x + proj.z.y * vector.y + proj.z.z * vector.z + proj.z.w * vector.w, proj.Z.X * vector.X + proj.Z.Y * vector.Y + proj.Z.Z * vector.Z + proj.Z.W * vector.W,
proj.w.x * vector.x + proj.w.y * vector.y + proj.w.z * vector.z + proj.w.w * vector.w proj.W.X * vector.X + proj.W.Y * vector.Y + proj.W.Z * vector.Z + proj.W.W * vector.W
); );
} }
@ -929,11 +929,11 @@ namespace Godot
public static Vector3 operator *(Projection proj, Vector3 vector) public static Vector3 operator *(Projection proj, Vector3 vector)
{ {
Vector3 ret = new Vector3( Vector3 ret = new Vector3(
proj.x.x * vector.x + proj.y.x * vector.y + proj.z.x * vector.z + proj.w.x, proj.X.X * vector.X + proj.Y.X * vector.Y + proj.Z.X * vector.Z + proj.W.X,
proj.x.y * vector.x + proj.y.y * vector.y + proj.z.y * vector.z + proj.w.y, proj.X.Y * vector.X + proj.Y.Y * vector.Y + proj.Z.Y * vector.Z + proj.W.Y,
proj.x.z * vector.x + proj.y.z * vector.y + proj.z.z * vector.z + proj.w.z proj.X.Z * vector.X + proj.Y.Z * vector.Y + proj.Z.Z * vector.Z + proj.W.Z
); );
return ret / (proj.x.w * vector.x + proj.y.w * vector.y + proj.z.w * vector.z + proj.w.w); return ret / (proj.X.W * vector.X + proj.Y.W * vector.Y + proj.Z.W * vector.Z + proj.W.W);
} }
/// <summary> /// <summary>
@ -966,11 +966,11 @@ namespace Godot
{ {
return new Transform3D( return new Transform3D(
new Basis( new Basis(
new Vector3(proj.x.x, proj.x.y, proj.x.z), new Vector3(proj.X.X, proj.X.Y, proj.X.Z),
new Vector3(proj.y.x, proj.y.y, proj.y.z), new Vector3(proj.Y.X, proj.Y.Y, proj.Y.Z),
new Vector3(proj.z.x, proj.z.y, proj.z.z) new Vector3(proj.Z.X, proj.Z.Y, proj.Z.Z)
), ),
new Vector3(proj.w.x, proj.w.y, proj.w.z) new Vector3(proj.W.X, proj.W.Y, proj.W.Z)
); );
} }
@ -992,7 +992,7 @@ namespace Godot
/// <returns>Whether or not the projections are exactly equal.</returns> /// <returns>Whether or not the projections are exactly equal.</returns>
public readonly bool Equals(Projection other) public readonly bool Equals(Projection other)
{ {
return x == other.x && y == other.y && z == other.z && w == other.w; return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
} }
/// <summary> /// <summary>
@ -1001,7 +1001,7 @@ namespace Godot
/// <returns>A hash code for this projection.</returns> /// <returns>A hash code for this projection.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode() ^ w.GetHashCode(); return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode();
} }
/// <summary> /// <summary>
@ -1010,7 +1010,7 @@ namespace Godot
/// <returns>A string representation of this projection.</returns> /// <returns>A string representation of this projection.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"{x.x}, {x.y}, {x.z}, {x.w}\n{y.x}, {y.y}, {y.z}, {y.w}\n{z.x}, {z.y}, {z.z}, {z.w}\n{w.x}, {w.y}, {w.z}, {w.w}\n"; return $"{X.X}, {X.Y}, {X.Z}, {X.W}\n{Y.X}, {Y.Y}, {Y.Z}, {Y.W}\n{Z.X}, {Z.Y}, {Z.Z}, {Z.W}\n{W.X}, {W.Y}, {W.Z}, {W.W}\n";
} }
/// <summary> /// <summary>
@ -1019,10 +1019,10 @@ namespace Godot
/// <returns>A string representation of this projection.</returns> /// <returns>A string representation of this projection.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"{x.x.ToString(format)}, {x.y.ToString(format)}, {x.z.ToString(format)}, {x.w.ToString(format)}\n" + return $"{X.X.ToString(format)}, {X.Y.ToString(format)}, {X.Z.ToString(format)}, {X.W.ToString(format)}\n" +
$"{y.x.ToString(format)}, {y.y.ToString(format)}, {y.z.ToString(format)}, {y.w.ToString(format)}\n" + $"{Y.X.ToString(format)}, {Y.Y.ToString(format)}, {Y.Z.ToString(format)}, {Y.W.ToString(format)}\n" +
$"{z.x.ToString(format)}, {z.y.ToString(format)}, {z.z.ToString(format)}, {z.w.ToString(format)}\n" + $"{Z.X.ToString(format)}, {Z.Y.ToString(format)}, {Z.Z.ToString(format)}, {Z.W.ToString(format)}\n" +
$"{w.x.ToString(format)}, {w.y.ToString(format)}, {w.z.ToString(format)}, {w.w.ToString(format)}\n"; $"{W.X.ToString(format)}, {W.Y.ToString(format)}, {W.Z.ToString(format)}, {W.W.ToString(format)}\n";
} }
} }
} }

View File

@ -24,25 +24,25 @@ namespace Godot
/// X component of the quaternion (imaginary <c>i</c> axis part). /// X component of the quaternion (imaginary <c>i</c> axis part).
/// Quaternion components should usually not be manipulated directly. /// Quaternion components should usually not be manipulated directly.
/// </summary> /// </summary>
public real_t x; public real_t X;
/// <summary> /// <summary>
/// Y component of the quaternion (imaginary <c>j</c> axis part). /// Y component of the quaternion (imaginary <c>j</c> axis part).
/// Quaternion components should usually not be manipulated directly. /// Quaternion components should usually not be manipulated directly.
/// </summary> /// </summary>
public real_t y; public real_t Y;
/// <summary> /// <summary>
/// Z component of the quaternion (imaginary <c>k</c> axis part). /// Z component of the quaternion (imaginary <c>k</c> axis part).
/// Quaternion components should usually not be manipulated directly. /// Quaternion components should usually not be manipulated directly.
/// </summary> /// </summary>
public real_t z; public real_t Z;
/// <summary> /// <summary>
/// W component of the quaternion (real part). /// W component of the quaternion (real part).
/// Quaternion components should usually not be manipulated directly. /// Quaternion components should usually not be manipulated directly.
/// </summary> /// </summary>
public real_t w; public real_t W;
/// <summary> /// <summary>
/// Access quaternion components using their index. /// Access quaternion components using their index.
@ -51,10 +51,10 @@ namespace Godot
/// <paramref name="index"/> is not 0, 1, 2 or 3. /// <paramref name="index"/> is not 0, 1, 2 or 3.
/// </exception> /// </exception>
/// <value> /// <value>
/// <c>[0]</c> is equivalent to <see cref="x"/>, /// <c>[0]</c> is equivalent to <see cref="X"/>,
/// <c>[1]</c> is equivalent to <see cref="y"/>, /// <c>[1]</c> is equivalent to <see cref="Y"/>,
/// <c>[2]</c> is equivalent to <see cref="z"/>, /// <c>[2]</c> is equivalent to <see cref="Z"/>,
/// <c>[3]</c> is equivalent to <see cref="w"/>. /// <c>[3]</c> is equivalent to <see cref="W"/>.
/// </value> /// </value>
public real_t this[int index] public real_t this[int index]
{ {
@ -63,13 +63,13 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
return x; return X;
case 1: case 1:
return y; return Y;
case 2: case 2:
return z; return Z;
case 3: case 3:
return w; return W;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
} }
@ -79,16 +79,16 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
x = value; X = value;
break; break;
case 1: case 1:
y = value; Y = value;
break; break;
case 2: case 2:
z = value; Z = value;
break; break;
case 3: case 3:
w = value; W = value;
break; break;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
@ -155,9 +155,9 @@ namespace Godot
Quaternion lnPre = (fromQ.Inverse() * preQ).Log(); Quaternion lnPre = (fromQ.Inverse() * preQ).Log();
Quaternion lnPost = (fromQ.Inverse() * postQ).Log(); Quaternion lnPost = (fromQ.Inverse() * postQ).Log();
Quaternion ln = new Quaternion( Quaternion ln = new Quaternion(
Mathf.CubicInterpolate(lnFrom.x, lnTo.x, lnPre.x, lnPost.x, weight), Mathf.CubicInterpolate(lnFrom.X, lnTo.X, lnPre.X, lnPost.X, weight),
Mathf.CubicInterpolate(lnFrom.y, lnTo.y, lnPre.y, lnPost.y, weight), Mathf.CubicInterpolate(lnFrom.Y, lnTo.Y, lnPre.Y, lnPost.Y, weight),
Mathf.CubicInterpolate(lnFrom.z, lnTo.z, lnPre.z, lnPost.z, weight), Mathf.CubicInterpolate(lnFrom.Z, lnTo.Z, lnPre.Z, lnPost.Z, weight),
0); 0);
Quaternion q1 = fromQ * ln.Exp(); Quaternion q1 = fromQ * ln.Exp();
@ -167,9 +167,9 @@ namespace Godot
lnPre = (toQ.Inverse() * preQ).Log(); lnPre = (toQ.Inverse() * preQ).Log();
lnPost = (toQ.Inverse() * postQ).Log(); lnPost = (toQ.Inverse() * postQ).Log();
ln = new Quaternion( ln = new Quaternion(
Mathf.CubicInterpolate(lnFrom.x, lnTo.x, lnPre.x, lnPost.x, weight), Mathf.CubicInterpolate(lnFrom.X, lnTo.X, lnPre.X, lnPost.X, weight),
Mathf.CubicInterpolate(lnFrom.y, lnTo.y, lnPre.y, lnPost.y, weight), Mathf.CubicInterpolate(lnFrom.Y, lnTo.Y, lnPre.Y, lnPost.Y, weight),
Mathf.CubicInterpolate(lnFrom.z, lnTo.z, lnPre.z, lnPost.z, weight), Mathf.CubicInterpolate(lnFrom.Z, lnTo.Z, lnPre.Z, lnPost.Z, weight),
0); 0);
Quaternion q2 = toQ * ln.Exp(); Quaternion q2 = toQ * ln.Exp();
@ -224,9 +224,9 @@ namespace Godot
Quaternion lnPre = (fromQ.Inverse() * preQ).Log(); Quaternion lnPre = (fromQ.Inverse() * preQ).Log();
Quaternion lnPost = (fromQ.Inverse() * postQ).Log(); Quaternion lnPost = (fromQ.Inverse() * postQ).Log();
Quaternion ln = new Quaternion( Quaternion ln = new Quaternion(
Mathf.CubicInterpolateInTime(lnFrom.x, lnTo.x, lnPre.x, lnPost.x, weight, bT, preAT, postBT), Mathf.CubicInterpolateInTime(lnFrom.X, lnTo.X, lnPre.X, lnPost.X, weight, bT, preAT, postBT),
Mathf.CubicInterpolateInTime(lnFrom.y, lnTo.y, lnPre.y, lnPost.y, weight, bT, preAT, postBT), Mathf.CubicInterpolateInTime(lnFrom.Y, lnTo.Y, lnPre.Y, lnPost.Y, weight, bT, preAT, postBT),
Mathf.CubicInterpolateInTime(lnFrom.z, lnTo.z, lnPre.z, lnPost.z, weight, bT, preAT, postBT), Mathf.CubicInterpolateInTime(lnFrom.Z, lnTo.Z, lnPre.Z, lnPost.Z, weight, bT, preAT, postBT),
0); 0);
Quaternion q1 = fromQ * ln.Exp(); Quaternion q1 = fromQ * ln.Exp();
@ -236,9 +236,9 @@ namespace Godot
lnPre = (toQ.Inverse() * preQ).Log(); lnPre = (toQ.Inverse() * preQ).Log();
lnPost = (toQ.Inverse() * postQ).Log(); lnPost = (toQ.Inverse() * postQ).Log();
ln = new Quaternion( ln = new Quaternion(
Mathf.CubicInterpolateInTime(lnFrom.x, lnTo.x, lnPre.x, lnPost.x, weight, bT, preAT, postBT), Mathf.CubicInterpolateInTime(lnFrom.X, lnTo.X, lnPre.X, lnPost.X, weight, bT, preAT, postBT),
Mathf.CubicInterpolateInTime(lnFrom.y, lnTo.y, lnPre.y, lnPost.y, weight, bT, preAT, postBT), Mathf.CubicInterpolateInTime(lnFrom.Y, lnTo.Y, lnPre.Y, lnPost.Y, weight, bT, preAT, postBT),
Mathf.CubicInterpolateInTime(lnFrom.z, lnTo.z, lnPre.z, lnPost.z, weight, bT, preAT, postBT), Mathf.CubicInterpolateInTime(lnFrom.Z, lnTo.Z, lnPre.Z, lnPost.Z, weight, bT, preAT, postBT),
0); 0);
Quaternion q2 = toQ * ln.Exp(); Quaternion q2 = toQ * ln.Exp();
@ -253,12 +253,12 @@ namespace Godot
/// <returns>The dot product.</returns> /// <returns>The dot product.</returns>
public readonly real_t Dot(Quaternion b) public readonly real_t Dot(Quaternion b)
{ {
return (x * b.x) + (y * b.y) + (z * b.z) + (w * b.w); return (X * b.X) + (Y * b.Y) + (Z * b.Z) + (W * b.W);
} }
public readonly Quaternion Exp() public readonly Quaternion Exp()
{ {
Vector3 v = new Vector3(x, y, z); Vector3 v = new Vector3(X, Y, Z);
real_t theta = v.Length(); real_t theta = v.Length();
v = v.Normalized(); v = v.Normalized();
if (theta < Mathf.Epsilon || !v.IsNormalized()) if (theta < Mathf.Epsilon || !v.IsNormalized())
@ -270,18 +270,18 @@ namespace Godot
public readonly real_t GetAngle() public readonly real_t GetAngle()
{ {
return 2 * Mathf.Acos(w); return 2 * Mathf.Acos(W);
} }
public readonly Vector3 GetAxis() public readonly Vector3 GetAxis()
{ {
if (Mathf.Abs(w) > 1 - Mathf.Epsilon) if (Mathf.Abs(W) > 1 - Mathf.Epsilon)
{ {
return new Vector3(x, y, z); return new Vector3(X, Y, Z);
} }
real_t r = 1 / Mathf.Sqrt(1 - w * w); real_t r = 1 / Mathf.Sqrt(1 - W * W);
return new Vector3(x * r, y * r, z * r); return new Vector3(X * r, Y * r, Z * r);
} }
/// <summary> /// <summary>
@ -315,7 +315,7 @@ namespace Godot
throw new InvalidOperationException("Quaternion is not normalized."); throw new InvalidOperationException("Quaternion is not normalized.");
} }
#endif #endif
return new Quaternion(-x, -y, -z, w); return new Quaternion(-X, -Y, -Z, W);
} }
/// <summary> /// <summary>
@ -325,7 +325,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns> /// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite() public readonly bool IsFinite()
{ {
return Mathf.IsFinite(x) && Mathf.IsFinite(y) && Mathf.IsFinite(z) && Mathf.IsFinite(w); return Mathf.IsFinite(X) && Mathf.IsFinite(Y) && Mathf.IsFinite(Z) && Mathf.IsFinite(W);
} }
/// <summary> /// <summary>
@ -340,7 +340,7 @@ namespace Godot
public readonly Quaternion Log() public readonly Quaternion Log()
{ {
Vector3 v = GetAxis() * GetAngle(); Vector3 v = GetAxis() * GetAngle();
return new Quaternion(v.x, v.y, v.z, 0); return new Quaternion(v.X, v.Y, v.Z, 0);
} }
/// <summary> /// <summary>
@ -432,10 +432,10 @@ namespace Godot
// Calculate final values. // Calculate final values.
return new Quaternion return new Quaternion
( (
(scale0 * x) + (scale1 * to1.x), (scale0 * X) + (scale1 * to1.X),
(scale0 * y) + (scale1 * to1.y), (scale0 * Y) + (scale1 * to1.Y),
(scale0 * z) + (scale1 * to1.z), (scale0 * Z) + (scale1 * to1.Z),
(scale0 * w) + (scale1 * to1.w) (scale0 * W) + (scale1 * to1.W)
); );
} }
@ -474,10 +474,10 @@ namespace Godot
return new Quaternion return new Quaternion
( (
(invFactor * x) + (newFactor * to.x), (invFactor * X) + (newFactor * to.X),
(invFactor * y) + (newFactor * to.y), (invFactor * Y) + (newFactor * to.Y),
(invFactor * z) + (newFactor * to.z), (invFactor * Z) + (newFactor * to.Z),
(invFactor * w) + (newFactor * to.w) (invFactor * W) + (newFactor * to.W)
); );
} }
@ -501,10 +501,10 @@ namespace Godot
/// <param name="w">W component of the quaternion (real part).</param> /// <param name="w">W component of the quaternion (real part).</param>
public Quaternion(real_t x, real_t y, real_t z, real_t w) public Quaternion(real_t x, real_t y, real_t z, real_t w)
{ {
this.x = x; X = x;
this.y = y; Y = y;
this.z = z; Z = z;
this.w = w; W = w;
} }
/// <summary> /// <summary>
@ -535,20 +535,20 @@ namespace Godot
if (d == 0f) if (d == 0f)
{ {
x = 0f; X = 0f;
y = 0f; Y = 0f;
z = 0f; Z = 0f;
w = 0f; W = 0f;
} }
else else
{ {
(real_t sin, real_t cos) = Mathf.SinCos(angle * 0.5f); (real_t sin, real_t cos) = Mathf.SinCos(angle * 0.5f);
real_t s = sin / d; real_t s = sin / d;
x = axis.x * s; X = axis.X * s;
y = axis.y * s; Y = axis.Y * s;
z = axis.z * s; Z = axis.Z * s;
w = cos; W = cos;
} }
} }
@ -559,20 +559,20 @@ namespace Godot
if (d < -1.0f + Mathf.Epsilon) if (d < -1.0f + Mathf.Epsilon)
{ {
x = 0f; X = 0f;
y = 1f; Y = 1f;
z = 0f; Z = 0f;
w = 0f; W = 0f;
} }
else else
{ {
real_t s = Mathf.Sqrt((1.0f + d) * 2.0f); real_t s = Mathf.Sqrt((1.0f + d) * 2.0f);
real_t rs = 1.0f / s; real_t rs = 1.0f / s;
x = c.x * rs; X = c.X * rs;
y = c.y * rs; Y = c.Y * rs;
z = c.z * rs; Z = c.Z * rs;
w = s * 0.5f; W = s * 0.5f;
} }
} }
@ -584,9 +584,9 @@ namespace Godot
/// <param name="eulerYXZ">Euler angles that the quaternion will be rotated by.</param> /// <param name="eulerYXZ">Euler angles that the quaternion will be rotated by.</param>
public static Quaternion FromEuler(Vector3 eulerYXZ) public static Quaternion FromEuler(Vector3 eulerYXZ)
{ {
real_t halfA1 = eulerYXZ.y * 0.5f; real_t halfA1 = eulerYXZ.Y * 0.5f;
real_t halfA2 = eulerYXZ.x * 0.5f; real_t halfA2 = eulerYXZ.X * 0.5f;
real_t halfA3 = eulerYXZ.z * 0.5f; real_t halfA3 = eulerYXZ.Z * 0.5f;
// R = Y(a1).X(a2).Z(a3) convention for Euler angles. // R = Y(a1).X(a2).Z(a3) convention for Euler angles.
// Conversion to quaternion as listed in https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19770024290.pdf (page A-6) // Conversion to quaternion as listed in https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19770024290.pdf (page A-6)
@ -616,10 +616,10 @@ namespace Godot
{ {
return new Quaternion return new Quaternion
( (
(left.w * right.x) + (left.x * right.w) + (left.y * right.z) - (left.z * right.y), (left.W * right.X) + (left.X * right.W) + (left.Y * right.Z) - (left.Z * right.Y),
(left.w * right.y) + (left.y * right.w) + (left.z * right.x) - (left.x * right.z), (left.W * right.Y) + (left.Y * right.W) + (left.Z * right.X) - (left.X * right.Z),
(left.w * right.z) + (left.z * right.w) + (left.x * right.y) - (left.y * right.x), (left.W * right.Z) + (left.Z * right.W) + (left.X * right.Y) - (left.Y * right.X),
(left.w * right.w) - (left.x * right.x) - (left.y * right.y) - (left.z * right.z) (left.W * right.W) - (left.X * right.X) - (left.Y * right.Y) - (left.Z * right.Z)
); );
} }
@ -637,9 +637,9 @@ namespace Godot
throw new InvalidOperationException("Quaternion is not normalized."); throw new InvalidOperationException("Quaternion is not normalized.");
} }
#endif #endif
var u = new Vector3(quaternion.x, quaternion.y, quaternion.z); var u = new Vector3(quaternion.X, quaternion.Y, quaternion.Z);
Vector3 uv = u.Cross(vector); Vector3 uv = u.Cross(vector);
return vector + (((uv * quaternion.w) + u.Cross(uv)) * 2); return vector + (((uv * quaternion.W) + u.Cross(uv)) * 2);
} }
/// <summary> /// <summary>
@ -665,7 +665,7 @@ namespace Godot
/// <returns>The added quaternion.</returns> /// <returns>The added quaternion.</returns>
public static Quaternion operator +(Quaternion left, Quaternion right) public static Quaternion operator +(Quaternion left, Quaternion right)
{ {
return new Quaternion(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); return new Quaternion(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W);
} }
/// <summary> /// <summary>
@ -679,20 +679,20 @@ namespace Godot
/// <returns>The subtracted quaternion.</returns> /// <returns>The subtracted quaternion.</returns>
public static Quaternion operator -(Quaternion left, Quaternion right) public static Quaternion operator -(Quaternion left, Quaternion right)
{ {
return new Quaternion(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); return new Quaternion(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W);
} }
/// <summary> /// <summary>
/// Returns the negative value of the <see cref="Quaternion"/>. /// Returns the negative value of the <see cref="Quaternion"/>.
/// This is the same as writing /// This is the same as writing
/// <c>new Quaternion(-q.x, -q.y, -q.z, -q.w)</c>. This operation /// <c>new Quaternion(-q.X, -q.Y, -q.Z, -q.W)</c>. This operation
/// results in a quaternion that represents the same rotation. /// results in a quaternion that represents the same rotation.
/// </summary> /// </summary>
/// <param name="quat">The quaternion to negate.</param> /// <param name="quat">The quaternion to negate.</param>
/// <returns>The negated quaternion.</returns> /// <returns>The negated quaternion.</returns>
public static Quaternion operator -(Quaternion quat) public static Quaternion operator -(Quaternion quat)
{ {
return new Quaternion(-quat.x, -quat.y, -quat.z, -quat.w); return new Quaternion(-quat.X, -quat.Y, -quat.Z, -quat.W);
} }
/// <summary> /// <summary>
@ -706,7 +706,7 @@ namespace Godot
/// <returns>The multiplied quaternion.</returns> /// <returns>The multiplied quaternion.</returns>
public static Quaternion operator *(Quaternion left, real_t right) public static Quaternion operator *(Quaternion left, real_t right)
{ {
return new Quaternion(left.x * right, left.y * right, left.z * right, left.w * right); return new Quaternion(left.X * right, left.Y * right, left.Z * right, left.W * right);
} }
/// <summary> /// <summary>
@ -720,7 +720,7 @@ namespace Godot
/// <returns>The multiplied quaternion.</returns> /// <returns>The multiplied quaternion.</returns>
public static Quaternion operator *(real_t left, Quaternion right) public static Quaternion operator *(real_t left, Quaternion right)
{ {
return new Quaternion(right.x * left, right.y * left, right.z * left, right.w * left); return new Quaternion(right.X * left, right.Y * left, right.Z * left, right.W * left);
} }
/// <summary> /// <summary>
@ -780,7 +780,7 @@ namespace Godot
/// <returns>Whether or not the quaternions are exactly equal.</returns> /// <returns>Whether or not the quaternions are exactly equal.</returns>
public readonly bool Equals(Quaternion other) public readonly bool Equals(Quaternion other)
{ {
return x == other.x && y == other.y && z == other.z && w == other.w; return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
} }
/// <summary> /// <summary>
@ -791,7 +791,7 @@ namespace Godot
/// <returns>Whether or not the quaternions are approximately equal.</returns> /// <returns>Whether or not the quaternions are approximately equal.</returns>
public readonly bool IsEqualApprox(Quaternion other) public readonly bool IsEqualApprox(Quaternion other)
{ {
return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y) && Mathf.IsEqualApprox(z, other.z) && Mathf.IsEqualApprox(w, other.w); return Mathf.IsEqualApprox(X, other.X) && Mathf.IsEqualApprox(Y, other.Y) && Mathf.IsEqualApprox(Z, other.Z) && Mathf.IsEqualApprox(W, other.W);
} }
/// <summary> /// <summary>
@ -800,7 +800,7 @@ namespace Godot
/// <returns>A hash code for this quaternion.</returns> /// <returns>A hash code for this quaternion.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode() ^ w.GetHashCode(); return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode();
} }
/// <summary> /// <summary>
@ -809,7 +809,7 @@ namespace Godot
/// <returns>A string representation of this quaternion.</returns> /// <returns>A string representation of this quaternion.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"({x}, {y}, {z}, {w})"; return $"({X}, {Y}, {Z}, {W})";
} }
/// <summary> /// <summary>
@ -818,7 +818,7 @@ namespace Godot
/// <returns>A string representation of this quaternion.</returns> /// <returns>A string representation of this quaternion.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)}, {w.ToString(format)})"; return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)}, {W.ToString(format)})";
} }
} }
} }

View File

@ -66,7 +66,7 @@ namespace Godot
public readonly Rect2 Abs() public readonly Rect2 Abs()
{ {
Vector2 end = End; Vector2 end = End;
Vector2 topLeft = new Vector2(Mathf.Min(_position.x, end.x), Mathf.Min(_position.y, end.y)); Vector2 topLeft = new Vector2(Mathf.Min(_position.X, end.X), Mathf.Min(_position.Y, end.Y));
return new Rect2(topLeft, _size.Abs()); return new Rect2(topLeft, _size.Abs());
} }
@ -88,14 +88,14 @@ namespace Godot
return new Rect2(); return new Rect2();
} }
newRect._position.x = Mathf.Max(b._position.x, _position.x); newRect._position.X = Mathf.Max(b._position.X, _position.X);
newRect._position.y = Mathf.Max(b._position.y, _position.y); newRect._position.Y = Mathf.Max(b._position.Y, _position.Y);
Vector2 bEnd = b._position + b._size; Vector2 bEnd = b._position + b._size;
Vector2 end = _position + _size; Vector2 end = _position + _size;
newRect._size.x = Mathf.Min(bEnd.x, end.x) - newRect._position.x; newRect._size.X = Mathf.Min(bEnd.X, end.X) - newRect._position.X;
newRect._size.y = Mathf.Min(bEnd.y, end.y) - newRect._position.y; newRect._size.Y = Mathf.Min(bEnd.Y, end.Y) - newRect._position.Y;
return newRect; return newRect;
} }
@ -119,9 +119,9 @@ namespace Godot
/// </returns> /// </returns>
public readonly bool Encloses(Rect2 b) public readonly bool Encloses(Rect2 b)
{ {
return b._position.x >= _position.x && b._position.y >= _position.y && return b._position.X >= _position.X && b._position.Y >= _position.Y &&
b._position.x + b._size.x < _position.x + _size.x && b._position.X + b._size.X < _position.X + _size.X &&
b._position.y + b._size.y < _position.y + _size.y; b._position.Y + b._size.Y < _position.Y + _size.Y;
} }
/// <summary> /// <summary>
@ -136,22 +136,22 @@ namespace Godot
Vector2 begin = expanded._position; Vector2 begin = expanded._position;
Vector2 end = expanded._position + expanded._size; Vector2 end = expanded._position + expanded._size;
if (to.x < begin.x) if (to.X < begin.X)
{ {
begin.x = to.x; begin.X = to.X;
} }
if (to.y < begin.y) if (to.Y < begin.Y)
{ {
begin.y = to.y; begin.Y = to.Y;
} }
if (to.x > end.x) if (to.X > end.X)
{ {
end.x = to.x; end.X = to.X;
} }
if (to.y > end.y) if (to.Y > end.Y)
{ {
end.y = to.y; end.Y = to.Y;
} }
expanded._position = begin; expanded._position = begin;
@ -166,7 +166,7 @@ namespace Godot
/// <returns>The area.</returns> /// <returns>The area.</returns>
public readonly real_t GetArea() public readonly real_t GetArea()
{ {
return _size.x * _size.y; return _size.X * _size.Y;
} }
/// <summary> /// <summary>
@ -191,10 +191,10 @@ namespace Godot
{ {
Rect2 g = this; Rect2 g = this;
g._position.x -= by; g._position.X -= by;
g._position.y -= by; g._position.Y -= by;
g._size.x += by * 2; g._size.X += by * 2;
g._size.y += by * 2; g._size.Y += by * 2;
return g; return g;
} }
@ -214,10 +214,10 @@ namespace Godot
{ {
Rect2 g = this; Rect2 g = this;
g._position.x -= left; g._position.X -= left;
g._position.y -= top; g._position.Y -= top;
g._size.x += left + right; g._size.X += left + right;
g._size.y += top + bottom; g._size.Y += top + bottom;
return g; return g;
} }
@ -254,7 +254,7 @@ namespace Godot
/// </returns> /// </returns>
public readonly bool HasArea() public readonly bool HasArea()
{ {
return _size.x > 0.0f && _size.y > 0.0f; return _size.X > 0.0f && _size.Y > 0.0f;
} }
/// <summary> /// <summary>
@ -267,14 +267,14 @@ namespace Godot
/// </returns> /// </returns>
public readonly bool HasPoint(Vector2 point) public readonly bool HasPoint(Vector2 point)
{ {
if (point.x < _position.x) if (point.X < _position.X)
return false; return false;
if (point.y < _position.y) if (point.Y < _position.Y)
return false; return false;
if (point.x >= _position.x + _size.x) if (point.X >= _position.X + _size.X)
return false; return false;
if (point.y >= _position.y + _size.y) if (point.Y >= _position.Y + _size.Y)
return false; return false;
return true; return true;
@ -295,38 +295,38 @@ namespace Godot
{ {
if (includeBorders) if (includeBorders)
{ {
if (_position.x > b._position.x + b._size.x) if (_position.X > b._position.X + b._size.X)
{ {
return false; return false;
} }
if (_position.x + _size.x < b._position.x) if (_position.X + _size.X < b._position.X)
{ {
return false; return false;
} }
if (_position.y > b._position.y + b._size.y) if (_position.Y > b._position.Y + b._size.Y)
{ {
return false; return false;
} }
if (_position.y + _size.y < b._position.y) if (_position.Y + _size.Y < b._position.Y)
{ {
return false; return false;
} }
} }
else else
{ {
if (_position.x >= b._position.x + b._size.x) if (_position.X >= b._position.X + b._size.X)
{ {
return false; return false;
} }
if (_position.x + _size.x <= b._position.x) if (_position.X + _size.X <= b._position.X)
{ {
return false; return false;
} }
if (_position.y >= b._position.y + b._size.y) if (_position.Y >= b._position.Y + b._size.Y)
{ {
return false; return false;
} }
if (_position.y + _size.y <= b._position.y) if (_position.Y + _size.Y <= b._position.Y)
{ {
return false; return false;
} }
@ -344,11 +344,11 @@ namespace Godot
{ {
Rect2 newRect; Rect2 newRect;
newRect._position.x = Mathf.Min(b._position.x, _position.x); newRect._position.X = Mathf.Min(b._position.X, _position.X);
newRect._position.y = Mathf.Min(b._position.y, _position.y); newRect._position.Y = Mathf.Min(b._position.Y, _position.Y);
newRect._size.x = Mathf.Max(b._position.x + b._size.x, _position.x + _size.x); newRect._size.X = Mathf.Max(b._position.X + b._size.X, _position.X + _size.X);
newRect._size.y = Mathf.Max(b._position.y + b._size.y, _position.y + _size.y); newRect._size.Y = Mathf.Max(b._position.Y + b._size.Y, _position.Y + _size.Y);
newRect._size -= newRect._position; // Make relative again newRect._size -= newRect._position; // Make relative again

View File

@ -4,21 +4,21 @@ using System.Runtime.InteropServices;
namespace Godot namespace Godot
{ {
/// <summary> /// <summary>
/// 2D axis-aligned bounding box using integers. Rect2i consists of a position, a size, and /// 2D axis-aligned bounding box using integers. Rect2I consists of a position, a size, and
/// several utility functions. It is typically used for fast overlap tests. /// several utility functions. It is typically used for fast overlap tests.
/// </summary> /// </summary>
[Serializable] [Serializable]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Rect2i : IEquatable<Rect2i> public struct Rect2I : IEquatable<Rect2I>
{ {
private Vector2i _position; private Vector2I _position;
private Vector2i _size; private Vector2I _size;
/// <summary> /// <summary>
/// Beginning corner. Typically has values lower than <see cref="End"/>. /// Beginning corner. Typically has values lower than <see cref="End"/>.
/// </summary> /// </summary>
/// <value>Directly uses a private field.</value> /// <value>Directly uses a private field.</value>
public Vector2i Position public Vector2I Position
{ {
readonly get { return _position; } readonly get { return _position; }
set { _position = value; } set { _position = value; }
@ -29,7 +29,7 @@ namespace Godot
/// If the size is negative, you can use <see cref="Abs"/> to fix it. /// If the size is negative, you can use <see cref="Abs"/> to fix it.
/// </summary> /// </summary>
/// <value>Directly uses a private field.</value> /// <value>Directly uses a private field.</value>
public Vector2i Size public Vector2I Size
{ {
readonly get { return _size; } readonly get { return _size; }
set { _size = value; } set { _size = value; }
@ -43,14 +43,14 @@ namespace Godot
/// Getting is equivalent to <paramref name="value"/> = <see cref="Position"/> + <see cref="Size"/>, /// Getting is equivalent to <paramref name="value"/> = <see cref="Position"/> + <see cref="Size"/>,
/// setting is equivalent to <see cref="Size"/> = <paramref name="value"/> - <see cref="Position"/> /// setting is equivalent to <see cref="Size"/> = <paramref name="value"/> - <see cref="Position"/>
/// </value> /// </value>
public Vector2i End public Vector2I End
{ {
readonly get { return _position + _size; } readonly get { return _position + _size; }
set { _size = value - _position; } set { _size = value - _position; }
} }
/// <summary> /// <summary>
/// The area of this <see cref="Rect2i"/>. /// The area of this <see cref="Rect2I"/>.
/// </summary> /// </summary>
/// <value>Equivalent to <see cref="GetArea()"/>.</value> /// <value>Equivalent to <see cref="GetArea()"/>.</value>
public readonly int Area public readonly int Area
@ -59,89 +59,89 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns a <see cref="Rect2i"/> with equivalent position and size, modified so that /// Returns a <see cref="Rect2I"/> with equivalent position and size, modified so that
/// the top-left corner is the origin and width and height are positive. /// the top-left corner is the origin and width and height are positive.
/// </summary> /// </summary>
/// <returns>The modified <see cref="Rect2i"/>.</returns> /// <returns>The modified <see cref="Rect2I"/>.</returns>
public readonly Rect2i Abs() public readonly Rect2I Abs()
{ {
Vector2i end = End; Vector2I end = End;
Vector2i topLeft = new Vector2i(Mathf.Min(_position.x, end.x), Mathf.Min(_position.y, end.y)); Vector2I topLeft = new Vector2I(Mathf.Min(_position.X, end.X), Mathf.Min(_position.Y, end.Y));
return new Rect2i(topLeft, _size.Abs()); return new Rect2I(topLeft, _size.Abs());
} }
/// <summary> /// <summary>
/// Returns the intersection of this <see cref="Rect2i"/> and <paramref name="b"/>. /// Returns the intersection of this <see cref="Rect2I"/> and <paramref name="b"/>.
/// If the rectangles do not intersect, an empty <see cref="Rect2i"/> is returned. /// If the rectangles do not intersect, an empty <see cref="Rect2I"/> is returned.
/// </summary> /// </summary>
/// <param name="b">The other <see cref="Rect2i"/>.</param> /// <param name="b">The other <see cref="Rect2I"/>.</param>
/// <returns> /// <returns>
/// The intersection of this <see cref="Rect2i"/> and <paramref name="b"/>, /// The intersection of this <see cref="Rect2I"/> and <paramref name="b"/>,
/// or an empty <see cref="Rect2i"/> if they do not intersect. /// or an empty <see cref="Rect2I"/> if they do not intersect.
/// </returns> /// </returns>
public readonly Rect2i Intersection(Rect2i b) public readonly Rect2I Intersection(Rect2I b)
{ {
Rect2i newRect = b; Rect2I newRect = b;
if (!Intersects(newRect)) if (!Intersects(newRect))
{ {
return new Rect2i(); return new Rect2I();
} }
newRect._position.x = Mathf.Max(b._position.x, _position.x); newRect._position.X = Mathf.Max(b._position.X, _position.X);
newRect._position.y = Mathf.Max(b._position.y, _position.y); newRect._position.Y = Mathf.Max(b._position.Y, _position.Y);
Vector2i bEnd = b._position + b._size; Vector2I bEnd = b._position + b._size;
Vector2i end = _position + _size; Vector2I end = _position + _size;
newRect._size.x = Mathf.Min(bEnd.x, end.x) - newRect._position.x; newRect._size.X = Mathf.Min(bEnd.X, end.X) - newRect._position.X;
newRect._size.y = Mathf.Min(bEnd.y, end.y) - newRect._position.y; newRect._size.Y = Mathf.Min(bEnd.Y, end.Y) - newRect._position.Y;
return newRect; return newRect;
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if this <see cref="Rect2i"/> completely encloses another one. /// Returns <see langword="true"/> if this <see cref="Rect2I"/> completely encloses another one.
/// </summary> /// </summary>
/// <param name="b">The other <see cref="Rect2i"/> that may be enclosed.</param> /// <param name="b">The other <see cref="Rect2I"/> that may be enclosed.</param>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not this <see cref="Rect2i"/> encloses <paramref name="b"/>. /// A <see langword="bool"/> for whether or not this <see cref="Rect2I"/> encloses <paramref name="b"/>.
/// </returns> /// </returns>
public readonly bool Encloses(Rect2i b) public readonly bool Encloses(Rect2I b)
{ {
return b._position.x >= _position.x && b._position.y >= _position.y && return b._position.X >= _position.X && b._position.Y >= _position.Y &&
b._position.x + b._size.x < _position.x + _size.x && b._position.X + b._size.X < _position.X + _size.X &&
b._position.y + b._size.y < _position.y + _size.y; b._position.Y + b._size.Y < _position.Y + _size.Y;
} }
/// <summary> /// <summary>
/// Returns this <see cref="Rect2i"/> expanded to include a given point. /// Returns this <see cref="Rect2I"/> expanded to include a given point.
/// </summary> /// </summary>
/// <param name="to">The point to include.</param> /// <param name="to">The point to include.</param>
/// <returns>The expanded <see cref="Rect2i"/>.</returns> /// <returns>The expanded <see cref="Rect2I"/>.</returns>
public readonly Rect2i Expand(Vector2i to) public readonly Rect2I Expand(Vector2I to)
{ {
Rect2i expanded = this; Rect2I expanded = this;
Vector2i begin = expanded._position; Vector2I begin = expanded._position;
Vector2i end = expanded._position + expanded._size; Vector2I end = expanded._position + expanded._size;
if (to.x < begin.x) if (to.X < begin.X)
{ {
begin.x = to.x; begin.X = to.X;
} }
if (to.y < begin.y) if (to.Y < begin.Y)
{ {
begin.y = to.y; begin.Y = to.Y;
} }
if (to.x > end.x) if (to.X > end.X)
{ {
end.x = to.x; end.X = to.X;
} }
if (to.y > end.y) if (to.Y > end.Y)
{ {
end.y = to.y; end.Y = to.Y;
} }
expanded._position = begin; expanded._position = begin;
@ -151,48 +151,48 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns the area of the <see cref="Rect2i"/>. /// Returns the area of the <see cref="Rect2I"/>.
/// </summary> /// </summary>
/// <returns>The area.</returns> /// <returns>The area.</returns>
public readonly int GetArea() public readonly int GetArea()
{ {
return _size.x * _size.y; return _size.X * _size.Y;
} }
/// <summary> /// <summary>
/// Returns the center of the <see cref="Rect2i"/>, which is equal /// Returns the center of the <see cref="Rect2I"/>, which is equal
/// to <see cref="Position"/> + (<see cref="Size"/> / 2). /// to <see cref="Position"/> + (<see cref="Size"/> / 2).
/// If <see cref="Size"/> is an odd number, the returned center /// If <see cref="Size"/> is an odd number, the returned center
/// value will be rounded towards <see cref="Position"/>. /// value will be rounded towards <see cref="Position"/>.
/// </summary> /// </summary>
/// <returns>The center.</returns> /// <returns>The center.</returns>
public readonly Vector2i GetCenter() public readonly Vector2I GetCenter()
{ {
return _position + (_size / 2); return _position + (_size / 2);
} }
/// <summary> /// <summary>
/// Returns a copy of the <see cref="Rect2i"/> grown by the specified amount /// Returns a copy of the <see cref="Rect2I"/> grown by the specified amount
/// on all sides. /// on all sides.
/// </summary> /// </summary>
/// <seealso cref="GrowIndividual(int, int, int, int)"/> /// <seealso cref="GrowIndividual(int, int, int, int)"/>
/// <seealso cref="GrowSide(Side, int)"/> /// <seealso cref="GrowSide(Side, int)"/>
/// <param name="by">The amount to grow by.</param> /// <param name="by">The amount to grow by.</param>
/// <returns>The grown <see cref="Rect2i"/>.</returns> /// <returns>The grown <see cref="Rect2I"/>.</returns>
public readonly Rect2i Grow(int by) public readonly Rect2I Grow(int by)
{ {
Rect2i g = this; Rect2I g = this;
g._position.x -= by; g._position.X -= by;
g._position.y -= by; g._position.Y -= by;
g._size.x += by * 2; g._size.X += by * 2;
g._size.y += by * 2; g._size.Y += by * 2;
return g; return g;
} }
/// <summary> /// <summary>
/// Returns a copy of the <see cref="Rect2i"/> grown by the specified amount /// Returns a copy of the <see cref="Rect2I"/> grown by the specified amount
/// on each side individually. /// on each side individually.
/// </summary> /// </summary>
/// <seealso cref="Grow(int)"/> /// <seealso cref="Grow(int)"/>
@ -201,31 +201,31 @@ namespace Godot
/// <param name="top">The amount to grow by on the top side.</param> /// <param name="top">The amount to grow by on the top side.</param>
/// <param name="right">The amount to grow by on the right side.</param> /// <param name="right">The amount to grow by on the right side.</param>
/// <param name="bottom">The amount to grow by on the bottom side.</param> /// <param name="bottom">The amount to grow by on the bottom side.</param>
/// <returns>The grown <see cref="Rect2i"/>.</returns> /// <returns>The grown <see cref="Rect2I"/>.</returns>
public readonly Rect2i GrowIndividual(int left, int top, int right, int bottom) public readonly Rect2I GrowIndividual(int left, int top, int right, int bottom)
{ {
Rect2i g = this; Rect2I g = this;
g._position.x -= left; g._position.X -= left;
g._position.y -= top; g._position.Y -= top;
g._size.x += left + right; g._size.X += left + right;
g._size.y += top + bottom; g._size.Y += top + bottom;
return g; return g;
} }
/// <summary> /// <summary>
/// Returns a copy of the <see cref="Rect2i"/> grown by the specified amount /// Returns a copy of the <see cref="Rect2I"/> grown by the specified amount
/// on the specified <see cref="Side"/>. /// on the specified <see cref="Side"/>.
/// </summary> /// </summary>
/// <seealso cref="Grow(int)"/> /// <seealso cref="Grow(int)"/>
/// <seealso cref="GrowIndividual(int, int, int, int)"/> /// <seealso cref="GrowIndividual(int, int, int, int)"/>
/// <param name="side">The side to grow.</param> /// <param name="side">The side to grow.</param>
/// <param name="by">The amount to grow by.</param> /// <param name="by">The amount to grow by.</param>
/// <returns>The grown <see cref="Rect2i"/>.</returns> /// <returns>The grown <see cref="Rect2I"/>.</returns>
public readonly Rect2i GrowSide(Side side, int by) public readonly Rect2I GrowSide(Side side, int by)
{ {
Rect2i g = this; Rect2I g = this;
g = g.GrowIndividual(Side.Left == side ? by : 0, g = g.GrowIndividual(Side.Left == side ? by : 0,
Side.Top == side ? by : 0, Side.Top == side ? by : 0,
@ -236,76 +236,76 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the <see cref="Rect2i"/> has /// Returns <see langword="true"/> if the <see cref="Rect2I"/> has
/// area, and <see langword="false"/> if the <see cref="Rect2i"/> /// area, and <see langword="false"/> if the <see cref="Rect2I"/>
/// is linear, empty, or has a negative <see cref="Size"/>. /// is linear, empty, or has a negative <see cref="Size"/>.
/// See also <see cref="GetArea"/>. /// See also <see cref="GetArea"/>.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="Rect2i"/> has area. /// A <see langword="bool"/> for whether or not the <see cref="Rect2I"/> has area.
/// </returns> /// </returns>
public readonly bool HasArea() public readonly bool HasArea()
{ {
return _size.x > 0 && _size.y > 0; return _size.X > 0 && _size.Y > 0;
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the <see cref="Rect2i"/> contains a point, /// Returns <see langword="true"/> if the <see cref="Rect2I"/> contains a point,
/// or <see langword="false"/> otherwise. /// or <see langword="false"/> otherwise.
/// </summary> /// </summary>
/// <param name="point">The point to check.</param> /// <param name="point">The point to check.</param>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="Rect2i"/> contains <paramref name="point"/>. /// A <see langword="bool"/> for whether or not the <see cref="Rect2I"/> contains <paramref name="point"/>.
/// </returns> /// </returns>
public readonly bool HasPoint(Vector2i point) public readonly bool HasPoint(Vector2I point)
{ {
if (point.x < _position.x) if (point.X < _position.X)
return false; return false;
if (point.y < _position.y) if (point.Y < _position.Y)
return false; return false;
if (point.x >= _position.x + _size.x) if (point.X >= _position.X + _size.X)
return false; return false;
if (point.y >= _position.y + _size.y) if (point.Y >= _position.Y + _size.Y)
return false; return false;
return true; return true;
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the <see cref="Rect2i"/> overlaps with <paramref name="b"/> /// Returns <see langword="true"/> if the <see cref="Rect2I"/> overlaps with <paramref name="b"/>
/// (i.e. they have at least one point in common). /// (i.e. they have at least one point in common).
/// </summary> /// </summary>
/// <param name="b">The other <see cref="Rect2i"/> to check for intersections with.</param> /// <param name="b">The other <see cref="Rect2I"/> to check for intersections with.</param>
/// <returns>A <see langword="bool"/> for whether or not they are intersecting.</returns> /// <returns>A <see langword="bool"/> for whether or not they are intersecting.</returns>
public readonly bool Intersects(Rect2i b) public readonly bool Intersects(Rect2I b)
{ {
if (_position.x >= b._position.x + b._size.x) if (_position.X >= b._position.X + b._size.X)
return false; return false;
if (_position.x + _size.x <= b._position.x) if (_position.X + _size.X <= b._position.X)
return false; return false;
if (_position.y >= b._position.y + b._size.y) if (_position.Y >= b._position.Y + b._size.Y)
return false; return false;
if (_position.y + _size.y <= b._position.y) if (_position.Y + _size.Y <= b._position.Y)
return false; return false;
return true; return true;
} }
/// <summary> /// <summary>
/// Returns a larger <see cref="Rect2i"/> that contains this <see cref="Rect2i"/> and <paramref name="b"/>. /// Returns a larger <see cref="Rect2I"/> that contains this <see cref="Rect2I"/> and <paramref name="b"/>.
/// </summary> /// </summary>
/// <param name="b">The other <see cref="Rect2i"/>.</param> /// <param name="b">The other <see cref="Rect2I"/>.</param>
/// <returns>The merged <see cref="Rect2i"/>.</returns> /// <returns>The merged <see cref="Rect2I"/>.</returns>
public readonly Rect2i Merge(Rect2i b) public readonly Rect2I Merge(Rect2I b)
{ {
Rect2i newRect; Rect2I newRect;
newRect._position.x = Mathf.Min(b._position.x, _position.x); newRect._position.X = Mathf.Min(b._position.X, _position.X);
newRect._position.y = Mathf.Min(b._position.y, _position.y); newRect._position.Y = Mathf.Min(b._position.Y, _position.Y);
newRect._size.x = Mathf.Max(b._position.x + b._size.x, _position.x + _size.x); newRect._size.X = Mathf.Max(b._position.X + b._size.X, _position.X + _size.X);
newRect._size.y = Mathf.Max(b._position.y + b._size.y, _position.y + _size.y); newRect._size.Y = Mathf.Max(b._position.Y + b._size.Y, _position.Y + _size.Y);
newRect._size -= newRect._position; // Make relative again newRect._size -= newRect._position; // Make relative again
@ -313,93 +313,93 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Constructs a <see cref="Rect2i"/> from a position and size. /// Constructs a <see cref="Rect2I"/> from a position and size.
/// </summary> /// </summary>
/// <param name="position">The position.</param> /// <param name="position">The position.</param>
/// <param name="size">The size.</param> /// <param name="size">The size.</param>
public Rect2i(Vector2i position, Vector2i size) public Rect2I(Vector2I position, Vector2I size)
{ {
_position = position; _position = position;
_size = size; _size = size;
} }
/// <summary> /// <summary>
/// Constructs a <see cref="Rect2i"/> from a position, width, and height. /// Constructs a <see cref="Rect2I"/> from a position, width, and height.
/// </summary> /// </summary>
/// <param name="position">The position.</param> /// <param name="position">The position.</param>
/// <param name="width">The width.</param> /// <param name="width">The width.</param>
/// <param name="height">The height.</param> /// <param name="height">The height.</param>
public Rect2i(Vector2i position, int width, int height) public Rect2I(Vector2I position, int width, int height)
{ {
_position = position; _position = position;
_size = new Vector2i(width, height); _size = new Vector2I(width, height);
} }
/// <summary> /// <summary>
/// Constructs a <see cref="Rect2i"/> from x, y, and size. /// Constructs a <see cref="Rect2I"/> from x, y, and size.
/// </summary> /// </summary>
/// <param name="x">The position's X coordinate.</param> /// <param name="x">The position's X coordinate.</param>
/// <param name="y">The position's Y coordinate.</param> /// <param name="y">The position's Y coordinate.</param>
/// <param name="size">The size.</param> /// <param name="size">The size.</param>
public Rect2i(int x, int y, Vector2i size) public Rect2I(int x, int y, Vector2I size)
{ {
_position = new Vector2i(x, y); _position = new Vector2I(x, y);
_size = size; _size = size;
} }
/// <summary> /// <summary>
/// Constructs a <see cref="Rect2i"/> from x, y, width, and height. /// Constructs a <see cref="Rect2I"/> from x, y, width, and height.
/// </summary> /// </summary>
/// <param name="x">The position's X coordinate.</param> /// <param name="x">The position's X coordinate.</param>
/// <param name="y">The position's Y coordinate.</param> /// <param name="y">The position's Y coordinate.</param>
/// <param name="width">The width.</param> /// <param name="width">The width.</param>
/// <param name="height">The height.</param> /// <param name="height">The height.</param>
public Rect2i(int x, int y, int width, int height) public Rect2I(int x, int y, int width, int height)
{ {
_position = new Vector2i(x, y); _position = new Vector2I(x, y);
_size = new Vector2i(width, height); _size = new Vector2I(width, height);
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the /// Returns <see langword="true"/> if the
/// <see cref="Rect2i"/>s are exactly equal. /// <see cref="Rect2I"/>s are exactly equal.
/// </summary> /// </summary>
/// <param name="left">The left rect.</param> /// <param name="left">The left rect.</param>
/// <param name="right">The right rect.</param> /// <param name="right">The right rect.</param>
/// <returns>Whether or not the rects are equal.</returns> /// <returns>Whether or not the rects are equal.</returns>
public static bool operator ==(Rect2i left, Rect2i right) public static bool operator ==(Rect2I left, Rect2I right)
{ {
return left.Equals(right); return left.Equals(right);
} }
/// <summary> /// <summary>
/// Returns <see langword="true"/> if the /// Returns <see langword="true"/> if the
/// <see cref="Rect2i"/>s are not equal. /// <see cref="Rect2I"/>s are not equal.
/// </summary> /// </summary>
/// <param name="left">The left rect.</param> /// <param name="left">The left rect.</param>
/// <param name="right">The right rect.</param> /// <param name="right">The right rect.</param>
/// <returns>Whether or not the rects are not equal.</returns> /// <returns>Whether or not the rects are not equal.</returns>
public static bool operator !=(Rect2i left, Rect2i right) public static bool operator !=(Rect2I left, Rect2I right)
{ {
return !left.Equals(right); return !left.Equals(right);
} }
/// <summary> /// <summary>
/// Converts this <see cref="Rect2i"/> to a <see cref="Rect2"/>. /// Converts this <see cref="Rect2I"/> to a <see cref="Rect2"/>.
/// </summary> /// </summary>
/// <param name="value">The rect to convert.</param> /// <param name="value">The rect to convert.</param>
public static implicit operator Rect2(Rect2i value) public static implicit operator Rect2(Rect2I value)
{ {
return new Rect2(value._position, value._size); return new Rect2(value._position, value._size);
} }
/// <summary> /// <summary>
/// Converts a <see cref="Rect2"/> to a <see cref="Rect2i"/>. /// Converts a <see cref="Rect2"/> to a <see cref="Rect2I"/>.
/// </summary> /// </summary>
/// <param name="value">The rect to convert.</param> /// <param name="value">The rect to convert.</param>
public static explicit operator Rect2i(Rect2 value) public static explicit operator Rect2I(Rect2 value)
{ {
return new Rect2i((Vector2i)value.Position, (Vector2i)value.Size); return new Rect2I((Vector2I)value.Position, (Vector2I)value.Size);
} }
/// <summary> /// <summary>
@ -409,7 +409,7 @@ namespace Godot
/// <returns>Whether or not the rect and the other object are equal.</returns> /// <returns>Whether or not the rect and the other object are equal.</returns>
public override readonly bool Equals(object obj) public override readonly bool Equals(object obj)
{ {
return obj is Rect2i other && Equals(other); return obj is Rect2I other && Equals(other);
} }
/// <summary> /// <summary>
@ -417,13 +417,13 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="other">The other rect to compare.</param> /// <param name="other">The other rect to compare.</param>
/// <returns>Whether or not the rects are equal.</returns> /// <returns>Whether or not the rects are equal.</returns>
public readonly bool Equals(Rect2i other) public readonly bool Equals(Rect2I other)
{ {
return _position.Equals(other._position) && _size.Equals(other._size); return _position.Equals(other._position) && _size.Equals(other._size);
} }
/// <summary> /// <summary>
/// Serves as the hash function for <see cref="Rect2i"/>. /// Serves as the hash function for <see cref="Rect2I"/>.
/// </summary> /// </summary>
/// <returns>A hash code for this rect.</returns> /// <returns>A hash code for this rect.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
@ -432,7 +432,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="Rect2i"/> to a string. /// Converts this <see cref="Rect2I"/> to a string.
/// </summary> /// </summary>
/// <returns>A string representation of this rect.</returns> /// <returns>A string representation of this rect.</returns>
public override readonly string ToString() public override readonly string ToString()
@ -441,7 +441,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="Rect2i"/> to a string with the given <paramref name="format"/>. /// Converts this <see cref="Rect2I"/> to a string with the given <paramref name="format"/>.
/// </summary> /// </summary>
/// <returns>A string representation of this rect.</returns> /// <returns>A string representation of this rect.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)

View File

@ -6,25 +6,25 @@ using Godot.NativeInterop;
namespace Godot namespace Godot
{ {
/// <summary> /// <summary>
/// The RID type is used to access the unique integer ID of a resource. /// The Rid type is used to access the unique integer ID of a resource.
/// They are opaque, which means they do not grant access to the associated /// They are opaque, which means they do not grant access to the associated
/// resource by themselves. They are used by and with the low-level Server /// resource by themselves. They are used by and with the low-level Server
/// classes such as <see cref="RenderingServer"/>. /// classes such as <see cref="RenderingServer"/>.
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public readonly struct RID public readonly struct Rid
{ {
private readonly ulong _id; // Default is 0 private readonly ulong _id; // Default is 0
internal RID(ulong id) internal Rid(ulong id)
{ {
_id = id; _id = id;
} }
/// <summary> /// <summary>
/// Constructs a new <see cref="RID"/> for the given <see cref="Object"/> <paramref name="from"/>. /// Constructs a new <see cref="Rid"/> for the given <see cref="GodotObject"/> <paramref name="from"/>.
/// </summary> /// </summary>
public RID(Object from) public Rid(Godot.Object from)
=> _id = from is Resource res ? res.GetRid()._id : default; => _id = from is Resource res ? res.GetRid()._id : default;
/// <summary> /// <summary>
@ -34,9 +34,9 @@ namespace Godot
public ulong Id => _id; public ulong Id => _id;
/// <summary> /// <summary>
/// Converts this <see cref="RID"/> to a string. /// Converts this <see cref="Rid"/> to a string.
/// </summary> /// </summary>
/// <returns>A string representation of this RID.</returns> /// <returns>A string representation of this Rid.</returns>
public override string ToString() => $"RID({Id})"; public override string ToString() => $"Rid({Id})";
} }
} }

View File

@ -675,15 +675,15 @@ namespace Godot
/// <summary> /// <summary>
/// Converts ASCII encoded array to string. /// Converts ASCII encoded array to string.
/// Fast alternative to <see cref="GetStringFromUTF8"/> if the /// Fast alternative to <see cref="GetStringFromUtf8"/> if the
/// content is ASCII-only. Unlike the UTF-8 function this function /// content is ASCII-only. Unlike the UTF-8 function this function
/// maps every byte to a character in the array. Multibyte sequences /// maps every byte to a character in the array. Multibyte sequences
/// will not be interpreted correctly. For parsing user input always /// will not be interpreted correctly. For parsing user input always
/// use <see cref="GetStringFromUTF8"/>. /// use <see cref="GetStringFromUtf8"/>.
/// </summary> /// </summary>
/// <param name="bytes">A byte array of ASCII characters (on the range of 0-127).</param> /// <param name="bytes">A byte array of ASCII characters (on the range of 0-127).</param>
/// <returns>A string created from the bytes.</returns> /// <returns>A string created from the bytes.</returns>
public static string GetStringFromASCII(this byte[] bytes) public static string GetStringFromAscii(this byte[] bytes)
{ {
return Encoding.ASCII.GetString(bytes); return Encoding.ASCII.GetString(bytes);
} }
@ -693,7 +693,7 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="bytes">A byte array of UTF-16 characters.</param> /// <param name="bytes">A byte array of UTF-16 characters.</param>
/// <returns>A string created from the bytes.</returns> /// <returns>A string created from the bytes.</returns>
public static string GetStringFromUTF16(this byte[] bytes) public static string GetStringFromUtf16(this byte[] bytes)
{ {
return Encoding.Unicode.GetString(bytes); return Encoding.Unicode.GetString(bytes);
} }
@ -703,14 +703,14 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="bytes">A byte array of UTF-32 characters.</param> /// <param name="bytes">A byte array of UTF-32 characters.</param>
/// <returns>A string created from the bytes.</returns> /// <returns>A string created from the bytes.</returns>
public static string GetStringFromUTF32(this byte[] bytes) public static string GetStringFromUtf32(this byte[] bytes)
{ {
return Encoding.UTF32.GetString(bytes); return Encoding.UTF32.GetString(bytes);
} }
/// <summary> /// <summary>
/// Converts UTF-8 encoded array to string. /// Converts UTF-8 encoded array to string.
/// Slower than <see cref="GetStringFromASCII"/> but supports UTF-8 /// Slower than <see cref="GetStringFromAscii"/> but supports UTF-8
/// encoded data. Use this function if you are unsure about the /// encoded data. Use this function if you are unsure about the
/// source of the data. For user input this function /// source of the data. For user input this function
/// should always be preferred. /// should always be preferred.
@ -719,7 +719,7 @@ namespace Godot
/// A byte array of UTF-8 characters (a character may take up multiple bytes). /// A byte array of UTF-8 characters (a character may take up multiple bytes).
/// </param> /// </param>
/// <returns>A string created from the bytes.</returns> /// <returns>A string created from the bytes.</returns>
public static string GetStringFromUTF8(this byte[] bytes) public static string GetStringFromUtf8(this byte[] bytes)
{ {
return Encoding.UTF8.GetString(bytes); return Encoding.UTF8.GetString(bytes);
} }
@ -1287,10 +1287,10 @@ namespace Godot
/// <summary> /// <summary>
/// Returns the MD5 hash of the string as an array of bytes. /// Returns the MD5 hash of the string as an array of bytes.
/// </summary> /// </summary>
/// <seealso cref="MD5Text(string)"/> /// <seealso cref="Md5Text(string)"/>
/// <param name="instance">The string to hash.</param> /// <param name="instance">The string to hash.</param>
/// <returns>The MD5 hash of the string.</returns> /// <returns>The MD5 hash of the string.</returns>
public static byte[] MD5Buffer(this string instance) public static byte[] Md5Buffer(this string instance)
{ {
#pragma warning disable CA5351 // Do Not Use Broken Cryptographic Algorithms #pragma warning disable CA5351 // Do Not Use Broken Cryptographic Algorithms
return MD5.HashData(Encoding.UTF8.GetBytes(instance)); return MD5.HashData(Encoding.UTF8.GetBytes(instance));
@ -1300,12 +1300,12 @@ namespace Godot
/// <summary> /// <summary>
/// Returns the MD5 hash of the string as a string. /// Returns the MD5 hash of the string as a string.
/// </summary> /// </summary>
/// <seealso cref="MD5Buffer(string)"/> /// <seealso cref="Md5Buffer(string)"/>
/// <param name="instance">The string to hash.</param> /// <param name="instance">The string to hash.</param>
/// <returns>The MD5 hash of the string.</returns> /// <returns>The MD5 hash of the string.</returns>
public static string MD5Text(this string instance) public static string Md5Text(this string instance)
{ {
return instance.MD5Buffer().HexEncode(); return instance.Md5Buffer().HexEncode();
} }
/// <summary> /// <summary>
@ -1523,10 +1523,10 @@ namespace Godot
/// <summary> /// <summary>
/// Returns the SHA-1 hash of the string as an array of bytes. /// Returns the SHA-1 hash of the string as an array of bytes.
/// </summary> /// </summary>
/// <seealso cref="SHA1Text(string)"/> /// <seealso cref="Sha1Text(string)"/>
/// <param name="instance">The string to hash.</param> /// <param name="instance">The string to hash.</param>
/// <returns>The SHA-1 hash of the string.</returns> /// <returns>The SHA-1 hash of the string.</returns>
public static byte[] SHA1Buffer(this string instance) public static byte[] Sha1Buffer(this string instance)
{ {
#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms #pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms
return SHA1.HashData(Encoding.UTF8.GetBytes(instance)); return SHA1.HashData(Encoding.UTF8.GetBytes(instance));
@ -1536,21 +1536,21 @@ namespace Godot
/// <summary> /// <summary>
/// Returns the SHA-1 hash of the string as a string. /// Returns the SHA-1 hash of the string as a string.
/// </summary> /// </summary>
/// <seealso cref="SHA1Buffer(string)"/> /// <seealso cref="Sha1Buffer(string)"/>
/// <param name="instance">The string to hash.</param> /// <param name="instance">The string to hash.</param>
/// <returns>The SHA-1 hash of the string.</returns> /// <returns>The SHA-1 hash of the string.</returns>
public static string SHA1Text(this string instance) public static string Sha1Text(this string instance)
{ {
return instance.SHA1Buffer().HexEncode(); return instance.Sha1Buffer().HexEncode();
} }
/// <summary> /// <summary>
/// Returns the SHA-256 hash of the string as an array of bytes. /// Returns the SHA-256 hash of the string as an array of bytes.
/// </summary> /// </summary>
/// <seealso cref="SHA256Text(string)"/> /// <seealso cref="Sha256Text(string)"/>
/// <param name="instance">The string to hash.</param> /// <param name="instance">The string to hash.</param>
/// <returns>The SHA-256 hash of the string.</returns> /// <returns>The SHA-256 hash of the string.</returns>
public static byte[] SHA256Buffer(this string instance) public static byte[] Sha256Buffer(this string instance)
{ {
return SHA256.HashData(Encoding.UTF8.GetBytes(instance)); return SHA256.HashData(Encoding.UTF8.GetBytes(instance));
} }
@ -1558,12 +1558,12 @@ namespace Godot
/// <summary> /// <summary>
/// Returns the SHA-256 hash of the string as a string. /// Returns the SHA-256 hash of the string as a string.
/// </summary> /// </summary>
/// <seealso cref="SHA256Buffer(string)"/> /// <seealso cref="Sha256Buffer(string)"/>
/// <param name="instance">The string to hash.</param> /// <param name="instance">The string to hash.</param>
/// <returns>The SHA-256 hash of the string.</returns> /// <returns>The SHA-256 hash of the string.</returns>
public static string SHA256Text(this string instance) public static string Sha256Text(this string instance)
{ {
return instance.SHA256Buffer().HexEncode(); return instance.Sha256Buffer().HexEncode();
} }
/// <summary> /// <summary>
@ -1745,15 +1745,15 @@ namespace Godot
/// <summary> /// <summary>
/// Converts the String (which is a character array) to PackedByteArray (which is an array of bytes). /// Converts the String (which is a character array) to PackedByteArray (which is an array of bytes).
/// The conversion is faster compared to <see cref="ToUTF8Buffer(string)"/>, /// The conversion is faster compared to <see cref="ToUtf8Buffer(string)"/>,
/// as this method assumes that all the characters in the String are ASCII characters. /// as this method assumes that all the characters in the String are ASCII characters.
/// </summary> /// </summary>
/// <seealso cref="ToUTF8Buffer(string)"/> /// <seealso cref="ToUtf8Buffer(string)"/>
/// <seealso cref="ToUTF16Buffer(string)"/> /// <seealso cref="ToUtf16Buffer(string)"/>
/// <seealso cref="ToUTF32Buffer(string)"/> /// <seealso cref="ToUtf32Buffer(string)"/>
/// <param name="instance">The string to convert.</param> /// <param name="instance">The string to convert.</param>
/// <returns>The string as ASCII encoded bytes.</returns> /// <returns>The string as ASCII encoded bytes.</returns>
public static byte[] ToASCIIBuffer(this string instance) public static byte[] ToAsciiBuffer(this string instance)
{ {
return Encoding.ASCII.GetBytes(instance); return Encoding.ASCII.GetBytes(instance);
} }
@ -1783,12 +1783,12 @@ namespace Godot
/// <summary> /// <summary>
/// Converts the string (which is an array of characters) to an UTF-16 encoded array of bytes. /// Converts the string (which is an array of characters) to an UTF-16 encoded array of bytes.
/// </summary> /// </summary>
/// <seealso cref="ToASCIIBuffer(string)"/> /// <seealso cref="ToAsciiBuffer(string)"/>
/// <seealso cref="ToUTF32Buffer(string)"/> /// <seealso cref="ToUtf32Buffer(string)"/>
/// <seealso cref="ToUTF8Buffer(string)"/> /// <seealso cref="ToUtf8Buffer(string)"/>
/// <param name="instance">The string to convert.</param> /// <param name="instance">The string to convert.</param>
/// <returns>The string as UTF-16 encoded bytes.</returns> /// <returns>The string as UTF-16 encoded bytes.</returns>
public static byte[] ToUTF16Buffer(this string instance) public static byte[] ToUtf16Buffer(this string instance)
{ {
return Encoding.Unicode.GetBytes(instance); return Encoding.Unicode.GetBytes(instance);
} }
@ -1796,28 +1796,28 @@ namespace Godot
/// <summary> /// <summary>
/// Converts the string (which is an array of characters) to an UTF-32 encoded array of bytes. /// Converts the string (which is an array of characters) to an UTF-32 encoded array of bytes.
/// </summary> /// </summary>
/// <seealso cref="ToASCIIBuffer(string)"/> /// <seealso cref="ToAsciiBuffer(string)"/>
/// <seealso cref="ToUTF16Buffer(string)"/> /// <seealso cref="ToUtf16Buffer(string)"/>
/// <seealso cref="ToUTF8Buffer(string)"/> /// <seealso cref="ToUtf8Buffer(string)"/>
/// <param name="instance">The string to convert.</param> /// <param name="instance">The string to convert.</param>
/// <returns>The string as UTF-32 encoded bytes.</returns> /// <returns>The string as UTF-32 encoded bytes.</returns>
public static byte[] ToUTF32Buffer(this string instance) public static byte[] ToUtf32Buffer(this string instance)
{ {
return Encoding.UTF32.GetBytes(instance); return Encoding.UTF32.GetBytes(instance);
} }
/// <summary> /// <summary>
/// Converts the string (which is an array of characters) to an UTF-8 encoded array of bytes. /// Converts the string (which is an array of characters) to an UTF-8 encoded array of bytes.
/// The conversion is a bit slower than <see cref="ToASCIIBuffer(string)"/>, /// The conversion is a bit slower than <see cref="ToAsciiBuffer(string)"/>,
/// but supports all UTF-8 characters. Therefore, you should prefer this function /// but supports all UTF-8 characters. Therefore, you should prefer this function
/// over <see cref="ToASCIIBuffer(string)"/>. /// over <see cref="ToAsciiBuffer(string)"/>.
/// </summary> /// </summary>
/// <seealso cref="ToASCIIBuffer(string)"/> /// <seealso cref="ToAsciiBuffer(string)"/>
/// <seealso cref="ToUTF16Buffer(string)"/> /// <seealso cref="ToUtf16Buffer(string)"/>
/// <seealso cref="ToUTF32Buffer(string)"/> /// <seealso cref="ToUtf32Buffer(string)"/>
/// <param name="instance">The string to convert.</param> /// <param name="instance">The string to convert.</param>
/// <returns>The string as UTF-8 encoded bytes.</returns> /// <returns>The string as UTF-8 encoded bytes.</returns>
public static byte[] ToUTF8Buffer(this string instance) public static byte[] ToUtf8Buffer(this string instance)
{ {
return Encoding.UTF8.GetBytes(instance); return Encoding.UTF8.GetBytes(instance);
} }

View File

@ -19,23 +19,23 @@ namespace Godot
/// <summary> /// <summary>
/// The basis matrix's X vector (column 0). Equivalent to array index <c>[0]</c>. /// The basis matrix's X vector (column 0). Equivalent to array index <c>[0]</c>.
/// </summary> /// </summary>
public Vector2 x; public Vector2 X;
/// <summary> /// <summary>
/// The basis matrix's Y vector (column 1). Equivalent to array index <c>[1]</c>. /// The basis matrix's Y vector (column 1). Equivalent to array index <c>[1]</c>.
/// </summary> /// </summary>
public Vector2 y; public Vector2 Y;
/// <summary> /// <summary>
/// The origin vector (column 2, the third column). Equivalent to array index <c>[2]</c>. /// The origin vector (column 2, the third column). Equivalent to array index <c>[2]</c>.
/// The origin vector represents translation. /// The origin vector represents translation.
/// </summary> /// </summary>
public Vector2 origin; public Vector2 Origin;
/// <summary> /// <summary>
/// Returns the transform's rotation (in radians). /// Returns the transform's rotation (in radians).
/// </summary> /// </summary>
public readonly real_t Rotation => Mathf.Atan2(x.y, x.x); public readonly real_t Rotation => Mathf.Atan2(X.Y, X.X);
/// <summary> /// <summary>
/// Returns the scale. /// Returns the scale.
@ -45,13 +45,13 @@ namespace Godot
get get
{ {
real_t detSign = Mathf.Sign(BasisDeterminant()); real_t detSign = Mathf.Sign(BasisDeterminant());
return new Vector2(x.Length(), detSign * y.Length()); return new Vector2(X.Length(), detSign * Y.Length());
} }
} }
/// <summary> /// <summary>
/// Access whole columns in the form of <see cref="Vector2"/>. /// Access whole columns in the form of <see cref="Vector2"/>.
/// The third column is the <see cref="origin"/> vector. /// The third column is the <see cref="Origin"/> vector.
/// </summary> /// </summary>
/// <param name="column">Which column vector.</param> /// <param name="column">Which column vector.</param>
/// <exception cref="ArgumentOutOfRangeException"> /// <exception cref="ArgumentOutOfRangeException">
@ -64,11 +64,11 @@ namespace Godot
switch (column) switch (column)
{ {
case 0: case 0:
return x; return X;
case 1: case 1:
return y; return Y;
case 2: case 2:
return origin; return Origin;
default: default:
throw new ArgumentOutOfRangeException(nameof(column)); throw new ArgumentOutOfRangeException(nameof(column));
} }
@ -78,13 +78,13 @@ namespace Godot
switch (column) switch (column)
{ {
case 0: case 0:
x = value; X = value;
return; return;
case 1: case 1:
y = value; Y = value;
return; return;
case 2: case 2:
origin = value; Origin = value;
return; return;
default: default:
throw new ArgumentOutOfRangeException(nameof(column)); throw new ArgumentOutOfRangeException(nameof(column));
@ -94,7 +94,7 @@ namespace Godot
/// <summary> /// <summary>
/// Access matrix elements in column-major order. /// Access matrix elements in column-major order.
/// The third column is the <see cref="origin"/> vector. /// The third column is the <see cref="Origin"/> vector.
/// </summary> /// </summary>
/// <param name="column">Which column, the matrix horizontal position.</param> /// <param name="column">Which column, the matrix horizontal position.</param>
/// <param name="row">Which row, the matrix vertical position.</param> /// <param name="row">Which row, the matrix vertical position.</param>
@ -152,12 +152,12 @@ namespace Godot
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
private readonly real_t BasisDeterminant() private readonly real_t BasisDeterminant()
{ {
return (x.x * y.y) - (x.y * y.x); return (X.X * Y.Y) - (X.Y * Y.X);
} }
/// <summary> /// <summary>
/// Returns a vector transformed (multiplied) by the basis matrix. /// Returns a vector transformed (multiplied) by the basis matrix.
/// This method does not account for translation (the <see cref="origin"/> vector). /// This method does not account for translation (the <see cref="Origin"/> vector).
/// </summary> /// </summary>
/// <seealso cref="BasisXformInv(Vector2)"/> /// <seealso cref="BasisXformInv(Vector2)"/>
/// <param name="v">A vector to transform.</param> /// <param name="v">A vector to transform.</param>
@ -169,7 +169,7 @@ namespace Godot
/// <summary> /// <summary>
/// Returns a vector transformed (multiplied) by the inverse basis matrix. /// Returns a vector transformed (multiplied) by the inverse basis matrix.
/// This method does not account for translation (the <see cref="origin"/> vector). /// This method does not account for translation (the <see cref="Origin"/> vector).
/// ///
/// Note: This results in a multiplication by the inverse of the /// Note: This results in a multiplication by the inverse of the
/// basis matrix only if it represents a rotation-reflection. /// basis matrix only if it represents a rotation-reflection.
@ -179,7 +179,7 @@ namespace Godot
/// <returns>The inversely transformed vector.</returns> /// <returns>The inversely transformed vector.</returns>
public readonly Vector2 BasisXformInv(Vector2 v) public readonly Vector2 BasisXformInv(Vector2 v)
{ {
return new Vector2(x.Dot(v), y.Dot(v)); return new Vector2(X.Dot(v), Y.Dot(v));
} }
/// <summary> /// <summary>
@ -222,14 +222,14 @@ namespace Godot
} }
// Extract parameters // Extract parameters
Vector2 p1 = origin; Vector2 p1 = Origin;
Vector2 p2 = transform.origin; Vector2 p2 = transform.Origin;
// Construct matrix // Construct matrix
var res = new Transform2D(Mathf.Atan2(v.y, v.x), p1.Lerp(p2, weight)); var res = new Transform2D(Mathf.Atan2(v.Y, v.X), p1.Lerp(p2, weight));
Vector2 scale = s1.Lerp(s2, weight); Vector2 scale = s1.Lerp(s2, weight);
res.x *= scale; res.X *= scale;
res.y *= scale; res.Y *= scale;
return res; return res;
} }
@ -245,10 +245,10 @@ namespace Godot
Transform2D inv = this; Transform2D inv = this;
// Swap // Swap
inv.x.y = y.x; inv.X.Y = Y.X;
inv.y.x = x.y; inv.Y.X = X.Y;
inv.origin = inv.BasisXform(-inv.origin); inv.Origin = inv.BasisXform(-inv.Origin);
return inv; return inv;
} }
@ -260,7 +260,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns> /// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite() public readonly bool IsFinite()
{ {
return x.IsFinite() && y.IsFinite() && origin.IsFinite(); return X.IsFinite() && Y.IsFinite() && Origin.IsFinite();
} }
/// <summary> /// <summary>
@ -272,15 +272,15 @@ namespace Godot
{ {
Transform2D on = this; Transform2D on = this;
Vector2 onX = on.x; Vector2 onX = on.X;
Vector2 onY = on.y; Vector2 onY = on.Y;
onX.Normalize(); onX.Normalize();
onY = onY - (onX * onX.Dot(onY)); onY = onY - (onX * onX.Dot(onY));
onY.Normalize(); onY.Normalize();
on.x = onX; on.X = onX;
on.y = onY; on.Y = onY;
return on; return on;
} }
@ -319,9 +319,9 @@ namespace Godot
public readonly Transform2D Scaled(Vector2 scale) public readonly Transform2D Scaled(Vector2 scale)
{ {
Transform2D copy = this; Transform2D copy = this;
copy.x *= scale; copy.X *= scale;
copy.y *= scale; copy.Y *= scale;
copy.origin *= scale; copy.Origin *= scale;
return copy; return copy;
} }
@ -335,8 +335,8 @@ namespace Godot
public readonly Transform2D ScaledLocal(Vector2 scale) public readonly Transform2D ScaledLocal(Vector2 scale)
{ {
Transform2D copy = this; Transform2D copy = this;
copy.x *= scale; copy.X *= scale;
copy.y *= scale; copy.Y *= scale;
return copy; return copy;
} }
@ -360,7 +360,7 @@ namespace Godot
public readonly Transform2D Translated(Vector2 offset) public readonly Transform2D Translated(Vector2 offset)
{ {
Transform2D copy = this; Transform2D copy = this;
copy.origin += offset; copy.Origin += offset;
return copy; return copy;
} }
@ -374,7 +374,7 @@ namespace Godot
public readonly Transform2D TranslatedLocal(Vector2 offset) public readonly Transform2D TranslatedLocal(Vector2 offset)
{ {
Transform2D copy = this; Transform2D copy = this;
copy.origin += copy.BasisXform(offset); copy.Origin += copy.BasisXform(offset);
return copy; return copy;
} }
@ -409,26 +409,26 @@ namespace Godot
/// <param name="originPos">The origin vector, or column index 2.</param> /// <param name="originPos">The origin vector, or column index 2.</param>
public Transform2D(Vector2 xAxis, Vector2 yAxis, Vector2 originPos) public Transform2D(Vector2 xAxis, Vector2 yAxis, Vector2 originPos)
{ {
x = xAxis; X = xAxis;
y = yAxis; Y = yAxis;
origin = originPos; Origin = originPos;
} }
/// <summary> /// <summary>
/// Constructs a transformation matrix from the given components. /// Constructs a transformation matrix from the given components.
/// Arguments are named such that xy is equal to calling <c>x.y</c>. /// Arguments are named such that xy is equal to calling <c>X.Y</c>.
/// </summary> /// </summary>
/// <param name="xx">The X component of the X column vector, accessed via <c>t.x.x</c> or <c>[0][0]</c>.</param> /// <param name="xx">The X component of the X column vector, accessed via <c>t.X.X</c> or <c>[0][0]</c>.</param>
/// <param name="xy">The Y component of the X column vector, accessed via <c>t.x.y</c> or <c>[0][1]</c>.</param> /// <param name="xy">The Y component of the X column vector, accessed via <c>t.X.Y</c> or <c>[0][1]</c>.</param>
/// <param name="yx">The X component of the Y column vector, accessed via <c>t.y.x</c> or <c>[1][0]</c>.</param> /// <param name="yx">The X component of the Y column vector, accessed via <c>t.Y.X</c> or <c>[1][0]</c>.</param>
/// <param name="yy">The Y component of the Y column vector, accessed via <c>t.y.y</c> or <c>[1][1]</c>.</param> /// <param name="yy">The Y component of the Y column vector, accessed via <c>t.Y.Y</c> or <c>[1][1]</c>.</param>
/// <param name="ox">The X component of the origin vector, accessed via <c>t.origin.x</c> or <c>[2][0]</c>.</param> /// <param name="ox">The X component of the origin vector, accessed via <c>t.Origin.X</c> or <c>[2][0]</c>.</param>
/// <param name="oy">The Y component of the origin vector, accessed via <c>t.origin.y</c> or <c>[2][1]</c>.</param> /// <param name="oy">The Y component of the origin vector, accessed via <c>t.Origin.Y</c> or <c>[2][1]</c>.</param>
public Transform2D(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy) public Transform2D(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy)
{ {
x = new Vector2(xx, xy); X = new Vector2(xx, xy);
y = new Vector2(yx, yy); Y = new Vector2(yx, yy);
origin = new Vector2(ox, oy); Origin = new Vector2(ox, oy);
} }
/// <summary> /// <summary>
@ -440,10 +440,10 @@ namespace Godot
public Transform2D(real_t rotation, Vector2 origin) public Transform2D(real_t rotation, Vector2 origin)
{ {
(real_t sin, real_t cos) = Mathf.SinCos(rotation); (real_t sin, real_t cos) = Mathf.SinCos(rotation);
x.x = y.y = cos; X.X = Y.Y = cos;
x.y = y.x = sin; X.Y = Y.X = sin;
y.x *= -1; Y.X *= -1;
this.origin = origin; Origin = origin;
} }
/// <summary> /// <summary>
@ -459,11 +459,11 @@ namespace Godot
{ {
(real_t rotationSin, real_t rotationCos) = Mathf.SinCos(rotation); (real_t rotationSin, real_t rotationCos) = Mathf.SinCos(rotation);
(real_t rotationSkewSin, real_t rotationSkewCos) = Mathf.SinCos(rotation + skew); (real_t rotationSkewSin, real_t rotationSkewCos) = Mathf.SinCos(rotation + skew);
x.x = rotationCos * scale.x; X.X = rotationCos * scale.X;
y.y = rotationSkewCos * scale.y; Y.Y = rotationSkewCos * scale.Y;
y.x = -rotationSkewSin * scale.y; Y.X = -rotationSkewSin * scale.Y;
x.y = rotationSin * scale.x; X.Y = rotationSin * scale.X;
this.origin = origin; Origin = origin;
} }
/// <summary> /// <summary>
@ -476,17 +476,17 @@ namespace Godot
/// <returns>The composed transform.</returns> /// <returns>The composed transform.</returns>
public static Transform2D operator *(Transform2D left, Transform2D right) public static Transform2D operator *(Transform2D left, Transform2D right)
{ {
left.origin = left * right.origin; left.Origin = left * right.Origin;
real_t x0 = left.Tdotx(right.x); real_t x0 = left.Tdotx(right.X);
real_t x1 = left.Tdoty(right.x); real_t x1 = left.Tdoty(right.X);
real_t y0 = left.Tdotx(right.y); real_t y0 = left.Tdotx(right.Y);
real_t y1 = left.Tdoty(right.y); real_t y1 = left.Tdoty(right.Y);
left.x.x = x0; left.X.X = x0;
left.x.y = x1; left.X.Y = x1;
left.y.x = y0; left.Y.X = y0;
left.y.y = y1; left.Y.Y = y1;
return left; return left;
} }
@ -499,7 +499,7 @@ namespace Godot
/// <returns>The transformed Vector2.</returns> /// <returns>The transformed Vector2.</returns>
public static Vector2 operator *(Transform2D transform, Vector2 vector) public static Vector2 operator *(Transform2D transform, Vector2 vector)
{ {
return new Vector2(transform.Tdotx(vector), transform.Tdoty(vector)) + transform.origin; return new Vector2(transform.Tdotx(vector), transform.Tdoty(vector)) + transform.Origin;
} }
/// <summary> /// <summary>
@ -510,8 +510,8 @@ namespace Godot
/// <returns>The inversely transformed Vector2.</returns> /// <returns>The inversely transformed Vector2.</returns>
public static Vector2 operator *(Vector2 vector, Transform2D transform) public static Vector2 operator *(Vector2 vector, Transform2D transform)
{ {
Vector2 vInv = vector - transform.origin; Vector2 vInv = vector - transform.Origin;
return new Vector2(transform.x.Dot(vInv), transform.y.Dot(vInv)); return new Vector2(transform.X.Dot(vInv), transform.Y.Dot(vInv));
} }
/// <summary> /// <summary>
@ -523,8 +523,8 @@ namespace Godot
public static Rect2 operator *(Transform2D transform, Rect2 rect) public static Rect2 operator *(Transform2D transform, Rect2 rect)
{ {
Vector2 pos = transform * rect.Position; Vector2 pos = transform * rect.Position;
Vector2 toX = transform.x * rect.Size.x; Vector2 toX = transform.X * rect.Size.X;
Vector2 toY = transform.y * rect.Size.y; Vector2 toY = transform.Y * rect.Size.Y;
return new Rect2(pos, new Vector2()).Expand(pos + toX).Expand(pos + toY).Expand(pos + toX + toY); return new Rect2(pos, new Vector2()).Expand(pos + toX).Expand(pos + toY).Expand(pos + toX + toY);
} }
@ -538,9 +538,9 @@ namespace Godot
public static Rect2 operator *(Rect2 rect, Transform2D transform) public static Rect2 operator *(Rect2 rect, Transform2D transform)
{ {
Vector2 pos = rect.Position * transform; Vector2 pos = rect.Position * transform;
Vector2 to1 = new Vector2(rect.Position.x, rect.Position.y + rect.Size.y) * transform; Vector2 to1 = new Vector2(rect.Position.X, rect.Position.Y + rect.Size.Y) * transform;
Vector2 to2 = new Vector2(rect.Position.x + rect.Size.x, rect.Position.y + rect.Size.y) * transform; Vector2 to2 = new Vector2(rect.Position.X + rect.Size.X, rect.Position.Y + rect.Size.Y) * transform;
Vector2 to3 = new Vector2(rect.Position.x + rect.Size.x, rect.Position.y) * transform; Vector2 to3 = new Vector2(rect.Position.X + rect.Size.X, rect.Position.Y) * transform;
return new Rect2(pos, new Vector2()).Expand(to1).Expand(to2).Expand(to3); return new Rect2(pos, new Vector2()).Expand(to1).Expand(to2).Expand(to3);
} }
@ -629,7 +629,7 @@ namespace Godot
/// <returns>Whether or not the matrices are exactly equal.</returns> /// <returns>Whether or not the matrices are exactly equal.</returns>
public readonly bool Equals(Transform2D other) public readonly bool Equals(Transform2D other)
{ {
return x.Equals(other.x) && y.Equals(other.y) && origin.Equals(other.origin); return X.Equals(other.X) && Y.Equals(other.Y) && Origin.Equals(other.Origin);
} }
/// <summary> /// <summary>
@ -640,7 +640,7 @@ namespace Godot
/// <returns>Whether or not the matrices are approximately equal.</returns> /// <returns>Whether or not the matrices are approximately equal.</returns>
public readonly bool IsEqualApprox(Transform2D other) public readonly bool IsEqualApprox(Transform2D other)
{ {
return x.IsEqualApprox(other.x) && y.IsEqualApprox(other.y) && origin.IsEqualApprox(other.origin); return X.IsEqualApprox(other.X) && Y.IsEqualApprox(other.Y) && Origin.IsEqualApprox(other.Origin);
} }
/// <summary> /// <summary>
@ -649,7 +649,7 @@ namespace Godot
/// <returns>A hash code for this transform.</returns> /// <returns>A hash code for this transform.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return x.GetHashCode() ^ y.GetHashCode() ^ origin.GetHashCode(); return X.GetHashCode() ^ Y.GetHashCode() ^ Origin.GetHashCode();
} }
/// <summary> /// <summary>
@ -658,7 +658,7 @@ namespace Godot
/// <returns>A string representation of this transform.</returns> /// <returns>A string representation of this transform.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"[X: {x}, Y: {y}, O: {origin}]"; return $"[X: {X}, Y: {Y}, O: {Origin}]";
} }
/// <summary> /// <summary>
@ -667,7 +667,7 @@ namespace Godot
/// <returns>A string representation of this transform.</returns> /// <returns>A string representation of this transform.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"[X: {x.ToString(format)}, Y: {y.ToString(format)}, O: {origin.ToString(format)}]"; return $"[X: {X.ToString(format)}, Y: {Y.ToString(format)}, O: {Origin.ToString(format)}]";
} }
} }
} }

View File

@ -6,7 +6,7 @@ namespace Godot
/// <summary> /// <summary>
/// 3×4 matrix (3 rows, 4 columns) used for 3D linear transformations. /// 3×4 matrix (3 rows, 4 columns) used for 3D linear transformations.
/// It can represent transformations such as translation, rotation, or scaling. /// It can represent transformations such as translation, rotation, or scaling.
/// It consists of a <see cref="Basis"/> (first 3 columns) and a /// It consists of a <see cref="Godot.Basis"/> (first 3 columns) and a
/// <see cref="Vector3"/> for the origin (last column). /// <see cref="Vector3"/> for the origin (last column).
/// ///
/// For more information, read this documentation article: /// For more information, read this documentation article:
@ -17,19 +17,19 @@ namespace Godot
public struct Transform3D : IEquatable<Transform3D> public struct Transform3D : IEquatable<Transform3D>
{ {
/// <summary> /// <summary>
/// The <see cref="Basis"/> of this transform. Contains the X, Y, and Z basis /// The <see cref="Godot.Basis"/> of this transform. Contains the X, Y, and Z basis
/// vectors (columns 0 to 2) and is responsible for rotation and scale. /// vectors (columns 0 to 2) and is responsible for rotation and scale.
/// </summary> /// </summary>
public Basis basis; public Basis Basis;
/// <summary> /// <summary>
/// The origin vector (column 3, the fourth column). Equivalent to array index <c>[3]</c>. /// The origin vector (column 3, the fourth column). Equivalent to array index <c>[3]</c>.
/// </summary> /// </summary>
public Vector3 origin; public Vector3 Origin;
/// <summary> /// <summary>
/// Access whole columns in the form of <see cref="Vector3"/>. /// Access whole columns in the form of <see cref="Vector3"/>.
/// The fourth column is the <see cref="origin"/> vector. /// The fourth column is the <see cref="Origin"/> vector.
/// </summary> /// </summary>
/// <param name="column">Which column vector.</param> /// <param name="column">Which column vector.</param>
/// <exception cref="ArgumentOutOfRangeException"> /// <exception cref="ArgumentOutOfRangeException">
@ -42,13 +42,13 @@ namespace Godot
switch (column) switch (column)
{ {
case 0: case 0:
return basis.Column0; return Basis.Column0;
case 1: case 1:
return basis.Column1; return Basis.Column1;
case 2: case 2:
return basis.Column2; return Basis.Column2;
case 3: case 3:
return origin; return Origin;
default: default:
throw new ArgumentOutOfRangeException(nameof(column)); throw new ArgumentOutOfRangeException(nameof(column));
} }
@ -58,16 +58,16 @@ namespace Godot
switch (column) switch (column)
{ {
case 0: case 0:
basis.Column0 = value; Basis.Column0 = value;
return; return;
case 1: case 1:
basis.Column1 = value; Basis.Column1 = value;
return; return;
case 2: case 2:
basis.Column2 = value; Basis.Column2 = value;
return; return;
case 3: case 3:
origin = value; Origin = value;
return; return;
default: default:
throw new ArgumentOutOfRangeException(nameof(column)); throw new ArgumentOutOfRangeException(nameof(column));
@ -77,7 +77,7 @@ namespace Godot
/// <summary> /// <summary>
/// Access matrix elements in column-major order. /// Access matrix elements in column-major order.
/// The fourth column is the <see cref="origin"/> vector. /// The fourth column is the <see cref="Origin"/> vector.
/// </summary> /// </summary>
/// <param name="column">Which column, the matrix horizontal position.</param> /// <param name="column">Which column, the matrix horizontal position.</param>
/// <param name="row">Which row, the matrix vertical position.</param> /// <param name="row">Which row, the matrix vertical position.</param>
@ -87,18 +87,18 @@ namespace Godot
{ {
if (column == 3) if (column == 3)
{ {
return origin[row]; return Origin[row];
} }
return basis[column, row]; return Basis[column, row];
} }
set set
{ {
if (column == 3) if (column == 3)
{ {
origin[row] = value; Origin[row] = value;
return; return;
} }
basis[column, row] = value; Basis[column, row] = value;
} }
} }
@ -110,8 +110,8 @@ namespace Godot
/// <returns>The inverse transformation matrix.</returns> /// <returns>The inverse transformation matrix.</returns>
public readonly Transform3D AffineInverse() public readonly Transform3D AffineInverse()
{ {
Basis basisInv = basis.Inverse(); Basis basisInv = Basis.Inverse();
return new Transform3D(basisInv, basisInv * -origin); return new Transform3D(basisInv, basisInv * -Origin);
} }
/// <summary> /// <summary>
@ -124,19 +124,19 @@ namespace Godot
/// <returns>The interpolated transform.</returns> /// <returns>The interpolated transform.</returns>
public readonly Transform3D InterpolateWith(Transform3D transform, real_t weight) public readonly Transform3D InterpolateWith(Transform3D transform, real_t weight)
{ {
Vector3 sourceScale = basis.Scale; Vector3 sourceScale = Basis.Scale;
Quaternion sourceRotation = basis.GetRotationQuaternion(); Quaternion sourceRotation = Basis.GetRotationQuaternion();
Vector3 sourceLocation = origin; Vector3 sourceLocation = Origin;
Vector3 destinationScale = transform.basis.Scale; Vector3 destinationScale = transform.Basis.Scale;
Quaternion destinationRotation = transform.basis.GetRotationQuaternion(); Quaternion destinationRotation = transform.Basis.GetRotationQuaternion();
Vector3 destinationLocation = transform.origin; Vector3 destinationLocation = transform.Origin;
var interpolated = new Transform3D(); var interpolated = new Transform3D();
Quaternion quaternion = sourceRotation.Slerp(destinationRotation, weight).Normalized(); Quaternion quaternion = sourceRotation.Slerp(destinationRotation, weight).Normalized();
Vector3 scale = sourceScale.Lerp(destinationScale, weight); Vector3 scale = sourceScale.Lerp(destinationScale, weight);
interpolated.basis.SetQuaternionScale(quaternion, scale); interpolated.Basis.SetQuaternionScale(quaternion, scale);
interpolated.origin = sourceLocation.Lerp(destinationLocation, weight); interpolated.Origin = sourceLocation.Lerp(destinationLocation, weight);
return interpolated; return interpolated;
} }
@ -149,8 +149,8 @@ namespace Godot
/// <returns>The inverse matrix.</returns> /// <returns>The inverse matrix.</returns>
public readonly Transform3D Inverse() public readonly Transform3D Inverse()
{ {
Basis basisTr = basis.Transposed(); Basis basisTr = Basis.Transposed();
return new Transform3D(basisTr, basisTr * -origin); return new Transform3D(basisTr, basisTr * -Origin);
} }
/// <summary> /// <summary>
@ -160,7 +160,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns> /// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite() public readonly bool IsFinite()
{ {
return basis.IsFinite() && origin.IsFinite(); return Basis.IsFinite() && Origin.IsFinite();
} }
/// <summary> /// <summary>
@ -179,7 +179,7 @@ namespace Godot
public readonly Transform3D LookingAt(Vector3 target, Vector3 up) public readonly Transform3D LookingAt(Vector3 target, Vector3 up)
{ {
Transform3D t = this; Transform3D t = this;
t.SetLookAt(origin, target, up); t.SetLookAt(Origin, target, up);
return t; return t;
} }
@ -190,7 +190,7 @@ namespace Godot
/// <returns>The orthonormalized transform.</returns> /// <returns>The orthonormalized transform.</returns>
public readonly Transform3D Orthonormalized() public readonly Transform3D Orthonormalized()
{ {
return new Transform3D(basis.Orthonormalized(), origin); return new Transform3D(Basis.Orthonormalized(), Origin);
} }
/// <summary> /// <summary>
@ -219,7 +219,7 @@ namespace Godot
public readonly Transform3D RotatedLocal(Vector3 axis, real_t angle) public readonly Transform3D RotatedLocal(Vector3 axis, real_t angle)
{ {
Basis tmpBasis = new Basis(axis, angle); Basis tmpBasis = new Basis(axis, angle);
return new Transform3D(basis * tmpBasis, origin); return new Transform3D(Basis * tmpBasis, Origin);
} }
/// <summary> /// <summary>
@ -231,7 +231,7 @@ namespace Godot
/// <returns>The scaled transformation matrix.</returns> /// <returns>The scaled transformation matrix.</returns>
public readonly Transform3D Scaled(Vector3 scale) public readonly Transform3D Scaled(Vector3 scale)
{ {
return new Transform3D(basis.Scaled(scale), origin * scale); return new Transform3D(Basis.Scaled(scale), Origin * scale);
} }
/// <summary> /// <summary>
@ -244,7 +244,7 @@ namespace Godot
public readonly Transform3D ScaledLocal(Vector3 scale) public readonly Transform3D ScaledLocal(Vector3 scale)
{ {
Basis tmpBasis = Basis.FromScale(scale); Basis tmpBasis = Basis.FromScale(scale);
return new Transform3D(basis * tmpBasis, origin); return new Transform3D(Basis * tmpBasis, Origin);
} }
private void SetLookAt(Vector3 eye, Vector3 target, Vector3 up) private void SetLookAt(Vector3 eye, Vector3 target, Vector3 up)
@ -265,9 +265,9 @@ namespace Godot
column0.Normalize(); column0.Normalize();
column1.Normalize(); column1.Normalize();
basis = new Basis(column0, column1, column2); Basis = new Basis(column0, column1, column2);
origin = eye; Origin = eye;
} }
/// <summary> /// <summary>
@ -279,7 +279,7 @@ namespace Godot
/// <returns>The translated matrix.</returns> /// <returns>The translated matrix.</returns>
public readonly Transform3D Translated(Vector3 offset) public readonly Transform3D Translated(Vector3 offset)
{ {
return new Transform3D(basis, origin + offset); return new Transform3D(Basis, Origin + offset);
} }
/// <summary> /// <summary>
@ -291,11 +291,11 @@ namespace Godot
/// <returns>The translated matrix.</returns> /// <returns>The translated matrix.</returns>
public readonly Transform3D TranslatedLocal(Vector3 offset) public readonly Transform3D TranslatedLocal(Vector3 offset)
{ {
return new Transform3D(basis, new Vector3 return new Transform3D(Basis, new Vector3
( (
origin[0] + basis.Row0.Dot(offset), Origin[0] + Basis.Row0.Dot(offset),
origin[1] + basis.Row1.Dot(offset), Origin[1] + Basis.Row1.Dot(offset),
origin[2] + basis.Row2.Dot(offset) Origin[2] + Basis.Row2.Dot(offset)
)); ));
} }
@ -337,64 +337,64 @@ namespace Godot
/// <param name="origin">The origin vector, or column index 3.</param> /// <param name="origin">The origin vector, or column index 3.</param>
public Transform3D(Vector3 column0, Vector3 column1, Vector3 column2, Vector3 origin) public Transform3D(Vector3 column0, Vector3 column1, Vector3 column2, Vector3 origin)
{ {
basis = new Basis(column0, column1, column2); Basis = new Basis(column0, column1, column2);
this.origin = origin; Origin = origin;
} }
/// <summary> /// <summary>
/// Constructs a transformation matrix from the given components. /// Constructs a transformation matrix from the given components.
/// Arguments are named such that xy is equal to calling <c>basis.x.y</c>. /// Arguments are named such that xy is equal to calling <c>Basis.X.Y</c>.
/// </summary> /// </summary>
/// <param name="xx">The X component of the X column vector, accessed via <c>t.basis.x.x</c> or <c>[0][0]</c>.</param> /// <param name="xx">The X component of the X column vector, accessed via <c>t.Basis.X.X</c> or <c>[0][0]</c>.</param>
/// <param name="yx">The X component of the Y column vector, accessed via <c>t.basis.y.x</c> or <c>[1][0]</c>.</param> /// <param name="yx">The X component of the Y column vector, accessed via <c>t.Basis.Y.X</c> or <c>[1][0]</c>.</param>
/// <param name="zx">The X component of the Z column vector, accessed via <c>t.basis.z.x</c> or <c>[2][0]</c>.</param> /// <param name="zx">The X component of the Z column vector, accessed via <c>t.Basis.Z.X</c> or <c>[2][0]</c>.</param>
/// <param name="xy">The Y component of the X column vector, accessed via <c>t.basis.x.y</c> or <c>[0][1]</c>.</param> /// <param name="xy">The Y component of the X column vector, accessed via <c>t.Basis.X.Y</c> or <c>[0][1]</c>.</param>
/// <param name="yy">The Y component of the Y column vector, accessed via <c>t.basis.y.y</c> or <c>[1][1]</c>.</param> /// <param name="yy">The Y component of the Y column vector, accessed via <c>t.Basis.Y.Y</c> or <c>[1][1]</c>.</param>
/// <param name="zy">The Y component of the Z column vector, accessed via <c>t.basis.y.y</c> or <c>[2][1]</c>.</param> /// <param name="zy">The Y component of the Z column vector, accessed via <c>t.Basis.Y.Y</c> or <c>[2][1]</c>.</param>
/// <param name="xz">The Z component of the X column vector, accessed via <c>t.basis.x.y</c> or <c>[0][2]</c>.</param> /// <param name="xz">The Z component of the X column vector, accessed via <c>t.Basis.X.Y</c> or <c>[0][2]</c>.</param>
/// <param name="yz">The Z component of the Y column vector, accessed via <c>t.basis.y.y</c> or <c>[1][2]</c>.</param> /// <param name="yz">The Z component of the Y column vector, accessed via <c>t.Basis.Y.Y</c> or <c>[1][2]</c>.</param>
/// <param name="zz">The Z component of the Z column vector, accessed via <c>t.basis.y.y</c> or <c>[2][2]</c>.</param> /// <param name="zz">The Z component of the Z column vector, accessed via <c>t.Basis.Y.Y</c> or <c>[2][2]</c>.</param>
/// <param name="ox">The X component of the origin vector, accessed via <c>t.origin.x</c> or <c>[2][0]</c>.</param> /// <param name="ox">The X component of the origin vector, accessed via <c>t.Origin.X</c> or <c>[2][0]</c>.</param>
/// <param name="oy">The Y component of the origin vector, accessed via <c>t.origin.y</c> or <c>[2][1]</c>.</param> /// <param name="oy">The Y component of the origin vector, accessed via <c>t.Origin.Y</c> or <c>[2][1]</c>.</param>
/// <param name="oz">The Z component of the origin vector, accessed via <c>t.origin.z</c> or <c>[2][2]</c>.</param> /// <param name="oz">The Z component of the origin vector, accessed via <c>t.Origin.Z</c> or <c>[2][2]</c>.</param>
public Transform3D(real_t xx, real_t yx, real_t zx, real_t xy, real_t yy, real_t zy, real_t xz, real_t yz, real_t zz, real_t ox, real_t oy, real_t oz) public Transform3D(real_t xx, real_t yx, real_t zx, real_t xy, real_t yy, real_t zy, real_t xz, real_t yz, real_t zz, real_t ox, real_t oy, real_t oz)
{ {
basis = new Basis(xx, yx, zx, xy, yy, zy, xz, yz, zz); Basis = new Basis(xx, yx, zx, xy, yy, zy, xz, yz, zz);
origin = new Vector3(ox, oy, oz); Origin = new Vector3(ox, oy, oz);
} }
/// <summary> /// <summary>
/// Constructs a transformation matrix from the given <paramref name="basis"/> and /// Constructs a transformation matrix from the given <paramref name="basis"/> and
/// <paramref name="origin"/> vector. /// <paramref name="origin"/> vector.
/// </summary> /// </summary>
/// <param name="basis">The <see cref="Basis"/> to create the basis from.</param> /// <param name="basis">The <see cref="Godot.Basis"/> to create the basis from.</param>
/// <param name="origin">The origin vector, or column index 3.</param> /// <param name="origin">The origin vector, or column index 3.</param>
public Transform3D(Basis basis, Vector3 origin) public Transform3D(Basis basis, Vector3 origin)
{ {
this.basis = basis; Basis = basis;
this.origin = origin; Origin = origin;
} }
/// <summary> /// <summary>
/// Constructs a transformation matrix from the given <paramref name="projection"/> /// Constructs a transformation matrix from the given <paramref name="projection"/>
/// by trimming the last row of the projection matrix (<c>projection.x.w</c>, /// by trimming the last row of the projection matrix (<c>projection.X.W</c>,
/// <c>projection.y.w</c>, <c>projection.z.w</c>, and <c>projection.w.w</c> /// <c>projection.Y.W</c>, <c>projection.Z.W</c>, and <c>projection.W.W</c>
/// are not copied over). /// are not copied over).
/// </summary> /// </summary>
/// <param name="projection">The <see cref="Projection"/> to create the transform from.</param> /// <param name="projection">The <see cref="Projection"/> to create the transform from.</param>
public Transform3D(Projection projection) public Transform3D(Projection projection)
{ {
basis = new Basis Basis = new Basis
( (
projection.x.x, projection.y.x, projection.z.x, projection.X.X, projection.Y.X, projection.Z.X,
projection.x.y, projection.y.y, projection.z.y, projection.X.Y, projection.Y.Y, projection.Z.Y,
projection.x.z, projection.y.z, projection.z.z projection.X.Z, projection.Y.Z, projection.Z.Z
); );
origin = new Vector3 Origin = new Vector3
( (
projection.w.x, projection.W.X,
projection.w.y, projection.W.Y,
projection.w.z projection.W.Z
); );
} }
@ -408,8 +408,8 @@ namespace Godot
/// <returns>The composed transform.</returns> /// <returns>The composed transform.</returns>
public static Transform3D operator *(Transform3D left, Transform3D right) public static Transform3D operator *(Transform3D left, Transform3D right)
{ {
left.origin = left * right.origin; left.Origin = left * right.Origin;
left.basis *= right.basis; left.Basis *= right.Basis;
return left; return left;
} }
@ -423,9 +423,9 @@ namespace Godot
{ {
return new Vector3 return new Vector3
( (
transform.basis.Row0.Dot(vector) + transform.origin.x, transform.Basis.Row0.Dot(vector) + transform.Origin.X,
transform.basis.Row1.Dot(vector) + transform.origin.y, transform.Basis.Row1.Dot(vector) + transform.Origin.Y,
transform.basis.Row2.Dot(vector) + transform.origin.z transform.Basis.Row2.Dot(vector) + transform.Origin.Z
); );
} }
@ -440,13 +440,13 @@ namespace Godot
/// <returns>The inversely transformed Vector3.</returns> /// <returns>The inversely transformed Vector3.</returns>
public static Vector3 operator *(Vector3 vector, Transform3D transform) public static Vector3 operator *(Vector3 vector, Transform3D transform)
{ {
Vector3 vInv = vector - transform.origin; Vector3 vInv = vector - transform.Origin;
return new Vector3 return new Vector3
( (
(transform.basis.Row0[0] * vInv.x) + (transform.basis.Row1[0] * vInv.y) + (transform.basis.Row2[0] * vInv.z), (transform.Basis.Row0[0] * vInv.X) + (transform.Basis.Row1[0] * vInv.Y) + (transform.Basis.Row2[0] * vInv.Z),
(transform.basis.Row0[1] * vInv.x) + (transform.basis.Row1[1] * vInv.y) + (transform.basis.Row2[1] * vInv.z), (transform.Basis.Row0[1] * vInv.X) + (transform.Basis.Row1[1] * vInv.Y) + (transform.Basis.Row2[1] * vInv.Z),
(transform.basis.Row0[2] * vInv.x) + (transform.basis.Row1[2] * vInv.y) + (transform.basis.Row2[2] * vInv.z) (transform.Basis.Row0[2] * vInv.X) + (transform.Basis.Row1[2] * vInv.Y) + (transform.Basis.Row2[2] * vInv.Z)
); );
} }
@ -456,19 +456,19 @@ namespace Godot
/// <param name="transform">The transformation to apply.</param> /// <param name="transform">The transformation to apply.</param>
/// <param name="aabb">An AABB to transform.</param> /// <param name="aabb">An AABB to transform.</param>
/// <returns>The transformed AABB.</returns> /// <returns>The transformed AABB.</returns>
public static AABB operator *(Transform3D transform, AABB aabb) public static Aabb operator *(Transform3D transform, Aabb aabb)
{ {
Vector3 min = aabb.Position; Vector3 min = aabb.Position;
Vector3 max = aabb.Position + aabb.Size; Vector3 max = aabb.Position + aabb.Size;
Vector3 tmin = transform.origin; Vector3 tmin = transform.Origin;
Vector3 tmax = transform.origin; Vector3 tmax = transform.Origin;
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
{ {
real_t e = transform.basis[i][j] * min[j]; real_t e = transform.Basis[i][j] * min[j];
real_t f = transform.basis[i][j] * max[j]; real_t f = transform.Basis[i][j] * max[j];
if (e < f) if (e < f)
{ {
tmin[i] += e; tmin[i] += e;
@ -482,7 +482,7 @@ namespace Godot
} }
} }
return new AABB(tmin, tmax - tmin); return new Aabb(tmin, tmax - tmin);
} }
/// <summary> /// <summary>
@ -491,18 +491,18 @@ namespace Godot
/// <param name="aabb">An AABB to inversely transform.</param> /// <param name="aabb">An AABB to inversely transform.</param>
/// <param name="transform">The transformation to apply.</param> /// <param name="transform">The transformation to apply.</param>
/// <returns>The inversely transformed AABB.</returns> /// <returns>The inversely transformed AABB.</returns>
public static AABB operator *(AABB aabb, Transform3D transform) public static Aabb operator *(Aabb aabb, Transform3D transform)
{ {
Vector3 pos = new Vector3(aabb.Position.x + aabb.Size.x, aabb.Position.y + aabb.Size.y, aabb.Position.z + aabb.Size.z) * transform; Vector3 pos = new Vector3(aabb.Position.X + aabb.Size.X, aabb.Position.Y + aabb.Size.Y, aabb.Position.Z + aabb.Size.Z) * transform;
Vector3 to1 = new Vector3(aabb.Position.x + aabb.Size.x, aabb.Position.y + aabb.Size.y, aabb.Position.z) * transform; Vector3 to1 = new Vector3(aabb.Position.X + aabb.Size.X, aabb.Position.Y + aabb.Size.Y, aabb.Position.Z) * transform;
Vector3 to2 = new Vector3(aabb.Position.x + aabb.Size.x, aabb.Position.y, aabb.Position.z + aabb.Size.z) * transform; Vector3 to2 = new Vector3(aabb.Position.X + aabb.Size.X, aabb.Position.Y, aabb.Position.Z + aabb.Size.Z) * transform;
Vector3 to3 = new Vector3(aabb.Position.x + aabb.Size.x, aabb.Position.y, aabb.Position.z) * transform; Vector3 to3 = new Vector3(aabb.Position.X + aabb.Size.X, aabb.Position.Y, aabb.Position.Z) * transform;
Vector3 to4 = new Vector3(aabb.Position.x, aabb.Position.y + aabb.Size.y, aabb.Position.z + aabb.Size.z) * transform; Vector3 to4 = new Vector3(aabb.Position.X, aabb.Position.Y + aabb.Size.Y, aabb.Position.Z + aabb.Size.Z) * transform;
Vector3 to5 = new Vector3(aabb.Position.x, aabb.Position.y + aabb.Size.y, aabb.Position.z) * transform; Vector3 to5 = new Vector3(aabb.Position.X, aabb.Position.Y + aabb.Size.Y, aabb.Position.Z) * transform;
Vector3 to6 = new Vector3(aabb.Position.x, aabb.Position.y, aabb.Position.z + aabb.Size.z) * transform; Vector3 to6 = new Vector3(aabb.Position.X, aabb.Position.Y, aabb.Position.Z + aabb.Size.Z) * transform;
Vector3 to7 = new Vector3(aabb.Position.x, aabb.Position.y, aabb.Position.z) * transform; Vector3 to7 = new Vector3(aabb.Position.X, aabb.Position.Y, aabb.Position.Z) * transform;
return new AABB(pos, new Vector3()).Expand(to1).Expand(to2).Expand(to3).Expand(to4).Expand(to5).Expand(to6).Expand(to7); return new Aabb(pos, new Vector3()).Expand(to1).Expand(to2).Expand(to3).Expand(to4).Expand(to5).Expand(to6).Expand(to7);
} }
/// <summary> /// <summary>
@ -513,7 +513,7 @@ namespace Godot
/// <returns>The transformed Plane.</returns> /// <returns>The transformed Plane.</returns>
public static Plane operator *(Transform3D transform, Plane plane) public static Plane operator *(Transform3D transform, Plane plane)
{ {
Basis bInvTrans = transform.basis.Inverse().Transposed(); Basis bInvTrans = transform.Basis.Inverse().Transposed();
// Transform a single point on the plane. // Transform a single point on the plane.
Vector3 point = transform * (plane.Normal * plane.D); Vector3 point = transform * (plane.Normal * plane.D);
@ -534,7 +534,7 @@ namespace Godot
public static Plane operator *(Plane plane, Transform3D transform) public static Plane operator *(Plane plane, Transform3D transform)
{ {
Transform3D tInv = transform.AffineInverse(); Transform3D tInv = transform.AffineInverse();
Basis bTrans = transform.basis.Transposed(); Basis bTrans = transform.Basis.Transposed();
// Transform a single point on the plane. // Transform a single point on the plane.
Vector3 point = tInv * (plane.Normal * plane.D); Vector3 point = tInv * (plane.Normal * plane.D);
@ -637,7 +637,7 @@ namespace Godot
/// <returns>Whether or not the matrices are exactly equal.</returns> /// <returns>Whether or not the matrices are exactly equal.</returns>
public readonly bool Equals(Transform3D other) public readonly bool Equals(Transform3D other)
{ {
return basis.Equals(other.basis) && origin.Equals(other.origin); return Basis.Equals(other.Basis) && Origin.Equals(other.Origin);
} }
/// <summary> /// <summary>
@ -648,7 +648,7 @@ namespace Godot
/// <returns>Whether or not the matrices are approximately equal.</returns> /// <returns>Whether or not the matrices are approximately equal.</returns>
public readonly bool IsEqualApprox(Transform3D other) public readonly bool IsEqualApprox(Transform3D other)
{ {
return basis.IsEqualApprox(other.basis) && origin.IsEqualApprox(other.origin); return Basis.IsEqualApprox(other.Basis) && Origin.IsEqualApprox(other.Origin);
} }
/// <summary> /// <summary>
@ -657,7 +657,7 @@ namespace Godot
/// <returns>A hash code for this transform.</returns> /// <returns>A hash code for this transform.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return basis.GetHashCode() ^ origin.GetHashCode(); return Basis.GetHashCode() ^ Origin.GetHashCode();
} }
/// <summary> /// <summary>
@ -666,7 +666,7 @@ namespace Godot
/// <returns>A string representation of this transform.</returns> /// <returns>A string representation of this transform.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"[X: {basis.x}, Y: {basis.y}, Z: {basis.z}, O: {origin}]"; return $"[X: {Basis.X}, Y: {Basis.Y}, Z: {Basis.Z}, O: {Origin}]";
} }
/// <summary> /// <summary>
@ -675,7 +675,7 @@ namespace Godot
/// <returns>A string representation of this transform.</returns> /// <returns>A string representation of this transform.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"[X: {basis.x.ToString(format)}, Y: {basis.y.ToString(format)}, Z: {basis.z.ToString(format)}, O: {origin.ToString(format)}]"; return $"[X: {Basis.X.ToString(format)}, Y: {Basis.Y.ToString(format)}, Z: {Basis.Z.ToString(format)}, O: {Origin.ToString(format)}]";
} }
} }
} }

View File

@ -60,13 +60,13 @@ public partial struct Variant : IDisposable
case Type.Int: case Type.Int:
case Type.Float: case Type.Float:
case Type.Vector2: case Type.Vector2:
case Type.Vector2i: case Type.Vector2I:
case Type.Rect2: case Type.Rect2:
case Type.Rect2i: case Type.Rect2I:
case Type.Vector3: case Type.Vector3:
case Type.Vector3i: case Type.Vector3I:
case Type.Vector4: case Type.Vector4:
case Type.Vector4i: case Type.Vector4I:
case Type.Plane: case Type.Plane:
case Type.Quaternion: case Type.Quaternion:
case Type.Color: case Type.Color:
@ -117,24 +117,24 @@ public partial struct Variant : IDisposable
Type.Float => AsDouble(), Type.Float => AsDouble(),
Type.String => AsString(), Type.String => AsString(),
Type.Vector2 => AsVector2(), Type.Vector2 => AsVector2(),
Type.Vector2i => AsVector2i(), Type.Vector2I => AsVector2I(),
Type.Rect2 => AsRect2(), Type.Rect2 => AsRect2(),
Type.Rect2i => AsRect2i(), Type.Rect2I => AsRect2I(),
Type.Vector3 => AsVector3(), Type.Vector3 => AsVector3(),
Type.Vector3i => AsVector3i(), Type.Vector3I => AsVector3I(),
Type.Transform2d => AsTransform2D(), Type.Transform2D => AsTransform2D(),
Type.Vector4 => AsVector4(), Type.Vector4 => AsVector4(),
Type.Vector4i => AsVector4i(), Type.Vector4I => AsVector4I(),
Type.Plane => AsPlane(), Type.Plane => AsPlane(),
Type.Quaternion => AsQuaternion(), Type.Quaternion => AsQuaternion(),
Type.Aabb => AsAABB(), Type.Aabb => AsAabb(),
Type.Basis => AsBasis(), Type.Basis => AsBasis(),
Type.Transform3d => AsTransform3D(), Type.Transform3D => AsTransform3D(),
Type.Projection => AsProjection(), Type.Projection => AsProjection(),
Type.Color => AsColor(), Type.Color => AsColor(),
Type.StringName => AsStringName(), Type.StringName => AsStringName(),
Type.NodePath => AsNodePath(), Type.NodePath => AsNodePath(),
Type.Rid => AsRID(), Type.Rid => AsRid(),
Type.Object => AsGodotObject(), Type.Object => AsGodotObject(),
Type.Callable => AsCallable(), Type.Callable => AsCallable(),
Type.Signal => AsSignal(), Type.Signal => AsSignal(),
@ -219,16 +219,16 @@ public partial struct Variant : IDisposable
VariantUtils.ConvertToVector2((godot_variant)NativeVar); VariantUtils.ConvertToVector2((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector2i AsVector2i() => public Vector2I AsVector2I() =>
VariantUtils.ConvertToVector2i((godot_variant)NativeVar); VariantUtils.ConvertToVector2I((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Rect2 AsRect2() => public Rect2 AsRect2() =>
VariantUtils.ConvertToRect2((godot_variant)NativeVar); VariantUtils.ConvertToRect2((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Rect2i AsRect2i() => public Rect2I AsRect2I() =>
VariantUtils.ConvertToRect2i((godot_variant)NativeVar); VariantUtils.ConvertToRect2I((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Transform2D AsTransform2D() => public Transform2D AsTransform2D() =>
@ -239,8 +239,8 @@ public partial struct Variant : IDisposable
VariantUtils.ConvertToVector3((godot_variant)NativeVar); VariantUtils.ConvertToVector3((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector3i AsVector3i() => public Vector3I AsVector3I() =>
VariantUtils.ConvertToVector3i((godot_variant)NativeVar); VariantUtils.ConvertToVector3I((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Basis AsBasis() => public Basis AsBasis() =>
@ -259,16 +259,16 @@ public partial struct Variant : IDisposable
VariantUtils.ConvertToVector4((godot_variant)NativeVar); VariantUtils.ConvertToVector4((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector4i AsVector4i() => public Vector4I AsVector4I() =>
VariantUtils.ConvertToVector4i((godot_variant)NativeVar); VariantUtils.ConvertToVector4I((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Projection AsProjection() => public Projection AsProjection() =>
VariantUtils.ConvertToProjection((godot_variant)NativeVar); VariantUtils.ConvertToProjection((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public AABB AsAABB() => public Aabb AsAabb() =>
VariantUtils.ConvertToAABB((godot_variant)NativeVar); VariantUtils.ConvertToAabb((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Color AsColor() => public Color AsColor() =>
@ -344,8 +344,8 @@ public partial struct Variant : IDisposable
VariantUtils.ConvertToSystemArrayOfNodePath((godot_variant)NativeVar); VariantUtils.ConvertToSystemArrayOfNodePath((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public RID[] AsSystemArrayOfRID() => public Rid[] AsSystemArrayOfRid() =>
VariantUtils.ConvertToSystemArrayOfRID((godot_variant)NativeVar); VariantUtils.ConvertToSystemArrayOfRid((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Godot.Object AsGodotObject() => public Godot.Object AsGodotObject() =>
@ -360,8 +360,8 @@ public partial struct Variant : IDisposable
VariantUtils.ConvertToNodePath((godot_variant)NativeVar); VariantUtils.ConvertToNodePath((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public RID AsRID() => public Rid AsRid() =>
VariantUtils.ConvertToRID((godot_variant)NativeVar); VariantUtils.ConvertToRid((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Collections.Dictionary AsGodotDictionary() => public Collections.Dictionary AsGodotDictionary() =>
@ -416,13 +416,13 @@ public partial struct Variant : IDisposable
public static explicit operator Vector2(Variant from) => from.AsVector2(); public static explicit operator Vector2(Variant from) => from.AsVector2();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Vector2i(Variant from) => from.AsVector2i(); public static explicit operator Vector2I(Variant from) => from.AsVector2I();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Rect2(Variant from) => from.AsRect2(); public static explicit operator Rect2(Variant from) => from.AsRect2();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Rect2i(Variant from) => from.AsRect2i(); public static explicit operator Rect2I(Variant from) => from.AsRect2I();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Transform2D(Variant from) => from.AsTransform2D(); public static explicit operator Transform2D(Variant from) => from.AsTransform2D();
@ -431,7 +431,7 @@ public partial struct Variant : IDisposable
public static explicit operator Vector3(Variant from) => from.AsVector3(); public static explicit operator Vector3(Variant from) => from.AsVector3();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Vector3i(Variant from) => from.AsVector3i(); public static explicit operator Vector3I(Variant from) => from.AsVector3I();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Basis(Variant from) => from.AsBasis(); public static explicit operator Basis(Variant from) => from.AsBasis();
@ -446,13 +446,13 @@ public partial struct Variant : IDisposable
public static explicit operator Vector4(Variant from) => from.AsVector4(); public static explicit operator Vector4(Variant from) => from.AsVector4();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Vector4i(Variant from) => from.AsVector4i(); public static explicit operator Vector4I(Variant from) => from.AsVector4I();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Projection(Variant from) => from.AsProjection(); public static explicit operator Projection(Variant from) => from.AsProjection();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator AABB(Variant from) => from.AsAABB(); public static explicit operator Aabb(Variant from) => from.AsAabb();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Color(Variant from) => from.AsColor(); public static explicit operator Color(Variant from) => from.AsColor();
@ -500,7 +500,7 @@ public partial struct Variant : IDisposable
public static explicit operator NodePath[](Variant from) => from.AsSystemArrayOfNodePath(); public static explicit operator NodePath[](Variant from) => from.AsSystemArrayOfNodePath();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator RID[](Variant from) => from.AsSystemArrayOfRID(); public static explicit operator Rid[](Variant from) => from.AsSystemArrayOfRid();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Godot.Object(Variant from) => from.AsGodotObject(); public static explicit operator Godot.Object(Variant from) => from.AsGodotObject();
@ -512,7 +512,7 @@ public partial struct Variant : IDisposable
public static explicit operator NodePath(Variant from) => from.AsNodePath(); public static explicit operator NodePath(Variant from) => from.AsNodePath();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator RID(Variant from) => from.AsRID(); public static explicit operator Rid(Variant from) => from.AsRid();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Collections.Dictionary(Variant from) => from.AsGodotDictionary(); public static explicit operator Collections.Dictionary(Variant from) => from.AsGodotDictionary();
@ -566,13 +566,13 @@ public partial struct Variant : IDisposable
public static Variant CreateFrom(Vector2 from) => from; public static Variant CreateFrom(Vector2 from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Vector2i from) => from; public static Variant CreateFrom(Vector2I from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Rect2 from) => from; public static Variant CreateFrom(Rect2 from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Rect2i from) => from; public static Variant CreateFrom(Rect2I from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Transform2D from) => from; public static Variant CreateFrom(Transform2D from) => from;
@ -581,7 +581,7 @@ public partial struct Variant : IDisposable
public static Variant CreateFrom(Vector3 from) => from; public static Variant CreateFrom(Vector3 from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Vector3i from) => from; public static Variant CreateFrom(Vector3I from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Basis from) => from; public static Variant CreateFrom(Basis from) => from;
@ -596,13 +596,13 @@ public partial struct Variant : IDisposable
public static Variant CreateFrom(Vector4 from) => from; public static Variant CreateFrom(Vector4 from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Vector4i from) => from; public static Variant CreateFrom(Vector4I from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Projection from) => from; public static Variant CreateFrom(Projection from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(AABB from) => from; public static Variant CreateFrom(Aabb from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Color from) => from; public static Variant CreateFrom(Color from) => from;
@ -661,7 +661,7 @@ public partial struct Variant : IDisposable
public static Variant CreateFrom(Span<NodePath> from) => from; public static Variant CreateFrom(Span<NodePath> from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Span<RID> from) => from; public static Variant CreateFrom(Span<Rid> from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Godot.Object from) => from; public static Variant CreateFrom(Godot.Object from) => from;
@ -673,7 +673,7 @@ public partial struct Variant : IDisposable
public static Variant CreateFrom(NodePath from) => from; public static Variant CreateFrom(NodePath from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(RID from) => from; public static Variant CreateFrom(Rid from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Collections.Dictionary from) => from; public static Variant CreateFrom(Collections.Dictionary from) => from;
@ -740,16 +740,16 @@ public partial struct Variant : IDisposable
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector2(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector2(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Vector2i from) => public static implicit operator Variant(Vector2I from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector2i(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector2I(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Rect2 from) => public static implicit operator Variant(Rect2 from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromRect2(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromRect2(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Rect2i from) => public static implicit operator Variant(Rect2I from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromRect2i(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromRect2I(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Transform2D from) => public static implicit operator Variant(Transform2D from) =>
@ -760,8 +760,8 @@ public partial struct Variant : IDisposable
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector3(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector3(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Vector3i from) => public static implicit operator Variant(Vector3I from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector3i(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector3I(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Basis from) => public static implicit operator Variant(Basis from) =>
@ -780,16 +780,16 @@ public partial struct Variant : IDisposable
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector4(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector4(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Vector4i from) => public static implicit operator Variant(Vector4I from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector4i(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector4I(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Projection from) => public static implicit operator Variant(Projection from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromProjection(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromProjection(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(AABB from) => public static implicit operator Variant(Aabb from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromAABB(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromAabb(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Color from) => public static implicit operator Variant(Color from) =>
@ -856,7 +856,7 @@ public partial struct Variant : IDisposable
(Variant)from.AsSpan(); (Variant)from.AsSpan();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(RID[] from) => public static implicit operator Variant(Rid[] from) =>
(Variant)from.AsSpan(); (Variant)from.AsSpan();
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -904,8 +904,8 @@ public partial struct Variant : IDisposable
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSystemArrayOfNodePath(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSystemArrayOfNodePath(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Span<RID> from) => public static implicit operator Variant(Span<Rid> from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSystemArrayOfRID(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSystemArrayOfRid(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Godot.Object from) => public static implicit operator Variant(Godot.Object from) =>
@ -920,8 +920,8 @@ public partial struct Variant : IDisposable
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromNodePath(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromNodePath(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(RID from) => public static implicit operator Variant(Rid from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromRID(from)); CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromRid(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Collections.Dictionary from) => public static implicit operator Variant(Collections.Dictionary from) =>

View File

@ -29,12 +29,12 @@ namespace Godot
/// <summary> /// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>. /// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary> /// </summary>
public real_t x; public real_t X;
/// <summary> /// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>. /// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary> /// </summary>
public real_t y; public real_t Y;
/// <summary> /// <summary>
/// Access vector components using their index. /// Access vector components using their index.
@ -43,8 +43,8 @@ namespace Godot
/// <paramref name="index"/> is not 0 or 1. /// <paramref name="index"/> is not 0 or 1.
/// </exception> /// </exception>
/// <value> /// <value>
/// <c>[0]</c> is equivalent to <see cref="x"/>, /// <c>[0]</c> is equivalent to <see cref="X"/>,
/// <c>[1]</c> is equivalent to <see cref="y"/>. /// <c>[1]</c> is equivalent to <see cref="Y"/>.
/// </value> /// </value>
public real_t this[int index] public real_t this[int index]
{ {
@ -53,9 +53,9 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
return x; return X;
case 1: case 1:
return y; return Y;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
} }
@ -65,10 +65,10 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
x = value; X = value;
return; return;
case 1: case 1:
y = value; Y = value;
return; return;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
@ -81,8 +81,8 @@ namespace Godot
/// </summary> /// </summary>
public readonly void Deconstruct(out real_t x, out real_t y) public readonly void Deconstruct(out real_t x, out real_t y)
{ {
x = this.x; x = X;
y = this.y; y = Y;
} }
internal void Normalize() internal void Normalize()
@ -91,13 +91,13 @@ namespace Godot
if (lengthsq == 0) if (lengthsq == 0)
{ {
x = y = 0f; X = Y = 0f;
} }
else else
{ {
real_t length = Mathf.Sqrt(lengthsq); real_t length = Mathf.Sqrt(lengthsq);
x /= length; X /= length;
y /= length; Y /= length;
} }
} }
@ -107,19 +107,19 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Abs(real_t)"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Abs(real_t)"/> called on each component.</returns>
public readonly Vector2 Abs() public readonly Vector2 Abs()
{ {
return new Vector2(Mathf.Abs(x), Mathf.Abs(y)); return new Vector2(Mathf.Abs(X), Mathf.Abs(Y));
} }
/// <summary> /// <summary>
/// Returns this vector's angle with respect to the X axis, or (1, 0) vector, in radians. /// Returns this vector's angle with respect to the X axis, or (1, 0) vector, in radians.
/// ///
/// Equivalent to the result of <see cref="Mathf.Atan2(real_t, real_t)"/> when /// Equivalent to the result of <see cref="Mathf.Atan2(real_t, real_t)"/> when
/// called with the vector's <see cref="y"/> and <see cref="x"/> as parameters: <c>Mathf.Atan2(v.y, v.x)</c>. /// called with the vector's <see cref="Y"/> and <see cref="X"/> as parameters: <c>Mathf.Atan2(v.Y, v.X)</c>.
/// </summary> /// </summary>
/// <returns>The angle of this vector, in radians.</returns> /// <returns>The angle of this vector, in radians.</returns>
public readonly real_t Angle() public readonly real_t Angle()
{ {
return Mathf.Atan2(y, x); return Mathf.Atan2(Y, X);
} }
/// <summary> /// <summary>
@ -139,16 +139,16 @@ namespace Godot
/// <returns>The angle between the two vectors, in radians.</returns> /// <returns>The angle between the two vectors, in radians.</returns>
public readonly real_t AngleToPoint(Vector2 to) public readonly real_t AngleToPoint(Vector2 to)
{ {
return Mathf.Atan2(to.y - y, to.x - x); return Mathf.Atan2(to.Y - Y, to.X - X);
} }
/// <summary> /// <summary>
/// Returns the aspect ratio of this vector, the ratio of <see cref="x"/> to <see cref="y"/>. /// Returns the aspect ratio of this vector, the ratio of <see cref="X"/> to <see cref="Y"/>.
/// </summary> /// </summary>
/// <returns>The <see cref="x"/> component divided by the <see cref="y"/> component.</returns> /// <returns>The <see cref="X"/> component divided by the <see cref="Y"/> component.</returns>
public readonly real_t Aspect() public readonly real_t Aspect()
{ {
return x / y; return X / Y;
} }
/// <summary> /// <summary>
@ -167,7 +167,7 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Ceil"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Ceil"/> called on each component.</returns>
public readonly Vector2 Ceil() public readonly Vector2 Ceil()
{ {
return new Vector2(Mathf.Ceil(x), Mathf.Ceil(y)); return new Vector2(Mathf.Ceil(X), Mathf.Ceil(Y));
} }
/// <summary> /// <summary>
@ -182,8 +182,8 @@ namespace Godot
{ {
return new Vector2 return new Vector2
( (
Mathf.Clamp(x, min.x, max.x), Mathf.Clamp(X, min.X, max.X),
Mathf.Clamp(y, min.y, max.y) Mathf.Clamp(Y, min.Y, max.Y)
); );
} }
@ -194,7 +194,7 @@ namespace Godot
/// <returns>The cross product value.</returns> /// <returns>The cross product value.</returns>
public readonly real_t Cross(Vector2 with) public readonly real_t Cross(Vector2 with)
{ {
return (x * with.y) - (y * with.x); return (X * with.Y) - (Y * with.X);
} }
/// <summary> /// <summary>
@ -210,8 +210,8 @@ namespace Godot
{ {
return new Vector2 return new Vector2
( (
Mathf.CubicInterpolate(x, b.x, preA.x, postB.x, weight), Mathf.CubicInterpolate(X, b.X, preA.X, postB.X, weight),
Mathf.CubicInterpolate(y, b.y, preA.y, postB.y, weight) Mathf.CubicInterpolate(Y, b.Y, preA.Y, postB.Y, weight)
); );
} }
@ -233,8 +233,8 @@ namespace Godot
{ {
return new Vector2 return new Vector2
( (
Mathf.CubicInterpolateInTime(x, b.x, preA.x, postB.x, weight, t, preAT, postBT), Mathf.CubicInterpolateInTime(X, b.X, preA.X, postB.X, weight, t, preAT, postBT),
Mathf.CubicInterpolateInTime(y, b.y, preA.y, postB.y, weight, t, preAT, postBT) Mathf.CubicInterpolateInTime(Y, b.Y, preA.Y, postB.Y, weight, t, preAT, postBT)
); );
} }
@ -251,8 +251,8 @@ namespace Godot
{ {
return new Vector2 return new Vector2
( (
Mathf.BezierInterpolate(x, control1.x, control2.x, end.x, t), Mathf.BezierInterpolate(X, control1.X, control2.X, end.X, t),
Mathf.BezierInterpolate(y, control1.y, control2.y, end.y, t) Mathf.BezierInterpolate(Y, control1.Y, control2.Y, end.Y, t)
); );
} }
@ -268,8 +268,8 @@ namespace Godot
public readonly Vector2 BezierDerivative(Vector2 control1, Vector2 control2, Vector2 end, real_t t) public readonly Vector2 BezierDerivative(Vector2 control1, Vector2 control2, Vector2 end, real_t t)
{ {
return new Vector2( return new Vector2(
Mathf.BezierDerivative(x, control1.x, control2.x, end.x, t), Mathf.BezierDerivative(X, control1.X, control2.X, end.X, t),
Mathf.BezierDerivative(y, control1.y, control2.y, end.y, t) Mathf.BezierDerivative(Y, control1.Y, control2.Y, end.Y, t)
); );
} }
@ -280,7 +280,7 @@ namespace Godot
/// <returns>The direction from this vector to <paramref name="to"/>.</returns> /// <returns>The direction from this vector to <paramref name="to"/>.</returns>
public readonly Vector2 DirectionTo(Vector2 to) public readonly Vector2 DirectionTo(Vector2 to)
{ {
return new Vector2(to.x - x, to.y - y).Normalized(); return new Vector2(to.X - X, to.Y - Y).Normalized();
} }
/// <summary> /// <summary>
@ -292,7 +292,7 @@ namespace Godot
/// <returns>The squared distance between the two vectors.</returns> /// <returns>The squared distance between the two vectors.</returns>
public readonly real_t DistanceSquaredTo(Vector2 to) public readonly real_t DistanceSquaredTo(Vector2 to)
{ {
return (x - to.x) * (x - to.x) + (y - to.y) * (y - to.y); return (X - to.X) * (X - to.X) + (Y - to.Y) * (Y - to.Y);
} }
/// <summary> /// <summary>
@ -302,7 +302,7 @@ namespace Godot
/// <returns>The distance between the two vectors.</returns> /// <returns>The distance between the two vectors.</returns>
public readonly real_t DistanceTo(Vector2 to) public readonly real_t DistanceTo(Vector2 to)
{ {
return Mathf.Sqrt((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y)); return Mathf.Sqrt((X - to.X) * (X - to.X) + (Y - to.Y) * (Y - to.Y));
} }
/// <summary> /// <summary>
@ -312,7 +312,7 @@ namespace Godot
/// <returns>The dot product of the two vectors.</returns> /// <returns>The dot product of the two vectors.</returns>
public readonly real_t Dot(Vector2 with) public readonly real_t Dot(Vector2 with)
{ {
return (x * with.x) + (y * with.y); return (X * with.X) + (Y * with.Y);
} }
/// <summary> /// <summary>
@ -321,16 +321,16 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Floor"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Floor"/> called on each component.</returns>
public readonly Vector2 Floor() public readonly Vector2 Floor()
{ {
return new Vector2(Mathf.Floor(x), Mathf.Floor(y)); return new Vector2(Mathf.Floor(X), Mathf.Floor(Y));
} }
/// <summary> /// <summary>
/// Returns the inverse of this vector. This is the same as <c>new Vector2(1 / v.x, 1 / v.y)</c>. /// Returns the inverse of this vector. This is the same as <c>new Vector2(1 / v.X, 1 / v.Y)</c>.
/// </summary> /// </summary>
/// <returns>The inverse of this vector.</returns> /// <returns>The inverse of this vector.</returns>
public readonly Vector2 Inverse() public readonly Vector2 Inverse()
{ {
return new Vector2(1 / x, 1 / y); return new Vector2(1 / X, 1 / Y);
} }
/// <summary> /// <summary>
@ -340,7 +340,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns> /// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite() public readonly bool IsFinite()
{ {
return Mathf.IsFinite(x) && Mathf.IsFinite(y); return Mathf.IsFinite(X) && Mathf.IsFinite(Y);
} }
/// <summary> /// <summary>
@ -359,7 +359,7 @@ namespace Godot
/// <returns>The length of this vector.</returns> /// <returns>The length of this vector.</returns>
public readonly real_t Length() public readonly real_t Length()
{ {
return Mathf.Sqrt((x * x) + (y * y)); return Mathf.Sqrt((X * X) + (Y * Y));
} }
/// <summary> /// <summary>
@ -370,7 +370,7 @@ namespace Godot
/// <returns>The squared length of this vector.</returns> /// <returns>The squared length of this vector.</returns>
public readonly real_t LengthSquared() public readonly real_t LengthSquared()
{ {
return (x * x) + (y * y); return (X * X) + (Y * Y);
} }
/// <summary> /// <summary>
@ -384,8 +384,8 @@ namespace Godot
{ {
return new Vector2 return new Vector2
( (
Mathf.Lerp(x, to.x, weight), Mathf.Lerp(X, to.X, weight),
Mathf.Lerp(y, to.y, weight) Mathf.Lerp(Y, to.Y, weight)
); );
} }
@ -415,7 +415,7 @@ namespace Godot
/// <returns>The index of the highest axis.</returns> /// <returns>The index of the highest axis.</returns>
public readonly Axis MaxAxisIndex() public readonly Axis MaxAxisIndex()
{ {
return x < y ? Axis.Y : Axis.X; return X < Y ? Axis.Y : Axis.X;
} }
/// <summary> /// <summary>
@ -425,7 +425,7 @@ namespace Godot
/// <returns>The index of the lowest axis.</returns> /// <returns>The index of the lowest axis.</returns>
public readonly Axis MinAxisIndex() public readonly Axis MinAxisIndex()
{ {
return x < y ? Axis.X : Axis.Y; return X < Y ? Axis.X : Axis.Y;
} }
/// <summary> /// <summary>
@ -467,8 +467,8 @@ namespace Godot
public readonly Vector2 PosMod(real_t mod) public readonly Vector2 PosMod(real_t mod)
{ {
Vector2 v; Vector2 v;
v.x = Mathf.PosMod(x, mod); v.X = Mathf.PosMod(X, mod);
v.y = Mathf.PosMod(y, mod); v.Y = Mathf.PosMod(Y, mod);
return v; return v;
} }
@ -483,8 +483,8 @@ namespace Godot
public readonly Vector2 PosMod(Vector2 modv) public readonly Vector2 PosMod(Vector2 modv)
{ {
Vector2 v; Vector2 v;
v.x = Mathf.PosMod(x, modv.x); v.X = Mathf.PosMod(X, modv.X);
v.y = Mathf.PosMod(y, modv.y); v.Y = Mathf.PosMod(Y, modv.Y);
return v; return v;
} }
@ -524,8 +524,8 @@ namespace Godot
(real_t sin, real_t cos) = Mathf.SinCos(angle); (real_t sin, real_t cos) = Mathf.SinCos(angle);
return new Vector2 return new Vector2
( (
x * cos - y * sin, X * cos - Y * sin,
x * sin + y * cos X * sin + Y * cos
); );
} }
@ -536,7 +536,7 @@ namespace Godot
/// <returns>The rounded vector.</returns> /// <returns>The rounded vector.</returns>
public readonly Vector2 Round() public readonly Vector2 Round()
{ {
return new Vector2(Mathf.Round(x), Mathf.Round(y)); return new Vector2(Mathf.Round(X), Mathf.Round(Y));
} }
/// <summary> /// <summary>
@ -548,8 +548,8 @@ namespace Godot
public readonly Vector2 Sign() public readonly Vector2 Sign()
{ {
Vector2 v; Vector2 v;
v.x = Mathf.Sign(x); v.X = Mathf.Sign(X);
v.y = Mathf.Sign(y); v.Y = Mathf.Sign(Y);
return v; return v;
} }
@ -597,7 +597,7 @@ namespace Godot
/// <returns>The snapped vector.</returns> /// <returns>The snapped vector.</returns>
public readonly Vector2 Snapped(Vector2 step) public readonly Vector2 Snapped(Vector2 step)
{ {
return new Vector2(Mathf.Snapped(x, step.x), Mathf.Snapped(y, step.y)); return new Vector2(Mathf.Snapped(X, step.X), Mathf.Snapped(Y, step.Y));
} }
/// <summary> /// <summary>
@ -607,7 +607,7 @@ namespace Godot
/// <returns>The perpendicular vector.</returns> /// <returns>The perpendicular vector.</returns>
public readonly Vector2 Orthogonal() public readonly Vector2 Orthogonal()
{ {
return new Vector2(y, -x); return new Vector2(Y, -X);
} }
// Constants // Constants
@ -664,8 +664,8 @@ namespace Godot
/// <param name="y">The vector's Y component.</param> /// <param name="y">The vector's Y component.</param>
public Vector2(real_t x, real_t y) public Vector2(real_t x, real_t y)
{ {
this.x = x; X = x;
this.y = y; Y = y;
} }
/// <summary> /// <summary>
@ -689,8 +689,8 @@ namespace Godot
/// <returns>The added vector.</returns> /// <returns>The added vector.</returns>
public static Vector2 operator +(Vector2 left, Vector2 right) public static Vector2 operator +(Vector2 left, Vector2 right)
{ {
left.x += right.x; left.X += right.X;
left.y += right.y; left.Y += right.Y;
return left; return left;
} }
@ -703,14 +703,14 @@ namespace Godot
/// <returns>The subtracted vector.</returns> /// <returns>The subtracted vector.</returns>
public static Vector2 operator -(Vector2 left, Vector2 right) public static Vector2 operator -(Vector2 left, Vector2 right)
{ {
left.x -= right.x; left.X -= right.X;
left.y -= right.y; left.Y -= right.Y;
return left; return left;
} }
/// <summary> /// <summary>
/// Returns the negative value of the <see cref="Vector2"/>. /// Returns the negative value of the <see cref="Vector2"/>.
/// This is the same as writing <c>new Vector2(-v.x, -v.y)</c>. /// This is the same as writing <c>new Vector2(-v.X, -v.Y)</c>.
/// This operation flips the direction of the vector while /// This operation flips the direction of the vector while
/// keeping the same magnitude. /// keeping the same magnitude.
/// With floats, the number zero can be either positive or negative. /// With floats, the number zero can be either positive or negative.
@ -719,8 +719,8 @@ namespace Godot
/// <returns>The negated/flipped vector.</returns> /// <returns>The negated/flipped vector.</returns>
public static Vector2 operator -(Vector2 vec) public static Vector2 operator -(Vector2 vec)
{ {
vec.x = -vec.x; vec.X = -vec.X;
vec.y = -vec.y; vec.Y = -vec.Y;
return vec; return vec;
} }
@ -733,8 +733,8 @@ namespace Godot
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector2 operator *(Vector2 vec, real_t scale) public static Vector2 operator *(Vector2 vec, real_t scale)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
return vec; return vec;
} }
@ -747,8 +747,8 @@ namespace Godot
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector2 operator *(real_t scale, Vector2 vec) public static Vector2 operator *(real_t scale, Vector2 vec)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
return vec; return vec;
} }
@ -761,8 +761,8 @@ namespace Godot
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector2 operator *(Vector2 left, Vector2 right) public static Vector2 operator *(Vector2 left, Vector2 right)
{ {
left.x *= right.x; left.X *= right.X;
left.y *= right.y; left.Y *= right.Y;
return left; return left;
} }
@ -775,8 +775,8 @@ namespace Godot
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector2 operator /(Vector2 vec, real_t divisor) public static Vector2 operator /(Vector2 vec, real_t divisor)
{ {
vec.x /= divisor; vec.X /= divisor;
vec.y /= divisor; vec.Y /= divisor;
return vec; return vec;
} }
@ -789,8 +789,8 @@ namespace Godot
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector2 operator /(Vector2 vec, Vector2 divisorv) public static Vector2 operator /(Vector2 vec, Vector2 divisorv)
{ {
vec.x /= divisorv.x; vec.X /= divisorv.X;
vec.y /= divisorv.y; vec.Y /= divisorv.Y;
return vec; return vec;
} }
@ -812,8 +812,8 @@ namespace Godot
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector2 operator %(Vector2 vec, real_t divisor) public static Vector2 operator %(Vector2 vec, real_t divisor)
{ {
vec.x %= divisor; vec.X %= divisor;
vec.y %= divisor; vec.Y %= divisor;
return vec; return vec;
} }
@ -835,8 +835,8 @@ namespace Godot
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector2 operator %(Vector2 vec, Vector2 divisorv) public static Vector2 operator %(Vector2 vec, Vector2 divisorv)
{ {
vec.x %= divisorv.x; vec.X %= divisorv.X;
vec.y %= divisorv.y; vec.Y %= divisorv.Y;
return vec; return vec;
} }
@ -879,11 +879,11 @@ namespace Godot
/// <returns>Whether or not the left is less than the right.</returns> /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector2 left, Vector2 right) public static bool operator <(Vector2 left, Vector2 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
return left.y < right.y; return left.Y < right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
@ -899,11 +899,11 @@ namespace Godot
/// <returns>Whether or not the left is greater than the right.</returns> /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector2 left, Vector2 right) public static bool operator >(Vector2 left, Vector2 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
return left.y > right.y; return left.Y > right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
@ -919,11 +919,11 @@ namespace Godot
/// <returns>Whether or not the left is less than or equal to the right.</returns> /// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector2 left, Vector2 right) public static bool operator <=(Vector2 left, Vector2 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
return left.y <= right.y; return left.Y <= right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
@ -939,11 +939,11 @@ namespace Godot
/// <returns>Whether or not the left is greater than or equal to the right.</returns> /// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector2 left, Vector2 right) public static bool operator >=(Vector2 left, Vector2 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
return left.y >= right.y; return left.Y >= right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
@ -968,7 +968,7 @@ namespace Godot
/// <returns>Whether or not the vectors are exactly equal.</returns> /// <returns>Whether or not the vectors are exactly equal.</returns>
public readonly bool Equals(Vector2 other) public readonly bool Equals(Vector2 other)
{ {
return x == other.x && y == other.y; return X == other.X && Y == other.Y;
} }
/// <summary> /// <summary>
@ -979,7 +979,7 @@ namespace Godot
/// <returns>Whether or not the vectors are approximately equal.</returns> /// <returns>Whether or not the vectors are approximately equal.</returns>
public readonly bool IsEqualApprox(Vector2 other) public readonly bool IsEqualApprox(Vector2 other)
{ {
return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y); return Mathf.IsEqualApprox(X, other.X) && Mathf.IsEqualApprox(Y, other.Y);
} }
/// <summary> /// <summary>
@ -991,7 +991,7 @@ namespace Godot
/// <returns>Whether or not the vector is approximately zero.</returns> /// <returns>Whether or not the vector is approximately zero.</returns>
public readonly bool IsZeroApprox() public readonly bool IsZeroApprox()
{ {
return Mathf.IsZeroApprox(x) && Mathf.IsZeroApprox(y); return Mathf.IsZeroApprox(X) && Mathf.IsZeroApprox(Y);
} }
/// <summary> /// <summary>
@ -1000,7 +1000,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return y.GetHashCode() ^ x.GetHashCode(); return Y.GetHashCode() ^ X.GetHashCode();
} }
/// <summary> /// <summary>
@ -1009,7 +1009,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"({x}, {y})"; return $"({X}, {Y})";
} }
/// <summary> /// <summary>
@ -1018,7 +1018,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"({x.ToString(format)}, {y.ToString(format)})"; return $"({X.ToString(format)}, {Y.ToString(format)})";
} }
} }
} }

View File

@ -8,7 +8,7 @@ namespace Godot
/// </summary> /// </summary>
[Serializable] [Serializable]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Vector2i : IEquatable<Vector2i> public struct Vector2I : IEquatable<Vector2I>
{ {
/// <summary> /// <summary>
/// Enumerated index values for the axes. /// Enumerated index values for the axes.
@ -29,12 +29,12 @@ namespace Godot
/// <summary> /// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>. /// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary> /// </summary>
public int x; public int X;
/// <summary> /// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>. /// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary> /// </summary>
public int y; public int Y;
/// <summary> /// <summary>
/// Access vector components using their index. /// Access vector components using their index.
@ -43,8 +43,8 @@ namespace Godot
/// <paramref name="index"/> is not 0 or 1. /// <paramref name="index"/> is not 0 or 1.
/// </exception> /// </exception>
/// <value> /// <value>
/// <c>[0]</c> is equivalent to <see cref="x"/>, /// <c>[0]</c> is equivalent to <see cref="X"/>,
/// <c>[1]</c> is equivalent to <see cref="y"/>. /// <c>[1]</c> is equivalent to <see cref="Y"/>.
/// </value> /// </value>
public int this[int index] public int this[int index]
{ {
@ -53,9 +53,9 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
return x; return X;
case 1: case 1:
return y; return Y;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
} }
@ -65,10 +65,10 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
x = value; X = value;
return; return;
case 1: case 1:
y = value; Y = value;
return; return;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
@ -81,26 +81,26 @@ namespace Godot
/// </summary> /// </summary>
public readonly void Deconstruct(out int x, out int y) public readonly void Deconstruct(out int x, out int y)
{ {
x = this.x; x = X;
y = this.y; y = Y;
} }
/// <summary> /// <summary>
/// Returns a new vector with all components in absolute values (i.e. positive). /// Returns a new vector with all components in absolute values (i.e. positive).
/// </summary> /// </summary>
/// <returns>A vector with <see cref="Mathf.Abs(int)"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Abs(int)"/> called on each component.</returns>
public readonly Vector2i Abs() public readonly Vector2I Abs()
{ {
return new Vector2i(Mathf.Abs(x), Mathf.Abs(y)); return new Vector2I(Mathf.Abs(X), Mathf.Abs(Y));
} }
/// <summary> /// <summary>
/// Returns the aspect ratio of this vector, the ratio of <see cref="x"/> to <see cref="y"/>. /// Returns the aspect ratio of this vector, the ratio of <see cref="X"/> to <see cref="Y"/>.
/// </summary> /// </summary>
/// <returns>The <see cref="x"/> component divided by the <see cref="y"/> component.</returns> /// <returns>The <see cref="X"/> component divided by the <see cref="Y"/> component.</returns>
public readonly real_t Aspect() public readonly real_t Aspect()
{ {
return x / (real_t)y; return X / (real_t)Y;
} }
/// <summary> /// <summary>
@ -111,12 +111,12 @@ namespace Godot
/// <param name="min">The vector with minimum allowed values.</param> /// <param name="min">The vector with minimum allowed values.</param>
/// <param name="max">The vector with maximum allowed values.</param> /// <param name="max">The vector with maximum allowed values.</param>
/// <returns>The vector with all components clamped.</returns> /// <returns>The vector with all components clamped.</returns>
public readonly Vector2i Clamp(Vector2i min, Vector2i max) public readonly Vector2I Clamp(Vector2I min, Vector2I max)
{ {
return new Vector2i return new Vector2I
( (
Mathf.Clamp(x, min.x, max.x), Mathf.Clamp(X, min.X, max.X),
Mathf.Clamp(y, min.y, max.y) Mathf.Clamp(Y, min.Y, max.Y)
); );
} }
@ -127,8 +127,8 @@ namespace Godot
/// <returns>The length of this vector.</returns> /// <returns>The length of this vector.</returns>
public readonly real_t Length() public readonly real_t Length()
{ {
int x2 = x * x; int x2 = X * X;
int y2 = y * y; int y2 = Y * Y;
return Mathf.Sqrt(x2 + y2); return Mathf.Sqrt(x2 + y2);
} }
@ -141,8 +141,8 @@ namespace Godot
/// <returns>The squared length of this vector.</returns> /// <returns>The squared length of this vector.</returns>
public readonly int LengthSquared() public readonly int LengthSquared()
{ {
int x2 = x * x; int x2 = X * X;
int y2 = y * y; int y2 = Y * Y;
return x2 + y2; return x2 + y2;
} }
@ -154,7 +154,7 @@ namespace Godot
/// <returns>The index of the highest axis.</returns> /// <returns>The index of the highest axis.</returns>
public readonly Axis MaxAxisIndex() public readonly Axis MaxAxisIndex()
{ {
return x < y ? Axis.Y : Axis.X; return X < Y ? Axis.Y : Axis.X;
} }
/// <summary> /// <summary>
@ -164,7 +164,7 @@ namespace Godot
/// <returns>The index of the lowest axis.</returns> /// <returns>The index of the lowest axis.</returns>
public readonly Axis MinAxisIndex() public readonly Axis MinAxisIndex()
{ {
return x < y ? Axis.X : Axis.Y; return X < Y ? Axis.X : Axis.Y;
} }
/// <summary> /// <summary>
@ -173,181 +173,181 @@ namespace Godot
/// by calling <see cref="Mathf.Sign(int)"/> on each component. /// by calling <see cref="Mathf.Sign(int)"/> on each component.
/// </summary> /// </summary>
/// <returns>A vector with all components as either <c>1</c>, <c>-1</c>, or <c>0</c>.</returns> /// <returns>A vector with all components as either <c>1</c>, <c>-1</c>, or <c>0</c>.</returns>
public readonly Vector2i Sign() public readonly Vector2I Sign()
{ {
Vector2i v = this; Vector2I v = this;
v.x = Mathf.Sign(v.x); v.X = Mathf.Sign(v.X);
v.y = Mathf.Sign(v.y); v.Y = Mathf.Sign(v.Y);
return v; return v;
} }
// Constants // Constants
private static readonly Vector2i _zero = new Vector2i(0, 0); private static readonly Vector2I _zero = new Vector2I(0, 0);
private static readonly Vector2i _one = new Vector2i(1, 1); private static readonly Vector2I _one = new Vector2I(1, 1);
private static readonly Vector2i _up = new Vector2i(0, -1); private static readonly Vector2I _up = new Vector2I(0, -1);
private static readonly Vector2i _down = new Vector2i(0, 1); private static readonly Vector2I _down = new Vector2I(0, 1);
private static readonly Vector2i _right = new Vector2i(1, 0); private static readonly Vector2I _right = new Vector2I(1, 0);
private static readonly Vector2i _left = new Vector2i(-1, 0); private static readonly Vector2I _left = new Vector2I(-1, 0);
/// <summary> /// <summary>
/// Zero vector, a vector with all components set to <c>0</c>. /// Zero vector, a vector with all components set to <c>0</c>.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector2i(0, 0)</c>.</value> /// <value>Equivalent to <c>new Vector2I(0, 0)</c>.</value>
public static Vector2i Zero { get { return _zero; } } public static Vector2I Zero { get { return _zero; } }
/// <summary> /// <summary>
/// One vector, a vector with all components set to <c>1</c>. /// One vector, a vector with all components set to <c>1</c>.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector2i(1, 1)</c>.</value> /// <value>Equivalent to <c>new Vector2I(1, 1)</c>.</value>
public static Vector2i One { get { return _one; } } public static Vector2I One { get { return _one; } }
/// <summary> /// <summary>
/// Up unit vector. Y is down in 2D, so this vector points -Y. /// Up unit vector. Y is down in 2D, so this vector points -Y.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector2i(0, -1)</c>.</value> /// <value>Equivalent to <c>new Vector2I(0, -1)</c>.</value>
public static Vector2i Up { get { return _up; } } public static Vector2I Up { get { return _up; } }
/// <summary> /// <summary>
/// Down unit vector. Y is down in 2D, so this vector points +Y. /// Down unit vector. Y is down in 2D, so this vector points +Y.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector2i(0, 1)</c>.</value> /// <value>Equivalent to <c>new Vector2I(0, 1)</c>.</value>
public static Vector2i Down { get { return _down; } } public static Vector2I Down { get { return _down; } }
/// <summary> /// <summary>
/// Right unit vector. Represents the direction of right. /// Right unit vector. Represents the direction of right.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector2i(1, 0)</c>.</value> /// <value>Equivalent to <c>new Vector2I(1, 0)</c>.</value>
public static Vector2i Right { get { return _right; } } public static Vector2I Right { get { return _right; } }
/// <summary> /// <summary>
/// Left unit vector. Represents the direction of left. /// Left unit vector. Represents the direction of left.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector2i(-1, 0)</c>.</value> /// <value>Equivalent to <c>new Vector2I(-1, 0)</c>.</value>
public static Vector2i Left { get { return _left; } } public static Vector2I Left { get { return _left; } }
/// <summary> /// <summary>
/// Constructs a new <see cref="Vector2i"/> with the given components. /// Constructs a new <see cref="Vector2I"/> with the given components.
/// </summary> /// </summary>
/// <param name="x">The vector's X component.</param> /// <param name="x">The vector's X component.</param>
/// <param name="y">The vector's Y component.</param> /// <param name="y">The vector's Y component.</param>
public Vector2i(int x, int y) public Vector2I(int x, int y)
{ {
this.x = x; X = x;
this.y = y; Y = y;
} }
/// <summary> /// <summary>
/// Adds each component of the <see cref="Vector2i"/> /// Adds each component of the <see cref="Vector2I"/>
/// with the components of the given <see cref="Vector2i"/>. /// with the components of the given <see cref="Vector2I"/>.
/// </summary> /// </summary>
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>The added vector.</returns> /// <returns>The added vector.</returns>
public static Vector2i operator +(Vector2i left, Vector2i right) public static Vector2I operator +(Vector2I left, Vector2I right)
{ {
left.x += right.x; left.X += right.X;
left.y += right.y; left.Y += right.Y;
return left; return left;
} }
/// <summary> /// <summary>
/// Subtracts each component of the <see cref="Vector2i"/> /// Subtracts each component of the <see cref="Vector2I"/>
/// by the components of the given <see cref="Vector2i"/>. /// by the components of the given <see cref="Vector2I"/>.
/// </summary> /// </summary>
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>The subtracted vector.</returns> /// <returns>The subtracted vector.</returns>
public static Vector2i operator -(Vector2i left, Vector2i right) public static Vector2I operator -(Vector2I left, Vector2I right)
{ {
left.x -= right.x; left.X -= right.X;
left.y -= right.y; left.Y -= right.Y;
return left; return left;
} }
/// <summary> /// <summary>
/// Returns the negative value of the <see cref="Vector2i"/>. /// Returns the negative value of the <see cref="Vector2I"/>.
/// This is the same as writing <c>new Vector2i(-v.x, -v.y)</c>. /// This is the same as writing <c>new Vector2I(-v.X, -v.Y)</c>.
/// This operation flips the direction of the vector while /// This operation flips the direction of the vector while
/// keeping the same magnitude. /// keeping the same magnitude.
/// </summary> /// </summary>
/// <param name="vec">The vector to negate/flip.</param> /// <param name="vec">The vector to negate/flip.</param>
/// <returns>The negated/flipped vector.</returns> /// <returns>The negated/flipped vector.</returns>
public static Vector2i operator -(Vector2i vec) public static Vector2I operator -(Vector2I vec)
{ {
vec.x = -vec.x; vec.X = -vec.X;
vec.y = -vec.y; vec.Y = -vec.Y;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Multiplies each component of the <see cref="Vector2i"/> /// Multiplies each component of the <see cref="Vector2I"/>
/// by the given <see langword="int"/>. /// by the given <see langword="int"/>.
/// </summary> /// </summary>
/// <param name="vec">The vector to multiply.</param> /// <param name="vec">The vector to multiply.</param>
/// <param name="scale">The scale to multiply by.</param> /// <param name="scale">The scale to multiply by.</param>
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector2i operator *(Vector2i vec, int scale) public static Vector2I operator *(Vector2I vec, int scale)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Multiplies each component of the <see cref="Vector2i"/> /// Multiplies each component of the <see cref="Vector2I"/>
/// by the given <see langword="int"/>. /// by the given <see langword="int"/>.
/// </summary> /// </summary>
/// <param name="scale">The scale to multiply by.</param> /// <param name="scale">The scale to multiply by.</param>
/// <param name="vec">The vector to multiply.</param> /// <param name="vec">The vector to multiply.</param>
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector2i operator *(int scale, Vector2i vec) public static Vector2I operator *(int scale, Vector2I vec)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Multiplies each component of the <see cref="Vector2i"/> /// Multiplies each component of the <see cref="Vector2I"/>
/// by the components of the given <see cref="Vector2i"/>. /// by the components of the given <see cref="Vector2I"/>.
/// </summary> /// </summary>
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector2i operator *(Vector2i left, Vector2i right) public static Vector2I operator *(Vector2I left, Vector2I right)
{ {
left.x *= right.x; left.X *= right.X;
left.y *= right.y; left.Y *= right.Y;
return left; return left;
} }
/// <summary> /// <summary>
/// Divides each component of the <see cref="Vector2i"/> /// Divides each component of the <see cref="Vector2I"/>
/// by the given <see langword="int"/>. /// by the given <see langword="int"/>.
/// </summary> /// </summary>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param> /// <param name="divisor">The divisor value.</param>
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector2i operator /(Vector2i vec, int divisor) public static Vector2I operator /(Vector2I vec, int divisor)
{ {
vec.x /= divisor; vec.X /= divisor;
vec.y /= divisor; vec.Y /= divisor;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Divides each component of the <see cref="Vector2i"/> /// Divides each component of the <see cref="Vector2I"/>
/// by the components of the given <see cref="Vector2i"/>. /// by the components of the given <see cref="Vector2I"/>.
/// </summary> /// </summary>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param> /// <param name="divisorv">The divisor vector.</param>
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector2i operator /(Vector2i vec, Vector2i divisorv) public static Vector2I operator /(Vector2I vec, Vector2I divisorv)
{ {
vec.x /= divisorv.x; vec.X /= divisorv.X;
vec.y /= divisorv.y; vec.Y /= divisorv.Y;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Gets the remainder of each component of the <see cref="Vector2i"/> /// Gets the remainder of each component of the <see cref="Vector2I"/>
/// with the components of the given <see langword="int"/>. /// with the components of the given <see langword="int"/>.
/// This operation uses truncated division, which is often not desired /// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers. /// as it does not work well with negative numbers.
@ -356,22 +356,22 @@ namespace Godot
/// </summary> /// </summary>
/// <example> /// <example>
/// <code> /// <code>
/// GD.Print(new Vector2i(10, -20) % 7); // Prints "(3, -6)" /// GD.Print(new Vector2I(10, -20) % 7); // Prints "(3, -6)"
/// </code> /// </code>
/// </example> /// </example>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param> /// <param name="divisor">The divisor value.</param>
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector2i operator %(Vector2i vec, int divisor) public static Vector2I operator %(Vector2I vec, int divisor)
{ {
vec.x %= divisor; vec.X %= divisor;
vec.y %= divisor; vec.Y %= divisor;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Gets the remainder of each component of the <see cref="Vector2i"/> /// Gets the remainder of each component of the <see cref="Vector2I"/>
/// with the components of the given <see cref="Vector2i"/>. /// with the components of the given <see cref="Vector2I"/>.
/// This operation uses truncated division, which is often not desired /// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers. /// as it does not work well with negative numbers.
/// Consider using <see cref="Mathf.PosMod(int, int)"/> instead /// Consider using <see cref="Mathf.PosMod(int, int)"/> instead
@ -379,16 +379,16 @@ namespace Godot
/// </summary> /// </summary>
/// <example> /// <example>
/// <code> /// <code>
/// GD.Print(new Vector2i(10, -20) % new Vector2i(7, 8)); // Prints "(3, -4)" /// GD.Print(new Vector2I(10, -20) % new Vector2I(7, 8)); // Prints "(3, -4)"
/// </code> /// </code>
/// </example> /// </example>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param> /// <param name="divisorv">The divisor vector.</param>
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector2i operator %(Vector2i vec, Vector2i divisorv) public static Vector2I operator %(Vector2I vec, Vector2I divisorv)
{ {
vec.x %= divisorv.x; vec.X %= divisorv.X;
vec.y %= divisorv.y; vec.Y %= divisorv.Y;
return vec; return vec;
} }
@ -398,7 +398,7 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are equal.</returns> /// <returns>Whether or not the vectors are equal.</returns>
public static bool operator ==(Vector2i left, Vector2i right) public static bool operator ==(Vector2I left, Vector2I right)
{ {
return left.Equals(right); return left.Equals(right);
} }
@ -409,13 +409,13 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are not equal.</returns> /// <returns>Whether or not the vectors are not equal.</returns>
public static bool operator !=(Vector2i left, Vector2i right) public static bool operator !=(Vector2I left, Vector2I right)
{ {
return !left.Equals(right); return !left.Equals(right);
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector2i"/> vectors by first checking if /// Compares two <see cref="Vector2I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than /// the X value of the <paramref name="left"/> vector is less than
/// the X value of the <paramref name="right"/> vector. /// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -425,17 +425,17 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than the right.</returns> /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector2i left, Vector2i right) public static bool operator <(Vector2I left, Vector2I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
return left.y < right.y; return left.Y < right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector2i"/> vectors by first checking if /// Compares two <see cref="Vector2I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than /// the X value of the <paramref name="left"/> vector is greater than
/// the X value of the <paramref name="right"/> vector. /// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -445,17 +445,17 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than the right.</returns> /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector2i left, Vector2i right) public static bool operator >(Vector2I left, Vector2I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
return left.y > right.y; return left.Y > right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector2i"/> vectors by first checking if /// Compares two <see cref="Vector2I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than /// the X value of the <paramref name="left"/> vector is less than
/// or equal to the X value of the <paramref name="right"/> vector. /// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -465,17 +465,17 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than or equal to the right.</returns> /// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector2i left, Vector2i right) public static bool operator <=(Vector2I left, Vector2I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
return left.y <= right.y; return left.Y <= right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector2i"/> vectors by first checking if /// Compares two <see cref="Vector2I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than /// the X value of the <paramref name="left"/> vector is greater than
/// or equal to the X value of the <paramref name="right"/> vector. /// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -485,33 +485,33 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than or equal to the right.</returns> /// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector2i left, Vector2i right) public static bool operator >=(Vector2I left, Vector2I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
return left.y >= right.y; return left.Y >= right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector2i"/> to a <see cref="Vector2"/>. /// Converts this <see cref="Vector2I"/> to a <see cref="Vector2"/>.
/// </summary> /// </summary>
/// <param name="value">The vector to convert.</param> /// <param name="value">The vector to convert.</param>
public static implicit operator Vector2(Vector2i value) public static implicit operator Vector2(Vector2I value)
{ {
return new Vector2(value.x, value.y); return new Vector2(value.X, value.Y);
} }
/// <summary> /// <summary>
/// Converts a <see cref="Vector2"/> to a <see cref="Vector2i"/>. /// Converts a <see cref="Vector2"/> to a <see cref="Vector2I"/>.
/// </summary> /// </summary>
/// <param name="value">The vector to convert.</param> /// <param name="value">The vector to convert.</param>
public static explicit operator Vector2i(Vector2 value) public static explicit operator Vector2I(Vector2 value)
{ {
return new Vector2i( return new Vector2I(
Mathf.RoundToInt(value.x), Mathf.RoundToInt(value.X),
Mathf.RoundToInt(value.y) Mathf.RoundToInt(value.Y)
); );
} }
@ -523,7 +523,7 @@ namespace Godot
/// <returns>Whether or not the vector and the object are equal.</returns> /// <returns>Whether or not the vector and the object are equal.</returns>
public override readonly bool Equals(object obj) public override readonly bool Equals(object obj)
{ {
return obj is Vector2i other && Equals(other); return obj is Vector2I other && Equals(other);
} }
/// <summary> /// <summary>
@ -531,36 +531,36 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="other">The other vector.</param> /// <param name="other">The other vector.</param>
/// <returns>Whether or not the vectors are equal.</returns> /// <returns>Whether or not the vectors are equal.</returns>
public readonly bool Equals(Vector2i other) public readonly bool Equals(Vector2I other)
{ {
return x == other.x && y == other.y; return X == other.X && Y == other.Y;
} }
/// <summary> /// <summary>
/// Serves as the hash function for <see cref="Vector2i"/>. /// Serves as the hash function for <see cref="Vector2I"/>.
/// </summary> /// </summary>
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return y.GetHashCode() ^ x.GetHashCode(); return Y.GetHashCode() ^ X.GetHashCode();
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector2i"/> to a string. /// Converts this <see cref="Vector2I"/> to a string.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"({x}, {y})"; return $"({X}, {Y})";
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector2i"/> to a string with the given <paramref name="format"/>. /// Converts this <see cref="Vector2I"/> to a string with the given <paramref name="format"/>.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"({x.ToString(format)}, {y.ToString(format)})"; return $"({X.ToString(format)}, {Y.ToString(format)})";
} }
} }
} }

View File

@ -33,17 +33,17 @@ namespace Godot
/// <summary> /// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>. /// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary> /// </summary>
public real_t x; public real_t X;
/// <summary> /// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>. /// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary> /// </summary>
public real_t y; public real_t Y;
/// <summary> /// <summary>
/// The vector's Z component. Also accessible by using the index position <c>[2]</c>. /// The vector's Z component. Also accessible by using the index position <c>[2]</c>.
/// </summary> /// </summary>
public real_t z; public real_t Z;
/// <summary> /// <summary>
/// Access vector components using their index. /// Access vector components using their index.
@ -52,9 +52,9 @@ namespace Godot
/// <paramref name="index"/> is not 0, 1 or 2. /// <paramref name="index"/> is not 0, 1 or 2.
/// </exception> /// </exception>
/// <value> /// <value>
/// <c>[0]</c> is equivalent to <see cref="x"/>, /// <c>[0]</c> is equivalent to <see cref="X"/>,
/// <c>[1]</c> is equivalent to <see cref="y"/>, /// <c>[1]</c> is equivalent to <see cref="Y"/>,
/// <c>[2]</c> is equivalent to <see cref="z"/>. /// <c>[2]</c> is equivalent to <see cref="Z"/>.
/// </value> /// </value>
public real_t this[int index] public real_t this[int index]
{ {
@ -63,11 +63,11 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
return x; return X;
case 1: case 1:
return y; return Y;
case 2: case 2:
return z; return Z;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
} }
@ -77,13 +77,13 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
x = value; X = value;
return; return;
case 1: case 1:
y = value; Y = value;
return; return;
case 2: case 2:
z = value; Z = value;
return; return;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
@ -96,9 +96,9 @@ namespace Godot
/// </summary> /// </summary>
public readonly void Deconstruct(out real_t x, out real_t y, out real_t z) public readonly void Deconstruct(out real_t x, out real_t y, out real_t z)
{ {
x = this.x; x = X;
y = this.y; y = Y;
z = this.z; z = Z;
} }
internal void Normalize() internal void Normalize()
@ -107,14 +107,14 @@ namespace Godot
if (lengthsq == 0) if (lengthsq == 0)
{ {
x = y = z = 0f; X = Y = Z = 0f;
} }
else else
{ {
real_t length = Mathf.Sqrt(lengthsq); real_t length = Mathf.Sqrt(lengthsq);
x /= length; X /= length;
y /= length; Y /= length;
z /= length; Z /= length;
} }
} }
@ -124,7 +124,7 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Abs(real_t)"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Abs(real_t)"/> called on each component.</returns>
public readonly Vector3 Abs() public readonly Vector3 Abs()
{ {
return new Vector3(Mathf.Abs(x), Mathf.Abs(y), Mathf.Abs(z)); return new Vector3(Mathf.Abs(X), Mathf.Abs(Y), Mathf.Abs(Z));
} }
/// <summary> /// <summary>
@ -153,7 +153,7 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Ceil"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Ceil"/> called on each component.</returns>
public readonly Vector3 Ceil() public readonly Vector3 Ceil()
{ {
return new Vector3(Mathf.Ceil(x), Mathf.Ceil(y), Mathf.Ceil(z)); return new Vector3(Mathf.Ceil(X), Mathf.Ceil(Y), Mathf.Ceil(Z));
} }
/// <summary> /// <summary>
@ -168,9 +168,9 @@ namespace Godot
{ {
return new Vector3 return new Vector3
( (
Mathf.Clamp(x, min.x, max.x), Mathf.Clamp(X, min.X, max.X),
Mathf.Clamp(y, min.y, max.y), Mathf.Clamp(Y, min.Y, max.Y),
Mathf.Clamp(z, min.z, max.z) Mathf.Clamp(Z, min.Z, max.Z)
); );
} }
@ -183,9 +183,9 @@ namespace Godot
{ {
return new Vector3 return new Vector3
( (
(y * with.z) - (z * with.y), (Y * with.Z) - (Z * with.Y),
(z * with.x) - (x * with.z), (Z * with.X) - (X * with.Z),
(x * with.y) - (y * with.x) (X * with.Y) - (Y * with.X)
); );
} }
@ -202,9 +202,9 @@ namespace Godot
{ {
return new Vector3 return new Vector3
( (
Mathf.CubicInterpolate(x, b.x, preA.x, postB.x, weight), Mathf.CubicInterpolate(X, b.X, preA.X, postB.X, weight),
Mathf.CubicInterpolate(y, b.y, preA.y, postB.y, weight), Mathf.CubicInterpolate(Y, b.Y, preA.Y, postB.Y, weight),
Mathf.CubicInterpolate(z, b.z, preA.z, postB.z, weight) Mathf.CubicInterpolate(Z, b.Z, preA.Z, postB.Z, weight)
); );
} }
@ -226,9 +226,9 @@ namespace Godot
{ {
return new Vector3 return new Vector3
( (
Mathf.CubicInterpolateInTime(x, b.x, preA.x, postB.x, weight, t, preAT, postBT), Mathf.CubicInterpolateInTime(X, b.X, preA.X, postB.X, weight, t, preAT, postBT),
Mathf.CubicInterpolateInTime(y, b.y, preA.y, postB.y, weight, t, preAT, postBT), Mathf.CubicInterpolateInTime(Y, b.Y, preA.Y, postB.Y, weight, t, preAT, postBT),
Mathf.CubicInterpolateInTime(z, b.z, preA.z, postB.z, weight, t, preAT, postBT) Mathf.CubicInterpolateInTime(Z, b.Z, preA.Z, postB.Z, weight, t, preAT, postBT)
); );
} }
@ -245,9 +245,9 @@ namespace Godot
{ {
return new Vector3 return new Vector3
( (
Mathf.BezierInterpolate(x, control1.x, control2.x, end.x, t), Mathf.BezierInterpolate(X, control1.X, control2.X, end.X, t),
Mathf.BezierInterpolate(y, control1.y, control2.y, end.y, t), Mathf.BezierInterpolate(Y, control1.Y, control2.Y, end.Y, t),
Mathf.BezierInterpolate(z, control1.z, control2.z, end.z, t) Mathf.BezierInterpolate(Z, control1.Z, control2.Z, end.Z, t)
); );
} }
@ -263,9 +263,9 @@ namespace Godot
public readonly Vector3 BezierDerivative(Vector3 control1, Vector3 control2, Vector3 end, real_t t) public readonly Vector3 BezierDerivative(Vector3 control1, Vector3 control2, Vector3 end, real_t t)
{ {
return new Vector3( return new Vector3(
Mathf.BezierDerivative(x, control1.x, control2.x, end.x, t), Mathf.BezierDerivative(X, control1.X, control2.X, end.X, t),
Mathf.BezierDerivative(y, control1.y, control2.y, end.y, t), Mathf.BezierDerivative(Y, control1.Y, control2.Y, end.Y, t),
Mathf.BezierDerivative(z, control1.z, control2.z, end.y, t) Mathf.BezierDerivative(Z, control1.Z, control2.Z, end.Y, t)
); );
} }
@ -276,7 +276,7 @@ namespace Godot
/// <returns>The direction from this vector to <paramref name="to"/>.</returns> /// <returns>The direction from this vector to <paramref name="to"/>.</returns>
public readonly Vector3 DirectionTo(Vector3 to) public readonly Vector3 DirectionTo(Vector3 to)
{ {
return new Vector3(to.x - x, to.y - y, to.z - z).Normalized(); return new Vector3(to.X - X, to.Y - Y, to.Z - Z).Normalized();
} }
/// <summary> /// <summary>
@ -309,7 +309,7 @@ namespace Godot
/// <returns>The dot product of the two vectors.</returns> /// <returns>The dot product of the two vectors.</returns>
public readonly real_t Dot(Vector3 with) public readonly real_t Dot(Vector3 with)
{ {
return (x * with.x) + (y * with.y) + (z * with.z); return (X * with.X) + (Y * with.Y) + (Z * with.Z);
} }
/// <summary> /// <summary>
@ -318,16 +318,16 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Floor"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Floor"/> called on each component.</returns>
public readonly Vector3 Floor() public readonly Vector3 Floor()
{ {
return new Vector3(Mathf.Floor(x), Mathf.Floor(y), Mathf.Floor(z)); return new Vector3(Mathf.Floor(X), Mathf.Floor(Y), Mathf.Floor(Z));
} }
/// <summary> /// <summary>
/// Returns the inverse of this vector. This is the same as <c>new Vector3(1 / v.x, 1 / v.y, 1 / v.z)</c>. /// Returns the inverse of this vector. This is the same as <c>new Vector3(1 / v.X, 1 / v.Y, 1 / v.Z)</c>.
/// </summary> /// </summary>
/// <returns>The inverse of this vector.</returns> /// <returns>The inverse of this vector.</returns>
public readonly Vector3 Inverse() public readonly Vector3 Inverse()
{ {
return new Vector3(1 / x, 1 / y, 1 / z); return new Vector3(1 / X, 1 / Y, 1 / Z);
} }
/// <summary> /// <summary>
@ -337,7 +337,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns> /// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite() public readonly bool IsFinite()
{ {
return Mathf.IsFinite(x) && Mathf.IsFinite(y) && Mathf.IsFinite(z); return Mathf.IsFinite(X) && Mathf.IsFinite(Y) && Mathf.IsFinite(Z);
} }
/// <summary> /// <summary>
@ -356,9 +356,9 @@ namespace Godot
/// <returns>The length of this vector.</returns> /// <returns>The length of this vector.</returns>
public readonly real_t Length() public readonly real_t Length()
{ {
real_t x2 = x * x; real_t x2 = X * X;
real_t y2 = y * y; real_t y2 = Y * Y;
real_t z2 = z * z; real_t z2 = Z * Z;
return Mathf.Sqrt(x2 + y2 + z2); return Mathf.Sqrt(x2 + y2 + z2);
} }
@ -371,9 +371,9 @@ namespace Godot
/// <returns>The squared length of this vector.</returns> /// <returns>The squared length of this vector.</returns>
public readonly real_t LengthSquared() public readonly real_t LengthSquared()
{ {
real_t x2 = x * x; real_t x2 = X * X;
real_t y2 = y * y; real_t y2 = Y * Y;
real_t z2 = z * z; real_t z2 = Z * Z;
return x2 + y2 + z2; return x2 + y2 + z2;
} }
@ -389,9 +389,9 @@ namespace Godot
{ {
return new Vector3 return new Vector3
( (
Mathf.Lerp(x, to.x, weight), Mathf.Lerp(X, to.X, weight),
Mathf.Lerp(y, to.y, weight), Mathf.Lerp(Y, to.Y, weight),
Mathf.Lerp(z, to.z, weight) Mathf.Lerp(Z, to.Z, weight)
); );
} }
@ -421,7 +421,7 @@ namespace Godot
/// <returns>The index of the highest axis.</returns> /// <returns>The index of the highest axis.</returns>
public readonly Axis MaxAxisIndex() public readonly Axis MaxAxisIndex()
{ {
return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X); return X < Y ? (Y < Z ? Axis.Z : Axis.Y) : (X < Z ? Axis.Z : Axis.X);
} }
/// <summary> /// <summary>
@ -431,7 +431,7 @@ namespace Godot
/// <returns>The index of the lowest axis.</returns> /// <returns>The index of the lowest axis.</returns>
public readonly Axis MinAxisIndex() public readonly Axis MinAxisIndex()
{ {
return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z); return X < Y ? (X < Z ? Axis.X : Axis.Z) : (Y < Z ? Axis.Y : Axis.Z);
} }
/// <summary> /// <summary>
@ -470,9 +470,9 @@ namespace Godot
public readonly Basis Outer(Vector3 with) public readonly Basis Outer(Vector3 with)
{ {
return new Basis( return new Basis(
x * with.x, x * with.y, x * with.z, X * with.X, X * with.Y, X * with.Z,
y * with.x, y * with.y, y * with.z, Y * with.X, Y * with.Y, Y * with.Z,
z * with.x, z * with.y, z * with.z Z * with.X, Z * with.Y, Z * with.Z
); );
} }
@ -487,9 +487,9 @@ namespace Godot
public readonly Vector3 PosMod(real_t mod) public readonly Vector3 PosMod(real_t mod)
{ {
Vector3 v; Vector3 v;
v.x = Mathf.PosMod(x, mod); v.X = Mathf.PosMod(X, mod);
v.y = Mathf.PosMod(y, mod); v.Y = Mathf.PosMod(Y, mod);
v.z = Mathf.PosMod(z, mod); v.Z = Mathf.PosMod(Z, mod);
return v; return v;
} }
@ -504,9 +504,9 @@ namespace Godot
public readonly Vector3 PosMod(Vector3 modv) public readonly Vector3 PosMod(Vector3 modv)
{ {
Vector3 v; Vector3 v;
v.x = Mathf.PosMod(x, modv.x); v.X = Mathf.PosMod(X, modv.X);
v.y = Mathf.PosMod(y, modv.y); v.Y = Mathf.PosMod(Y, modv.Y);
v.z = Mathf.PosMod(z, modv.z); v.Z = Mathf.PosMod(Z, modv.Z);
return v; return v;
} }
@ -561,7 +561,7 @@ namespace Godot
/// <returns>The rounded vector.</returns> /// <returns>The rounded vector.</returns>
public readonly Vector3 Round() public readonly Vector3 Round()
{ {
return new Vector3(Mathf.Round(x), Mathf.Round(y), Mathf.Round(z)); return new Vector3(Mathf.Round(X), Mathf.Round(Y), Mathf.Round(Z));
} }
/// <summary> /// <summary>
@ -573,9 +573,9 @@ namespace Godot
public readonly Vector3 Sign() public readonly Vector3 Sign()
{ {
Vector3 v; Vector3 v;
v.x = Mathf.Sign(x); v.X = Mathf.Sign(X);
v.y = Mathf.Sign(y); v.Y = Mathf.Sign(Y);
v.z = Mathf.Sign(z); v.Z = Mathf.Sign(Z);
return v; return v;
} }
@ -642,9 +642,9 @@ namespace Godot
{ {
return new Vector3 return new Vector3
( (
Mathf.Snapped(x, step.x), Mathf.Snapped(X, step.X),
Mathf.Snapped(y, step.y), Mathf.Snapped(Y, step.Y),
Mathf.Snapped(z, step.z) Mathf.Snapped(Z, step.Z)
); );
} }
@ -719,9 +719,9 @@ namespace Godot
/// <param name="z">The vector's Z component.</param> /// <param name="z">The vector's Z component.</param>
public Vector3(real_t x, real_t y, real_t z) public Vector3(real_t x, real_t y, real_t z)
{ {
this.x = x; X = x;
this.y = y; Y = y;
this.z = z; Z = z;
} }
/// <summary> /// <summary>
@ -733,9 +733,9 @@ namespace Godot
/// <returns>The added vector.</returns> /// <returns>The added vector.</returns>
public static Vector3 operator +(Vector3 left, Vector3 right) public static Vector3 operator +(Vector3 left, Vector3 right)
{ {
left.x += right.x; left.X += right.X;
left.y += right.y; left.Y += right.Y;
left.z += right.z; left.Z += right.Z;
return left; return left;
} }
@ -748,15 +748,15 @@ namespace Godot
/// <returns>The subtracted vector.</returns> /// <returns>The subtracted vector.</returns>
public static Vector3 operator -(Vector3 left, Vector3 right) public static Vector3 operator -(Vector3 left, Vector3 right)
{ {
left.x -= right.x; left.X -= right.X;
left.y -= right.y; left.Y -= right.Y;
left.z -= right.z; left.Z -= right.Z;
return left; return left;
} }
/// <summary> /// <summary>
/// Returns the negative value of the <see cref="Vector3"/>. /// Returns the negative value of the <see cref="Vector3"/>.
/// This is the same as writing <c>new Vector3(-v.x, -v.y, -v.z)</c>. /// This is the same as writing <c>new Vector3(-v.X, -v.Y, -v.Z)</c>.
/// This operation flips the direction of the vector while /// This operation flips the direction of the vector while
/// keeping the same magnitude. /// keeping the same magnitude.
/// With floats, the number zero can be either positive or negative. /// With floats, the number zero can be either positive or negative.
@ -765,9 +765,9 @@ namespace Godot
/// <returns>The negated/flipped vector.</returns> /// <returns>The negated/flipped vector.</returns>
public static Vector3 operator -(Vector3 vec) public static Vector3 operator -(Vector3 vec)
{ {
vec.x = -vec.x; vec.X = -vec.X;
vec.y = -vec.y; vec.Y = -vec.Y;
vec.z = -vec.z; vec.Z = -vec.Z;
return vec; return vec;
} }
@ -780,9 +780,9 @@ namespace Godot
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector3 operator *(Vector3 vec, real_t scale) public static Vector3 operator *(Vector3 vec, real_t scale)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
vec.z *= scale; vec.Z *= scale;
return vec; return vec;
} }
@ -795,9 +795,9 @@ namespace Godot
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector3 operator *(real_t scale, Vector3 vec) public static Vector3 operator *(real_t scale, Vector3 vec)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
vec.z *= scale; vec.Z *= scale;
return vec; return vec;
} }
@ -810,9 +810,9 @@ namespace Godot
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector3 operator *(Vector3 left, Vector3 right) public static Vector3 operator *(Vector3 left, Vector3 right)
{ {
left.x *= right.x; left.X *= right.X;
left.y *= right.y; left.Y *= right.Y;
left.z *= right.z; left.Z *= right.Z;
return left; return left;
} }
@ -825,9 +825,9 @@ namespace Godot
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector3 operator /(Vector3 vec, real_t divisor) public static Vector3 operator /(Vector3 vec, real_t divisor)
{ {
vec.x /= divisor; vec.X /= divisor;
vec.y /= divisor; vec.Y /= divisor;
vec.z /= divisor; vec.Z /= divisor;
return vec; return vec;
} }
@ -840,9 +840,9 @@ namespace Godot
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector3 operator /(Vector3 vec, Vector3 divisorv) public static Vector3 operator /(Vector3 vec, Vector3 divisorv)
{ {
vec.x /= divisorv.x; vec.X /= divisorv.X;
vec.y /= divisorv.y; vec.Y /= divisorv.Y;
vec.z /= divisorv.z; vec.Z /= divisorv.Z;
return vec; return vec;
} }
@ -864,9 +864,9 @@ namespace Godot
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector3 operator %(Vector3 vec, real_t divisor) public static Vector3 operator %(Vector3 vec, real_t divisor)
{ {
vec.x %= divisor; vec.X %= divisor;
vec.y %= divisor; vec.Y %= divisor;
vec.z %= divisor; vec.Z %= divisor;
return vec; return vec;
} }
@ -888,9 +888,9 @@ namespace Godot
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector3 operator %(Vector3 vec, Vector3 divisorv) public static Vector3 operator %(Vector3 vec, Vector3 divisorv)
{ {
vec.x %= divisorv.x; vec.X %= divisorv.X;
vec.y %= divisorv.y; vec.Y %= divisorv.Y;
vec.z %= divisorv.z; vec.Z %= divisorv.Z;
return vec; return vec;
} }
@ -933,15 +933,15 @@ namespace Godot
/// <returns>Whether or not the left is less than the right.</returns> /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector3 left, Vector3 right) public static bool operator <(Vector3 left, Vector3 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
return left.z < right.z; return left.Z < right.Z;
} }
return left.y < right.y; return left.Y < right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
@ -957,15 +957,15 @@ namespace Godot
/// <returns>Whether or not the left is greater than the right.</returns> /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector3 left, Vector3 right) public static bool operator >(Vector3 left, Vector3 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
return left.z > right.z; return left.Z > right.Z;
} }
return left.y > right.y; return left.Y > right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
@ -981,15 +981,15 @@ namespace Godot
/// <returns>Whether or not the left is less than or equal to the right.</returns> /// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector3 left, Vector3 right) public static bool operator <=(Vector3 left, Vector3 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
return left.z <= right.z; return left.Z <= right.Z;
} }
return left.y < right.y; return left.Y < right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
@ -1005,15 +1005,15 @@ namespace Godot
/// <returns>Whether or not the left is greater than or equal to the right.</returns> /// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector3 left, Vector3 right) public static bool operator >=(Vector3 left, Vector3 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
return left.z >= right.z; return left.Z >= right.Z;
} }
return left.y > right.y; return left.Y > right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
@ -1038,7 +1038,7 @@ namespace Godot
/// <returns>Whether or not the vectors are exactly equal.</returns> /// <returns>Whether or not the vectors are exactly equal.</returns>
public readonly bool Equals(Vector3 other) public readonly bool Equals(Vector3 other)
{ {
return x == other.x && y == other.y && z == other.z; return X == other.X && Y == other.Y && Z == other.Z;
} }
/// <summary> /// <summary>
@ -1049,7 +1049,7 @@ namespace Godot
/// <returns>Whether or not the vectors are approximately equal.</returns> /// <returns>Whether or not the vectors are approximately equal.</returns>
public readonly bool IsEqualApprox(Vector3 other) public readonly bool IsEqualApprox(Vector3 other)
{ {
return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y) && Mathf.IsEqualApprox(z, other.z); return Mathf.IsEqualApprox(X, other.X) && Mathf.IsEqualApprox(Y, other.Y) && Mathf.IsEqualApprox(Z, other.Z);
} }
/// <summary> /// <summary>
@ -1061,7 +1061,7 @@ namespace Godot
/// <returns>Whether or not the vector is approximately zero.</returns> /// <returns>Whether or not the vector is approximately zero.</returns>
public readonly bool IsZeroApprox() public readonly bool IsZeroApprox()
{ {
return Mathf.IsZeroApprox(x) && Mathf.IsZeroApprox(y) && Mathf.IsZeroApprox(z); return Mathf.IsZeroApprox(X) && Mathf.IsZeroApprox(Y) && Mathf.IsZeroApprox(Z);
} }
/// <summary> /// <summary>
@ -1070,7 +1070,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode(); return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode();
} }
/// <summary> /// <summary>
@ -1079,7 +1079,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"({x}, {y}, {z})"; return $"({X}, {Y}, {Z})";
} }
/// <summary> /// <summary>
@ -1088,7 +1088,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)})"; return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)})";
} }
} }
} }

View File

@ -8,7 +8,7 @@ namespace Godot
/// </summary> /// </summary>
[Serializable] [Serializable]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Vector3i : IEquatable<Vector3i> public struct Vector3I : IEquatable<Vector3I>
{ {
/// <summary> /// <summary>
/// Enumerated index values for the axes. /// Enumerated index values for the axes.
@ -33,17 +33,17 @@ namespace Godot
/// <summary> /// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>. /// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary> /// </summary>
public int x; public int X;
/// <summary> /// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>. /// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary> /// </summary>
public int y; public int Y;
/// <summary> /// <summary>
/// The vector's Z component. Also accessible by using the index position <c>[2]</c>. /// The vector's Z component. Also accessible by using the index position <c>[2]</c>.
/// </summary> /// </summary>
public int z; public int Z;
/// <summary> /// <summary>
/// Access vector components using their <paramref name="index"/>. /// Access vector components using their <paramref name="index"/>.
@ -52,9 +52,9 @@ namespace Godot
/// <paramref name="index"/> is not 0, 1 or 2. /// <paramref name="index"/> is not 0, 1 or 2.
/// </exception> /// </exception>
/// <value> /// <value>
/// <c>[0]</c> is equivalent to <see cref="x"/>, /// <c>[0]</c> is equivalent to <see cref="X"/>,
/// <c>[1]</c> is equivalent to <see cref="y"/>, /// <c>[1]</c> is equivalent to <see cref="Y"/>,
/// <c>[2]</c> is equivalent to <see cref="z"/>. /// <c>[2]</c> is equivalent to <see cref="Z"/>.
/// </value> /// </value>
public int this[int index] public int this[int index]
{ {
@ -63,11 +63,11 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
return x; return X;
case 1: case 1:
return y; return Y;
case 2: case 2:
return z; return Z;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
} }
@ -77,13 +77,13 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
x = value; X = value;
return; return;
case 1: case 1:
y = value; Y = value;
return; return;
case 2: case 2:
z = value; Z = value;
return; return;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
@ -96,18 +96,18 @@ namespace Godot
/// </summary> /// </summary>
public readonly void Deconstruct(out int x, out int y, out int z) public readonly void Deconstruct(out int x, out int y, out int z)
{ {
x = this.x; x = X;
y = this.y; y = Y;
z = this.z; z = Z;
} }
/// <summary> /// <summary>
/// Returns a new vector with all components in absolute values (i.e. positive). /// Returns a new vector with all components in absolute values (i.e. positive).
/// </summary> /// </summary>
/// <returns>A vector with <see cref="Mathf.Abs(int)"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Abs(int)"/> called on each component.</returns>
public readonly Vector3i Abs() public readonly Vector3I Abs()
{ {
return new Vector3i(Mathf.Abs(x), Mathf.Abs(y), Mathf.Abs(z)); return new Vector3I(Mathf.Abs(X), Mathf.Abs(Y), Mathf.Abs(Z));
} }
/// <summary> /// <summary>
@ -118,13 +118,13 @@ namespace Godot
/// <param name="min">The vector with minimum allowed values.</param> /// <param name="min">The vector with minimum allowed values.</param>
/// <param name="max">The vector with maximum allowed values.</param> /// <param name="max">The vector with maximum allowed values.</param>
/// <returns>The vector with all components clamped.</returns> /// <returns>The vector with all components clamped.</returns>
public readonly Vector3i Clamp(Vector3i min, Vector3i max) public readonly Vector3I Clamp(Vector3I min, Vector3I max)
{ {
return new Vector3i return new Vector3I
( (
Mathf.Clamp(x, min.x, max.x), Mathf.Clamp(X, min.X, max.X),
Mathf.Clamp(y, min.y, max.y), Mathf.Clamp(Y, min.Y, max.Y),
Mathf.Clamp(z, min.z, max.z) Mathf.Clamp(Z, min.Z, max.Z)
); );
} }
@ -135,9 +135,9 @@ namespace Godot
/// <returns>The length of this vector.</returns> /// <returns>The length of this vector.</returns>
public readonly real_t Length() public readonly real_t Length()
{ {
int x2 = x * x; int x2 = X * X;
int y2 = y * y; int y2 = Y * Y;
int z2 = z * z; int z2 = Z * Z;
return Mathf.Sqrt(x2 + y2 + z2); return Mathf.Sqrt(x2 + y2 + z2);
} }
@ -150,9 +150,9 @@ namespace Godot
/// <returns>The squared length of this vector.</returns> /// <returns>The squared length of this vector.</returns>
public readonly int LengthSquared() public readonly int LengthSquared()
{ {
int x2 = x * x; int x2 = X * X;
int y2 = y * y; int y2 = Y * Y;
int z2 = z * z; int z2 = Z * Z;
return x2 + y2 + z2; return x2 + y2 + z2;
} }
@ -164,7 +164,7 @@ namespace Godot
/// <returns>The index of the highest axis.</returns> /// <returns>The index of the highest axis.</returns>
public readonly Axis MaxAxisIndex() public readonly Axis MaxAxisIndex()
{ {
return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X); return X < Y ? (Y < Z ? Axis.Z : Axis.Y) : (X < Z ? Axis.Z : Axis.X);
} }
/// <summary> /// <summary>
@ -174,7 +174,7 @@ namespace Godot
/// <returns>The index of the lowest axis.</returns> /// <returns>The index of the lowest axis.</returns>
public readonly Axis MinAxisIndex() public readonly Axis MinAxisIndex()
{ {
return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z); return X < Y ? (X < Z ? Axis.X : Axis.Z) : (Y < Z ? Axis.Y : Axis.Z);
} }
/// <summary> /// <summary>
@ -183,208 +183,208 @@ namespace Godot
/// by calling <see cref="Mathf.Sign(int)"/> on each component. /// by calling <see cref="Mathf.Sign(int)"/> on each component.
/// </summary> /// </summary>
/// <returns>A vector with all components as either <c>1</c>, <c>-1</c>, or <c>0</c>.</returns> /// <returns>A vector with all components as either <c>1</c>, <c>-1</c>, or <c>0</c>.</returns>
public readonly Vector3i Sign() public readonly Vector3I Sign()
{ {
Vector3i v = this; Vector3I v = this;
v.x = Mathf.Sign(v.x); v.X = Mathf.Sign(v.X);
v.y = Mathf.Sign(v.y); v.Y = Mathf.Sign(v.Y);
v.z = Mathf.Sign(v.z); v.Z = Mathf.Sign(v.Z);
return v; return v;
} }
// Constants // Constants
private static readonly Vector3i _zero = new Vector3i(0, 0, 0); private static readonly Vector3I _zero = new Vector3I(0, 0, 0);
private static readonly Vector3i _one = new Vector3i(1, 1, 1); private static readonly Vector3I _one = new Vector3I(1, 1, 1);
private static readonly Vector3i _up = new Vector3i(0, 1, 0); private static readonly Vector3I _up = new Vector3I(0, 1, 0);
private static readonly Vector3i _down = new Vector3i(0, -1, 0); private static readonly Vector3I _down = new Vector3I(0, -1, 0);
private static readonly Vector3i _right = new Vector3i(1, 0, 0); private static readonly Vector3I _right = new Vector3I(1, 0, 0);
private static readonly Vector3i _left = new Vector3i(-1, 0, 0); private static readonly Vector3I _left = new Vector3I(-1, 0, 0);
private static readonly Vector3i _forward = new Vector3i(0, 0, -1); private static readonly Vector3I _forward = new Vector3I(0, 0, -1);
private static readonly Vector3i _back = new Vector3i(0, 0, 1); private static readonly Vector3I _back = new Vector3I(0, 0, 1);
/// <summary> /// <summary>
/// Zero vector, a vector with all components set to <c>0</c>. /// Zero vector, a vector with all components set to <c>0</c>.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector3i(0, 0, 0)</c>.</value> /// <value>Equivalent to <c>new Vector3I(0, 0, 0)</c>.</value>
public static Vector3i Zero { get { return _zero; } } public static Vector3I Zero { get { return _zero; } }
/// <summary> /// <summary>
/// One vector, a vector with all components set to <c>1</c>. /// One vector, a vector with all components set to <c>1</c>.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector3i(1, 1, 1)</c>.</value> /// <value>Equivalent to <c>new Vector3I(1, 1, 1)</c>.</value>
public static Vector3i One { get { return _one; } } public static Vector3I One { get { return _one; } }
/// <summary> /// <summary>
/// Up unit vector. /// Up unit vector.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector3i(0, 1, 0)</c>.</value> /// <value>Equivalent to <c>new Vector3I(0, 1, 0)</c>.</value>
public static Vector3i Up { get { return _up; } } public static Vector3I Up { get { return _up; } }
/// <summary> /// <summary>
/// Down unit vector. /// Down unit vector.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector3i(0, -1, 0)</c>.</value> /// <value>Equivalent to <c>new Vector3I(0, -1, 0)</c>.</value>
public static Vector3i Down { get { return _down; } } public static Vector3I Down { get { return _down; } }
/// <summary> /// <summary>
/// Right unit vector. Represents the local direction of right, /// Right unit vector. Represents the local direction of right,
/// and the global direction of east. /// and the global direction of east.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector3i(1, 0, 0)</c>.</value> /// <value>Equivalent to <c>new Vector3I(1, 0, 0)</c>.</value>
public static Vector3i Right { get { return _right; } } public static Vector3I Right { get { return _right; } }
/// <summary> /// <summary>
/// Left unit vector. Represents the local direction of left, /// Left unit vector. Represents the local direction of left,
/// and the global direction of west. /// and the global direction of west.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector3i(-1, 0, 0)</c>.</value> /// <value>Equivalent to <c>new Vector3I(-1, 0, 0)</c>.</value>
public static Vector3i Left { get { return _left; } } public static Vector3I Left { get { return _left; } }
/// <summary> /// <summary>
/// Forward unit vector. Represents the local direction of forward, /// Forward unit vector. Represents the local direction of forward,
/// and the global direction of north. /// and the global direction of north.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector3i(0, 0, -1)</c>.</value> /// <value>Equivalent to <c>new Vector3I(0, 0, -1)</c>.</value>
public static Vector3i Forward { get { return _forward; } } public static Vector3I Forward { get { return _forward; } }
/// <summary> /// <summary>
/// Back unit vector. Represents the local direction of back, /// Back unit vector. Represents the local direction of back,
/// and the global direction of south. /// and the global direction of south.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector3i(0, 0, 1)</c>.</value> /// <value>Equivalent to <c>new Vector3I(0, 0, 1)</c>.</value>
public static Vector3i Back { get { return _back; } } public static Vector3I Back { get { return _back; } }
/// <summary> /// <summary>
/// Constructs a new <see cref="Vector3i"/> with the given components. /// Constructs a new <see cref="Vector3I"/> with the given components.
/// </summary> /// </summary>
/// <param name="x">The vector's X component.</param> /// <param name="x">The vector's X component.</param>
/// <param name="y">The vector's Y component.</param> /// <param name="y">The vector's Y component.</param>
/// <param name="z">The vector's Z component.</param> /// <param name="z">The vector's Z component.</param>
public Vector3i(int x, int y, int z) public Vector3I(int x, int y, int z)
{ {
this.x = x; X = x;
this.y = y; Y = y;
this.z = z; Z = z;
} }
/// <summary> /// <summary>
/// Adds each component of the <see cref="Vector3i"/> /// Adds each component of the <see cref="Vector3I"/>
/// with the components of the given <see cref="Vector3i"/>. /// with the components of the given <see cref="Vector3I"/>.
/// </summary> /// </summary>
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>The added vector.</returns> /// <returns>The added vector.</returns>
public static Vector3i operator +(Vector3i left, Vector3i right) public static Vector3I operator +(Vector3I left, Vector3I right)
{ {
left.x += right.x; left.X += right.X;
left.y += right.y; left.Y += right.Y;
left.z += right.z; left.Z += right.Z;
return left; return left;
} }
/// <summary> /// <summary>
/// Subtracts each component of the <see cref="Vector3i"/> /// Subtracts each component of the <see cref="Vector3I"/>
/// by the components of the given <see cref="Vector3i"/>. /// by the components of the given <see cref="Vector3I"/>.
/// </summary> /// </summary>
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>The subtracted vector.</returns> /// <returns>The subtracted vector.</returns>
public static Vector3i operator -(Vector3i left, Vector3i right) public static Vector3I operator -(Vector3I left, Vector3I right)
{ {
left.x -= right.x; left.X -= right.X;
left.y -= right.y; left.Y -= right.Y;
left.z -= right.z; left.Z -= right.Z;
return left; return left;
} }
/// <summary> /// <summary>
/// Returns the negative value of the <see cref="Vector3i"/>. /// Returns the negative value of the <see cref="Vector3I"/>.
/// This is the same as writing <c>new Vector3i(-v.x, -v.y, -v.z)</c>. /// This is the same as writing <c>new Vector3I(-v.X, -v.Y, -v.Z)</c>.
/// This operation flips the direction of the vector while /// This operation flips the direction of the vector while
/// keeping the same magnitude. /// keeping the same magnitude.
/// </summary> /// </summary>
/// <param name="vec">The vector to negate/flip.</param> /// <param name="vec">The vector to negate/flip.</param>
/// <returns>The negated/flipped vector.</returns> /// <returns>The negated/flipped vector.</returns>
public static Vector3i operator -(Vector3i vec) public static Vector3I operator -(Vector3I vec)
{ {
vec.x = -vec.x; vec.X = -vec.X;
vec.y = -vec.y; vec.Y = -vec.Y;
vec.z = -vec.z; vec.Z = -vec.Z;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Multiplies each component of the <see cref="Vector3i"/> /// Multiplies each component of the <see cref="Vector3I"/>
/// by the given <see langword="int"/>. /// by the given <see langword="int"/>.
/// </summary> /// </summary>
/// <param name="vec">The vector to multiply.</param> /// <param name="vec">The vector to multiply.</param>
/// <param name="scale">The scale to multiply by.</param> /// <param name="scale">The scale to multiply by.</param>
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector3i operator *(Vector3i vec, int scale) public static Vector3I operator *(Vector3I vec, int scale)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
vec.z *= scale; vec.Z *= scale;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Multiplies each component of the <see cref="Vector3i"/> /// Multiplies each component of the <see cref="Vector3I"/>
/// by the given <see langword="int"/>. /// by the given <see langword="int"/>.
/// </summary> /// </summary>
/// <param name="scale">The scale to multiply by.</param> /// <param name="scale">The scale to multiply by.</param>
/// <param name="vec">The vector to multiply.</param> /// <param name="vec">The vector to multiply.</param>
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector3i operator *(int scale, Vector3i vec) public static Vector3I operator *(int scale, Vector3I vec)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
vec.z *= scale; vec.Z *= scale;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Multiplies each component of the <see cref="Vector3i"/> /// Multiplies each component of the <see cref="Vector3I"/>
/// by the components of the given <see cref="Vector3i"/>. /// by the components of the given <see cref="Vector3I"/>.
/// </summary> /// </summary>
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector3i operator *(Vector3i left, Vector3i right) public static Vector3I operator *(Vector3I left, Vector3I right)
{ {
left.x *= right.x; left.X *= right.X;
left.y *= right.y; left.Y *= right.Y;
left.z *= right.z; left.Z *= right.Z;
return left; return left;
} }
/// <summary> /// <summary>
/// Divides each component of the <see cref="Vector3i"/> /// Divides each component of the <see cref="Vector3I"/>
/// by the given <see langword="int"/>. /// by the given <see langword="int"/>.
/// </summary> /// </summary>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param> /// <param name="divisor">The divisor value.</param>
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector3i operator /(Vector3i vec, int divisor) public static Vector3I operator /(Vector3I vec, int divisor)
{ {
vec.x /= divisor; vec.X /= divisor;
vec.y /= divisor; vec.Y /= divisor;
vec.z /= divisor; vec.Z /= divisor;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Divides each component of the <see cref="Vector3i"/> /// Divides each component of the <see cref="Vector3I"/>
/// by the components of the given <see cref="Vector3i"/>. /// by the components of the given <see cref="Vector3I"/>.
/// </summary> /// </summary>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param> /// <param name="divisorv">The divisor vector.</param>
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector3i operator /(Vector3i vec, Vector3i divisorv) public static Vector3I operator /(Vector3I vec, Vector3I divisorv)
{ {
vec.x /= divisorv.x; vec.X /= divisorv.X;
vec.y /= divisorv.y; vec.Y /= divisorv.Y;
vec.z /= divisorv.z; vec.Z /= divisorv.Z;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Gets the remainder of each component of the <see cref="Vector3i"/> /// Gets the remainder of each component of the <see cref="Vector3I"/>
/// with the components of the given <see langword="int"/>. /// with the components of the given <see langword="int"/>.
/// This operation uses truncated division, which is often not desired /// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers. /// as it does not work well with negative numbers.
@ -393,23 +393,23 @@ namespace Godot
/// </summary> /// </summary>
/// <example> /// <example>
/// <code> /// <code>
/// GD.Print(new Vector3i(10, -20, 30) % 7); // Prints "(3, -6, 2)" /// GD.Print(new Vector3I(10, -20, 30) % 7); // Prints "(3, -6, 2)"
/// </code> /// </code>
/// </example> /// </example>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param> /// <param name="divisor">The divisor value.</param>
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector3i operator %(Vector3i vec, int divisor) public static Vector3I operator %(Vector3I vec, int divisor)
{ {
vec.x %= divisor; vec.X %= divisor;
vec.y %= divisor; vec.Y %= divisor;
vec.z %= divisor; vec.Z %= divisor;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Gets the remainder of each component of the <see cref="Vector3i"/> /// Gets the remainder of each component of the <see cref="Vector3I"/>
/// with the components of the given <see cref="Vector3i"/>. /// with the components of the given <see cref="Vector3I"/>.
/// This operation uses truncated division, which is often not desired /// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers. /// as it does not work well with negative numbers.
/// Consider using <see cref="Mathf.PosMod(int, int)"/> instead /// Consider using <see cref="Mathf.PosMod(int, int)"/> instead
@ -417,17 +417,17 @@ namespace Godot
/// </summary> /// </summary>
/// <example> /// <example>
/// <code> /// <code>
/// GD.Print(new Vector3i(10, -20, 30) % new Vector3i(7, 8, 9)); // Prints "(3, -4, 3)" /// GD.Print(new Vector3I(10, -20, 30) % new Vector3I(7, 8, 9)); // Prints "(3, -4, 3)"
/// </code> /// </code>
/// </example> /// </example>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param> /// <param name="divisorv">The divisor vector.</param>
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector3i operator %(Vector3i vec, Vector3i divisorv) public static Vector3I operator %(Vector3I vec, Vector3I divisorv)
{ {
vec.x %= divisorv.x; vec.X %= divisorv.X;
vec.y %= divisorv.y; vec.Y %= divisorv.Y;
vec.z %= divisorv.z; vec.Z %= divisorv.Z;
return vec; return vec;
} }
@ -437,7 +437,7 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are equal.</returns> /// <returns>Whether or not the vectors are equal.</returns>
public static bool operator ==(Vector3i left, Vector3i right) public static bool operator ==(Vector3I left, Vector3I right)
{ {
return left.Equals(right); return left.Equals(right);
} }
@ -448,13 +448,13 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are not equal.</returns> /// <returns>Whether or not the vectors are not equal.</returns>
public static bool operator !=(Vector3i left, Vector3i right) public static bool operator !=(Vector3I left, Vector3I right)
{ {
return !left.Equals(right); return !left.Equals(right);
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector3i"/> vectors by first checking if /// Compares two <see cref="Vector3I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than /// the X value of the <paramref name="left"/> vector is less than
/// the X value of the <paramref name="right"/> vector. /// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -464,21 +464,21 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than the right.</returns> /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector3i left, Vector3i right) public static bool operator <(Vector3I left, Vector3I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
return left.z < right.z; return left.Z < right.Z;
} }
return left.y < right.y; return left.Y < right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector3i"/> vectors by first checking if /// Compares two <see cref="Vector3I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than /// the X value of the <paramref name="left"/> vector is greater than
/// the X value of the <paramref name="right"/> vector. /// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -488,21 +488,21 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than the right.</returns> /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector3i left, Vector3i right) public static bool operator >(Vector3I left, Vector3I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
return left.z > right.z; return left.Z > right.Z;
} }
return left.y > right.y; return left.Y > right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector3i"/> vectors by first checking if /// Compares two <see cref="Vector3I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than /// the X value of the <paramref name="left"/> vector is less than
/// or equal to the X value of the <paramref name="right"/> vector. /// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -512,21 +512,21 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than or equal to the right.</returns> /// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector3i left, Vector3i right) public static bool operator <=(Vector3I left, Vector3I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
return left.z <= right.z; return left.Z <= right.Z;
} }
return left.y < right.y; return left.Y < right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector3i"/> vectors by first checking if /// Compares two <see cref="Vector3I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than /// the X value of the <paramref name="left"/> vector is greater than
/// or equal to the X value of the <paramref name="right"/> vector. /// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -536,38 +536,38 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than or equal to the right.</returns> /// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector3i left, Vector3i right) public static bool operator >=(Vector3I left, Vector3I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
return left.z >= right.z; return left.Z >= right.Z;
} }
return left.y > right.y; return left.Y > right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector3i"/> to a <see cref="Vector3"/>. /// Converts this <see cref="Vector3I"/> to a <see cref="Vector3"/>.
/// </summary> /// </summary>
/// <param name="value">The vector to convert.</param> /// <param name="value">The vector to convert.</param>
public static implicit operator Vector3(Vector3i value) public static implicit operator Vector3(Vector3I value)
{ {
return new Vector3(value.x, value.y, value.z); return new Vector3(value.X, value.Y, value.Z);
} }
/// <summary> /// <summary>
/// Converts a <see cref="Vector3"/> to a <see cref="Vector3i"/>. /// Converts a <see cref="Vector3"/> to a <see cref="Vector3I"/>.
/// </summary> /// </summary>
/// <param name="value">The vector to convert.</param> /// <param name="value">The vector to convert.</param>
public static explicit operator Vector3i(Vector3 value) public static explicit operator Vector3I(Vector3 value)
{ {
return new Vector3i( return new Vector3I(
Mathf.RoundToInt(value.x), Mathf.RoundToInt(value.X),
Mathf.RoundToInt(value.y), Mathf.RoundToInt(value.Y),
Mathf.RoundToInt(value.z) Mathf.RoundToInt(value.Z)
); );
} }
@ -579,7 +579,7 @@ namespace Godot
/// <returns>Whether or not the vector and the object are equal.</returns> /// <returns>Whether or not the vector and the object are equal.</returns>
public override readonly bool Equals(object obj) public override readonly bool Equals(object obj)
{ {
return obj is Vector3i other && Equals(other); return obj is Vector3I other && Equals(other);
} }
/// <summary> /// <summary>
@ -587,36 +587,36 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="other">The other vector.</param> /// <param name="other">The other vector.</param>
/// <returns>Whether or not the vectors are equal.</returns> /// <returns>Whether or not the vectors are equal.</returns>
public readonly bool Equals(Vector3i other) public readonly bool Equals(Vector3I other)
{ {
return x == other.x && y == other.y && z == other.z; return X == other.X && Y == other.Y && Z == other.Z;
} }
/// <summary> /// <summary>
/// Serves as the hash function for <see cref="Vector3i"/>. /// Serves as the hash function for <see cref="Vector3I"/>.
/// </summary> /// </summary>
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode(); return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode();
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector3i"/> to a string. /// Converts this <see cref="Vector3I"/> to a string.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"({x}, {y}, {z})"; return $"({X}, {Y}, {Z})";
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector3i"/> to a string with the given <paramref name="format"/>. /// Converts this <see cref="Vector3I"/> to a string with the given <paramref name="format"/>.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)})"; return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)})";
} }
} }
} }

View File

@ -37,22 +37,22 @@ namespace Godot
/// <summary> /// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>. /// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary> /// </summary>
public real_t x; public real_t X;
/// <summary> /// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>. /// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary> /// </summary>
public real_t y; public real_t Y;
/// <summary> /// <summary>
/// The vector's Z component. Also accessible by using the index position <c>[2]</c>. /// The vector's Z component. Also accessible by using the index position <c>[2]</c>.
/// </summary> /// </summary>
public real_t z; public real_t Z;
/// <summary> /// <summary>
/// The vector's W component. Also accessible by using the index position <c>[3]</c>. /// The vector's W component. Also accessible by using the index position <c>[3]</c>.
/// </summary> /// </summary>
public real_t w; public real_t W;
/// <summary> /// <summary>
/// Access vector components using their index. /// Access vector components using their index.
@ -61,10 +61,10 @@ namespace Godot
/// <paramref name="index"/> is not 0, 1, 2 or 3. /// <paramref name="index"/> is not 0, 1, 2 or 3.
/// </exception> /// </exception>
/// <value> /// <value>
/// <c>[0]</c> is equivalent to <see cref="x"/>, /// <c>[0]</c> is equivalent to <see cref="X"/>,
/// <c>[1]</c> is equivalent to <see cref="y"/>, /// <c>[1]</c> is equivalent to <see cref="Y"/>,
/// <c>[2]</c> is equivalent to <see cref="z"/>. /// <c>[2]</c> is equivalent to <see cref="Z"/>.
/// <c>[3]</c> is equivalent to <see cref="w"/>. /// <c>[3]</c> is equivalent to <see cref="W"/>.
/// </value> /// </value>
public real_t this[int index] public real_t this[int index]
{ {
@ -73,13 +73,13 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
return x; return X;
case 1: case 1:
return y; return Y;
case 2: case 2:
return z; return Z;
case 3: case 3:
return w; return W;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
} }
@ -89,16 +89,16 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
x = value; X = value;
return; return;
case 1: case 1:
y = value; Y = value;
return; return;
case 2: case 2:
z = value; Z = value;
return; return;
case 3: case 3:
w = value; W = value;
return; return;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
@ -111,10 +111,10 @@ namespace Godot
/// </summary> /// </summary>
public readonly void Deconstruct(out real_t x, out real_t y, out real_t z, out real_t w) public readonly void Deconstruct(out real_t x, out real_t y, out real_t z, out real_t w)
{ {
x = this.x; x = X;
y = this.y; y = Y;
z = this.z; z = Z;
w = this.w; w = W;
} }
internal void Normalize() internal void Normalize()
@ -123,15 +123,15 @@ namespace Godot
if (lengthsq == 0) if (lengthsq == 0)
{ {
x = y = z = w = 0f; X = Y = Z = W = 0f;
} }
else else
{ {
real_t length = Mathf.Sqrt(lengthsq); real_t length = Mathf.Sqrt(lengthsq);
x /= length; X /= length;
y /= length; Y /= length;
z /= length; Z /= length;
w /= length; W /= length;
} }
} }
@ -141,7 +141,7 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Abs(real_t)"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Abs(real_t)"/> called on each component.</returns>
public readonly Vector4 Abs() public readonly Vector4 Abs()
{ {
return new Vector4(Mathf.Abs(x), Mathf.Abs(y), Mathf.Abs(z), Mathf.Abs(w)); return new Vector4(Mathf.Abs(X), Mathf.Abs(Y), Mathf.Abs(Z), Mathf.Abs(W));
} }
/// <summary> /// <summary>
@ -150,7 +150,7 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Ceil"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Ceil"/> called on each component.</returns>
public readonly Vector4 Ceil() public readonly Vector4 Ceil()
{ {
return new Vector4(Mathf.Ceil(x), Mathf.Ceil(y), Mathf.Ceil(z), Mathf.Ceil(w)); return new Vector4(Mathf.Ceil(X), Mathf.Ceil(Y), Mathf.Ceil(Z), Mathf.Ceil(W));
} }
/// <summary> /// <summary>
@ -165,10 +165,10 @@ namespace Godot
{ {
return new Vector4 return new Vector4
( (
Mathf.Clamp(x, min.x, max.x), Mathf.Clamp(X, min.X, max.X),
Mathf.Clamp(y, min.y, max.y), Mathf.Clamp(Y, min.Y, max.Y),
Mathf.Clamp(z, min.z, max.z), Mathf.Clamp(Z, min.Z, max.Z),
Mathf.Clamp(w, min.w, max.w) Mathf.Clamp(W, min.W, max.W)
); );
} }
@ -185,10 +185,10 @@ namespace Godot
{ {
return new Vector4 return new Vector4
( (
Mathf.CubicInterpolate(x, b.x, preA.x, postB.x, weight), Mathf.CubicInterpolate(X, b.X, preA.X, postB.X, weight),
Mathf.CubicInterpolate(y, b.y, preA.y, postB.y, weight), Mathf.CubicInterpolate(Y, b.Y, preA.Y, postB.Y, weight),
Mathf.CubicInterpolate(z, b.z, preA.z, postB.z, weight), Mathf.CubicInterpolate(Z, b.Z, preA.Z, postB.Z, weight),
Mathf.CubicInterpolate(w, b.w, preA.w, postB.w, weight) Mathf.CubicInterpolate(W, b.W, preA.W, postB.W, weight)
); );
} }
@ -210,10 +210,10 @@ namespace Godot
{ {
return new Vector4 return new Vector4
( (
Mathf.CubicInterpolateInTime(x, b.x, preA.x, postB.x, weight, t, preAT, postBT), Mathf.CubicInterpolateInTime(X, b.X, preA.X, postB.X, weight, t, preAT, postBT),
Mathf.CubicInterpolateInTime(y, b.y, preA.y, postB.y, weight, t, preAT, postBT), Mathf.CubicInterpolateInTime(Y, b.Y, preA.Y, postB.Y, weight, t, preAT, postBT),
Mathf.CubicInterpolateInTime(z, b.z, preA.z, postB.z, weight, t, preAT, postBT), Mathf.CubicInterpolateInTime(Z, b.Z, preA.Z, postB.Z, weight, t, preAT, postBT),
Mathf.CubicInterpolateInTime(w, b.w, preA.w, postB.w, weight, t, preAT, postBT) Mathf.CubicInterpolateInTime(W, b.W, preA.W, postB.W, weight, t, preAT, postBT)
); );
} }
@ -224,7 +224,7 @@ namespace Godot
/// <returns>The direction from this vector to <paramref name="to"/>.</returns> /// <returns>The direction from this vector to <paramref name="to"/>.</returns>
public readonly Vector4 DirectionTo(Vector4 to) public readonly Vector4 DirectionTo(Vector4 to)
{ {
Vector4 ret = new Vector4(to.x - x, to.y - y, to.z - z, to.w - w); Vector4 ret = new Vector4(to.X - X, to.Y - Y, to.Z - Z, to.W - W);
ret.Normalize(); ret.Normalize();
return ret; return ret;
} }
@ -258,7 +258,7 @@ namespace Godot
/// <returns>The dot product of the two vectors.</returns> /// <returns>The dot product of the two vectors.</returns>
public readonly real_t Dot(Vector4 with) public readonly real_t Dot(Vector4 with)
{ {
return (x * with.x) + (y * with.y) + (z * with.z) + (w * with.w); return (X * with.X) + (Y * with.Y) + (Z * with.Z) + (W * with.W);
} }
/// <summary> /// <summary>
@ -267,16 +267,16 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Floor"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Floor"/> called on each component.</returns>
public readonly Vector4 Floor() public readonly Vector4 Floor()
{ {
return new Vector4(Mathf.Floor(x), Mathf.Floor(y), Mathf.Floor(z), Mathf.Floor(w)); return new Vector4(Mathf.Floor(X), Mathf.Floor(Y), Mathf.Floor(Z), Mathf.Floor(W));
} }
/// <summary> /// <summary>
/// Returns the inverse of this vector. This is the same as <c>new Vector4(1 / v.x, 1 / v.y, 1 / v.z, 1 / v.w)</c>. /// Returns the inverse of this vector. This is the same as <c>new Vector4(1 / v.X, 1 / v.Y, 1 / v.Z, 1 / v.W)</c>.
/// </summary> /// </summary>
/// <returns>The inverse of this vector.</returns> /// <returns>The inverse of this vector.</returns>
public readonly Vector4 Inverse() public readonly Vector4 Inverse()
{ {
return new Vector4(1 / x, 1 / y, 1 / z, 1 / w); return new Vector4(1 / X, 1 / Y, 1 / Z, 1 / W);
} }
/// <summary> /// <summary>
@ -286,7 +286,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns> /// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite() public readonly bool IsFinite()
{ {
return Mathf.IsFinite(x) && Mathf.IsFinite(y) && Mathf.IsFinite(z) && Mathf.IsFinite(w); return Mathf.IsFinite(X) && Mathf.IsFinite(Y) && Mathf.IsFinite(Z) && Mathf.IsFinite(W);
} }
/// <summary> /// <summary>
@ -305,10 +305,10 @@ namespace Godot
/// <returns>The length of this vector.</returns> /// <returns>The length of this vector.</returns>
public readonly real_t Length() public readonly real_t Length()
{ {
real_t x2 = x * x; real_t x2 = X * X;
real_t y2 = y * y; real_t y2 = Y * Y;
real_t z2 = z * z; real_t z2 = Z * Z;
real_t w2 = w * w; real_t w2 = W * W;
return Mathf.Sqrt(x2 + y2 + z2 + w2); return Mathf.Sqrt(x2 + y2 + z2 + w2);
} }
@ -321,10 +321,10 @@ namespace Godot
/// <returns>The squared length of this vector.</returns> /// <returns>The squared length of this vector.</returns>
public readonly real_t LengthSquared() public readonly real_t LengthSquared()
{ {
real_t x2 = x * x; real_t x2 = X * X;
real_t y2 = y * y; real_t y2 = Y * Y;
real_t z2 = z * z; real_t z2 = Z * Z;
real_t w2 = w * w; real_t w2 = W * W;
return x2 + y2 + z2 + w2; return x2 + y2 + z2 + w2;
} }
@ -340,10 +340,10 @@ namespace Godot
{ {
return new Vector4 return new Vector4
( (
Mathf.Lerp(x, to.x, weight), Mathf.Lerp(X, to.X, weight),
Mathf.Lerp(y, to.y, weight), Mathf.Lerp(Y, to.Y, weight),
Mathf.Lerp(z, to.z, weight), Mathf.Lerp(Z, to.Z, weight),
Mathf.Lerp(w, to.w, weight) Mathf.Lerp(W, to.W, weight)
); );
} }
@ -355,7 +355,7 @@ namespace Godot
public readonly Axis MaxAxisIndex() public readonly Axis MaxAxisIndex()
{ {
int max_index = 0; int max_index = 0;
real_t max_value = x; real_t max_value = X;
for (int i = 1; i < 4; i++) for (int i = 1; i < 4; i++)
{ {
if (this[i] > max_value) if (this[i] > max_value)
@ -375,7 +375,7 @@ namespace Godot
public readonly Axis MinAxisIndex() public readonly Axis MinAxisIndex()
{ {
int min_index = 0; int min_index = 0;
real_t min_value = x; real_t min_value = X;
for (int i = 1; i < 4; i++) for (int i = 1; i < 4; i++)
{ {
if (this[i] <= min_value) if (this[i] <= min_value)
@ -409,10 +409,10 @@ namespace Godot
public readonly Vector4 PosMod(real_t mod) public readonly Vector4 PosMod(real_t mod)
{ {
return new Vector4( return new Vector4(
Mathf.PosMod(x, mod), Mathf.PosMod(X, mod),
Mathf.PosMod(y, mod), Mathf.PosMod(Y, mod),
Mathf.PosMod(z, mod), Mathf.PosMod(Z, mod),
Mathf.PosMod(w, mod) Mathf.PosMod(W, mod)
); );
} }
@ -427,10 +427,10 @@ namespace Godot
public readonly Vector4 PosMod(Vector4 modv) public readonly Vector4 PosMod(Vector4 modv)
{ {
return new Vector4( return new Vector4(
Mathf.PosMod(x, modv.x), Mathf.PosMod(X, modv.X),
Mathf.PosMod(y, modv.y), Mathf.PosMod(Y, modv.Y),
Mathf.PosMod(z, modv.z), Mathf.PosMod(Z, modv.Z),
Mathf.PosMod(w, modv.w) Mathf.PosMod(W, modv.W)
); );
} }
@ -441,7 +441,7 @@ namespace Godot
/// <returns>The rounded vector.</returns> /// <returns>The rounded vector.</returns>
public readonly Vector4 Round() public readonly Vector4 Round()
{ {
return new Vector4(Mathf.Round(x), Mathf.Round(y), Mathf.Round(z), Mathf.Round(w)); return new Vector4(Mathf.Round(X), Mathf.Round(Y), Mathf.Round(Z), Mathf.Round(W));
} }
/// <summary> /// <summary>
@ -453,10 +453,10 @@ namespace Godot
public readonly Vector4 Sign() public readonly Vector4 Sign()
{ {
Vector4 v; Vector4 v;
v.x = Mathf.Sign(x); v.X = Mathf.Sign(X);
v.y = Mathf.Sign(y); v.Y = Mathf.Sign(Y);
v.z = Mathf.Sign(z); v.Z = Mathf.Sign(Z);
v.w = Mathf.Sign(w); v.W = Mathf.Sign(W);
return v; return v;
} }
@ -469,10 +469,10 @@ namespace Godot
public readonly Vector4 Snapped(Vector4 step) public readonly Vector4 Snapped(Vector4 step)
{ {
return new Vector4( return new Vector4(
Mathf.Snapped(x, step.x), Mathf.Snapped(X, step.X),
Mathf.Snapped(y, step.y), Mathf.Snapped(Y, step.Y),
Mathf.Snapped(z, step.z), Mathf.Snapped(Z, step.Z),
Mathf.Snapped(w, step.w) Mathf.Snapped(W, step.W)
); );
} }
@ -506,10 +506,10 @@ namespace Godot
/// <param name="w">The vector's W component.</param> /// <param name="w">The vector's W component.</param>
public Vector4(real_t x, real_t y, real_t z, real_t w) public Vector4(real_t x, real_t y, real_t z, real_t w)
{ {
this.x = x; X = x;
this.y = y; Y = y;
this.z = z; Z = z;
this.w = w; W = w;
} }
/// <summary> /// <summary>
@ -521,10 +521,10 @@ namespace Godot
/// <returns>The added vector.</returns> /// <returns>The added vector.</returns>
public static Vector4 operator +(Vector4 left, Vector4 right) public static Vector4 operator +(Vector4 left, Vector4 right)
{ {
left.x += right.x; left.X += right.X;
left.y += right.y; left.Y += right.Y;
left.z += right.z; left.Z += right.Z;
left.w += right.w; left.W += right.W;
return left; return left;
} }
@ -537,16 +537,16 @@ namespace Godot
/// <returns>The subtracted vector.</returns> /// <returns>The subtracted vector.</returns>
public static Vector4 operator -(Vector4 left, Vector4 right) public static Vector4 operator -(Vector4 left, Vector4 right)
{ {
left.x -= right.x; left.X -= right.X;
left.y -= right.y; left.Y -= right.Y;
left.z -= right.z; left.Z -= right.Z;
left.w -= right.w; left.W -= right.W;
return left; return left;
} }
/// <summary> /// <summary>
/// Returns the negative value of the <see cref="Vector4"/>. /// Returns the negative value of the <see cref="Vector4"/>.
/// This is the same as writing <c>new Vector4(-v.x, -v.y, -v.z, -v.w)</c>. /// This is the same as writing <c>new Vector4(-v.X, -v.Y, -v.Z, -v.W)</c>.
/// This operation flips the direction of the vector while /// This operation flips the direction of the vector while
/// keeping the same magnitude. /// keeping the same magnitude.
/// With floats, the number zero can be either positive or negative. /// With floats, the number zero can be either positive or negative.
@ -555,10 +555,10 @@ namespace Godot
/// <returns>The negated/flipped vector.</returns> /// <returns>The negated/flipped vector.</returns>
public static Vector4 operator -(Vector4 vec) public static Vector4 operator -(Vector4 vec)
{ {
vec.x = -vec.x; vec.X = -vec.X;
vec.y = -vec.y; vec.Y = -vec.Y;
vec.z = -vec.z; vec.Z = -vec.Z;
vec.w = -vec.w; vec.W = -vec.W;
return vec; return vec;
} }
@ -571,10 +571,10 @@ namespace Godot
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector4 operator *(Vector4 vec, real_t scale) public static Vector4 operator *(Vector4 vec, real_t scale)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
vec.z *= scale; vec.Z *= scale;
vec.w *= scale; vec.W *= scale;
return vec; return vec;
} }
@ -587,10 +587,10 @@ namespace Godot
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector4 operator *(real_t scale, Vector4 vec) public static Vector4 operator *(real_t scale, Vector4 vec)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
vec.z *= scale; vec.Z *= scale;
vec.w *= scale; vec.W *= scale;
return vec; return vec;
} }
@ -603,10 +603,10 @@ namespace Godot
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector4 operator *(Vector4 left, Vector4 right) public static Vector4 operator *(Vector4 left, Vector4 right)
{ {
left.x *= right.x; left.X *= right.X;
left.y *= right.y; left.Y *= right.Y;
left.z *= right.z; left.Z *= right.Z;
left.w *= right.w; left.W *= right.W;
return left; return left;
} }
@ -619,10 +619,10 @@ namespace Godot
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector4 operator /(Vector4 vec, real_t divisor) public static Vector4 operator /(Vector4 vec, real_t divisor)
{ {
vec.x /= divisor; vec.X /= divisor;
vec.y /= divisor; vec.Y /= divisor;
vec.z /= divisor; vec.Z /= divisor;
vec.w /= divisor; vec.W /= divisor;
return vec; return vec;
} }
@ -635,10 +635,10 @@ namespace Godot
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector4 operator /(Vector4 vec, Vector4 divisorv) public static Vector4 operator /(Vector4 vec, Vector4 divisorv)
{ {
vec.x /= divisorv.x; vec.X /= divisorv.X;
vec.y /= divisorv.y; vec.Y /= divisorv.Y;
vec.z /= divisorv.z; vec.Z /= divisorv.Z;
vec.w /= divisorv.w; vec.W /= divisorv.W;
return vec; return vec;
} }
@ -660,10 +660,10 @@ namespace Godot
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector4 operator %(Vector4 vec, real_t divisor) public static Vector4 operator %(Vector4 vec, real_t divisor)
{ {
vec.x %= divisor; vec.X %= divisor;
vec.y %= divisor; vec.Y %= divisor;
vec.z %= divisor; vec.Z %= divisor;
vec.w %= divisor; vec.W %= divisor;
return vec; return vec;
} }
@ -685,10 +685,10 @@ namespace Godot
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector4 operator %(Vector4 vec, Vector4 divisorv) public static Vector4 operator %(Vector4 vec, Vector4 divisorv)
{ {
vec.x %= divisorv.x; vec.X %= divisorv.X;
vec.y %= divisorv.y; vec.Y %= divisorv.Y;
vec.z %= divisorv.z; vec.Z %= divisorv.Z;
vec.w %= divisorv.w; vec.W %= divisorv.W;
return vec; return vec;
} }
@ -731,19 +731,19 @@ namespace Godot
/// <returns>Whether or not the left is less than the right.</returns> /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector4 left, Vector4 right) public static bool operator <(Vector4 left, Vector4 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
if (left.z == right.z) if (left.Z == right.Z)
{ {
return left.w < right.w; return left.W < right.W;
} }
return left.z < right.z; return left.Z < right.Z;
} }
return left.y < right.y; return left.Y < right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
@ -759,19 +759,19 @@ namespace Godot
/// <returns>Whether or not the left is greater than the right.</returns> /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector4 left, Vector4 right) public static bool operator >(Vector4 left, Vector4 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
if (left.z == right.z) if (left.Z == right.Z)
{ {
return left.w > right.w; return left.W > right.W;
} }
return left.z > right.z; return left.Z > right.Z;
} }
return left.y > right.y; return left.Y > right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
@ -787,19 +787,19 @@ namespace Godot
/// <returns>Whether or not the left is less than or equal to the right.</returns> /// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector4 left, Vector4 right) public static bool operator <=(Vector4 left, Vector4 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
if (left.z == right.z) if (left.Z == right.Z)
{ {
return left.w <= right.w; return left.W <= right.W;
} }
return left.z < right.z; return left.Z < right.Z;
} }
return left.y < right.y; return left.Y < right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
@ -815,19 +815,19 @@ namespace Godot
/// <returns>Whether or not the left is greater than or equal to the right.</returns> /// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector4 left, Vector4 right) public static bool operator >=(Vector4 left, Vector4 right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
if (left.z == right.z) if (left.Z == right.Z)
{ {
return left.w >= right.w; return left.W >= right.W;
} }
return left.z > right.z; return left.Z > right.Z;
} }
return left.y > right.y; return left.Y > right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
@ -852,7 +852,7 @@ namespace Godot
/// <returns>Whether or not the vectors are exactly equal.</returns> /// <returns>Whether or not the vectors are exactly equal.</returns>
public readonly bool Equals(Vector4 other) public readonly bool Equals(Vector4 other)
{ {
return x == other.x && y == other.y && z == other.z && w == other.w; return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
} }
/// <summary> /// <summary>
@ -863,7 +863,7 @@ namespace Godot
/// <returns>Whether or not the vectors are approximately equal.</returns> /// <returns>Whether or not the vectors are approximately equal.</returns>
public readonly bool IsEqualApprox(Vector4 other) public readonly bool IsEqualApprox(Vector4 other)
{ {
return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y) && Mathf.IsEqualApprox(z, other.z) && Mathf.IsEqualApprox(w, other.w); return Mathf.IsEqualApprox(X, other.X) && Mathf.IsEqualApprox(Y, other.Y) && Mathf.IsEqualApprox(Z, other.Z) && Mathf.IsEqualApprox(W, other.W);
} }
/// <summary> /// <summary>
@ -875,7 +875,7 @@ namespace Godot
/// <returns>Whether or not the vector is approximately zero.</returns> /// <returns>Whether or not the vector is approximately zero.</returns>
public readonly bool IsZeroApprox() public readonly bool IsZeroApprox()
{ {
return Mathf.IsZeroApprox(x) && Mathf.IsZeroApprox(y) && Mathf.IsZeroApprox(z) && Mathf.IsZeroApprox(w); return Mathf.IsZeroApprox(X) && Mathf.IsZeroApprox(Y) && Mathf.IsZeroApprox(Z) && Mathf.IsZeroApprox(W);
} }
/// <summary> /// <summary>
@ -884,7 +884,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode() ^ w.GetHashCode(); return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode();
} }
/// <summary> /// <summary>
@ -893,7 +893,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public override string ToString() public override string ToString()
{ {
return $"({x}, {y}, {z}, {w})"; return $"({X}, {Y}, {Z}, {W})";
} }
/// <summary> /// <summary>
@ -902,7 +902,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)}, {w.ToString(format)})"; return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)}, {W.ToString(format)})";
} }
} }
} }

View File

@ -8,7 +8,7 @@ namespace Godot
/// </summary> /// </summary>
[Serializable] [Serializable]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Vector4i : IEquatable<Vector4i> public struct Vector4I : IEquatable<Vector4I>
{ {
/// <summary> /// <summary>
/// Enumerated index values for the axes. /// Enumerated index values for the axes.
@ -37,22 +37,22 @@ namespace Godot
/// <summary> /// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>. /// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary> /// </summary>
public int x; public int X;
/// <summary> /// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>. /// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary> /// </summary>
public int y; public int Y;
/// <summary> /// <summary>
/// The vector's Z component. Also accessible by using the index position <c>[2]</c>. /// The vector's Z component. Also accessible by using the index position <c>[2]</c>.
/// </summary> /// </summary>
public int z; public int Z;
/// <summary> /// <summary>
/// The vector's W component. Also accessible by using the index position <c>[3]</c>. /// The vector's W component. Also accessible by using the index position <c>[3]</c>.
/// </summary> /// </summary>
public int w; public int W;
/// <summary> /// <summary>
/// Access vector components using their <paramref name="index"/>. /// Access vector components using their <paramref name="index"/>.
@ -61,10 +61,10 @@ namespace Godot
/// <paramref name="index"/> is not 0, 1, 2 or 3. /// <paramref name="index"/> is not 0, 1, 2 or 3.
/// </exception> /// </exception>
/// <value> /// <value>
/// <c>[0]</c> is equivalent to <see cref="x"/>, /// <c>[0]</c> is equivalent to <see cref="X"/>,
/// <c>[1]</c> is equivalent to <see cref="y"/>, /// <c>[1]</c> is equivalent to <see cref="Y"/>,
/// <c>[2]</c> is equivalent to <see cref="z"/>. /// <c>[2]</c> is equivalent to <see cref="Z"/>.
/// <c>[3]</c> is equivalent to <see cref="w"/>. /// <c>[3]</c> is equivalent to <see cref="W"/>.
/// </value> /// </value>
public int this[int index] public int this[int index]
{ {
@ -73,13 +73,13 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
return x; return X;
case 1: case 1:
return y; return Y;
case 2: case 2:
return z; return Z;
case 3: case 3:
return w; return W;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
} }
@ -89,16 +89,16 @@ namespace Godot
switch (index) switch (index)
{ {
case 0: case 0:
x = value; X = value;
return; return;
case 1: case 1:
y = value; Y = value;
return; return;
case 2: case 2:
z = value; Z = value;
return; return;
case 3: case 3:
w = value; W = value;
return; return;
default: default:
throw new ArgumentOutOfRangeException(nameof(index)); throw new ArgumentOutOfRangeException(nameof(index));
@ -111,19 +111,19 @@ namespace Godot
/// </summary> /// </summary>
public readonly void Deconstruct(out int x, out int y, out int z, out int w) public readonly void Deconstruct(out int x, out int y, out int z, out int w)
{ {
x = this.x; x = X;
y = this.y; y = Y;
z = this.z; z = Z;
w = this.w; w = W;
} }
/// <summary> /// <summary>
/// Returns a new vector with all components in absolute values (i.e. positive). /// Returns a new vector with all components in absolute values (i.e. positive).
/// </summary> /// </summary>
/// <returns>A vector with <see cref="Mathf.Abs(int)"/> called on each component.</returns> /// <returns>A vector with <see cref="Mathf.Abs(int)"/> called on each component.</returns>
public readonly Vector4i Abs() public readonly Vector4I Abs()
{ {
return new Vector4i(Mathf.Abs(x), Mathf.Abs(y), Mathf.Abs(z), Mathf.Abs(w)); return new Vector4I(Mathf.Abs(X), Mathf.Abs(Y), Mathf.Abs(Z), Mathf.Abs(W));
} }
/// <summary> /// <summary>
@ -134,14 +134,14 @@ namespace Godot
/// <param name="min">The vector with minimum allowed values.</param> /// <param name="min">The vector with minimum allowed values.</param>
/// <param name="max">The vector with maximum allowed values.</param> /// <param name="max">The vector with maximum allowed values.</param>
/// <returns>The vector with all components clamped.</returns> /// <returns>The vector with all components clamped.</returns>
public readonly Vector4i Clamp(Vector4i min, Vector4i max) public readonly Vector4I Clamp(Vector4I min, Vector4I max)
{ {
return new Vector4i return new Vector4I
( (
Mathf.Clamp(x, min.x, max.x), Mathf.Clamp(X, min.X, max.X),
Mathf.Clamp(y, min.y, max.y), Mathf.Clamp(Y, min.Y, max.Y),
Mathf.Clamp(z, min.z, max.z), Mathf.Clamp(Z, min.Z, max.Z),
Mathf.Clamp(w, min.w, max.w) Mathf.Clamp(W, min.W, max.W)
); );
} }
@ -152,10 +152,10 @@ namespace Godot
/// <returns>The length of this vector.</returns> /// <returns>The length of this vector.</returns>
public readonly real_t Length() public readonly real_t Length()
{ {
int x2 = x * x; int x2 = X * X;
int y2 = y * y; int y2 = Y * Y;
int z2 = z * z; int z2 = Z * Z;
int w2 = w * w; int w2 = W * W;
return Mathf.Sqrt(x2 + y2 + z2 + w2); return Mathf.Sqrt(x2 + y2 + z2 + w2);
} }
@ -168,10 +168,10 @@ namespace Godot
/// <returns>The squared length of this vector.</returns> /// <returns>The squared length of this vector.</returns>
public readonly int LengthSquared() public readonly int LengthSquared()
{ {
int x2 = x * x; int x2 = X * X;
int y2 = y * y; int y2 = Y * Y;
int z2 = z * z; int z2 = Z * Z;
int w2 = w * w; int w2 = W * W;
return x2 + y2 + z2 + w2; return x2 + y2 + z2 + w2;
} }
@ -184,7 +184,7 @@ namespace Godot
public readonly Axis MaxAxisIndex() public readonly Axis MaxAxisIndex()
{ {
int max_index = 0; int max_index = 0;
int max_value = x; int max_value = X;
for (int i = 1; i < 4; i++) for (int i = 1; i < 4; i++)
{ {
if (this[i] > max_value) if (this[i] > max_value)
@ -204,7 +204,7 @@ namespace Godot
public readonly Axis MinAxisIndex() public readonly Axis MinAxisIndex()
{ {
int min_index = 0; int min_index = 0;
int min_value = x; int min_value = X;
for (int i = 1; i < 4; i++) for (int i = 1; i < 4; i++)
{ {
if (this[i] <= min_value) if (this[i] <= min_value)
@ -222,213 +222,217 @@ namespace Godot
/// by calling <see cref="Mathf.Sign(int)"/> on each component. /// by calling <see cref="Mathf.Sign(int)"/> on each component.
/// </summary> /// </summary>
/// <returns>A vector with all components as either <c>1</c>, <c>-1</c>, or <c>0</c>.</returns> /// <returns>A vector with all components as either <c>1</c>, <c>-1</c>, or <c>0</c>.</returns>
public readonly Vector4i Sign() public readonly Vector4I Sign()
{ {
return new Vector4i(Mathf.Sign(x), Mathf.Sign(y), Mathf.Sign(z), Mathf.Sign(w)); return new Vector4I(Mathf.Sign(X), Mathf.Sign(Y), Mathf.Sign(Z), Mathf.Sign(W));
} }
// Constants // Constants
private static readonly Vector4i _zero = new Vector4i(0, 0, 0, 0); private static readonly Vector4I _zero = new Vector4I(0, 0, 0, 0);
private static readonly Vector4i _one = new Vector4i(1, 1, 1, 1); private static readonly Vector4I _one = new Vector4I(1, 1, 1, 1);
/// <summary> /// <summary>
/// Zero vector, a vector with all components set to <c>0</c>. /// Zero vector, a vector with all components set to <c>0</c>.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector4i(0, 0, 0, 0)</c>.</value> /// <value>Equivalent to <c>new Vector4I(0, 0, 0, 0)</c>.</value>
public static Vector4i Zero { get { return _zero; } } public static Vector4I Zero { get { return _zero; } }
/// <summary> /// <summary>
/// One vector, a vector with all components set to <c>1</c>. /// One vector, a vector with all components set to <c>1</c>.
/// </summary> /// </summary>
/// <value>Equivalent to <c>new Vector4i(1, 1, 1, 1)</c>.</value> /// <value>Equivalent to <c>new Vector4I(1, 1, 1, 1)</c>.</value>
public static Vector4i One { get { return _one; } } public static Vector4I One { get { return _one; } }
/// <summary> /// <summary>
/// Constructs a new <see cref="Vector4i"/> with the given components. /// Constructs a new <see cref="Vector4I"/> with the given components.
/// </summary> /// </summary>
/// <param name="x">The vector's X component.</param> /// <param name="x">The vector's X component.</param>
/// <param name="y">The vector's Y component.</param> /// <param name="y">The vector's Y component.</param>
/// <param name="z">The vector's Z component.</param> /// <param name="z">The vector's Z component.</param>
/// <param name="w">The vector's W component.</param> /// <param name="w">The vector's W component.</param>
public Vector4i(int x, int y, int z, int w) public Vector4I(int x, int y, int z, int w)
{ {
this.x = x; X = x;
this.y = y; Y = y;
this.z = z; Z = z;
this.w = w; W = w;
} }
/// <summary> /// <summary>
/// Adds each component of the <see cref="Vector4i"/> /// Adds each component of the <see cref="Vector4I"/>
/// with the components of the given <see cref="Vector4i"/>. /// with the components of the given <see cref="Vector4I"/>.
/// </summary> /// </summary>
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>The added vector.</returns> /// <returns>The added vector.</returns>
public static Vector4i operator +(Vector4i left, Vector4i right) public static Vector4I operator +(Vector4I left, Vector4I right)
{ {
left.x += right.x; left.X += right.X;
left.y += right.y; left.Y += right.Y;
left.z += right.z; left.Z += right.Z;
left.w += right.w; left.W += right.W;
return left; return left;
} }
/// <summary> /// <summary>
/// Subtracts each component of the <see cref="Vector4i"/> /// Subtracts each component of the <see cref="Vector4I"/>
/// by the components of the given <see cref="Vector4i"/>. /// by the components of the given <see cref="Vector4I"/>.
/// </summary> /// </summary>
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>The subtracted vector.</returns> /// <returns>The subtracted vector.</returns>
public static Vector4i operator -(Vector4i left, Vector4i right) public static Vector4I operator -(Vector4I left, Vector4I right)
{ {
left.x -= right.x; left.X -= right.X;
left.y -= right.y; left.Y -= right.Y;
left.z -= right.z; left.Z -= right.Z;
left.w -= right.w; left.W -= right.W;
return left; return left;
} }
/// <summary> /// <summary>
/// Returns the negative value of the <see cref="Vector4i"/>. /// Returns the negative value of the <see cref="Vector4I"/>.
/// This is the same as writing <c>new Vector4i(-v.x, -v.y, -v.z, -v.w)</c>. /// This is the same as writing <c>new Vector4I(-v.X, -v.Y, -v.Z, -v.W)</c>.
/// This operation flips the direction of the vector while /// This operation flips the direction of the vector while
/// keeping the same magnitude. /// keeping the same magnitude.
/// </summary> /// </summary>
/// <param name="vec">The vector to negate/flip.</param> /// <param name="vec">The vector to negate/flip.</param>
/// <returns>The negated/flipped vector.</returns> /// <returns>The negated/flipped vector.</returns>
public static Vector4i operator -(Vector4i vec) public static Vector4I operator -(Vector4I vec)
{ {
vec.x = -vec.x; vec.X = -vec.X;
vec.y = -vec.y; vec.Y = -vec.Y;
vec.z = -vec.z; vec.Z = -vec.Z;
vec.w = -vec.w; vec.W = -vec.W;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Multiplies each component of the <see cref="Vector4i"/> /// Multiplies each component of the <see cref="Vector4I"/>
/// by the given <see langword="int"/>. /// by the given <see langword="int"/>.
/// </summary> /// </summary>
/// <param name="vec">The vector to multiply.</param> /// <param name="vec">The vector to multiply.</param>
/// <param name="scale">The scale to multiply by.</param> /// <param name="scale">The scale to multiply by.</param>
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector4i operator *(Vector4i vec, int scale) public static Vector4I operator *(Vector4I vec, int scale)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
vec.z *= scale; vec.Z *= scale;
vec.w *= scale; vec.W *= scale;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Multiplies each component of the <see cref="Vector4i"/> /// Multiplies each component of the <see cref="Vector4I"/>
/// by the given <see langword="int"/>. /// by the given <see langword="int"/>.
/// </summary> /// </summary>
/// <param name="scale">The scale to multiply by.</param> /// <param name="scale">The scale to multiply by.</param>
/// <param name="vec">The vector to multiply.</param> /// <param name="vec">The vector to multiply.</param>
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector4i operator *(int scale, Vector4i vec) public static Vector4I operator *(int scale, Vector4I vec)
{ {
vec.x *= scale; vec.X *= scale;
vec.y *= scale; vec.Y *= scale;
vec.z *= scale; vec.Z *= scale;
vec.w *= scale; vec.W *= scale;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Multiplies each component of the <see cref="Vector4i"/> /// Multiplies each component of the <see cref="Vector4I"/>
/// by the components of the given <see cref="Vector4i"/>. /// by the components of the given <see cref="Vector4I"/>.
/// </summary> /// </summary>
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>The multiplied vector.</returns> /// <returns>The multiplied vector.</returns>
public static Vector4i operator *(Vector4i left, Vector4i right) public static Vector4I operator *(Vector4I left, Vector4I right)
{ {
left.x *= right.x; left.X *= right.X;
left.y *= right.y; left.Y *= right.Y;
left.z *= right.z; left.Z *= right.Z;
left.w *= right.w; left.W *= right.W;
return left; return left;
} }
/// <summary> /// <summary>
/// Divides each component of the <see cref="Vector4i"/> /// Divides each component of the <see cref="Vector4I"/>
/// by the given <see langword="int"/>. /// by the given <see langword="int"/>.
/// </summary> /// </summary>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param> /// <param name="divisor">The divisor value.</param>
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector4i operator /(Vector4i vec, int divisor) public static Vector4I operator /(Vector4I vec, int divisor)
{ {
vec.x /= divisor; vec.X /= divisor;
vec.y /= divisor; vec.Y /= divisor;
vec.z /= divisor; vec.Z /= divisor;
vec.w /= divisor; vec.W /= divisor;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Divides each component of the <see cref="Vector4i"/> /// Divides each component of the <see cref="Vector4I"/>
/// by the components of the given <see cref="Vector4i"/>. /// by the components of the given <see cref="Vector4I"/>.
/// </summary> /// </summary>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param> /// <param name="divisorv">The divisor vector.</param>
/// <returns>The divided vector.</returns> /// <returns>The divided vector.</returns>
public static Vector4i operator /(Vector4i vec, Vector4i divisorv) public static Vector4I operator /(Vector4I vec, Vector4I divisorv)
{ {
vec.x /= divisorv.x; vec.X /= divisorv.X;
vec.y /= divisorv.y; vec.Y /= divisorv.Y;
vec.z /= divisorv.z; vec.Z /= divisorv.Z;
vec.w /= divisorv.w; vec.W /= divisorv.W;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Gets the remainder of each component of the <see cref="Vector4i"/> /// Gets the remainder of each component of the <see cref="Vector4I"/>
/// with the components of the given <see langword="int"/>. /// with the components of the given <see langword="int"/>.
/// This operation uses truncated division, which is often not desired /// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers. /// as it does not work well with negative numbers.
/// Consider using <see cref="Mathf.PosMod(int, int)"/> instead
/// if you want to handle negative numbers.
/// </summary> /// </summary>
/// <example> /// <example>
/// <code> /// <code>
/// GD.Print(new Vecto43i(10, -20, 30, -40) % 7); // Prints "(3, -6, 2, -5)" /// GD.Print(new Vector4I(10, -20, 30, -40) % 7); // Prints "(3, -6, 2, -5)"
/// </code> /// </code>
/// </example> /// </example>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param> /// <param name="divisor">The divisor value.</param>
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector4i operator %(Vector4i vec, int divisor) public static Vector4I operator %(Vector4I vec, int divisor)
{ {
vec.x %= divisor; vec.X %= divisor;
vec.y %= divisor; vec.Y %= divisor;
vec.z %= divisor; vec.Z %= divisor;
vec.w %= divisor; vec.W %= divisor;
return vec; return vec;
} }
/// <summary> /// <summary>
/// Gets the remainder of each component of the <see cref="Vector4i"/> /// Gets the remainder of each component of the <see cref="Vector4I"/>
/// with the components of the given <see cref="Vector4i"/>. /// with the components of the given <see cref="Vector4I"/>.
/// This operation uses truncated division, which is often not desired /// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers. /// as it does not work well with negative numbers.
/// Consider using <see cref="Mathf.PosMod(int, int)"/> instead
/// if you want to handle negative numbers.
/// </summary> /// </summary>
/// <example> /// <example>
/// <code> /// <code>
/// GD.Print(new Vector4i(10, -20, 30, -40) % new Vector4i(6, 7, 8, 9)); // Prints "(4, -6, 6, -4)" /// GD.Print(new Vector4I(10, -20, 30, -40) % new Vector4I(6, 7, 8, 9)); // Prints "(4, -6, 6, -4)"
/// </code> /// </code>
/// </example> /// </example>
/// <param name="vec">The dividend vector.</param> /// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param> /// <param name="divisorv">The divisor vector.</param>
/// <returns>The remainder vector.</returns> /// <returns>The remainder vector.</returns>
public static Vector4i operator %(Vector4i vec, Vector4i divisorv) public static Vector4I operator %(Vector4I vec, Vector4I divisorv)
{ {
vec.x %= divisorv.x; vec.X %= divisorv.X;
vec.y %= divisorv.y; vec.Y %= divisorv.Y;
vec.z %= divisorv.z; vec.Z %= divisorv.Z;
vec.w %= divisorv.w; vec.W %= divisorv.W;
return vec; return vec;
} }
@ -438,7 +442,7 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are equal.</returns> /// <returns>Whether or not the vectors are equal.</returns>
public static bool operator ==(Vector4i left, Vector4i right) public static bool operator ==(Vector4I left, Vector4I right)
{ {
return left.Equals(right); return left.Equals(right);
} }
@ -449,13 +453,13 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are not equal.</returns> /// <returns>Whether or not the vectors are not equal.</returns>
public static bool operator !=(Vector4i left, Vector4i right) public static bool operator !=(Vector4I left, Vector4I right)
{ {
return !left.Equals(right); return !left.Equals(right);
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector4i"/> vectors by first checking if /// Compares two <see cref="Vector4I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than /// the X value of the <paramref name="left"/> vector is less than
/// the X value of the <paramref name="right"/> vector. /// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -465,25 +469,25 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than the right.</returns> /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector4i left, Vector4i right) public static bool operator <(Vector4I left, Vector4I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
if (left.z == right.z) if (left.Z == right.Z)
{ {
return left.w < right.w; return left.W < right.W;
} }
return left.z < right.z; return left.Z < right.Z;
} }
return left.y < right.y; return left.Y < right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector4i"/> vectors by first checking if /// Compares two <see cref="Vector4I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than /// the X value of the <paramref name="left"/> vector is greater than
/// the X value of the <paramref name="right"/> vector. /// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -493,25 +497,25 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than the right.</returns> /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector4i left, Vector4i right) public static bool operator >(Vector4I left, Vector4I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
if (left.z == right.z) if (left.Z == right.Z)
{ {
return left.w > right.w; return left.W > right.W;
} }
return left.z > right.z; return left.Z > right.Z;
} }
return left.y > right.y; return left.Y > right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector4i"/> vectors by first checking if /// Compares two <see cref="Vector4I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than /// the X value of the <paramref name="left"/> vector is less than
/// or equal to the X value of the <paramref name="right"/> vector. /// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -521,25 +525,25 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than or equal to the right.</returns> /// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector4i left, Vector4i right) public static bool operator <=(Vector4I left, Vector4I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
if (left.z == right.z) if (left.Z == right.Z)
{ {
return left.w <= right.w; return left.W <= right.W;
} }
return left.z < right.z; return left.Z < right.Z;
} }
return left.y < right.y; return left.Y < right.Y;
} }
return left.x < right.x; return left.X < right.X;
} }
/// <summary> /// <summary>
/// Compares two <see cref="Vector4i"/> vectors by first checking if /// Compares two <see cref="Vector4I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than /// the X value of the <paramref name="left"/> vector is greater than
/// or equal to the X value of the <paramref name="right"/> vector. /// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check /// If the X values are exactly equal, then it repeats this check
@ -549,43 +553,43 @@ namespace Godot
/// <param name="left">The left vector.</param> /// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param> /// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than or equal to the right.</returns> /// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector4i left, Vector4i right) public static bool operator >=(Vector4I left, Vector4I right)
{ {
if (left.x == right.x) if (left.X == right.X)
{ {
if (left.y == right.y) if (left.Y == right.Y)
{ {
if (left.z == right.z) if (left.Z == right.Z)
{ {
return left.w >= right.w; return left.W >= right.W;
} }
return left.z > right.z; return left.Z > right.Z;
} }
return left.y > right.y; return left.Y > right.Y;
} }
return left.x > right.x; return left.X > right.X;
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector4i"/> to a <see cref="Vector4"/>. /// Converts this <see cref="Vector4I"/> to a <see cref="Vector4"/>.
/// </summary> /// </summary>
/// <param name="value">The vector to convert.</param> /// <param name="value">The vector to convert.</param>
public static implicit operator Vector4(Vector4i value) public static implicit operator Vector4(Vector4I value)
{ {
return new Vector4(value.x, value.y, value.z, value.w); return new Vector4(value.X, value.Y, value.Z, value.W);
} }
/// <summary> /// <summary>
/// Converts a <see cref="Vector4"/> to a <see cref="Vector4i"/>. /// Converts a <see cref="Vector4"/> to a <see cref="Vector4I"/>.
/// </summary> /// </summary>
/// <param name="value">The vector to convert.</param> /// <param name="value">The vector to convert.</param>
public static explicit operator Vector4i(Vector4 value) public static explicit operator Vector4I(Vector4 value)
{ {
return new Vector4i( return new Vector4I(
Mathf.RoundToInt(value.x), Mathf.RoundToInt(value.X),
Mathf.RoundToInt(value.y), Mathf.RoundToInt(value.Y),
Mathf.RoundToInt(value.z), Mathf.RoundToInt(value.Z),
Mathf.RoundToInt(value.w) Mathf.RoundToInt(value.W)
); );
} }
@ -597,7 +601,7 @@ namespace Godot
/// <returns>Whether or not the vector and the object are equal.</returns> /// <returns>Whether or not the vector and the object are equal.</returns>
public override readonly bool Equals(object obj) public override readonly bool Equals(object obj)
{ {
return obj is Vector4i other && Equals(other); return obj is Vector4I other && Equals(other);
} }
/// <summary> /// <summary>
@ -605,36 +609,36 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="other">The other vector.</param> /// <param name="other">The other vector.</param>
/// <returns>Whether or not the vectors are equal.</returns> /// <returns>Whether or not the vectors are equal.</returns>
public readonly bool Equals(Vector4i other) public readonly bool Equals(Vector4I other)
{ {
return x == other.x && y == other.y && z == other.z && w == other.w; return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
} }
/// <summary> /// <summary>
/// Serves as the hash function for <see cref="Vector4i"/>. /// Serves as the hash function for <see cref="Vector4I"/>.
/// </summary> /// </summary>
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode() ^ w.GetHashCode(); return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode();
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector4i"/> to a string. /// Converts this <see cref="Vector4I"/> to a string.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public override readonly string ToString() public override readonly string ToString()
{ {
return $"({x}, {y}, {z}, {w})"; return $"({X}, {Y}, {Z}, {W})";
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector4i"/> to a string with the given <paramref name="format"/>. /// Converts this <see cref="Vector4I"/> to a string with the given <paramref name="format"/>.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format) public readonly string ToString(string format)
{ {
return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)}), {w.ToString(format)})"; return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)}), {W.ToString(format)})";
} }
} }
} }

View File

@ -49,7 +49,7 @@
</ItemGroup> </ItemGroup>
<!-- Sources --> <!-- Sources -->
<ItemGroup> <ItemGroup>
<Compile Include="Core\AABB.cs" /> <Compile Include="Core\Aabb.cs" />
<Compile Include="Core\Bridge\GodotSerializationInfo.cs" /> <Compile Include="Core\Bridge\GodotSerializationInfo.cs" />
<Compile Include="Core\Bridge\MethodInfo.cs" /> <Compile Include="Core\Bridge\MethodInfo.cs" />
<Compile Include="Core\Callable.generics.cs" /> <Compile Include="Core\Callable.generics.cs" />
@ -60,8 +60,9 @@
<Compile Include="Core\Attributes\ExportCategoryAttribute.cs" /> <Compile Include="Core\Attributes\ExportCategoryAttribute.cs" />
<Compile Include="Core\Attributes\ExportGroupAttribute.cs" /> <Compile Include="Core\Attributes\ExportGroupAttribute.cs" />
<Compile Include="Core\Attributes\ExportSubgroupAttribute.cs" /> <Compile Include="Core\Attributes\ExportSubgroupAttribute.cs" />
<Compile Include="Core\Attributes\GodotClassNameAttribute.cs" />
<Compile Include="Core\Attributes\MustBeVariantAttribute.cs" /> <Compile Include="Core\Attributes\MustBeVariantAttribute.cs" />
<Compile Include="Core\Attributes\RPCAttribute.cs" /> <Compile Include="Core\Attributes\RpcAttribute.cs" />
<Compile Include="Core\Attributes\ScriptPathAttribute.cs" /> <Compile Include="Core\Attributes\ScriptPathAttribute.cs" />
<Compile Include="Core\Attributes\SignalAttribute.cs" /> <Compile Include="Core\Attributes\SignalAttribute.cs" />
<Compile Include="Core\Attributes\ToolAttribute.cs" /> <Compile Include="Core\Attributes\ToolAttribute.cs" />
@ -110,9 +111,9 @@
<Compile Include="Core\Projection.cs" /> <Compile Include="Core\Projection.cs" />
<Compile Include="Core\Quaternion.cs" /> <Compile Include="Core\Quaternion.cs" />
<Compile Include="Core\Rect2.cs" /> <Compile Include="Core\Rect2.cs" />
<Compile Include="Core\Rect2i.cs" /> <Compile Include="Core\Rect2I.cs" />
<Compile Include="Core\ReflectionUtils.cs" /> <Compile Include="Core\ReflectionUtils.cs" />
<Compile Include="Core\RID.cs" /> <Compile Include="Core\Rid.cs" />
<Compile Include="Core\NativeInterop\NativeFuncs.cs" /> <Compile Include="Core\NativeInterop\NativeFuncs.cs" />
<Compile Include="Core\NativeInterop\InteropStructs.cs" /> <Compile Include="Core\NativeInterop\InteropStructs.cs" />
<Compile Include="Core\NativeInterop\Marshaling.cs" /> <Compile Include="Core\NativeInterop\Marshaling.cs" />
@ -124,11 +125,11 @@
<Compile Include="Core\Transform3D.cs" /> <Compile Include="Core\Transform3D.cs" />
<Compile Include="Core\Variant.cs" /> <Compile Include="Core\Variant.cs" />
<Compile Include="Core\Vector2.cs" /> <Compile Include="Core\Vector2.cs" />
<Compile Include="Core\Vector2i.cs" /> <Compile Include="Core\Vector2I.cs" />
<Compile Include="Core\Vector3.cs" /> <Compile Include="Core\Vector3.cs" />
<Compile Include="Core\Vector3i.cs" /> <Compile Include="Core\Vector3I.cs" />
<Compile Include="Core\Vector4.cs" /> <Compile Include="Core\Vector4.cs" />
<Compile Include="Core\Vector4i.cs" /> <Compile Include="Core\Vector4I.cs" />
<Compile Include="GlobalUsings.cs" /> <Compile Include="GlobalUsings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>

View File

@ -0,0 +1,292 @@
/**************************************************************************/
/* naming_utils.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "naming_utils.h"
#include "core/string/ucaps.h"
#include "core/templates/hash_map.h"
HashMap<String, String> _create_hashmap_from_vector(Vector<Pair<String, String>> vector) {
HashMap<String, String> hashmap = HashMap<String, String>(vector.size());
for (const Pair<String, String> &pair : vector) {
hashmap.insert(pair.first, pair.second);
}
return hashmap;
}
// Hardcoded collection of PascalCase name conversions.
const HashMap<String, String> pascal_case_name_overrides = _create_hashmap_from_vector({
{ "BitMap", "Bitmap" },
{ "JSONRPC", "JsonRpc" },
{ "OpenXRIPBinding", "OpenXRIPBinding" },
{ "SkeletonModification2DCCDIK", "SkeletonModification2DCcdik" },
{ "SkeletonModification2DFABRIK", "SkeletonModification2DFabrik" },
{ "SkeletonModification3DCCDIK", "SkeletonModification3DCcdik" },
{ "SkeletonModification3DFABRIK", "SkeletonModification3DFabrik" },
{ "System", "System_" },
{ "Thread", "GodotThread" },
});
// Hardcoded collection of PascalCase part conversions.
const HashMap<String, String> pascal_case_part_overrides = _create_hashmap_from_vector({
{ "AA", "AA" }, // Anti Aliasing
{ "AO", "AO" }, // Ambient Occlusion
{ "FILENAME", "FileName" },
{ "FADEIN", "FadeIn" },
{ "FADEOUT", "FadeOut" },
{ "FX", "FX" },
{ "GI", "GI" }, // Global Illumination
{ "GZIP", "GZip" },
{ "HBOX", "HBox" }, // Horizontal Box
{ "ID", "Id" },
{ "IO", "IO" }, // Input/Output
{ "IP", "IP" }, // Internet Protocol
{ "IV", "IV" }, // Initialization Vector
{ "MACOS", "MacOS" },
{ "NODEPATH", "NodePath" },
{ "SPIRV", "SpirV" },
{ "STDIN", "StdIn" },
{ "STDOUT", "StdOut" },
{ "USERNAME", "UserName" },
{ "UV", "UV" },
{ "UV2", "UV2" },
{ "VBOX", "VBox" }, // Vertical Box
{ "WHITESPACE", "WhiteSpace" },
{ "WM", "WM" },
{ "XR", "XR" },
{ "XRAPI", "XRApi" },
});
String _get_pascal_case_part_override(String p_part, bool p_input_is_upper = true) {
if (!p_input_is_upper) {
for (int i = 0; i < p_part.length(); i++) {
p_part[i] = _find_upper(p_part[i]);
}
}
if (pascal_case_part_overrides.has(p_part)) {
return pascal_case_part_overrides.get(p_part);
}
return String();
}
Vector<String> _split_pascal_case(const String &p_identifier) {
Vector<String> parts;
int current_part_start = 0;
bool prev_was_upper = is_ascii_upper_case(p_identifier[0]);
for (int i = 1; i < p_identifier.length(); i++) {
if (prev_was_upper) {
if (is_digit(p_identifier[i]) || is_ascii_lower_case(p_identifier[i])) {
if (!is_digit(p_identifier[i])) {
// These conditions only apply when the separator is not a digit.
if (i - current_part_start == 1) {
// Upper character was only the beggining of a word.
prev_was_upper = false;
continue;
}
if (i != p_identifier.length()) {
// If this is not the last character, the last uppercase
// character is the start of the next word.
i--;
}
}
if (i - current_part_start > 0) {
parts.append(p_identifier.substr(current_part_start, i - current_part_start));
current_part_start = i;
prev_was_upper = false;
}
}
} else {
if (is_digit(p_identifier[i]) || is_ascii_upper_case(p_identifier[i])) {
parts.append(p_identifier.substr(current_part_start, i - current_part_start));
current_part_start = i;
prev_was_upper = true;
}
}
}
// Add the rest of the identifier as the last part.
if (current_part_start != p_identifier.length()) {
parts.append(p_identifier.substr(current_part_start));
}
return parts;
}
String pascal_to_pascal_case(const String &p_identifier) {
if (p_identifier.length() == 0) {
return p_identifier;
}
if (p_identifier.length() <= 2) {
return p_identifier.to_upper();
}
if (pascal_case_name_overrides.has(p_identifier)) {
// Use hardcoded value for the identifier.
return pascal_case_name_overrides.get(p_identifier);
}
Vector<String> parts = _split_pascal_case(p_identifier);
String ret;
for (String &part : parts) {
String part_override = _get_pascal_case_part_override(part);
if (!part_override.is_empty()) {
// Use hardcoded value for part.
ret += part_override;
continue;
}
if (part.length() <= 2 && part.to_upper() == part) {
// Acronym of length 1 or 2.
for (int j = 0; j < part.length(); j++) {
part[j] = _find_upper(part[j]);
}
ret += part;
continue;
}
part[0] = _find_upper(part[0]);
for (int i = 1; i < part.length(); i++) {
if (is_digit(part[i - 1])) {
// Use uppercase after digits.
part[i] = _find_upper(part[i]);
continue;
}
part[i] = _find_lower(part[i]);
}
ret += part;
}
return ret;
}
String snake_to_pascal_case(const String &p_identifier, bool p_input_is_upper) {
String ret;
Vector<String> parts = p_identifier.split("_", true);
for (int i = 0; i < parts.size(); i++) {
String part = parts[i];
String part_override = _get_pascal_case_part_override(part, p_input_is_upper);
if (!part_override.is_empty()) {
// Use hardcoded value for part.
ret += part_override;
continue;
}
if (!part.is_empty()) {
part[0] = _find_upper(part[0]);
for (int j = 1; j < part.length(); j++) {
if (is_digit(part[j - 1])) {
// Use uppercase after digits.
part[j] = _find_upper(part[j]);
continue;
}
if (p_input_is_upper) {
part[j] = _find_lower(part[j]);
}
}
ret += part;
} else {
if (i == 0 || i == (parts.size() - 1)) {
// Preserve underscores at the beginning and end
ret += "_";
} else {
// Preserve contiguous underscores
if (parts[i - 1].length()) {
ret += "__";
} else {
ret += "_";
}
}
}
}
return ret;
}
String snake_to_camel_case(const String &p_identifier, bool p_input_is_upper) {
String ret;
Vector<String> parts = p_identifier.split("_", true);
for (int i = 0; i < parts.size(); i++) {
String part = parts[i];
String part_override = _get_pascal_case_part_override(part, p_input_is_upper);
if (!part_override.is_empty()) {
// Use hardcoded value for part.
if (i == 0) {
part_override[0] = _find_lower(part_override[0]);
}
ret += part_override;
continue;
}
if (!part.is_empty()) {
if (i == 0) {
part[0] = _find_lower(part[0]);
} else {
part[0] = _find_upper(part[0]);
}
for (int j = 1; j < part.length(); j++) {
if (is_digit(part[j - 1])) {
// Use uppercase after digits.
part[j] = _find_upper(part[j]);
continue;
}
if (p_input_is_upper) {
part[j] = _find_lower(part[j]);
}
}
ret += part;
} else {
if (i == 0 || i == (parts.size() - 1)) {
// Preserve underscores at the beginning and end
ret += "_";
} else {
// Preserve contiguous underscores
if (parts[i - 1].length()) {
ret += "__";
} else {
ret += "_";
}
}
}
}
return ret;
}

View File

@ -0,0 +1,42 @@
/**************************************************************************/
/* naming_utils.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef MONO_NAMING_UTILS_H
#define MONO_NAMING_UTILS_H
#include "core/string/ustring.h"
String pascal_to_pascal_case(const String &p_identifier);
String snake_to_pascal_case(const String &p_identifier, bool p_input_is_upper = false);
String snake_to_camel_case(const String &p_identifier, bool p_input_is_upper = false);
#endif // MONO_NAMING_UTILS_H