public static ReferenceInformationType ToReferenceInformationType(this RawString str) { if (str.SequenceEqual(FbxConstStrings.Direct())) { return(ReferenceInformationType.Direct); } else if (str.SequenceEqual(FbxConstStrings.IndexToDirect())) { return(ReferenceInformationType.IndexToDirect); } else { throw new FormatException(); } }
public static MappingInformationType ToMappingInformationType(this RawString str) { if (str.SequenceEqual(FbxConstStrings.ByVertice())) { return(MappingInformationType.ByVertice); } else if (str.SequenceEqual(FbxConstStrings.ByPolygonVertex())) { return(MappingInformationType.ByPolygonVertex); } else if (str.SequenceEqual(FbxConstStrings.ByPolygonVertex())) { return(MappingInformationType.ByControllPoint); } else { throw new FormatException(); } }
public LimbNode(FbxNode node) { Debug.Assert(node.Properties[2].AsString().ToModelType() == ModelType.LimbNode); Node = node; ID = node.Properties[0].AsInt64(); Name = node.Properties[1].AsString(); var property70 = node.FindChild(FbxConstStrings.Properties70()); Translation = default; Rotation = default; Scale = Vector3.One; foreach (var p in property70.Children) { var props = p.Properties; if (props.Length < 1 || props[0].Type != FbxPropertyType.String) { continue; } var propTypeName = props[0].AsString(); if (propTypeName.SequenceEqual(FbxConstStrings.Lcl_Translation())) { Translation = new Vector3( (float)props[4].AsDouble(), (float)props[5].AsDouble(), (float)props[6].AsDouble()); } else if (propTypeName.SequenceEqual(FbxConstStrings.Lcl_Rotation())) { Rotation = new Vector3( (float)props[4].AsDouble(), (float)props[5].AsDouble(), (float)props[6].AsDouble()); } else if (propTypeName.SequenceEqual(FbxConstStrings.Lcl_Scaling())) { Scale = new Vector3( (float)props[4].AsDouble(), (float)props[5].AsDouble(), (float)props[6].AsDouble()); } } }
public void GetInitialMatrix(out Matrix4 mat) { var array = _node.FindChild(FbxConstStrings.TransformLink()).Properties[0].AsDoubleArray(); mat.M00 = (float)array[0]; mat.M10 = (float)array[1]; mat.M20 = (float)array[2]; mat.M30 = (float)array[3]; mat.M01 = (float)array[4]; mat.M11 = (float)array[5]; mat.M21 = (float)array[6]; mat.M31 = (float)array[7]; mat.M02 = (float)array[8]; mat.M12 = (float)array[9]; mat.M22 = (float)array[10]; mat.M32 = (float)array[11]; mat.M03 = (float)array[12]; mat.M13 = (float)array[13]; mat.M23 = (float)array[14]; mat.M33 = (float)array[15]; }
public MeshGeometry(FbxNode geometryNode) { Debug.Assert(geometryNode.IsMeshGeometry()); ID = geometryNode.Properties[0].AsInt64(); Name = geometryNode.Properties[1].AsString(); _positions = default; _indicesRaw = default; _normals = default; NormalReferenceType = default; NormalMappingType = default; _normalIndices = default; _uv = default; UVReferenceType = default; UVMappingType = default; _uvIndices = default; Materials = default; foreach (var node in geometryNode.Children) { var nodeName = node.Name; if (nodeName.SequenceEqual(FbxConstStrings.Vertices())) { // "Vertices" _positions = node.Properties[0].AsDoubleArray(); } else if (nodeName.SequenceEqual(FbxConstStrings.PolygonVertexIndex())) { // "PolygonVertexindex" _indicesRaw = node.Properties[0].AsInt32Array(); } else if (nodeName.SequenceEqual(FbxConstStrings.LayerElementNormal())) { // "LayerElementNormal" _normals = node.FindChild(FbxConstStrings.Normals()).Properties[0].AsDoubleArray(); var referenceType = node.FindChild(FbxConstStrings.ReferenceInformationType()).Properties[0].AsString(); var mappingType = node.FindChild(FbxConstStrings.MappingInformationType()).Properties[0].AsString(); NormalReferenceType = referenceType.ToReferenceInformationType(); NormalMappingType = mappingType.ToMappingInformationType(); if (NormalReferenceType == ReferenceInformationType.IndexToDirect) { _normalIndices = node.FindChild(FbxConstStrings.NormalIndex()).Properties[0].AsInt32Array(); } } else if (nodeName.SequenceEqual(FbxConstStrings.LayerElementUV())) { // "LayerElementUV" _uv = node.FindChild(FbxConstStrings.UV()).Properties[0].AsDoubleArray(); var referenceType = node.FindChild(FbxConstStrings.ReferenceInformationType()).Properties[0].AsString(); var mappingType = node.FindChild(FbxConstStrings.MappingInformationType()).Properties[0].AsString(); UVReferenceType = referenceType.ToReferenceInformationType(); UVMappingType = mappingType.ToMappingInformationType(); if (UVReferenceType == ReferenceInformationType.IndexToDirect) { _uvIndices = node.FindChild(FbxConstStrings.UVIndex()).Properties[0].AsInt32Array(); } } else if (nodeName.SequenceEqual(FbxConstStrings.LayerElementMaterial())) { // "LayerElementMaterial" Materials = node.FindChild(FbxConstStrings.Materials()).Properties[0].AsInt32Array(); } } }
public RawArray <double> GetWeights() { return(_node.FindChild(FbxConstStrings.Weights()).Properties[0].AsDoubleArray()); }
public RawArray <int> GetIndices() { return(_node.FindChild(FbxConstStrings.Indexes()).Properties[0].AsInt32Array()); }