|
Signed Distance Fields 1.0
|
Primitive management in the construction tree. More...
#include <sdf.h>
Public Member Functions | |
| PrimitiveManager () | |
| Handle the writing of glsl primitives in an order respecting the dependency. | |
| bool | insertPrimitive (const QString &, const QString &, std::list< QString >=std::list< QString >()) |
| add a primitive in the shader, return true if the primitive is inserted, false otherwise (if the primitive was already in the list) | |
| void | setDependence (const QString &, std::list< QString > &) |
| set the dependency of a given primitive | |
| int | getId () |
| get a primitive name that is not in the primitives set yet | |
| QString | getPRIMITIVE () |
| return a glsl code of all primitives in an order respecting the dependency | |
| QString | getPRIMITIVE (std::list< QString >) |
| return a glsl code of all primitives in an order respecting the dependency | |
| QString | printGLSL () |
| Write PRIMITIVE code with identation and newline to help the reading. | |
| qsizetype | Alloc (qsizetype) |
| reserve some memory space in the global OpenGl buffer 'FloatBuffer' that is loaded on the GPU when executing the shader | |
| qsizetype | Alloc (const QString &, qsizetype size) |
| reserve some memory space in the global OpenGl buffer 'FloatBuffer' that is loaded on the GPU when executing the shader | |
| qsizetype | allocsize (const QString &name) const |
| Give the size of a memory block. Return 0 if the block is not allocated, allowing check if(!allocisze("name"))malloc("name", ...);. | |
| void | setFloatData (float *floatData, qsizetype ptr, qsizetype size) |
| Write in the 'FloatBuffer'. This is a read only buffer loaded on GPU when executing the shader. | |
| void | setFloatData (const QVector< float > &floatData, qsizetype ptr) |
| Write in the 'FloatBuffer'. This is a read only buffer loaded on GPU when executing the shader. | |
| void | setFloatData (const QVector< Vector > &floatData, qsizetype ptr) |
| Write in the 'FloatBuffer'. This is a read only buffer loaded on GPU when executing the shader. | |
| void | setFloatData (const QVector< Matrix > &floatData, qsizetype ptr) |
| Write in the 'FloatBuffer'. This is a read only buffer loaded on GPU when executing the shader. | |
| int | GetFloatBufferSize () const |
| return the size of the 'FloatBuffer' | |
| const float * | GetFloatBufferData () const |
| return the data of the 'FloatBuffer' | |
| QVector< float > | GetFloatBufferDataQVector () const |
| return the data of the 'FloatBuffer' | |
Protected Member Functions | |
| QString | getPRIMITIVE (const QString &, std::map< QString, bool > &) const |
| Return the glsl code of a primitive and it's dependency. | |
Primitive management in the construction tree.
|
explicit |
Handle the writing of glsl primitives in an order respecting the dependency.
| qsizetype PrimitiveManager::Alloc | ( | const QString & | name, |
| qsizetype | size ) |
reserve some memory space in the global OpenGl buffer 'FloatBuffer' that is loaded on the GPU when executing the shader
| name | name of the allocated memory. If it was already used return the pointer to that previously allocated memory |
| size | number of float to reserve See SDFFrames::GetShader for use example |
| qsizetype PrimitiveManager::Alloc | ( | qsizetype | size | ) |
reserve some memory space in the global OpenGl buffer 'FloatBuffer' that is loaded on the GPU when executing the shader
| qsizetype | size : number of float to reserve See SDFFrames::GetShader for use example |
| qsizetype PrimitiveManager::allocsize | ( | const QString & | name | ) | const |
Give the size of a memory block. Return 0 if the block is not allocated, allowing check if(!allocisze("name"))malloc("name", ...);.
| name | name of the allocated memory. |
| const float * PrimitiveManager::GetFloatBufferData | ( | ) | const |
return the data of the 'FloatBuffer'
| QVector< float > PrimitiveManager::GetFloatBufferDataQVector | ( | ) | const |
return the data of the 'FloatBuffer'
| int PrimitiveManager::GetFloatBufferSize | ( | ) | const |
return the size of the 'FloatBuffer'
| int PrimitiveManager::getId | ( | ) |
get a primitive name that is not in the primitives set yet
Create a uniqueId
| QString PrimitiveManager::getPRIMITIVE | ( | ) |
return a glsl code of all primitives in an order respecting the dependency
|
protected |
Return the glsl code of a primitive and it's dependency.
| name | The primitive to write. |
| primitivesWritten | A map to manage the primitives (true if the primitive is already written, false if the primitive is encouter but not written, not in the map if the primitive is not encouter yet). |
| QString PrimitiveManager::getPRIMITIVE | ( | std::list< QString > | names | ) |
return a glsl code of all primitives in an order respecting the dependency
| bool PrimitiveManager::insertPrimitive | ( | const QString & | name, |
| const QString & | glslCode, | ||
| std::list< QString > | dependency = std::list<QString>() ) |
add a primitive in the shader, return true if the primitive is inserted, false otherwise (if the primitive was already in the list)
| name | Name of the primitive. |
| glslCode | Code of the primitive. |
| dependency | List of name of primitive that need to be written before this one. |
| QString PrimitiveManager::printGLSL | ( | ) |
Write PRIMITIVE code with identation and newline to help the reading.
| void PrimitiveManager::setDependence | ( | const QString & | name, |
| std::list< QString > & | dependency ) |
set the dependency of a given primitive
| name | Name of the primitive. |
| dependency | List of name of primitive that need to be written before this one. |
| void PrimitiveManager::setFloatData | ( | const QVector< float > & | floatData, |
| qsizetype | ptr ) |
Write in the 'FloatBuffer'. This is a read only buffer loaded on GPU when executing the shader.
| floatData | pointer to the float array |
| pointer | to the start of the memory block in the 'FloatBuffer' (return value of the function PrimitiveManager::malloc) |
| void PrimitiveManager::setFloatData | ( | const QVector< Matrix > & | floatData, |
| qsizetype | ptr ) |
Write in the 'FloatBuffer'. This is a read only buffer loaded on GPU when executing the shader.
| floatData | pointer to the Matrix array. The array will be flatten out : [floatData[0][0], ..., floatData[0][9], floatData[1][0], ...] |
| ptr | pointer to the start of the memory block in the 'FloatBuffer' (return value of the function PrimitiveManager::malloc) |
| void PrimitiveManager::setFloatData | ( | const QVector< Vector > & | floatData, |
| qsizetype | ptr ) |
Write in the 'FloatBuffer'. This is a read only buffer loaded on GPU when executing the shader.
| QVector<Vector> | floatData : pointer to the Vector array. The array will be flatten out : [floatData[0].x, floatData[0].y, floatData[0].z, floatData[1].x, ...] |
| qsizetype | ptr : pointer to the start of the memory block in the 'FloatBuffer' (return value of the function PrimitiveManager::malloc) |
| void PrimitiveManager::setFloatData | ( | float * | floatData, |
| qsizetype | ptr, | ||
| qsizetype | size ) |
Write in the 'FloatBuffer'. This is a read only buffer loaded on GPU when executing the shader.
| floatData | pointer to the float array |
| ptr | pointer to the start of the memory block in the 'FloatBuffer' (return value of the function PrimitiveManager::malloc) |
| size | number of float to write |