Наследование: MapDoodadDefinition
Пример #1
0
        private static void Transform(ExtractedM2 m2, ExtractedMapM2Definition def)
        {
            for (var i = 0; i < m2.BoundingVertices.Count; i++)
            {
                // Scale and transform
                var vertex = m2.BoundingVertices[i];

                Vector3 rotatedVector;
                Vector3.Transform(ref vertex, ref def.ModelToWorld, out rotatedVector);

                // Translate
                Vector3 finalVector;
                Vector3.Add(ref rotatedVector, ref def.Position, out finalVector);

                m2.BoundingVertices[i] = finalVector;
                //currentM2.Vertices.Add(new VertexPositionNormalColored(finalVector, Color.Red, Vector3.Up));
            }
        }
Пример #2
0
        private void Add(ExtractedMapM2Definition def)
        {
            var model = ExtractedM2Parser.Process(_basePath, _mapId, def.FilePath);

            Transform(model, def);

            Models.Add(model);
        }
Пример #3
0
 private static void ReadMapM2Defs(BinaryReader br, ExtractedADT adt)
 {
     var count = br.ReadInt32();
     var m2DefList = new List<ExtractedMapM2Definition>(count);
     for (var i = 0; i < count; i++)
     {
         var def = new ExtractedMapM2Definition {
                                                    UniqueId = br.ReadUInt32(),
                                                    FilePath = br.ReadString(),
                                                    Extents = br.ReadBoundingBox(),
                                                    Position = br.ReadVector3(),
                                                    WorldToModel = br.ReadMatrix(),
                                                    ModelToWorld = br.ReadMatrix()
                                                };
         m2DefList.Add(def);
     }
     adt.M2Defs = m2DefList;
 }