mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-06 05:01:53 +00:00
Transitioned from VectorX to floatX
And some trying to update Rigidbody when transform changes
This commit is contained in:
@@ -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)
|
||||
{{
|
||||
|
||||
Reference in New Issue
Block a user