Transitioned from VectorX to floatX

And some trying to update Rigidbody when transform changes
This commit is contained in:
Simon Lübeß
2023-06-25 02:47:33 +02:00
parent 5f5da2ed35
commit 9e1f648aa0
49 changed files with 1281 additions and 871 deletions
+18 -4
View File
@@ -87,11 +87,11 @@ struct VectorAttribute<T, ComponentCount> : Attribute, IComptimeTypeApply where
if (ComponentCount == 3)
{
GenerateVector3Constructors(type);
Generatefloat3Constructors(type);
}
else if (ComponentCount == 4)
{
GenerateVector4Constructors(type);
Generatefloat4Constructors(type);
}
}
@@ -128,7 +128,7 @@ struct VectorAttribute<T, ComponentCount> : Attribute, IComptimeTypeApply where
}
[Comptime]
private void GenerateVector3Constructors(Type type)
private void Generatefloat3Constructors(Type type)
{
String baseName = type.GetName(.. scope String());
@@ -161,13 +161,27 @@ struct VectorAttribute<T, ComponentCount> : Attribute, IComptimeTypeApply where
}
[Comptime]
private void GenerateVector4Constructors(Type type)
private void Generatefloat4Constructors(Type type)
{
String baseName = type.GetName(.. scope String());
// Remove number from name
baseName.RemoveFromEnd(1);
String constructor = scope $"""
public this({baseName}2 xy, {baseName}2 zw)
{{
X = xy.X;
Y = xy.Y;
Z = zw.X;
W = zw.Y;
}}
""";
Compiler.EmitTypeBody(type, constructor);
String constructor1 = scope $"""
public this({baseName}2 xy, {typeof(T)} z, {typeof(T)} w)
{{