コード例 #1
0
        public WmoInstance(int uuid, Vector3 position, Vector3 rotation, WmoRootRender model)
        {
            ReferenceCount = 1;
            Uuid           = uuid;
            BoundingBox    = model.BoundingBox;

            mPosition = position;
            mRotation = rotation;
            mModel    = model;

            mInstanceMatrix = Matrix.RotationYawPitchRoll(MathUtil.DegreesToRadians(rotation.Y),
                                                          MathUtil.DegreesToRadians(rotation.X), MathUtil.DegreesToRadians(rotation.Z)) * Matrix.Translation(position);

            mRenderer = new WeakReference <WmoRootRender>(model);

            InstanceCorners = model.BoundingBox.GetCorners();
            Vector3.TransformCoordinate(InstanceCorners, ref mInstanceMatrix, InstanceCorners);

            BoundingBox = BoundingBox.Transform(ref mInstanceMatrix);
            GroupBoxes  = new BoundingBox[model.Groups.Count];
            for (var i = 0; i < GroupBoxes.Length; ++i)
            {
                var group = model.Groups[i];
                GroupBoxes[i] = group.BoundingBox.Transform(ref mInstanceMatrix);
            }
            Matrix.Invert(ref mInstanceMatrix, out mInverseInstanceMatrix);

            mInstanceMatrix = Matrix.Transpose(mInstanceMatrix);
            ModelRoot       = model.Data;
        }
コード例 #2
0
ファイル: WmoBatchRender.cs プロジェクト: veserine/Neo
        private void Dispose(bool disposing)
        {
            if (mActiveInstances != null)
            {
                mActiveInstances.Clear();
                mActiveInstances = null;
            }

            if (mInstances != null)
            {
                foreach (var inst in mInstances.Values)
                {
                    inst.Dispose();
                }

                mInstances.Clear();
                mInstances = null;
            }

            if (mRoot != null)
            {
                mRoot.Dispose();
                mRoot = null;
            }
        }
コード例 #3
0
 public WmoGroupRender(IO.Files.Models.WmoGroup group, WmoRootRender root)
 {
     Data = group;
     foreach (var batch in Data.Batches)
     {
         mBatches.Add(new WmoRenderBatch
         {
             Batch    = batch,
             Material = root.Data.GetMaterial(batch.MaterialId)
         });
     }
 }
コード例 #4
0
ファイル: WmoGroupRender.cs プロジェクト: Linrasis/WoWEditor
 public WmoGroupRender(IO.Files.Models.WmoGroup group, WmoRootRender root)
 {
     Data = group;
     foreach(var batch in Data.Batches)
     {
         mBatches.Add(new WmoRenderBatch
         {
             Batch = batch,
             Material = root.Data.GetMaterial(batch.MaterialId)
         });
     }
 }
コード例 #5
0
ファイル: WmoInstance.cs プロジェクト: jimleigh/WoWEditor
        public WmoInstance(int uuid, Vector3 position, Vector3 rotation, WmoRootRender model)
        {
            Uuid            = uuid;
            BoundingBox     = model.BoundingBox;
            mInstanceMatrix = Matrix.RotationYawPitchRoll(MathUtil.DegreesToRadians(rotation.Y),
                                                          MathUtil.DegreesToRadians(rotation.X), MathUtil.DegreesToRadians(rotation.Z)) * Matrix.Translation(position);

            BoundingBox = BoundingBox.Transform(ref mInstanceMatrix);
            GroupBoxes  = new BoundingBox[model.Groups.Count];
            for (var i = 0; i < GroupBoxes.Length; ++i)
            {
                var group = model.Groups[i];
                GroupBoxes[i] = group.BoundingBox.Transform(ref mInstanceMatrix);
            }

            mInstanceMatrix = Matrix.Transpose(mInstanceMatrix);
        }
コード例 #6
0
ファイル: WmoInstance.cs プロジェクト: Linrasis/WoWEditor
        public WmoInstance(int uuid, Vector3 position, Vector3 rotation, WmoRootRender model)
        {
            Uuid = uuid;
            BoundingBox = model.BoundingBox;
            mInstanceMatrix = Matrix.RotationYawPitchRoll(MathUtil.DegreesToRadians(rotation.Y),
                                  MathUtil.DegreesToRadians(rotation.X), MathUtil.DegreesToRadians(rotation.Z)) * Matrix.Translation(position);

            BoundingBox = BoundingBox.Transform(ref mInstanceMatrix);
            GroupBoxes = new BoundingBox[model.Groups.Count];
            for(var i = 0; i < GroupBoxes.Length; ++i)
            {
                var group = model.Groups[i];
                GroupBoxes[i] = group.BoundingBox.Transform(ref mInstanceMatrix);
            }

            mInstanceMatrix = Matrix.Transpose(mInstanceMatrix);
        }
コード例 #7
0
ファイル: WmoManager.cs プロジェクト: Linrasis/WoWEditor
        private void PreloadModel(string model)
        {
            var hash = model.ToUpperInvariant().GetHashCode();
            lock(mRenderer)
            {
                if (mRenderer.ContainsKey(hash))
                    return;

                var root = IO.Files.Models.ModelFactory.Instance.CreateWmo();

                if (root.Load(model) == false)
                    Log.Warning("Unable to load WMO '" + model + "'. Further instances wont be loaded again");


                var renderer = new WmoRootRender();
                renderer.OnAsyncLoad(root);

                var batch = new WmoBatchRender(renderer);

                lock (mAddLock)
                    mRenderer.Add(hash, batch);
            }
        }
コード例 #8
0
 public WmoBatchRender(WmoRootRender root)
 {
     mRoot = root;
 }
コード例 #9
0
ファイル: WmoBatchRender.cs プロジェクト: Linrasis/WoWEditor
 public WmoBatchRender(WmoRootRender root)
 {
     mRoot = root;
 }