#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_DIRECT3D11SAMPLEROPTIONSOBSERVER_H #define NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11SAMPLEROPTIONSOBSERVER_H #include "Nuclex/Graphics/Config.h" #include "Nuclex/Graphics/Rasterization/SamplerOptions.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 rasterizer state class Direct3D11SamplerOptionsObserver : public SamplerOptions::Observer { /// Initializes a new Direct3D 11 rasterizer state /// Manager the index buffer belongs to /// Sampler options the observer is attached to public: Direct3D11SamplerOptionsObserver( Direct3D11RasterizerResources &resources, SamplerOptions *samplerOptions ); /// Frees all resources owned by the sampler options observer public: virtual ~Direct3D11SamplerOptionsObserver(); /// Called right before the options are destroyed public: void Destroying(); /// Called when the options have been changed public: void Changed(); /// Retrieves the agnostic sampler options being observed /// The agnostic sampler options being observed public: SamplerOptions *GetResource() const { return this->samplerOptions; } /// Retrieves the Direct3D sampler state the observer is managing /// The observer's Direct3D sampler state public: const ID3D11SamplerStatePtr &GetDirect3DRasterizerState() const { return this->direct3DSamplerState; } /// /// Creates a Direct3D sampler state matching the observed sampler options /// private: void createDirect3DSamplerState(); private: Direct3D11SamplerOptionsObserver(const Direct3D11SamplerOptionsObserver &); private: Direct3D11SamplerOptionsObserver &operator =( const Direct3D11SamplerOptionsObserver & ); /// Resource manager the sampler options observer belongs to private: Direct3D11RasterizerResources &resources; /// Sampler options this observer is attached to private: SamplerOptions *samplerOptions; /// Sampler state managed by this observer private: ID3D11SamplerStatePtr direct3DSamplerState; }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Graphics::Rasterization #endif // NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11SAMPLEROPTIONSOBSERVER_H