Пример #1
0
        private bool LoadGroups()
        {
            if (mHeader.nGroups == 0)
            {
                Log.Warning("WMO has no groups - Skipping");
                return(true);
            }

            var rootPath = Path.ChangeExtension(mFileName, null);

            var minPos = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
            var maxPos = new Vector3(float.MinValue, float.MinValue, float.MinValue);

            for (var i = 0; i < mHeader.nGroups; ++i)
            {
                var groupName = string.Format("{0}_{1:D3}.wmo", rootPath, i);
                var group     = new WmoGroup(groupName, this);
                if (group.Load())
                {
                    mGroups.Add(group);
                    var gmin = group.MinPosition;
                    var gmax = group.MaxPosition;

                    if (gmin.X < minPos.X)
                    {
                        minPos.X = gmin.X;
                    }
                    if (gmin.Y < minPos.Y)
                    {
                        minPos.Y = gmin.Y;
                    }
                    if (gmin.Z < minPos.Z)
                    {
                        minPos.Z = gmin.Z;
                    }
                    if (gmax.X > maxPos.X)
                    {
                        maxPos.X = gmax.X;
                    }
                    if (gmax.Y > maxPos.Y)
                    {
                        maxPos.Y = gmax.Y;
                    }
                    if (gmax.Z > maxPos.Z)
                    {
                        maxPos.Z = gmax.Z;
                    }
                }
                else
                {
                    return(false);
                }
            }


            Groups = mGroups.Select(g => (Models.WmoGroup)g).ToList().AsReadOnly();

            BoundingBox = new BoundingBox(minPos, maxPos);
            return(true);
        }
Пример #2
0
        private bool LoadGroups()
        {
            if (mHeader.nGroups == 0)
            {
                Log.Warning("WMO has no groups - Skipping");
                return true;
            }

            var rootPath = Path.ChangeExtension(mFileName, null);

            var minPos = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
            var maxPos = new Vector3(float.MinValue, float.MinValue, float.MinValue);

            for (var i = 0; i < mHeader.nGroups; ++i)
            {
                var groupName = string.Format("{0}_{1:D3}.wmo", rootPath, i);
                var group = new WmoGroup(groupName, this);
                if (group.Load())
                {
                    mGroups.Add(group);
                    var gmin = group.MinPosition;
                    var gmax = group.MaxPosition;

                    if (gmin.X < minPos.X) minPos.X = gmin.X;
                    if (gmin.Y < minPos.Y) minPos.Y = gmin.Y;
                    if (gmin.Z < minPos.Z) minPos.Z = gmin.Z;
                    if (gmax.X > maxPos.X) maxPos.X = gmax.X;
                    if (gmax.Y > maxPos.Y) maxPos.Y = gmax.Y;
                    if (gmax.Z > maxPos.Z) maxPos.Z = gmax.Z;
                }
                else
                    return false;
            }


            Groups = mGroups.Select(g => (Models.WmoGroup)g).ToList().AsReadOnly();

            BoundingBox = new BoundingBox(minPos, maxPos);
            return true;
        }