#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_DIRECT3D11VERTEXSHADEROBSERVER_H
#define NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11VERTEXSHADEROBSERVER_H
#include "Nuclex/Graphics/Config.h"
#include "Nuclex/Graphics/Rasterization/VertexShader.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 Vertex shader
class Direct3D11VertexShaderObserver : public VertexShader::Observer {
/// Initializes a new Direct3D 11 Vertex shader
/// Manager the Vertex shader belongs to
/// Vertex shader the observer is attached to
public: Direct3D11VertexShaderObserver(
Direct3D11RasterizerResources &resources, VertexShader *vertexShader
);
/// Frees all resources owned by the vertex shader observer
public: virtual ~Direct3D11VertexShaderObserver() {}
/// 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 vertex shader being observed
/// The agnostic vertex shader being observed
public: VertexShader *GetResource() const { return this->vertexShader; }
/// Retrieves the Direct3D vertex shader the observer is managing
/// The observer's Direct3D vertex shader
public: const ID3D11VertexShaderPtr &GetDirect3DVertexShader() const {
return this->direct3DVertexShader;
}
private: Direct3D11VertexShaderObserver(const Direct3D11VertexShaderObserver &);
private: Direct3D11VertexShaderObserver &operator =(const Direct3D11VertexShaderObserver &);
/// Resource manager the render target belongs to
private: Direct3D11RasterizerResources &resources;
/// Vertex shader this observer is attached to
private: VertexShader *vertexShader;
/// Vertex shader managed by this observer
private: ID3D11VertexShaderPtr direct3DVertexShader;
};
// ------------------------------------------------------------------------------------------- //
}}} // namespace Nuclex::Graphics::Rasterization
#endif // NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11VERTEXSHADEROBSERVER_H