Exemple #1
0
        private static void ReadNormalMapEntryStruct(BinaryReader br, uint ChunkEnd, W3DMesh.Texture tex)
        {
            long type = ReadLong(br); //1 texture, 2 bumpScale/ specularExponent, 5 color, 7 alphaTest
            long size = ReadLong(br);
            string name = ReadString(br);

            switch (name)
            {
                case "DiffuseTexture":
                    long unknown = ReadLong(br);
                    texName = ReadString(br);
                    break;
                case "NormalMap":
                    long unknown_nrm = ReadLong(br);
                    tex.normalMap = ReadString(br);
                    break;
                case "BumpScale":
                    tex.bumpScale = ReadFloat(br);
                    break;
                case "AmbientColor":
                    tex.ambientColor = ReadRGBA(br);
                    break;
                case "DiffuseColor":
                    tex.diffuseColor = ReadRGBA(br);
                    break;
                case "SpecularColor":
                    tex.specularColor = ReadRGBA(br);
                    break;
                case "SpecularExponent":
                    tex.specularExponent = ReadFloat(br);
                    break;
                case "AlphaTestEnable":
                    tex.alphaTestEnable = ReadByte(br);
                    break;
                default:
                    //Console.WriteLine("##W3D: unknown entryStruct: " + name + "   in MeshNormalMapEntryStruct (size: " + size + ")");
                    while (br.BaseStream.Position < ChunkEnd)
                        ReadByte(br);
                    break;
            }
        }
Exemple #2
0
        //######################################################################################
        //# mesh
        //######################################################################################
        private static void ReadMeshHeader(BinaryReader br)
        {
            Version version = GetVersion(ReadLong(br));
            uint attrs = ReadLong(br);
            string meshName = ReadFixedString(br);
            string containerName = ReadFixedString(br);
            uint faceCount = ReadLong(br);
            uint vertCount = ReadLong(br);
            uint matlCount = ReadLong(br);
            uint damageStageCount = ReadLong(br);
            uint sortLevel = ReadLong(br);
            uint prelitVersion = ReadLong(br);
            uint futureCount = ReadLong(br);
            uint vertChannelCount = ReadLong(br);
            uint faceChannelCount = ReadLong(br);
            Vector3 minCorner = ReadVector(br);
            Vector3 maxCorner = ReadVector(br);
            Vector3 sphCenter = ReadVector(br);
            float sphRadius = ReadFloat(br);

            mesh = new W3DMesh(faceCount);
            modelName = containerName;
        }