Parse and use JointPos property

This commit is contained in:
Jarrod Doyle 2024-12-07 13:20:03 +00:00
parent 7dc1912390
commit df99a34d81
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
4 changed files with 29 additions and 2 deletions

View File

@ -502,3 +502,27 @@ public class PropSpotlightAndAmbient : Property
writer.Write(SpotBrightness);
}
}
public class PropJointPos : Property
{
public float[] Positions;
public override void Read(BinaryReader reader)
{
base.Read(reader);
Positions = new float[6];
for (var i = 0; i < 6; i++)
{
Positions[i] = reader.ReadSingle();
}
}
public override void Write(BinaryWriter writer)
{
base.Write(writer);
foreach (var position in Positions)
{
writer.Write(position);
}
}
}

View File

@ -158,6 +158,7 @@ public class DbFile
"P$ModelName" => new PropertyChunk<PropLabel>(),
"P$Scale" => new PropertyChunk<PropVector>(),
"P$RenderTyp" => new PropertyChunk<PropRenderType>(),
"P$JointPos" => new PropertyChunk<PropJointPos>(),
"P$OTxtRepr0" => new PropertyChunk<PropString>(),
"P$OTxtRepr1" => new PropertyChunk<PropString>(),
"P$OTxtRepr2" => new PropertyChunk<PropString>(),

View File

@ -93,6 +93,7 @@ public class ObjectHierarchy
AddProp<PropLabel>("P$ModelName");
AddProp<PropVector>("P$Scale");
AddProp<PropRenderType>("P$RenderTyp");
AddProp<PropJointPos>("P$JointPos");
AddProp<PropString>("P$OTxtRepr0");
AddProp<PropString>("P$OTxtRepr1");
AddProp<PropString>("P$OTxtRepr2");

View File

@ -244,6 +244,7 @@ public partial class Mission : Node3D
var modelNameProp = objHierarchy.GetProperty<PropLabel>(id, "P$ModelName");
var scaleProp = objHierarchy.GetProperty<PropVector>(id, "P$Scale");
var renderTypeProp = objHierarchy.GetProperty<PropRenderType>(id, "P$RenderTyp");
var jointPosProp = objHierarchy.GetProperty<PropJointPos>(id, "P$JointPos");
var txtRepl0 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr0");
var txtRepl1 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr1");
var txtRepl2 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr2");
@ -269,8 +270,8 @@ public partial class Mission : Node3D
model.RotationDegrees = rot;
model.Scale = scale;
// TODO: Apply real joints
var meshes = ModelLoader.TransformMeshes([45, 180, 0, 0, 0, 0], meshDetails);
var joints = jointPosProp != null ? jointPosProp.Positions : [0, 0, 0, 0, 0, 0];
var meshes = ModelLoader.TransformMeshes(joints, meshDetails);
bool GetTextReplPath(PropString prop, out string path)
{