![]() |
Scanframe Modular Application 0.1.0
|
Base class for Vertex array derived classes. More...
#include <VertexArrayBase.h>
Public Types | |
enum | EVertexMember : VertexMember { vmPosition = 1 << 0 , vmNormal = 1 << 1 , vmColor = 1 << 2 , vmTexCoord = 1 << 3 } |
Possible member of a vertex structure. Where the position can not be omitted as part of the vertex. More... | |
enum | EDrawMode { dmDrawArrays , dmDrawElements } |
Drawing mode of by the template. More... | |
enum | ERenderOption : int { roNone = 0 , roWires = 1 << 0 , roNormals = 1 << 1 } |
Render options. More... | |
typedef unsigned | VertexMember |
Type used to describe vertex structure members. | |
typedef TVector< std::pair< vector3f, vector3f > > | NormalsDataType |
Type for extracting normals from all used vertices. | |
Public Member Functions | |
VertexArrayBase (QObject *parent=nullptr) | |
Default Qt object constructor. | |
virtual void | draw ()=0 |
Draws the vertex array. Specifically called from the paintGL() function of the OpenGL widget. | |
virtual void | paint ()=0 |
Paints the object old style OpenGL. | |
virtual bool | hasColor () const =0 |
Determines if Vertex has a color component. | |
virtual bool | hasTexture () const =0 |
Determines if Vertex has a texture mapping component. | |
virtual NormalsDataType | getNormalsData () const =0 |
Gets the information from the vertices to make normals visible. | |
void | triggerGenerate () |
Sets a flag to trigger data generation when the data is called for. | |
void | setRenderOptions (RenderOptions options) |
Modify the render options which will trigger a regeneration of the vertices and indices. | |
RenderOptions | getRenderOptions () const |
Gets the render options. | |
Static Public Member Functions | |
static const Color & | getDefaultColor () |
Gets the default color used by the vertex structures when not set by the derived class. Created to have a single location for the default color. An example how it is used: | |
static void | setDefaultColor (const QColor &color) |
Sets the default color used by the vertex structures when not set by the derived class. | |
Protected Member Functions | |
virtual bool | setup ()=0 |
Sets up the vertex array for the OpenGL context. | |
virtual void | clearData ()=0 |
Clears the data to generate array buffers. | |
bool | callGenerate () |
Makes a call to virtual function generate() when the #_generateFlag is set using triggerGenerate(). | |
virtual void | generate ()=0 |
Generate the data needed for creation of vertex array and/or indices. Is or must be called by setup() function. | |
virtual void | modifyContext (bool before, bool draw, size_t mode_index) |
Allows modifying the OpenGL context before and after drawing. | |
bool | isTriggered () const |
Gets the flag if data is to be (re-)generated. Flag is set to True initially. | |
Base class for Vertex array derived classes.
typedef TVector<std::pair<vector3f, vector3f> > sf::xgl::VertexArrayBase::NormalsDataType |
Type for extracting normals from all used vertices.
typedef unsigned sf::xgl::VertexArrayBase::VertexMember |
Type used to describe vertex structure members.
enum sf::xgl::VertexArrayBase::ERenderOption : int |
Possible member of a vertex structure. Where the position can not be omitted as part of the vertex.
Enumerator | |
---|---|
vmPosition | Position member of vec3 type. |
vmNormal | Normal member of vec3 type. |
vmColor | Color member of vec4 type. |
vmTexCoord | Texture coord member of vec2 type |
|
explicit |
Default Qt object constructor.
|
protected |
Makes a call to virtual function generate() when the #_generateFlag is set using triggerGenerate().
|
protectedpure virtual |
Clears the data to generate array buffers.
Implemented in sf::xgl::TVertexArray< VertexMembers >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >, and sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal|VertexArrayBase::vmColor|VertexArrayBase::vmTexCoord >.
|
pure virtual |
Draws the vertex array. Specifically called from the paintGL() function of the OpenGL widget.
Implemented in sf::xgl::TVertexArray< VertexMembers >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal|VertexArrayBase::vmColor|VertexArrayBase::vmTexCoord >, and sf::xgl::VertexArray.
|
protectedpure virtual |
Generate the data needed for creation of vertex array and/or indices. Is or must be called by setup() function.
Implemented in sf::xgl::Axes, sf::xgl::Cone, sf::xgl::Cube, sf::xgl::Cylinder, sf::xgl::Disk, sf::xgl::Dynamic, sf::xgl::Line, sf::xgl::Normals, sf::xgl::Rectangle, sf::xgl::Sphere, and sf::xgl::Tube.
|
static |
Gets the default color used by the vertex structures when not set by the derived class. Created to have a single location for the default color.
An example how it is used:
|
pure virtual |
Gets the information from the vertices to make normals visible.
Implemented in sf::xgl::TVertexArray< VertexMembers >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >, and sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal|VertexArrayBase::vmColor|VertexArrayBase::vmTexCoord >.
RenderOptions sf::xgl::VertexArrayBase::getRenderOptions | ( | ) | const |
Gets the render options.
|
pure virtual |
Determines if Vertex has a color component.
Implemented in sf::xgl::TVertexArray< VertexMembers >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >, and sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal|VertexArrayBase::vmColor|VertexArrayBase::vmTexCoord >.
|
pure virtual |
Determines if Vertex has a texture mapping component.
Implemented in sf::xgl::TVertexArray< VertexMembers >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >, and sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal|VertexArrayBase::vmColor|VertexArrayBase::vmTexCoord >.
|
protected |
Gets the flag if data is to be (re-)generated. Flag is set to True initially.
|
protectedvirtual |
Allows modifying the OpenGL context before and after drawing.
before | True when this function is called before drawing and False when after. |
draw | True when called for drawing and not painting (is old style OpenGL). |
mode_index | Index of the mode list. When painting the |
Reimplemented in sf::xgl::Line, and sf::xgl::Normals.
|
pure virtual |
Paints the object old style OpenGL.
Implemented in sf::xgl::TVertexArray< VertexMembers >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal|VertexArrayBase::vmColor|VertexArrayBase::vmTexCoord >, and sf::xgl::VertexArray.
|
static |
Sets the default color used by the vertex structures when not set by the derived class.
void sf::xgl::VertexArrayBase::setRenderOptions | ( | RenderOptions | options | ) |
Modify the render options which will trigger a regeneration of the vertices and indices.
|
protectedpure virtual |
Sets up the vertex array for the OpenGL context.
Implemented in sf::xgl::TVertexArray< VertexMembers >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >, sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal|VertexArrayBase::vmColor|VertexArrayBase::vmTexCoord >, and sf::xgl::VertexArray.
void sf::xgl::VertexArrayBase::triggerGenerate | ( | ) |
Sets a flag to trigger data generation when the data is called for.