public GrnMeshWeightsNode(GrnNode parentNode) : base(parentNode, GrnNodeType.MeshWeights) { this.HighestBoneIndex = 0; this.HighestVertexWeightCount = 0; this.VertexWeights = new List <VertexWeight>(); }
protected override void Read(GrnBinaryReader reader) { reader.ReadBytes(4); this.Offset = reader.ReadUInt32(); reader.ReadBytes(8); int currentPosition = (Int32)reader.BaseStream.Position; reader.Seek((int)this.Offset, System.IO.SeekOrigin.Begin); this.NumTotalChildNodes = reader.ReadInt32(); reader.ReadBytes(12); int numChildren = this.NumTotalChildNodes; for (int i = 0; i < numChildren; i++) { GrnNodeType nodeType = (GrnNodeType)reader.ReadInt32(); GrnNode childNode = GrnNode.ReadByNodeType(reader, this, nodeType); this.ChildNodes.Add(childNode); numChildren -= childNode.NumTotalChildNodes; if (i > 0) { childNode.PreviousSibling = this.ChildNodes[i - 1]; childNode.PreviousSibling.NextSibling = childNode; } } reader.Seek(currentPosition, System.IO.SeekOrigin.Begin); }
public GrnNode(GrnNode parentNode, GrnNodeType nodeType) { this.ParentNode = parentNode; this.PreviousSibling = null; this.NextSibling = null; this.NodeType = nodeType; this.Offset = 0; this.ChildNodes = new List <GrnNode>(); this.Data = new byte[0]; }
public virtual void AppendChild(GrnNode node) { node.ParentNode = this; if (this.ChildNodes.Count > 0) { node.PreviousSibling = this.ChildNodes[this.ChildNodes.Count - 1]; node.PreviousSibling.NextSibling = node; } this.ChildNodes.Add(node); }
public GrnAnimationTransformTrackKeysNode(GrnNode parentNode) : base(parentNode, GrnNodeType.AnimationTransformTrackKeys) { this.Unknown = new Int32[5] { 0, 1, 2, 2, 1 }; this.PositionKeys = new List <float>(); this.RotationKeys = new List <float>(); this.ScaleKeys = new List <float>(); this.Unknown2 = new Int32[4] { 0, 1, 2, 0 }; this.Positions = new List <Vector3>(); this.Rotations = new List <Quaternion>(); this.Scales = new List <Matrix4x4>(); }
public int GetReadDataLength() { if (this.ChildNodes.Count > 0) { return((int)(this.ChildNodes[0].Offset - this.Offset)); } else if (this.NextSibling != null) { return((int)(this.NextSibling.Offset - this.Offset)); } GrnNode parentNode = this.ParentNode; while (parentNode != null) { if (parentNode.NextSibling != null && parentNode.NodeType != GrnNodeType.NullTerminator && parentNode.NodeType != GrnNodeType.VersionFrameDirectory && parentNode.NodeType != GrnNodeType.StandardFrameDirectory && parentNode.NodeType != GrnNodeType.NullFrameDirectory && parentNode.NodeType != GrnNodeType.FileDirectory) { return((int)(parentNode.NextSibling.Offset - this.Offset)); } parentNode = parentNode.ParentNode; } return(0); //switch (this.NodeType) //{ // case GrnNodeType.DataExtensionProperty: // case GrnNodeType.DataExtensionReference: // return 4; // break; // case GrnNodeType.DataExtension: // case GrnNodeType.DataExtensionPropertyValue: // return 8; // break; // default: // return 0; // break; //} }
protected virtual void Read(GrnBinaryReader reader) { this.Offset = reader.ReadUInt32(); this.NumTotalChildNodes = reader.ReadInt32(); int numChildren = this.NumTotalChildNodes; for (int i = 0; i < numChildren; i++) { GrnNodeType nodeType = (GrnNodeType)reader.ReadInt32(); GrnNode childNode = GrnNode.ReadByNodeType(reader, this, nodeType); this.ChildNodes.Add(childNode); numChildren -= childNode.NumTotalChildNodes; if (i > 0) { childNode.PreviousSibling = this.ChildNodes[i - 1]; childNode.PreviousSibling.NextSibling = childNode; } } }
protected override void Read(GrnBinaryReader reader) { this.NumTotalChildNodes = reader.ReadInt32(); reader.ReadBytes(8); this.FileLength = reader.ReadUInt32(); reader.ReadBytes(12); for (int i = 0; i < NumTotalChildNodes; i++) { GrnNodeType nodeType = (GrnNodeType)reader.ReadInt32(); GrnNode childNode = GrnNode.ReadByNodeType(reader, this, nodeType); this.ChildNodes.Add(childNode); if (i > 0) { childNode.PreviousSibling = this.ChildNodes[i - 1]; childNode.PreviousSibling.NextSibling = childNode; } } this.ReadData(reader, 0); }
public GrnMeshFieldNode(GrnNode parentNode) : base(parentNode, GrnNodeType.MeshField) { this.Unknown = 3; this.TextureCoordinates = new List <Vector3>(); }
public GrnDataExtensionPropertyValueNode(GrnNode parentNode) : base(parentNode, GrnNodeType.DataExtensionPropertyValue) { }
public GrnRenderPassTrianglesNode(GrnNode parentNode) : base(parentNode, GrnNodeType.RenderPassTriangles) { this.TextureIndices = new Dictionary <int, List <int> >(); }
public GrnBoneNode(GrnNode parentNode) : base(parentNode, GrnNodeType.Bone) { }
public GrnFormBoneChannelsNode(GrnNode parentNode) : base(parentNode, GrnNodeType.FormBoneChannels) { this.TransformChannelIndices = new List <int>(); }
public GrnSectionNode(GrnNode parentNode, GrnNodeType nodeType) : base(parentNode, nodeType) { }
public GrnDataExtensionReferenceNode(GrnNode parentNode) : base(parentNode, GrnNodeType.DataExtensionReference) { }
public GrnTextureMapImageNode(GrnNode parentNode) : base(parentNode, GrnNodeType.TextureMapImage) { this.Unknown = 7; }
public GrnMeshTrianglesNode(GrnNode parentNode) : base(parentNode, GrnNodeType.MeshTriangles) { this.Faces = new List <Face>(); }
public GrnMaterialSimpleDiffuseTextureNode(GrnNode parentNode) : base(parentNode, GrnNodeType.MaterialSimpleDiffuseTexture) { this.Unknown2 = 1; }
public GrnMeshNormalsNode(GrnNode parentNode) : base(parentNode, GrnNodeType.MeshNormals) { this.Normals = new List <Vector3>(); }
public GrnStringTableNode(GrnNode parentNode) : base(parentNode, GrnNodeType.StringTable) { this.Strings = new List <string>(); }
public static GrnNode ReadByNodeType(GrnBinaryReader reader, GrnNode parentNode, GrnNodeType nodeType) { GrnNode node; if (nodeType == GrnNodeType.FileDirectory) { node = new GrnMainNode(); } else if (nodeType == GrnNodeType.VersionFrameDirectory || nodeType == GrnNodeType.StandardFrameDirectory || nodeType == GrnNodeType.NullFrameDirectory) { node = new GrnSectionNode(parentNode, nodeType); } else if (nodeType == GrnNodeType.StringTable) { node = new GrnStringTableNode(parentNode); } else if (parentNode.NodeType == GrnNodeType.MeshVertexSet) { if (nodeType == GrnNodeType.MeshVertices) { node = new GrnMeshVerticesNode(parentNode); } else if (nodeType == GrnNodeType.MeshNormals) { node = new GrnMeshNormalsNode(parentNode); } else { node = new GrnNode(parentNode, nodeType); } } else if (nodeType == GrnNodeType.MeshField) { node = new GrnMeshFieldNode(parentNode); } else if (nodeType == GrnNodeType.MeshWeights) { node = new GrnMeshWeightsNode(parentNode); } else if (nodeType == GrnNodeType.MeshTriangles) { node = new GrnMeshTrianglesNode(parentNode); } else if (nodeType == GrnNodeType.DataExtensionProperty) { node = new GrnDataExtensionPropertyNode(parentNode); } else if (nodeType == GrnNodeType.DataExtensionPropertyValue) { node = new GrnDataExtensionPropertyValueNode(parentNode); } else if (nodeType == GrnNodeType.DataExtensionReference) { node = new GrnDataExtensionReferenceNode(parentNode); } else if (nodeType == GrnNodeType.Bone) { node = new GrnBoneNode(parentNode); } else if (nodeType == GrnNodeType.MaterialSimpleDiffuseTexture) { node = new GrnMaterialSimpleDiffuseTextureNode(parentNode); } else if (nodeType == GrnNodeType.FormBoneChannels) { node = new GrnFormBoneChannelsNode(parentNode); } else if (nodeType == GrnNodeType.FormMesh) { node = new GrnFormMeshNode(parentNode); } else if (nodeType == GrnNodeType.FormMeshBone) { node = new GrnFormMeshBoneNode(parentNode); } else if (nodeType == GrnNodeType.RenderPass) { node = new GrnRenderPassNode(parentNode); } else if (nodeType == GrnNodeType.RenderPassTriangles) { node = new GrnRenderPassTrianglesNode(parentNode); } else if (nodeType == GrnNodeType.AnimationTransformTrackKeys) { node = new GrnAnimationTransformTrackKeysNode(parentNode); } else if (nodeType == GrnNodeType.TextureMapImage) { node = new GrnTextureMapImageNode(parentNode); } else { node = new GrnNode(parentNode, nodeType); } node.Read(reader); return(node); }
public GrnMeshVerticesNode(GrnNode parentNode) : base(parentNode, GrnNodeType.MeshVertices) { this.Vertices = new List <Vector3>(); }
public GrnFormMeshNode(GrnNode parentNode) : base(parentNode, GrnNodeType.FormMesh) { }
public GrnRenderPassNode(GrnNode parentNode) : base(parentNode, GrnNodeType.RenderPass) { }