Ejemplo n.º 1
0
            public CMBTextureMapWrapper(TextureMapper texMap, CMB cmb)
            {
                CMBParent      = cmb;
                TextureMapData = texMap;

                this.WrapModeS = ConvertWrapMode(TextureMapData.WrapU);
                this.WrapModeT = ConvertWrapMode(TextureMapData.WrapV);
                this.MinFilter = ConvertMinFilterMode(TextureMapData.TextureMinFilter);
                this.MagFilter = ConvertMagFilterMode(TextureMapData.TextureMagFilter);
            }
Ejemplo n.º 2
0
        private List <CMB> ReadMesh(FileReader reader)
        {
            List <CMB> Models = new List <CMB>();

            reader.SetByteOrder(true);
            uint flags = reader.ReadUInt32();

            reader.SetByteOrder(false);
            int meshType   = ((int)flags >> 24);
            int numMeshes  = ((int)flags >> 16) & 0xFF;
            int meshOffset = reader.ReadInt32();

            if (numMeshes == 0x00)
            {
                return(Models);
            }

            //There should be 1 or 2 meshes, (opaque and transparent)
            if (numMeshes != 2 && numMeshes != 1)
            {
                throw new Exception($"Unexpected mesh count {numMeshes}. Expected 1 or 2");
            }

            if (meshType != 2)
            {
                throw new Exception($"Unexpected mesh tye {meshType}. Expected 2");
            }

            reader.SeekBegin(meshOffset + 32); //Relative to end of header
            uint magic    = reader.ReadUInt32();
            uint fileSize = reader.ReadUInt32();

            CMB cmb = new CMB();

            cmb.IFileInfo = new IFileInfo();
            cmb.Load(new System.IO.MemoryStream(reader.getSection((uint)meshOffset + 32, fileSize)));
            Models.Add(cmb);

            return(Models);
        }
Ejemplo n.º 3
0
 public CMBMaterialWrapper(Material material, CMB cmb, H3DMaterial h3D) : base(h3D)
 {
     ParentCMB   = cmb;
     CMBMaterial = material;
 }