public VertexShapeLODElement(Stream stream) { versionNumber = StreamUtils.ReadInt16(stream); BindingAttributes = StreamUtils.ReadInt32(stream); QuantizationParameters = new QuantizationParameters(stream); }
public Date(Stream stream) { data = new Int16[6]; for (int i = 0, c = data.Length; i < c; ++i) { data[i] = StreamUtils.ReadInt16(stream); } }
public PropertyTable(Stream stream) { VersionNumber = StreamUtils.ReadInt16(stream); NodePropertyTableCount = StreamUtils.ReadInt32(stream); NodeObjectIDs = new Int32[NodePropertyTableCount]; NodePropertyTables = new NodePropertyTable[NodePropertyTableCount]; for (int i = 0; i < NodePropertyTableCount; ++i) { NodeObjectIDs[i] = StreamUtils.ReadInt32(stream); NodePropertyTables[i] = new NodePropertyTable(stream); } }
public MetaDataNodeElement(Stream stream) : base(stream) { versionNumber = StreamUtils.ReadInt16(stream); }
public VertexBasedShapeCompressedRepData(Stream stream) { VersionNumber = StreamUtils.ReadInt16(stream); NormalBinding = StreamUtils.ReadByte(stream); TextureCoordBinding = StreamUtils.ReadByte(stream); ColourBinding = StreamUtils.ReadByte(stream); QuantizationParameters = new QuantizationParameters(stream); var primitiveListIndices = Int32CompressedDataPacket.GetArrayI32(stream, Int32CompressedDataPacket.PredictorType.Stride1); MemoryStream vertexDataStream; if (QuantizationParameters.BitsPerVertex == 0) { LosslessCompressedRawVertexData = new LosslessCompressedRawVertexData(stream); vertexDataStream = new MemoryStream(LosslessCompressedRawVertexData.VertexData); } else { throw new NotImplementedException("LossyQuantizedRawVertexData NOT IMPLEMENTED"); } var readNormals = NormalBinding == 1; var readTextureCoords = TextureCoordBinding == 1; var readColours = ColourBinding == 1; var vertexEntrySize = 3 + (readNormals ? 3 : 0) + (readTextureCoords ? 2 : 0) + (readColours ? 3 : 0); var vertexEntryCount = (vertexDataStream.Length / 4) / vertexEntrySize; var vertexPositions = new float[vertexEntryCount][]; var vertexNormals = readNormals ? new float[vertexEntryCount][] : null; var vertexColours = readColours ? new float[vertexEntryCount][] : null; var vertexTextureCoordinates = readTextureCoords ? new float[vertexEntryCount][] : null; for (int i = 0; i < vertexEntryCount; ++i) { if (readTextureCoords) { vertexTextureCoordinates[i] = new float[] { StreamUtils.ReadFloat(vertexDataStream), StreamUtils.ReadFloat(vertexDataStream) } } ; if (readColours) { vertexColours[i] = new float[] { StreamUtils.ReadFloat(vertexDataStream), StreamUtils.ReadFloat(vertexDataStream), StreamUtils.ReadFloat(vertexDataStream) } } ; if (readNormals) { vertexNormals[i] = new float[] { StreamUtils.ReadFloat(vertexDataStream), StreamUtils.ReadFloat(vertexDataStream), StreamUtils.ReadFloat(vertexDataStream) } } ; vertexPositions[i] = new float[] { StreamUtils.ReadFloat(vertexDataStream), StreamUtils.ReadFloat(vertexDataStream), StreamUtils.ReadFloat(vertexDataStream) }; } Positions = vertexPositions; Normals = vertexNormals; var triStripCount = primitiveListIndices.Length - 1; var triStrips = new int[triStripCount][]; for (int triStripIndex = 0; triStripIndex < triStripCount; ++triStripIndex) { var startIndex = primitiveListIndices[triStripIndex]; var endIndex = primitiveListIndices[triStripIndex + 1]; var indicesCount = endIndex - startIndex; var indices = new int[indicesCount]; for (int i = 0; i < indicesCount; ++i) { indices[i] = startIndex + i; } triStrips[triStripIndex] = indices; } TriStrips = triStrips; } } }
public TriStripSetShapeLODElement(Stream stream) : base(stream) { versionNumber = StreamUtils.ReadInt16(stream); VertexBasedShapeCompressedRepData = new VertexBasedShapeCompressedRepData(stream); }
public GUID(Stream stream) { guid = new Guid(StreamUtils.ReadInt32(stream), StreamUtils.ReadInt16(stream), StreamUtils.ReadInt16(stream), StreamUtils.ReadBytes(stream, 8, false)); }
public PartNodeElement(Stream stream) : base(stream) { versionNumber = StreamUtils.ReadInt16(stream); reservedField = StreamUtils.ReadInt32(stream); }