Exemplo n.º 1
0
        public void OnAsyncLoad(IO.Files.Terrain.MapChunk chunk, MapAreaRender parent)
        {
            mData        = chunk;
            mBoundingBox = chunk.BoundingBox;
            mModelBox    = chunk.ModelBox;
            mReferences  = new M2Instance[chunk.DoodadReferences.Length];
            for (var i = 0; i < mReferences.Length; ++i)
            {
                mReferences[i] = parent.AreaFile.DoodadInstances[chunk.DoodadReferences[i]];
            }

            for (var i = 0; i < mData.Layers.Length; ++i)
            {
                if ((mData.Layers[i].Flags & 0x40) != 0)
                {
                    mHasTexAnim = true;

                    var rotation = 0.0f;
                    if ((mData.Layers[i].Flags & 1) != 0)
                    {
                        rotation += (float)Math.PI / 4.0f;
                    }
                    if ((mData.Layers[i].Flags & 2) != 0)
                    {
                        rotation += (float)Math.PI / 2.0f;
                    }
                    if ((mData.Layers[i].Flags & 4) != 0)
                    {
                        rotation += (float)Math.PI;
                    }

                    var matrix = Matrix.RotationZ(rotation);
                    var dir    = Vector2.TransformCoordinate(new Vector2(0, 1), matrix);
                    mTexAnimDirections[i] = dir;

                    mTexAnimDirections[i].Normalize();
                    if ((mData.Layers[i].Flags & 8) != 0)
                    {
                        mTexAnimDirections[i] *= 1.2f;
                    }
                    else if ((mData.Layers[i].Flags & 0x10) != 0)
                    {
                        mTexAnimDirections[i] *= 1.44f;
                    }
                    else if ((mData.Layers[i].Flags & 0x20) != 0)
                    {
                        mTexAnimDirections[i] *= 1.728f;
                    }
                }
            }

            mIsAsyncLoaded = true;
            mParent        = new WeakReference <MapAreaRender>(parent);
        }
Exemplo n.º 2
0
        public void OnAsyncLoad(IO.Files.Terrain.MapChunk chunk, MapAreaRender parent)
        {
            mData        = chunk;
            mBoundingBox = chunk.BoundingBox;
            mModelBox    = chunk.ModelBox;
            mReferences  = new M2Instance[chunk.DoodadReferences.Length];
            for (var i = 0; i < mReferences.Length; ++i)
            {
                mReferences[i] = parent.AreaFile.DoodadInstances[chunk.DoodadReferences[i]];
            }

            mAsyncLoaded = true;
        }
Exemplo n.º 3
0
 private void ForceRenderMode(IO.Files.Terrain.MapChunk chunk, bool updateHoles)
 {
     if (chunk == mData)
     {
         if (updateHoles)
         {
             mHoleTexture.UpdateMemory(8, 8, Format.R8_UNorm, mData.HoleValues, 8);
         }
         else
         {
             mTexParams.AreaColour = ChunkEditManager.Instance.GetAreaColour(mData.AreaId, chunk.HasImpassFlag);
             SetRenderMode(ChunkEditManager.Instance.ChunkRenderMode);
             mScaleBuffer.UpdateData(mTexParams);
         }
     }
 }
Exemplo n.º 4
0
        public void OnAsyncLoad(IO.Files.Terrain.MapChunk chunk, MapAreaRender parent)
        {
            mData = chunk;
            mBoundingBox = chunk.BoundingBox;
            mModelBox = chunk.ModelBox;
            mReferences = new M2Instance[chunk.DoodadReferences.Length];
            for (var i = 0; i < mReferences.Length; ++i)
                mReferences[i] = parent.AreaFile.DoodadInstances[chunk.DoodadReferences[i]];

            mAsyncLoaded = true;
        }