Beispiel #1
0
        public void Read()
        {
            if (Type == ADTType.Normal)
            {
                ADTObjects = new ADT(World, X, Y, ADTType.Objects);
                ADTObjects.Read();

                //ADTTextures = new ADT(World, X, Y, ADTType.Textures);
                //ADTTextures.Read();
            }

            MapChunks = new MapChunk[16 * 16];
            int mcIdx = 0;

            foreach (var subChunk in Data.Chunks)
            {
                switch (subChunk.Name)
                {
                    case "MHDR":
                        MHDR = new MHDR(subChunk);
                        break;
                    case "MMDX":
                        MMDX = new MMDX(subChunk);
                        break;
                    case "MMID":
                        MMID = new MMID(subChunk);
                        ReadDoodads();
                        break;
                    case "MWMO":
                        MWMO = new MWMO(subChunk);
                        break;
                    case "MWID":
                        MWID = new MWID(subChunk);
                        ReadModels();
                        break;
                    case "MDDF":
                        MDDF = new MDDF(subChunk);
                        break;
                    case "MODF":
                        MODF = new MODF(subChunk);
                        break;
                    case "MH2O":
                        Liquid = new LiquidChunk(this, subChunk);
                        break;
                    case "MCNK":
                        MapChunks[mcIdx++] = new MapChunk(this, subChunk);
                        break;
                }
            }
        }
Beispiel #2
0
        public void GenerateGlobalModel()
        {
            ModelFile = MWMO.Filenames.FirstOrDefault().Value;
            if (string.IsNullOrEmpty(ModelFile))
            {
                return;
            }

            GlobalModel = new WMORoot(ModelFile);
            if (GlobalModel == null)
            {
                return;
            }

            var placementEntry = MODF.Entries.FirstOrDefault();

            if (placementEntry == null)
            {
                return;
            }

            ModelScene = MapChunk.GenerateWMOScene(placementEntry, GlobalModel)
                         .Transform(Matrix4.CreateRotationX((float)(-Math.PI / 2.0f)));
        }