#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2013 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11PIXELSHADEROBSERVER_H #define NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11PIXELSHADEROBSERVER_H #include "Nuclex/Graphics/Config.h" #include "Nuclex/Graphics/Rasterization/PixelShader.h" #include "../Direct3D11Api.h" namespace Nuclex { namespace Graphics { namespace Rasterization { // ------------------------------------------------------------------------------------------- // class Direct3D11RasterizerResources; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Graphics::Rasterization namespace Nuclex { namespace Graphics { namespace Rasterization { // ------------------------------------------------------------------------------------------- // ///Manages an attached Direct3D 11 pixel shader class Direct3D11PixelShaderObserver : public PixelShader::Observer { /// Initializes a new Direct3D 11 pixel shader /// Manager the pixel shader belongs to /// Pixel shader the observer is attached to public: Direct3D11PixelShaderObserver( Direct3D11RasterizerResources &resources, PixelShader *pixelShader ); /// Frees all resources owned by the pixel shader observer public: virtual ~Direct3D11PixelShaderObserver() {} /// Called right before the shader is destroyed public: void Destroying(); /// Called when a constant buffer has been set /// /// Index of the constant buffer that has been assigned /// public: void ConstantBufferChanged(std::size_t constantBufferIndex); /// Called when a texture has been set /// Index of the texture that has been assigned public: void TextureChanged(std::size_t textureIndex); /// Retrieves the agnostic pixel shader being observed /// The agnostic pixel shader being observed public: PixelShader *GetResource() const { return this->pixelShader; } /// Retrieves the Direct3D pixel shader the observer is managing /// The observer's Direct3D pixel shader public: const ID3D11PixelShaderPtr &GetDirect3DPixelShader() const { return this->direct3DPixelShader; } private: Direct3D11PixelShaderObserver(const Direct3D11PixelShaderObserver &); private: Direct3D11PixelShaderObserver &operator =(const Direct3D11PixelShaderObserver &); /// Resource manager the render target belongs to private: Direct3D11RasterizerResources &resources; /// Pixel shader this observer is attached to private: PixelShader *pixelShader; /// Pixel shader managed by this observer private: ID3D11PixelShaderPtr direct3DPixelShader; }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Graphics::Rasterization #endif // NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11PIXELSHADEROBSERVER_H