53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using System.ComponentModel;
|
|
using System.Globalization;
|
|
|
|
namespace Lity3DEditor;
|
|
|
|
public enum MeshType
|
|
{
|
|
[Description("无")]
|
|
NONE,
|
|
[Description("立方体")]
|
|
CUBE,
|
|
[Description("球体")]
|
|
SPHERE,
|
|
[Description("平面")]
|
|
PLANE,
|
|
[Description("OBJ 模型")]
|
|
OBJ
|
|
}
|
|
|
|
public class SceneNode
|
|
{
|
|
public string Name { get; set; } = "";
|
|
public int ParentIndex { get; set; } = -1;
|
|
public MeshType Mesh { get; set; } = MeshType.NONE;
|
|
public string MeshPath { get; set; } = "-";
|
|
|
|
public float PosX { get; set; }
|
|
public float PosY { get; set; }
|
|
public float PosZ { get; set; }
|
|
|
|
public float RotX { get; set; }
|
|
public float RotY { get; set; }
|
|
public float RotZ { get; set; }
|
|
|
|
public float ScaleX { get; set; } = 1.0f;
|
|
public float ScaleY { get; set; } = 1.0f;
|
|
public float ScaleZ { get; set; } = 1.0f;
|
|
|
|
[Browsable(false)]
|
|
public int LineIndex { get; set; }
|
|
|
|
public override string ToString() => Name;
|
|
|
|
public string ToSceneLine(int parentIndex)
|
|
{
|
|
ParentIndex = parentIndex;
|
|
return string.Format(CultureInfo.InvariantCulture,
|
|
"{0} {1} {2} {3} {4:F4} {5:F4} {6:F4} {7:F4} {8:F4} {9:F4} {10:F4} {11:F4} {12:F4}",
|
|
Name, parentIndex, Mesh, MeshPath,
|
|
PosX, PosY, PosZ, RotX, RotY, RotZ, ScaleX, ScaleY, ScaleZ);
|
|
}
|
|
}
|