Пример #1
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();
        }