A data structure for 1/2/3D and cube texture mapping. Also has optional render-to-texture functionality. More...
#include <mitsuba/hw/gputexture.h>
Inheritance diagram for mitsuba::GPUTexture:Public Types | |
| enum | ETextureType { ETexture1D = 0, ETexture2D, ETexture3D, ETextureCubeMap } |
| Available texture types. More... | |
| enum | EFrameBufferType { ENone = 0x00, EColorBuffer = 0x01, EDepthBuffer = 0x02, EColorAndDepthBuffer = 0x03 } |
| If the texture type is set to EFrameBuffer, the configuration must be one of the following constants. More... | |
| enum | EComponentFormat { EUInt8, EUInt16, EUInt32, EFloat16, EFloat32, EFloat64 } |
| Supported per-component data formats. More... | |
| enum | EPixelFormat { EDepth = 0, ELuminance, ELuminanceAlpha, ERGB, ERGBA } |
| Supported pixel format types. More... | |
| enum | ETexturePosition { EDefaultPosition = 0, ECubeMapPositiveX = 0, ECubeMapNegativeX, ECubeMapPositiveY, ECubeMapNegativeY, ECubeMapPositiveZ, ECubeMapNegativeZ, ELastPosition } |
| A texture has one more slots into which bitmaps can be placed. More... | |
| enum | EWrapType { EClamp = 0, EClampToEdge, EClampToBorder, ERepeat, EMirror } |
| Texture wrapping mode when texture coordinates exit the [0, 1] range. More... | |
| enum | EFilterType { ENearest = 0, ELinear, EMipMapNearest, EMipMapLinear } |
| The interpolation filter determines which texture pixels are considered when shading a fragment. More... | |
| enum | EDepthMode { ENormal, ECompare } |
| When this texture contains a depth buffer, the following modes control the read behavior of the associated texture unit. 'ENormal' means that texture values are returned as with any other texture, whereas 'ECompare' causes a depth comparison to take place (this is the default). More... | |
Public Member Functions | |
| GPUTexture (const std::string &name, Bitmap *bitmap) | |
| Construct a new texture. More... | |
| void | setName (const std::string &name) |
| Set the texture name. More... | |
| const std::string & | getName () const |
| Get the texture name. More... | |
| void | setType (ETextureType textureType) |
| Set the texture type. More... | |
| ETextureType | getType () const |
| Return the texture type. More... | |
| void | setPixelFormat (EPixelFormat fmt) |
| Set the pixel format of this texture. More... | |
| EPixelFormat | getPixelFormat () const |
| Return the pixel format of this texture. More... | |
| void | setComponentFormat (EComponentFormat fmt) |
| Set the component format of this texture. More... | |
| EComponentFormat | getComponentFormat () const |
| Return the component format of this texture. More... | |
| void | setFrameBufferType (EFrameBufferType frameBufferType) |
| Set the framebuffer type (applies only if type==EFrameBuffer) More... | |
| EFrameBufferType | getFrameBufferType () const |
| Return the framebuffer type (applies only if type==EFrameBuffer) More... | |
| void | setFilterType (EFilterType filterType) |
| Set the filter type. More... | |
| EFilterType | getFilterType () const |
| Return the filter type. More... | |
| void | setWrapType (EWrapType wrapType) |
| Set the wrap type. More... | |
| void | setWrapTypeU (EWrapType wrapType) |
| Set the wrap type along the U axis. More... | |
| EWrapType | getWrapTypeU () |
| Return the wrap type along the U axis. More... | |
| void | setWrapTypeV (EWrapType wrapType) |
| Set the wrap type along the V axis. More... | |
| EWrapType | getWrapTypeV () |
| Return the wrap type along the V axis. More... | |
| Point3i | getSize () const |
| Return the size in pixels. More... | |
| void | setSize (const Point3i &size) |
| Set the size in pixels. More... | |
| Float | getMaxAnisotropy () const |
| Get the maximal anisotropy. More... | |
| void | setMaxAnisotropy (Float maxAnisotropy) |
| Set the maximal anisotropy. More... | |
| bool | isMipMapped () const |
| Return whether mipmapping is enabled. More... | |
| void | setMipMapped (bool mipMapped) |
| Define whether mipmapping is enabled. More... | |
| EDepthMode | getDepthMode () const |
| Return the depth map read mode. More... | |
| void | setDepthMode (EDepthMode mode) |
| Set the depth map read mode. More... | |
| void | setBitmap (unsigned int slot, Bitmap *bitmap) |
| Store a bitmap in a bitmap slot. More... | |
| Bitmap * | getBitmap (unsigned int slot=EDefaultPosition) |
| Retrieve a bitmap from the given slot. More... | |
| const Bitmap * | getBitmap (unsigned int slot=EDefaultPosition) const |
| Retrieve a bitmap from the given slot. More... | |
| int | getBitmapCount () const |
| Return the number of stored bitmaps. More... | |
| virtual void | init ()=0 |
| Upload the texture. More... | |
| void | release () |
| Dereference the CPU bitmap associated with the texture. More... | |
| void | initAndRelease () |
| Run init, followed by release. More... | |
| virtual void | refresh ()=0 |
| Refresh (re-upload) the texture. More... | |
| virtual void | refresh (const Point2i &offset, const Vector2i &size)=0 |
| Refresh (re-upload) a subregion of the texture. More... | |
| virtual void | cleanup ()=0 |
| Free the texture from GPU memory. More... | |
| virtual void | bind (int textureUnit=0, int textureIndex=0) const =0 |
| Bind the texture and enable texturing. More... | |
| virtual void | unbind () const =0 |
| Unbind the texture and disable texturing. More... | |
| virtual void | download (Bitmap *bitmap=NULL)=0 |
| virtual void | activateTarget ()=0 |
| Activate the render target. More... | |
| virtual void | activateSide (int side)=0 |
| Activate a certain face of a cube map as render target. More... | |
| virtual void | setTargetRegion (const Point2i &offset, const Vector2i &size)=0 |
| Restrict rendering to a sub-region of the texture. More... | |
| virtual void | releaseTarget ()=0 |
| Deactivate the render target. More... | |
| const std::set< int > & | getTextureUnits () const |
| Return the texture units, to which this texture is currently bound. More... | |
| void | setSampleCount (int samples) |
| Set the number of samples (for multisample color render targets) More... | |
| int | getSampleCount () const |
| Return the number of samples (for multisample color render targets) More... | |
| void | setBorderColor (const Color3 &borderColor) |
Set the border color (applicable if wrapMode=EClamp/EClampToBorder) More... | |
| const Color3 & | getBorderColor () const |
| Return the border color. More... | |
| virtual void | blit (GPUTexture *target, int what) const =0 |
| Blit a render buffer into another render buffer. More... | |
| virtual void | blit (GPUTexture *target, int what, const Point2i &sourceOffset, const Vector2i &sourceSize, const Point2i &destOffset, const Vector2i &destSize) const =0 |
| Blit a render buffer into another render buffer. More... | |
| virtual void | clear ()=0 |
| Clear (assuming that this is a render buffer) More... | |
| virtual Color3 | getPixel (int x, int y) const =0 |
| Assuming that this is a 2D RGB framebuffer, read a single pixel from the GPU. More... | |
| std::string | toString () const |
| Return a string representation. More... | |
| virtual const Class * | getClass () const |
| Retrieve this object's class. More... | |
Public Member Functions inherited from Object | |
| Object () | |
| Construct a new object. More... | |
| int | getRefCount () const |
| Return the current reference count. More... | |
| void | incRef () const |
| Increase the reference count of the object by one. More... | |
| void | decRef (bool autoDeallocate=true) const |
| Decrease the reference count of the object and possibly deallocate it. More... | |
Static Public Attributes | |
| static Class * | m_theClass |
Static Public Attributes inherited from Object | |
| static Class * | m_theClass |
| Pointer to the object's class descriptor. More... | |
Protected Member Functions | |
| virtual | ~GPUTexture () |
| Virtual destructor. More... | |
Protected Member Functions inherited from Object | |
| virtual | ~Object () |
| Virtual private deconstructor. (Will only be called by ref) More... | |
Protected Attributes | |
| std::string | m_name |
| ETextureType | m_type |
| EPixelFormat | m_pixelFormat |
| EComponentFormat | m_componentFormat |
| EFilterType | m_filterType |
| EWrapType | m_wrapTypeU |
| EWrapType | m_wrapTypeV |
| EFrameBufferType | m_fbType |
| EDepthMode | m_depthMode |
| bool | m_mipmapped |
| PrimitiveThreadLocal< std::set < int > > | m_textureUnits |
| Float | m_maxAnisotropy |
| int | m_samples |
| std::vector< Bitmap * > | m_bitmaps |
| Point3i | m_size |
| Color3 | m_borderColor |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
| static void | staticInitialization () |
| Initializes the built-in reference count debugger (if enabled) More... | |
| static void | staticShutdown () |
| Free the memory taken by staticInitialization() More... | |
A data structure for 1/2/3D and cube texture mapping. Also has optional render-to-texture functionality.
Supported per-component data formats.
When this texture contains a depth buffer, the following modes control the read behavior of the associated texture unit. 'ENormal' means that texture values are returned as with any other texture, whereas 'ECompare' causes a depth comparison to take place (this is the default).
| Enumerator | |
|---|---|
| ENormal | |
| ECompare | |
The interpolation filter determines which texture pixels are considered when shading a fragment.
If the texture type is set to EFrameBuffer, the configuration must be one of the following constants.
A texture has one more slots into which bitmaps can be placed.
Available texture types.
Texture wrapping mode when texture coordinates exit the [0, 1] range.
| mitsuba::GPUTexture::GPUTexture | ( | const std::string & | name, |
| Bitmap * | bitmap | ||
| ) |
Construct a new texture.
If bitmap is non-NULL, the texture type, format will be automatically set
| name | A human-readable name (for debugging) |
| bitmap | An bitmap to be put into the first slot. A NULL value will be ignored. |
|
protectedvirtual |
Virtual destructor.
|
pure virtual |
Activate a certain face of a cube map as render target.
Implemented in mitsuba::GLTexture.
|
pure virtual |
Activate the render target.
Implemented in mitsuba::GLTexture.
|
pure virtual |
Bind the texture and enable texturing.
| textureUnit | Specifies the unit to which this texture should be bound |
| textureIndex | When this texture has multiple sub-textures (e.g. a color and depth map in the case of a EColorAndDepthBuffer texture), this parameter specifies the one to be bound |
Implemented in mitsuba::GLTexture.
|
pure virtual |
Blit a render buffer into another render buffer.
| target | Specifies the target render buffer |
| what | A bitwise-OR of the components in EFrameBufferType to copy |
Implemented in mitsuba::GLTexture.
|
pure virtual |
Blit a render buffer into another render buffer.
| target | Specifies the target render buffer (or NULL for the framebuffer) |
| what | A bitwise-OR of the components in EFrameBufferType to copy |
| sourceOffset | Offset in the source render buffer |
| sourceOffset | Size of the region to be copied from the source render buffer |
| destOffset | Offset in the destination render buffer |
| destOffset | Size of the region to be copied into the dest destination buffer |
Implemented in mitsuba::GLTexture.
|
pure virtual |
Free the texture from GPU memory.
Implemented in mitsuba::GLTexture.
|
pure virtual |
Clear (assuming that this is a render buffer)
Implemented in mitsuba::GLTexture.
|
pure virtual |
Download the texture (only for render target textures). When the 'bitmap' parameter is NULL, the destination is the internal bitmap given by getTexture(0)
Implemented in mitsuba::GLTexture.
| Bitmap* mitsuba::GPUTexture::getBitmap | ( | unsigned int | slot = EDefaultPosition | ) |
Retrieve a bitmap from the given slot.
| const Bitmap* mitsuba::GPUTexture::getBitmap | ( | unsigned int | slot = EDefaultPosition | ) | const |
Retrieve a bitmap from the given slot.
|
inline |
Return the number of stored bitmaps.
|
inline |
Return the border color.
|
virtual |
|
inline |
Return the component format of this texture.
|
inline |
Return the depth map read mode.
|
inline |
Return the filter type.
|
inline |
Return the framebuffer type (applies only if type==EFrameBuffer)
|
inline |
Get the maximal anisotropy.
|
inline |
Get the texture name.
|
pure virtual |
Assuming that this is a 2D RGB framebuffer, read a single pixel from the GPU.
Implemented in mitsuba::GLTexture.
|
inline |
Return the pixel format of this texture.
|
inline |
Return the number of samples (for multisample color render targets)
|
inline |
Return the size in pixels.
|
inline |
Return the texture units, to which this texture is currently bound.
|
inline |
Return the texture type.
|
inline |
Return the wrap type along the U axis.
|
inline |
Return the wrap type along the V axis.
|
pure virtual |
Upload the texture.
Implemented in mitsuba::GLTexture.
|
inline |
Return whether mipmapping is enabled.
|
pure virtual |
Refresh (re-upload) the texture.
Implemented in mitsuba::GLTexture.
|
pure virtual |
Refresh (re-upload) a subregion of the texture.
Note: this is only implemented for 2D textures
Implemented in mitsuba::GLTexture.
| void mitsuba::GPUTexture::release | ( | ) |
Dereference the CPU bitmap associated with the texture.
|
pure virtual |
Deactivate the render target.
Implemented in mitsuba::GLTexture.
| void mitsuba::GPUTexture::setBitmap | ( | unsigned int | slot, |
| Bitmap * | bitmap | ||
| ) |
Store a bitmap in a bitmap slot.
|
inline |
Set the border color (applicable if wrapMode=EClamp/EClampToBorder)
|
inline |
Set the component format of this texture.
|
inline |
Set the depth map read mode.
|
inline |
Set the filter type.
| void mitsuba::GPUTexture::setFrameBufferType | ( | EFrameBufferType | frameBufferType | ) |
Set the framebuffer type (applies only if type==EFrameBuffer)
|
inline |
Set the maximal anisotropy.
A value of 1 will result in isotropic texture filtering. A value of 0 (default) will use the global max. anisotropy value
|
inline |
Define whether mipmapping is enabled.
|
inline |
Set the texture name.
|
inline |
Set the pixel format of this texture.
|
inline |
Set the number of samples (for multisample color render targets)
|
inline |
Set the size in pixels.
|
pure virtual |
Restrict rendering to a sub-region of the texture.
Implemented in mitsuba::GLTexture.
|
inline |
Set the texture type.
|
inline |
Set the wrap type.
|
inline |
Set the wrap type along the U axis.
|
inline |
Set the wrap type along the V axis.
|
virtual |
Return a string representation.
Reimplemented from Object.
|
pure virtual |
Unbind the texture and disable texturing.
Implemented in mitsuba::GLTexture.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
static |
|
protected |
|
protected |
|
protected |