示例#1
0
        private void SyncLoad()
        {
            mSyncLoadToken = null;

            mTexParams.TextureScales   = new Vector4(mData.TextureScales);
            mTexParams.SpecularFactors = new Vector4(mData.SpecularFactors);
            mTexParams.ChunkLine       = new Vector4(0.0f, 0.7f, 0.0f, 0.0f);
            mTexParams.AreaColour      = ChunkEditManager.Instance.GetAreaColour(mData.AreaId, mData.HasImpassFlag);

            mTexAnimBuffer       = new ConstantBuffer(WorldFrame.Instance.GraphicsContext);
            mTexAnimStore.Layer0 = mTexAnimStore.Layer1 = mTexAnimStore.Layer2 = mTexAnimStore.Layer3 = Matrix.Identity;
            mTexAnimBuffer.UpdateData(mTexAnimStore);
            mAlphaTexture = new Graphics.Texture(WorldFrame.Instance.GraphicsContext);
            mAlphaTexture.UpdateMemory(64, 64, Format.R8G8B8A8_UNorm, mData.AlphaValues, 4 * 64);
            mHoleTexture = new Graphics.Texture(WorldFrame.Instance.GraphicsContext);
            mHoleTexture.UpdateMemory(8, 8, Format.R8_UNorm, mData.HoleValues, 8);
            mScaleBuffer = new ConstantBuffer(WorldFrame.Instance.GraphicsContext);
            mScaleBuffer.UpdateData(mTexParams);
            mShaderTextures         = mData.Textures.ToArray();
            mShaderSpecularTextures = mData.SpecularTextures.ToArray();

            SetRenderMode(ChunkEditManager.Instance.ChunkRenderMode); //Set current render mode

            mIsSyncLoaded = true;
        }
示例#2
0
 private void SyncLoad()
 {
     mAlphaTexture = new Graphics.Texture(WorldFrame.Instance.GraphicsContext);
     mAlphaTexture.UpdateMemory(64, 64, SharpDX.DXGI.Format.R8G8B8A8_UNorm, mData.AlphaValues, 4 * 64);
     mHoleTexture = new Graphics.Texture(WorldFrame.Instance.GraphicsContext);
     mHoleTexture.UpdateMemory(8, 8, SharpDX.DXGI.Format.R8_UNorm, mData.HoleValues, 8);
     mScaleBuffer = new ConstantBuffer(WorldFrame.Instance.GraphicsContext);
     mScaleBuffer.UpdateData(mData.TextureScales);
     mShaderTextures = mData.Textures.ToArray();
     mSyncLoaded     = true;
 }
示例#3
0
        public override void SyncUpdate()
        {
            if (mActiveSky == null)
            {
                return;
            }

            if (mIsTextureDirty)
            {
                mIsTextureDirty = false;
                mSkyTexture.UpdateMemory(1, 180, SharpDX.DXGI.Format.B8G8R8A8_UNorm, mSkyGraph, 4);
            }
        }
示例#4
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);
         }
     }
 }
示例#5
0
        public override void SyncUpdate()
        {
            if (mLights.Count == 0)
            {
                return;
            }

            if (mIsTextureDirty)
            {
                mIsTextureDirty = false;
                mSkyTexture.UpdateMemory(1, 180, SharpDX.DXGI.Format.B8G8R8A8_UNorm, mSkyGraph, 4);
            }

            if (mIsDirty == false)
            {
                return;
            }

            lock (mColorLock)
            {
                mIsDirty = false;
            }
        }
示例#6
0
        public void OnFrame()
        {
            if (mIsAsyncLoaded == false)
            {
                return;
            }

            if (WorldFrame.Instance.MapManager.IsInitialLoad == false)
            {
                if (WorldFrame.Instance.MapManager.SkySphere.BoundingSphere.Intersects(ref mBoundingBox) == false)
                {
                    if (M2Manager.IsViewDirty == false)
                    {
                        return;
                    }

                    if (WorldFrame.Instance.MapManager.SkySphere.BoundingSphere.Intersects(ref mModelBox) == false)
                    {
                        return;
                    }
                }

                if (WorldFrame.Instance.ActiveCamera.Contains(ref mBoundingBox) == false)
                {
                    if (M2Manager.IsViewDirty == false)
                    {
                        return;
                    }

                    PushDoodadReferences();
                    return;
                }
            }

            if (mIsSyncLoaded == false)
            {
                if (!BeginSyncLoad())
                {
                    return;
                }
            }

            if (M2Manager.IsViewDirty)
            {
                PushDoodadReferences();
            }

            if (mData.IsAlphaChanged)
            {
                mAlphaTexture.UpdateMemory(64, 64, Format.R8G8B8A8_UNorm, mData.AlphaValues, 4 * 64);
                mData.IsAlphaChanged = false;
            }

            if (mData.TexturesChanged)
            {
                mShaderTextures         = mData.Textures.ToArray();
                mShaderSpecularTextures = mData.SpecularTextures.ToArray();
                mData.TexturesChanged   = false;
            }

            UpdateTextureAnimations();

            ChunkMesh.StartVertex = mData.StartVertex;
            ChunkMesh.Program.SetPixelTexture(0, mAlphaTexture);
            ChunkMesh.Program.SetPixelTexture(1, mHoleTexture);
            ChunkMesh.Program.SetPixelTextures(2, mShaderTextures);
            ChunkMesh.Program.SetPixelTextures(6, mShaderSpecularTextures);
            ChunkMesh.Program.SetVertexConstantBuffer(1, mTexAnimBuffer);

            ChunkMesh.Program.SetPixelConstantBuffer(2, mScaleBuffer);

            ChunkMesh.Draw();
        }
示例#7
0
 private void SyncLoad()
 {
     mAlphaTexture = new Graphics.Texture(WorldFrame.Instance.GraphicsContext);
     mAlphaTexture.UpdateMemory(64, 64, SharpDX.DXGI.Format.R8G8B8A8_UNorm, mData.AlphaValues, 4 * 64);
     mHoleTexture = new Graphics.Texture(WorldFrame.Instance.GraphicsContext);
     mHoleTexture.UpdateMemory(8, 8, SharpDX.DXGI.Format.R8_UNorm, mData.HoleValues, 8);
     mScaleBuffer = new ConstantBuffer(WorldFrame.Instance.GraphicsContext);
     mScaleBuffer.UpdateData(mData.TextureScales);
     mShaderTextures = mData.Textures.ToArray();
     mSyncLoaded = true;
 }