Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_RENDERSYSTEM_DIRECT3D9TEXTURE_H__
00009 #define __SP_RENDERSYSTEM_DIRECT3D9TEXTURE_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013
00014 #if defined(SP_COMPILE_WITH_DIRECT3D9)
00015
00016
00017 #include "RenderSystem/spTextureBase.hpp"
00018
00019 #if defined(SP_PLATFORM_WINDOWS)
00020 # include <d3d9.h>
00021 # include <d3dx9.h>
00022 # if defined(SP_COMPILER_VC)
00023 # include <dxerr.h>
00024 # else
00025 # include <dxerr9.h>
00026 # endif
00027 #endif
00028
00029
00030 namespace sp
00031 {
00032 namespace video
00033 {
00034
00035
00036 class Direct3D9Driver;
00037
00038 class SP_EXPORT Direct3D9Texture : public Texture
00039 {
00040
00041 public:
00042
00043 Direct3D9Texture();
00044 Direct3D9Texture(
00045 IDirect3DTexture9* d3dTexture, IDirect3DCubeTexture9* d3dCubeTexture, IDirect3DVolumeTexture9* d3dVolumeTexture,
00046 const STextureCreationFlags &CreationFlags
00047 );
00048 ~Direct3D9Texture();
00049
00050
00051
00052 bool valid() const;
00053
00054 void bind(s32 Level = 0) const;
00055 void unbind(s32 Level = 0) const;
00056
00057 bool shareImageBuffer();
00058 bool updateImageBuffer();
00059
00060 private:
00061
00062 friend class Direct3D9RenderSystem;
00063 friend class Direct3D9Shader;
00064
00065
00066
00067 void clear();
00068
00069 void updateTextureAttributes(s32 SamplerLayer) const;
00070 void recreateHWTexture();
00071
00072 void updateImageTexture();
00073 void updateImageCubeTexture(s32 Face);
00074 void updateImageVolumeTexture();
00075
00076 void writeImageSurfaceBuffer(u8* DestImageBuffer, const u8* ImageBuffer, s32 Width, s32 Height);
00077 void readImageSurfaceBuffer(const u8* DestImageBuffer, u8* ImageBuffer, s32 Width, s32 Height);
00078
00079 bool createMipMaps(s32 Level = 1);
00080 void generateMipMapLevel(s32* src, s32* dst, s32 Width, s32 Height);
00081
00082 void updateBaseTexture();
00083
00084
00085
00086 IDirect3DBaseTexture9* D3DBaseTexture_;
00087
00088 IDirect3DTexture9* D3D2DTexture_;
00089 IDirect3DCubeTexture9* D3DCubeTexture_;
00090 IDirect3DVolumeTexture9* D3DVolumeTexture_;
00091
00092 };
00093
00094
00095 }
00096
00097 }
00098
00099
00100 #endif
00101
00102 #endif
00103
00104
00105
00106