Exemplo n.º 1
0
        public void PreviewActive()
        {
            var game = Game.Instance;

            CreateTextureShaderResourceView(tex);
            if (shaderResourceView == null) return;
            mQuad = new TexturePreviewQuad(Game.Instance, tex.Description);

            Light.IsPreviewingTexture = true;
        }
Exemplo n.º 2
0
        public void PreviewActive()
        {
            var desc = new ShaderResourceViewDescription();
            desc.Format = tex.Description.Format;
            desc.Dimension = ShaderResourceViewDimension.TextureCube;
            desc.Texture2D.MipLevels = tex.Description.MipLevels;
            desc.Texture2D.MostDetailedMip = 0;
            shaderResourceView = new ShaderResourceView(mGame.Device, tex, desc);
            shaderResourceView.DebugName = "Preview";

            if (shaderResourceView == null) return;

            desc.Dimension = ShaderResourceViewDimension.Texture2DArray;
            desc.Texture2DArray.ArraySize = 1;
            desc.Texture2DArray.MipLevels = tex.Description.MipLevels;
            desc.Texture2DArray.MostDetailedMip = 0;
            mFaces = new ShaderResourceView[6];
            for (int i = 0; i < 6; ++i)
            {
                desc.Texture2DArray.FirstArraySlice = i;
                mFaces[i] = new ShaderResourceView(mGame.Device, tex, desc);
            }

            cube = mGame.ResourceManager.Mesh.Load(InternalResources.MESH_CUBE);
            sphere = mGame.ResourceManager.Mesh.Load(InternalResources.MESH_SPHERE);

            var passDesc = new MaterialPassDesc();
            passDesc.ManualConstantBuffers = true;
            passDesc.ShaderFile = "CubemapPreview.hlsl";
            passCube = new MaterialPass(Game.Instance.Device, passDesc, "Preview(Cube)");

            passDesc.PixelShaderFunction = "PS_Sphere";
            passSphere = new MaterialPass(mGame.Device, passDesc, "Preview(Sphere)");

            skybox = new SkyBox(mGame, shaderResourceView, "Preview");

            mQuad = new TexturePreviewQuad(mGame, tex.Description);
            Light.IsPreviewingTexture = true;
        }