|
|
@@ -38,7 +38,50 @@ THE SOFTWARE.
|
|
|
namespace CamelotEngine {
|
|
|
class CM_D3D9_EXPORT D3D9Texture : public Texture, public D3D9Resource
|
|
|
{
|
|
|
+ public:
|
|
|
+ /// destructor
|
|
|
+ ~D3D9Texture();
|
|
|
+
|
|
|
+ /// overridden from Texture
|
|
|
+ void copy_internal( TexturePtr& target );
|
|
|
+
|
|
|
+ /// @copydoc Texture::getBuffer
|
|
|
+ HardwarePixelBufferPtr getBuffer_internal(size_t face, size_t mipmap);
|
|
|
+
|
|
|
+ /// retrieves a pointer to the actual texture
|
|
|
+ IDirect3DBaseTexture9 *getTexture_internal();
|
|
|
+ /// retrieves a pointer to the normal 1D/2D texture
|
|
|
+ IDirect3DTexture9 *getNormTexture_internal();
|
|
|
+ /// retrieves a pointer to the cube texture
|
|
|
+ IDirect3DCubeTexture9 *getCubeTexture_internal();
|
|
|
+
|
|
|
+ /** Indicates whether the hardware gamma is actually enabled and supported.
|
|
|
+ @remarks
|
|
|
+ Because hardware gamma might not actually be supported, we need to
|
|
|
+ ignore it sometimes. Because D3D doesn't encode sRGB in the format but
|
|
|
+ as a sampler state, and we don't want to change the original requested
|
|
|
+ hardware gamma flag (e.g. serialisation) we need another indicator.
|
|
|
+ */
|
|
|
+ bool isHardwareGammaReadToBeUsed() const { return mHwGamma && mHwGammaReadSupported; }
|
|
|
+
|
|
|
+ /// Will this texture need to be in the default pool?
|
|
|
+ bool useDefaultPool();
|
|
|
+
|
|
|
+ // Called immediately after the Direct3D device has been created.
|
|
|
+ virtual void notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device);
|
|
|
+
|
|
|
+ // Called before the Direct3D device is going to be destroyed.
|
|
|
+ virtual void notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device);
|
|
|
+
|
|
|
+ // Called immediately after the Direct3D device has entered a lost state.
|
|
|
+ virtual void notifyOnDeviceLost(IDirect3DDevice9* d3d9Device);
|
|
|
+
|
|
|
+ // Called immediately after the Direct3D device has been reset
|
|
|
+ virtual void notifyOnDeviceReset(IDirect3DDevice9* d3d9Device);
|
|
|
+
|
|
|
protected:
|
|
|
+ friend class D3D9TextureManager;
|
|
|
+ friend class D3D9HardwarePixelBuffer;
|
|
|
|
|
|
struct TextureResources
|
|
|
{
|
|
|
@@ -60,7 +103,6 @@ namespace CamelotEngine {
|
|
|
/// Map between device to texture resources.
|
|
|
DeviceToTextureResourcesMap mMapDeviceToTextureResources;
|
|
|
|
|
|
-
|
|
|
/// Vector of pointers to subsurfaces
|
|
|
typedef vector<HardwarePixelBufferPtr>::type SurfaceList;
|
|
|
SurfaceList mSurfaceList;
|
|
|
@@ -78,6 +120,8 @@ namespace CamelotEngine {
|
|
|
D3DMULTISAMPLE_TYPE mFSAAType;
|
|
|
DWORD mFSAAQuality;
|
|
|
|
|
|
+ D3D9Texture();
|
|
|
+
|
|
|
/// overriden from Resource
|
|
|
void initialize_internal();
|
|
|
|
|
|
@@ -93,10 +137,6 @@ namespace CamelotEngine {
|
|
|
|
|
|
/// @copydoc Resource::calculateSize
|
|
|
size_t calculateSize(void) const;
|
|
|
- /// @copydoc Texture::createInternalResources
|
|
|
- void createInternalResources(void);
|
|
|
- /// @copydoc Texture::freeInternalResources
|
|
|
- void freeInternalResources(void);
|
|
|
/// @copydoc Texture::createInternalResourcesImpl
|
|
|
void createInternalResourcesImpl(void);
|
|
|
/// Creates this texture resources on the specified device.
|
|
|
@@ -136,50 +176,6 @@ namespace CamelotEngine {
|
|
|
void freeTextureResources(IDirect3DDevice9* d3d9Device, TextureResources* textureResources);
|
|
|
|
|
|
void determinePool();
|
|
|
-
|
|
|
- friend class D3D9HardwarePixelBuffer;
|
|
|
- public:
|
|
|
- /// constructor
|
|
|
- D3D9Texture();
|
|
|
- /// destructor
|
|
|
- ~D3D9Texture();
|
|
|
-
|
|
|
- /// overridden from Texture
|
|
|
- void copy_internal( TexturePtr& target );
|
|
|
-
|
|
|
- /// @copydoc Texture::getBuffer
|
|
|
- HardwarePixelBufferPtr getBuffer_internal(size_t face, size_t mipmap);
|
|
|
-
|
|
|
- /// retrieves a pointer to the actual texture
|
|
|
- IDirect3DBaseTexture9 *getTexture_internal();
|
|
|
- /// retrieves a pointer to the normal 1D/2D texture
|
|
|
- IDirect3DTexture9 *getNormTexture_internal();
|
|
|
- /// retrieves a pointer to the cube texture
|
|
|
- IDirect3DCubeTexture9 *getCubeTexture_internal();
|
|
|
-
|
|
|
- /** Indicates whether the hardware gamma is actually enabled and supported.
|
|
|
- @remarks
|
|
|
- Because hardware gamma might not actually be supported, we need to
|
|
|
- ignore it sometimes. Because D3D doesn't encode sRGB in the format but
|
|
|
- as a sampler state, and we don't want to change the original requested
|
|
|
- hardware gamma flag (e.g. serialisation) we need another indicator.
|
|
|
- */
|
|
|
- bool isHardwareGammaReadToBeUsed() const { return mHwGamma && mHwGammaReadSupported; }
|
|
|
-
|
|
|
- /// Will this texture need to be in the default pool?
|
|
|
- bool useDefaultPool();
|
|
|
-
|
|
|
- // Called immediately after the Direct3D device has been created.
|
|
|
- virtual void notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device);
|
|
|
-
|
|
|
- // Called before the Direct3D device is going to be destroyed.
|
|
|
- virtual void notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device);
|
|
|
-
|
|
|
- // Called immediately after the Direct3D device has entered a lost state.
|
|
|
- virtual void notifyOnDeviceLost(IDirect3DDevice9* d3d9Device);
|
|
|
-
|
|
|
- // Called immediately after the Direct3D device has been reset
|
|
|
- virtual void notifyOnDeviceReset(IDirect3DDevice9* d3d9Device);
|
|
|
};
|
|
|
|
|
|
typedef std::shared_ptr<D3D9Texture> D3D9TexturePtr;
|