Exemplo n.º 1
0
        public void Read()
        {
            Header = new MHDR();
            Header.Read(Data.GetChunkByName("MHDR").GetStream());

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

            foreach (var mapChunk in Data.Chunks.Where(c => c.Name == "MCNK"))
            {
                MapChunks[mapChunkIndex++] = new MapChunk(this, mapChunk);
            }

            LiquidHandler = new LiquidHandler(this);

            // do this seperate from map chunk initialization to access liquid data
            foreach (var mapChunk in MapChunks)
            {
                mapChunk.GenerateTriangles();
            }

            DoodadHandler = new DoodadHandler(this);
            foreach (var mapChunk in MapChunks)
            {
                DoodadHandler.ProcessMapChunk(mapChunk);
            }

            WorldModelHandler = new WorldModelHandler(this);
            foreach (var mapChunk in MapChunks)
            {
                WorldModelHandler.ProcessMapChunk(mapChunk);
            }
        }
Exemplo n.º 2
0
 public void AddDungeon(WorldModelRoot model, WorldModelHandler.WorldModelDefinition def)
 {
     var verts = new List<Vector3>();
     var tris = new List<Triangle<uint>>();
     WorldModelHandler.InsertModelGeometry(verts, tris, def, model);
     AddData(verts, tris);
 }
Exemplo n.º 3
0
        public static Matrix GetWmoDoodadTransformation(DoodadInstance inst, WorldModelHandler.WorldModelDefinition root)
        {
            var rootTransformation = GetTransformation(root);

            var translation = Matrix.Translation(inst.Position);
            var scale = Matrix.Scaling(new Vector3(inst.Scale));
            var rotation = Matrix.RotationY(MathHelper.Pi);
            var quatRotation = Matrix.RotationQuaternion(new Quaternion(-inst.QuatY, inst.QuatZ, -inst.QuatX, inst.QuatW));

            return scale*rotation*quatRotation*translation*rootTransformation;
        }
Exemplo n.º 4
0
        public void Read()
        {
            Header = new MHDR();
            Header.Read(Data.GetChunkByName("MHDR").GetStream());

            MapChunks = new MapChunk[16 * 16];
            int mapChunkIndex = 0;
            foreach (var mapChunk in Data.Chunks.Where(c => c.Name == "MCNK"))
                MapChunks[mapChunkIndex++] = new MapChunk(this, mapChunk);

            LiquidHandler = new LiquidHandler(this);

            // do this seperate from map chunk initialization to access liquid data
            foreach (var mapChunk in MapChunks)
                mapChunk.GenerateTriangles();

            DoodadHandler = new DoodadHandler(this);
            foreach (var mapChunk in MapChunks)
                DoodadHandler.ProcessMapChunk(mapChunk);

            WorldModelHandler = new WorldModelHandler(this);
            foreach (var mapChunk in MapChunks)
                WorldModelHandler.ProcessMapChunk(mapChunk);
        }
Exemplo n.º 5
0
 public WmoDrawer(Microsoft.Xna.Framework.Game game, string path,  WorldModelHandler.WorldModelDefinition def) : base(game)
 {
     _path = path;
     _def = def;
 }