1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __C_SOFTWARE_TEXTURE_H_INCLUDED__
6 #define __C_SOFTWARE_TEXTURE_H_INCLUDED__
7 
8 #include "ITexture.h"
9 #include "CImage.h"
10 
11 namespace irr
12 {
13 namespace video
14 {
15 
16 /*!
17 	interface for a Video Driver dependent Texture.
18 */
19 class CSoftwareTexture : public ITexture
20 {
21 public:
22 
23 	//! constructor
24 	CSoftwareTexture(IImage* surface, const io::path& name,
25 			bool renderTarget=false, void* mipmapData=0);
26 
27 	//! destructor
28 	virtual ~CSoftwareTexture();
29 
30 	//! lock function
31 	virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0);
32 
33 	//! unlock function
34 	virtual void unlock();
35 
36 	//! Returns original size of the texture.
37 	virtual const core::dimension2d<u32>& getOriginalSize() const;
38 
39 	//! Returns (=size) of the texture.
40 	virtual const core::dimension2d<u32>& getSize() const;
41 
42 	//! returns unoptimized surface
43 	virtual CImage* getImage();
44 
45 	//! returns texture surface
46 	virtual CImage* getTexture();
47 
48 	//! returns driver type of texture (=the driver, who created the texture)
49 	virtual E_DRIVER_TYPE getDriverType() const;
50 
51 	//! returns color format of texture
52 	virtual ECOLOR_FORMAT getColorFormat() const;
53 
54 	//! returns pitch of texture (in bytes)
55 	virtual u32 getPitch() const;
56 
57 	//! Regenerates the mip map levels of the texture. Useful after locking and
58 	//! modifying the texture
59 	virtual void regenerateMipMapLevels(void* mipmapData=0);
60 
61 	//! is it a render target?
62 	virtual bool isRenderTarget() const;
63 
64 private:
65 	CImage* Image;
66 	CImage* Texture;
67 	core::dimension2d<u32> OrigSize;
68 	bool IsRenderTarget;
69 };
70 
71 
72 } // end namespace video
73 } // end namespace irr
74 
75 #endif
76 
77