Ejemplo n.º 1
0
        internal static W3dShaderMaterial Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dShaderMaterial();

                ParseChunks(reader, context.CurrentEndPosition, chunkType =>
                {
                    switch (chunkType)
                    {
                    case W3dChunkType.W3D_CHUNK_SHADER_MATERIAL_HEADER:
                        result.Header = W3dShaderMaterialHeader.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_SHADER_MATERIAL_PROPERTY:
                        result.Properties.Add(W3dShaderMaterialProperty.Parse(reader, context));
                        break;

                    default:
                        throw CreateUnknownChunkException(chunkType);
                    }
                });

                return result;
            }));
        }
Ejemplo n.º 2
0
        public static W3dShaderMaterial Parse(BinaryReader reader, uint chunkSize)
        {
            var properties = new List <W3dShaderMaterialProperty>();

            var finalResult = ParseChunk <W3dShaderMaterial>(reader, chunkSize, (result, header) =>
            {
                switch (header.ChunkType)
                {
                case W3dChunkType.W3D_CHUNK_SHADER_MATERIAL_HEADER:
                    result.Header = W3dShaderMaterialHeader.Parse(reader, header.ChunkSize);
                    break;

                case W3dChunkType.W3D_CHUNK_SHADER_MATERIAL_PROPERTY:
                    properties.Add(W3dShaderMaterialProperty.Parse(reader, header.ChunkSize));
                    break;

                default:
                    throw CreateUnknownChunkException(header);
                }
            });

            finalResult.Properties = properties;

            return(finalResult);
        }
Ejemplo n.º 3
0
        public static W3dShaderMaterialHeader Parse(BinaryReader reader, uint chunkSize)
        {
            var result = new W3dShaderMaterialHeader
            {
                Number   = reader.ReadByte(),
                TypeName = reader.ReadFixedLengthString(W3dConstants.NameLength * 2)
            };

            reader.ReadUInt32(); // Reserved

            return(result);
        }
        internal static W3dShaderMaterialHeader Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dShaderMaterialHeader
                {
                    Number = reader.ReadByte(),
                    TypeName = reader.ReadFixedLengthString(W3dConstants.NameLength * 2)
                };

                reader.ReadUInt32(); // Reserved

                return result;
            }));
        }