public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); this.Width = reader.ReadInt32(); this.Height = reader.ReadInt32(); this.Unknown = reader.ReadInt32(); }
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 override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); this.Unknown = reader.ReadInt32(); this.TextureMapIndex = reader.ReadInt32(); this.Unknown2 = reader.ReadInt32(); }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { for (int i = 0; i < this.ChildNodes.Count; i++) { this.ChildNodes[i].ReadData(reader, 0); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); for (int i = 0; i < this.GetReadDataLength() / 12; ++i) { this.Normals.Add(reader.ReadVector3D()); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); for (int i = 0; i < this.GetReadDataLength() / 12; ++i) { this.Vertices.Add(reader.ReadVector3D()); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); for (int i = 0; i < this.GetReadDataLength() / 4; ++i) { this.TransformChannelIndices.Add(reader.ReadInt32()); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); this.BoneIndex = reader.ReadInt32(); this.Unknown = reader.ReadSingle(); this.OBBMin = reader.ReadVector3D(); this.OBBMax = reader.ReadVector3D(); }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); this.Unknown = reader.ReadInt32(); // maybe count for whether its UV or UVW for (int i = 0; i < this.GetReadDataLength() / 12; ++i) { this.TextureCoordinates.Add(reader.ReadVector3D()); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); this.ParentIndex = reader.ReadInt32(); this.Position = reader.ReadVector3D(); this.Rotation = reader.ReadQuaternion(); this.Scale = reader.ReadMatrix3x3(); if (this.GetReadDataLength() != this.GetWriteDataLength()) throw new Exception("bbb"); }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); this.StringTableIndex = reader.ReadInt32(); for (int i = 0; i < this.ChildNodes.Count; i++) { this.ChildNodes[i].ReadData(reader, directoryOffset); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); this.MeshIndex = reader.ReadInt32(); for (int i = 0; i < this.ChildNodes.Count; i++) { this.ChildNodes[i].ReadData(reader, directoryOffset); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); this.ParentIndex = reader.ReadInt32(); this.Position = reader.ReadVector3D(); this.Rotation = reader.ReadQuaternion(); this.Scale = reader.ReadMatrix3x3(); if (this.GetReadDataLength() != this.GetWriteDataLength()) { throw new Exception("bbb"); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); this.TransformChannelIndex = reader.ReadInt32(); if (this.PreviousSibling != null && ((GrnAnimationTransformTrackKeysNode)this.PreviousSibling).TransformChannelIndex == this.TransformChannelIndex) { return; } // read 5 unknowns for (int i = 0; i < 5; ++i) { this.Unknown[i] = reader.ReadInt32(); } int numPositions = reader.ReadInt32(); int numRotations = reader.ReadInt32(); int numTransforms = reader.ReadInt32(); // read 4 unknowns for (int i = 0; i < 4; ++i) { this.Unknown2[i] = reader.ReadInt32(); } for (int i = 0; i < numPositions; ++i) { this.PositionKeys.Add(reader.ReadSingle()); } for (int i = 0; i < numRotations; ++i) { this.RotationKeys.Add(reader.ReadSingle()); } for (int i = 0; i < numTransforms; ++i) { this.ScaleKeys.Add(reader.ReadSingle()); } for (int i = 0; i < numPositions; ++i) { this.Positions.Add(reader.ReadVector3D()); } for (int i = 0; i < numRotations; ++i) { this.Rotations.Add(reader.ReadQuaternion()); } for (int i = 0; i < numTransforms; ++i) { this.Scales.Add(reader.ReadMatrix3x3()); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); int count = reader.ReadInt32(); for (int i = 0; i < count; ++i) { int faceIndex = reader.ReadInt32(); this.TextureIndices.Add(faceIndex, new List<int>()); this.TextureIndices[faceIndex].Add(reader.ReadInt32()); this.TextureIndices[faceIndex].Add(reader.ReadInt32()); this.TextureIndices[faceIndex].Add(reader.ReadInt32()); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); Int32 numString = reader.ReadInt32(); Int32 stringDataLength = reader.ReadInt32(); Strings.Capacity = numString; for (int i = 0; i < numString; i++) { Strings.Add(reader.ReadString()); } //reader.ReadBytes((-stringDataLength) & 3); // padding }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); int count = reader.ReadInt32(); for (int i = 0; i < count; ++i) { int faceIndex = reader.ReadInt32(); this.TextureIndices.Add(faceIndex, new List <int>()); this.TextureIndices[faceIndex].Add(reader.ReadInt32()); this.TextureIndices[faceIndex].Add(reader.ReadInt32()); this.TextureIndices[faceIndex].Add(reader.ReadInt32()); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); for (int i = 0; i < this.GetReadDataLength() / 24; ++i) { this.Faces.Add(new Face()); this.Faces[i].Indices.Add((Int16)reader.ReadInt32()); this.Faces[i].Indices.Add((Int16)reader.ReadInt32()); this.Faces[i].Indices.Add((Int16)reader.ReadInt32()); this.Faces[i].NormalIndices.Add(reader.ReadInt32()); this.Faces[i].NormalIndices.Add(reader.ReadInt32()); this.Faces[i].NormalIndices.Add(reader.ReadInt32()); } }
public virtual void ReadData(GrnBinaryReader reader, int directoryOffset) { Int32 outputLength = this.GetReadDataLength(); if (outputLength > 0) { reader.Seek((int)this.Offset + directoryOffset, System.IO.SeekOrigin.Begin); Data = reader.ReadBytes(outputLength); } for (int i = 0; i < this.ChildNodes.Count; i++) { this.ChildNodes[i].ReadData(reader, directoryOffset); } }
public override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); int weightsCount = reader.ReadInt32(); this.HighestBoneIndex = reader.ReadInt32(); // unknown (12 Jormund.grn) this.HighestVertexWeightCount = reader.ReadInt32(); // unknown (2 Jormund.grn) for (int i = 0; i < weightsCount; ++i) { this.VertexWeights.Add(new VertexWeight()); int boneCount = reader.ReadInt32(); for (int j = 0; j < boneCount; ++j) { this.VertexWeights[i].BoneIndices.Add(reader.ReadInt32()); this.VertexWeights[i].Weights.Add(reader.ReadSingle()); } } }
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 override void ReadData(GrnBinaryReader reader, int directoryOffset) { reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin); this.DataExtensionIndex = reader.ReadInt32(); }
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); }