Exemple #1
0
        //#######################################################################################
        //# Texture
        //#######################################################################################
        private static void ReadTexture(BinaryReader br, uint ChunkEnd)
        {
            while (br.BaseStream.Position < ChunkEnd)
            {
                uint Chunktype = ReadLong(br);
                uint Chunksize = getChunkSize(ReadLong(br));
                uint subChunkEnd = (uint)br.BaseStream.Position + Chunksize;

                W3DMesh.Texture tex = new W3DMesh.Texture();
                switch (Chunktype)
                {
                    case 50:
                        texName = ReadString(br);
                        tex.type = W3DMesh.textureType.standard;
                        break;
                    case 51:
                        tex.attributes = ReadShort(br);
                        tex.animType = ReadShort(br);
                        tex.frameCount = ReadLong(br);
                        tex.frameRate = ReadFloat(br);
                        tex.type = W3DMesh.textureType.animated;
                        break;
                    default:
                        Console.WriteLine("unknown chunktype: " + Chunktype + "   in MeshTexture");
                        br.ReadBytes((int)Chunksize);
                        break;
                }
                mesh.textures.Add(texName, tex);
            }
        }
Exemple #2
0
        private static void ReadNormalMap(BinaryReader br, uint ChunkEnd)
        {
            W3DMesh.Texture tex = new W3DMesh.Texture();
            tex.type = W3DMesh.textureType.bumpMapped;
            while (br.BaseStream.Position < ChunkEnd)
            {
                uint Chunktype = ReadLong(br);
                uint Chunksize = getChunkSize(ReadLong(br));
                uint subChunkEnd = (uint)br.BaseStream.Position + Chunksize;

                switch (Chunktype)
                {
                    case 82:
                        ReadNormalMapHeader(br);
                        break;
                    case 83:
                        ReadNormalMapEntryStruct(br, subChunkEnd, tex);
                        break;
                    default:
                        Console.WriteLine("unknown chunktype: " + Chunktype + " in MeshNormalMap");
                        br.ReadBytes((int)Chunksize);
                        break;
                }
            }
            mesh.textures.Add(texName, tex);
        }