|
Beatmup
|
Real-valued vector usable by GPU. More...
#include <linear_mapping.h>
Public Types | |
| enum class | Format { TEXTURE , FIXED16 , FLOAT } |
| Vector data format. More... | |
Public Types inherited from Beatmup::GL::TextureHandler | |
| enum | TextureFormat { Rx8 , RGBx8 , RGBAx8 , Rx32f , RGBx32f , RGBAx32f , OES_Ext } |
| Texture format, specifies how the texture should be interpreted on the shader side. More... | |
Public Member Functions | |
| Vector (Context &context, GraphicPipeline &gpu, const int size, const Format format) | |
| Vector (Context &context, GraphicPipeline &gpu, const int size, const Format format, const float *values, const bool remap=false) | |
| Creates a vector in GPU memory. More... | |
| ~Vector () | |
| void | fetch (GraphicPipeline &gpu, std::vector< float > &output) const |
| Grabs vector values back from GPU to user memory. More... | |
| Format | getDataFormat () const |
| int | getSize () const |
| Returns the length of the vector. More... | |
| size_t | getMemorySize () const |
| Returns memory size in bytes taken by the vector. More... | |
| const int | getWidth () const |
| Width of the texture in pixels. More... | |
| const int | getHeight () const |
| Height of the texture in pixels. More... | |
| const int | getDepth () const |
| Depth of the texture in pixels. More... | |
| const TextureFormat | getTextureFormat () const |
| Returns the texture format specifying how the shader must interpret the data. More... | |
| float | getMappingScale () const |
| Provides the scale factor applied to the vector values sent to GPU. More... | |
| float | getMappingOffset () const |
| Provides the constant offset added to the vector values sent to GPU. More... | |
Public Member Functions inherited from Beatmup::GL::TextureHandler | |
| ~TextureHandler () | |
| float | getAspectRatio () const |
| Aspect ratio of the texture. More... | |
| float | getInvAspectRatio () const |
| Inverse of the aspect ratio of the texture. More... | |
| const bool | isFloatingPoint () const |
| const int | getNumberOfChannels () const |
| Returns number of channels containing in the texture. More... | |
| bool | hasValidHandle () const |
Returns true if the texture handle points to a valid texture. More... | |
Public Member Functions inherited from Beatmup::Object | |
| virtual | ~Object () |
Static Public Attributes | |
| static const Format | DEFAULT_FORMAT = Vector::Format::FLOAT |
Static Public Attributes inherited from Beatmup::GL::TextureHandler | |
| static const int | TEXTURE_FORMAT_BYTES_PER_PIXEL [] |
| size of a texel in bytes for different texture formats More... | |
Private Member Functions | |
| void | prepare (GraphicPipeline &gpu) |
| Prepares (eventually uploads) texture data on GPU. More... | |
Private Attributes | |
| Context & | context |
| const TextureFormat | texFormat |
| texture format of the texture handler More... | |
| const Format | format |
| data format More... | |
| const int | size |
| number of samples in the vector More... | |
| float | mapScale |
| float | mapOffset |
Additional Inherited Members | |
Static Public Member Functions inherited from Beatmup::GL::TextureHandler | |
| static const char * | textureFormatToString (const TextureFormat &) |
Protected Member Functions inherited from Beatmup::GL::TextureHandler | |
| TextureHandler () | |
| void | invalidate (RecycleBin &) |
| Forces disposing the texture data, e.g. More... | |
Protected Attributes inherited from Beatmup::GL::TextureHandler | |
| handle_t | textureHandle |
Real-valued vector usable by GPU.
Definition at line 29 of file linear_mapping.h.
|
strong |
Vector data format.
| Enumerator | |
|---|---|
| TEXTURE | 8 bit per element covering [0, 1] range |
| FIXED16 | 16 bit per element |
| FLOAT | 32 bit per element, floating point |
Definition at line 34 of file linear_mapping.h.
| Vector::Vector | ( | Context & | context, |
| GraphicPipeline & | gpu, | ||
| const int | size, | ||
| const Format | format | ||
| ) |
Definition at line 363 of file linear_mapping.cpp.
| Vector::Vector | ( | Context & | context, |
| GraphicPipeline & | gpu, | ||
| const int | size, | ||
| const Format | format, | ||
| const float * | values, | ||
| const bool | remap = false |
||
| ) |
Creates a vector in GPU memory.
| [in] | context | A context |
| [in] | gpu | A graphic pipeline instance |
| [in] | size | Size of the vector (number of scalar dimensions) |
| [in] | format | Vector data format used to store the values in GPU memory |
| [in] | values | Vector elements values |
| [in] | remap | If true and a fixed-point data format is used, the stored values are remapped to fit the range of the coresponding fixed-point representation. |
Definition at line 397 of file linear_mapping.cpp.
| Vector::~Vector | ( | ) |
Definition at line 479 of file linear_mapping.cpp.
|
privatevirtual |
Prepares (eventually uploads) texture data on GPU.
Called only by the context managing thread.
| [in] | gpu | Graphic pipeline instance |
Reimplemented from Beatmup::GL::TextureHandler.
Definition at line 484 of file linear_mapping.cpp.
| void Vector::fetch | ( | GraphicPipeline & | gpu, |
| std::vector< float > & | output | ||
| ) | const |
Grabs vector values back from GPU to user memory.
| [in] | gpu | A graphic pipeline instance |
| [in] | output | The output vector |
Definition at line 489 of file linear_mapping.cpp.
|
inline |
Definition at line 72 of file linear_mapping.h.
|
inline |
| size_t Vector::getMemorySize | ( | ) | const |
Returns memory size in bytes taken by the vector.
Definition at line 536 of file linear_mapping.cpp.
|
inlinevirtual |
Width of the texture in pixels.
Implements Beatmup::GL::TextureHandler.
Definition at line 85 of file linear_mapping.h.
|
inlinevirtual |
Height of the texture in pixels.
Implements Beatmup::GL::TextureHandler.
Definition at line 86 of file linear_mapping.h.
|
inlinevirtual |
Depth of the texture in pixels.
Implements Beatmup::GL::TextureHandler.
Definition at line 87 of file linear_mapping.h.
|
inlinevirtual |
Returns the texture format specifying how the shader must interpret the data.
Implements Beatmup::GL::TextureHandler.
Definition at line 88 of file linear_mapping.h.
|
inline |
Provides the scale factor applied to the vector values sent to GPU.
The scale factor is applied if remapping is enabled in the constructor and a fixed-point representation is used. The vector values are remapped to match the dynamics range of the fixed point representation: [gpu texture values] = a * [original values] + b
Definition at line 96 of file linear_mapping.h.
|
inline |
Provides the constant offset added to the vector values sent to GPU.
The offset is added if remapping is enabled in the constructor and a fixed-point representation is used. The vector values are remapped to match the dynamics range of the fixed point representation: [gpu texture values] = a * [original values] + b
Definition at line 104 of file linear_mapping.h.
|
private |
Definition at line 40 of file linear_mapping.h.
|
private |
texture format of the texture handler
Definition at line 41 of file linear_mapping.h.
|
private |
data format
Definition at line 42 of file linear_mapping.h.
|
private |
number of samples in the vector
Definition at line 43 of file linear_mapping.h.
|
private |
Definition at line 44 of file linear_mapping.h.
|
private |
Definition at line 44 of file linear_mapping.h.
|
static |
Definition at line 48 of file linear_mapping.h.