Add BinaryReader LGS rotation extension
This commit is contained in:
parent
dd2fd3f37b
commit
23b5400eae
|
@ -79,11 +79,11 @@ public class BrList : IChunk
|
|||
flags = reader.ReadSByte();
|
||||
position = reader.ReadVec3();
|
||||
size = reader.ReadVec3();
|
||||
angle = new Vector3(reader.ReadUInt16(), reader.ReadUInt16(), reader.ReadUInt16());
|
||||
angle = reader.ReadRotation();
|
||||
currentFaceIndex = reader.ReadInt16();
|
||||
gridLineSpacing = reader.ReadSingle();
|
||||
gridPhaseShift = reader.ReadVec3();
|
||||
gridOrientation = new Vector3(reader.ReadUInt16(), reader.ReadUInt16(), reader.ReadUInt16());
|
||||
gridOrientation = reader.ReadRotation();
|
||||
gridEnabled = reader.ReadBoolean();
|
||||
numFaces = reader.ReadByte();
|
||||
edgeSelected = reader.ReadSByte();
|
||||
|
|
|
@ -6,6 +6,12 @@ namespace KeepersCompound.LGS;
|
|||
|
||||
public static class Extensions
|
||||
{
|
||||
public static Vector3 ReadRotation(this BinaryReader reader)
|
||||
{
|
||||
var raw = new Vector3(reader.ReadUInt16(), reader.ReadUInt16(), reader.ReadUInt16());
|
||||
return raw * 360 / (ushort.MaxValue + 1);
|
||||
}
|
||||
|
||||
public static Vector3 ReadVec3(this BinaryReader reader)
|
||||
{
|
||||
return new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
|
||||
|
|
|
@ -264,8 +264,7 @@ public partial class Mission : Node3D
|
|||
// Let's try and place an object :)
|
||||
var modelName = modelNameProp.value + ".bin";
|
||||
var pos = brush.position.ToGodotVec3();
|
||||
var rawRot = brush.angle;
|
||||
var rot = new Vector3(rawRot.Y, rawRot.Z, rawRot.X) * 360 / (ushort.MaxValue + 1);
|
||||
var rot = brush.angle.ToGodotVec3(false);
|
||||
var scale = scaleProp == null ? Vector3.One : scaleProp.value.ToGodotVec3(false);
|
||||
var model = Timing.TimeStage("Get Models", () =>
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue