Parse and use JointPos property
This commit is contained in:
parent
7dc1912390
commit
df99a34d81
|
@ -502,3 +502,27 @@ public class PropSpotlightAndAmbient : Property
|
||||||
writer.Write(SpotBrightness);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -158,6 +158,7 @@ public class DbFile
|
||||||
"P$ModelName" => new PropertyChunk<PropLabel>(),
|
"P$ModelName" => new PropertyChunk<PropLabel>(),
|
||||||
"P$Scale" => new PropertyChunk<PropVector>(),
|
"P$Scale" => new PropertyChunk<PropVector>(),
|
||||||
"P$RenderTyp" => new PropertyChunk<PropRenderType>(),
|
"P$RenderTyp" => new PropertyChunk<PropRenderType>(),
|
||||||
|
"P$JointPos" => new PropertyChunk<PropJointPos>(),
|
||||||
"P$OTxtRepr0" => new PropertyChunk<PropString>(),
|
"P$OTxtRepr0" => new PropertyChunk<PropString>(),
|
||||||
"P$OTxtRepr1" => new PropertyChunk<PropString>(),
|
"P$OTxtRepr1" => new PropertyChunk<PropString>(),
|
||||||
"P$OTxtRepr2" => new PropertyChunk<PropString>(),
|
"P$OTxtRepr2" => new PropertyChunk<PropString>(),
|
||||||
|
|
|
@ -93,6 +93,7 @@ public class ObjectHierarchy
|
||||||
AddProp<PropLabel>("P$ModelName");
|
AddProp<PropLabel>("P$ModelName");
|
||||||
AddProp<PropVector>("P$Scale");
|
AddProp<PropVector>("P$Scale");
|
||||||
AddProp<PropRenderType>("P$RenderTyp");
|
AddProp<PropRenderType>("P$RenderTyp");
|
||||||
|
AddProp<PropJointPos>("P$JointPos");
|
||||||
AddProp<PropString>("P$OTxtRepr0");
|
AddProp<PropString>("P$OTxtRepr0");
|
||||||
AddProp<PropString>("P$OTxtRepr1");
|
AddProp<PropString>("P$OTxtRepr1");
|
||||||
AddProp<PropString>("P$OTxtRepr2");
|
AddProp<PropString>("P$OTxtRepr2");
|
||||||
|
|
|
@ -244,6 +244,7 @@ public partial class Mission : Node3D
|
||||||
var modelNameProp = objHierarchy.GetProperty<PropLabel>(id, "P$ModelName");
|
var modelNameProp = objHierarchy.GetProperty<PropLabel>(id, "P$ModelName");
|
||||||
var scaleProp = objHierarchy.GetProperty<PropVector>(id, "P$Scale");
|
var scaleProp = objHierarchy.GetProperty<PropVector>(id, "P$Scale");
|
||||||
var renderTypeProp = objHierarchy.GetProperty<PropRenderType>(id, "P$RenderTyp");
|
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 txtRepl0 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr0");
|
||||||
var txtRepl1 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr1");
|
var txtRepl1 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr1");
|
||||||
var txtRepl2 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr2");
|
var txtRepl2 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr2");
|
||||||
|
@ -269,8 +270,8 @@ public partial class Mission : Node3D
|
||||||
model.RotationDegrees = rot;
|
model.RotationDegrees = rot;
|
||||||
model.Scale = scale;
|
model.Scale = scale;
|
||||||
|
|
||||||
// TODO: Apply real joints
|
var joints = jointPosProp != null ? jointPosProp.Positions : [0, 0, 0, 0, 0, 0];
|
||||||
var meshes = ModelLoader.TransformMeshes([45, 180, 0, 0, 0, 0], meshDetails);
|
var meshes = ModelLoader.TransformMeshes(joints, meshDetails);
|
||||||
|
|
||||||
bool GetTextReplPath(PropString prop, out string path)
|
bool GetTextReplPath(PropString prop, out string path)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue