#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_DIRECT3D11TEXTURE2OBSERVER_H
#define NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11TEXTURE2OBSERVER_H
#include "Nuclex/Graphics/Config.h"
#include "Nuclex/Graphics/Rasterization/Texture2.h"
#include "Direct3D11TextureObserver.h"
namespace Nuclex { namespace Graphics { namespace Rasterization {
// ------------------------------------------------------------------------------------------- //
class Direct3D11RasterizerResources;
// ------------------------------------------------------------------------------------------- //
}}} // namespace Nuclex::Graphics::Rasterization
namespace Nuclex { namespace Graphics { namespace Rasterization {
// ------------------------------------------------------------------------------------------- //
///Manages an attached Direct3D 11 texture
class Direct3D11Texture2Observer : public Direct3D11TextureObserver {
/// Initializes a new Direct3D 11 texture
/// Manager the texture belongs to
/// Texture the observer is attached to
public: Direct3D11Texture2Observer(
Direct3D11RasterizerResources &resources, Texture2 *texture
);
/// Frees all resources owned by the texture observer
public: virtual ~Direct3D11Texture2Observer() {}
/// Called right before the texture is destroyed
public: void Destroying();
/// Called when the texture has been cleared
public: void Cleared();
/// Called when the texture has been modified
/// Box around the changed area
public: void Changed(const Box &changedBox);
/// Retrieves the agnostic texture being observed
/// The agnostic texture being observed
public: Texture2 *GetResource() const { return this->texture2; }
/// Retrieves the Direct3D texture the observer is managing
/// The observer's Direct3D texture
public: const ID3D11Texture2DPtr &GetDirect3DTexture() const {
return this->direct3DTexture;
}
/// Retrieves the view for the observer's Direct3D texture
/// The view for the observer's Direct3D texture
public: const ID3D11ShaderResourceViewPtr &GetResourceView() const {
return this->direct3DResourceView;
}
private: Direct3D11Texture2Observer(const Direct3D11Texture2Observer &);
private: Direct3D11Texture2Observer &operator =(const Direct3D11Texture2Observer &);
/// Resource manager the render target belongs to
private: Direct3D11RasterizerResources &resources;
/// Texture this observer is attached to
private: Texture2 *texture2;
/// Texture managed by this observer
private: ID3D11Texture2DPtr direct3DTexture;
/// View for the texture managed by this obserer
private: ID3D11ShaderResourceViewPtr direct3DResourceView;
};
// ------------------------------------------------------------------------------------------- //
}}} // namespace Nuclex::Graphics::Rasterization
#endif // NUCLEX_GRAPHICS_RASTERIZATION_DIRECT3D11TEXTURE2OBSERVER_H