Esempio n. 1
0
        private static WMOGroup ReadBuildingGroup(BinaryReader br)
        {
            var group = new WMOGroup {
                Bounds = br.ReadBoundingBox()
            };

            Vector3[] vertices;
            var numVerts = br.ReadInt32();
            if (numVerts > 0)
            {
                vertices = new Vector3[numVerts];
                for (var j = 0; j < numVerts; j++)
                {
                    vertices[j] = br.ReadVector3();
                }
            }
            else
            {
                vertices = null;
            }
            group.Vertices = vertices;
            group.Tree = ReadBSPTree(br);

            return group;
        }
Esempio n. 2
0
        private static void ReadBuildings(BinaryReader br, TreeReference<WMO> tree)
        {
            var numBuildings = br.ReadInt32();
            for (var i = 0; i < numBuildings; i++)
            {
                var bounds = br.ReadBoundingBox();
                var invRot = br.ReadSingle();
                var matrix = Matrix.CreateRotationY(((-1.0f*(invRot - 90)))*RadiansPerDegree);
                var center = br.ReadVector3();

                WMOGroup[] groups;
                var numGroups = br.ReadInt32();
                if (numGroups > 0)
                {
                    groups = new WMOGroup[numGroups];
                    for (var j = 0; j < numGroups; j++)
                    {
                        groups[j] = ReadBuildingGroup(br);
                    }
                }
                else
                {
                    groups = null;
                }

                var building = new WMO {
                    Bounds = bounds,
                    Center = center,
                    InverseRotation = matrix,
                    WmoGroups = groups
                };

                tree.Tree.Insert(building);
            }
        }