Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::xgl::Dynamic Class Referencefinal

Dynamic object . More...

#include <Dynamic.h>

Inheritance diagram for sf::xgl::Dynamic:
Collaboration diagram for sf::xgl::Dynamic:

Public Types

typedef TClosure< void, VertexArrayBase * > Callback
 
- Public Types inherited from sf::xgl::VertexArrayBase
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

void addVertex (const vector3f &position, const vector3f &normal, const Color &color)
 Adds a vertex to the vertices array.
 
void beginMode (GLenum mode, const Matrix &matrix, const Color &color, CullingState culling)
 Adds an entry the modes list.
 
void endMode ()
 Completes the openend modes list entry setting the stop value.
 
void setCallback (const Callback &closure)
 
 TVertexArray (ShaderProgram *sp)
 Constructor.
 
- Public Member Functions inherited from sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >
 TVertexArray (ShaderProgram *sp)
 Constructor.
 
 ~TVertexArray () override
 Virtual destructor.
 
ShaderProgramshaderProgram ()
 Gets the associated shader program.
 
void draw () final
 Overridden from base class VertexArrayBase. Uses new style OpenGL with a shader program.
 
void paint () final
 Overridden from base class VertexArrayBase. Uses old style OpenGL without a shader program.
 
bool hasColor () const final
 Overridden from base class VertexArrayBase.
 
bool hasTexture () const final
 Overridden from base class VertexArrayBase.
 
void setTexture (QOpenGLTexture *texture)
 Assigns the texture.
 
NormalsDataType getNormalsData () const override
 Overridden from base class.
 
void clearData () override
 Clears the data to generate array buffers.
 
- Public Member Functions inherited from sf::xgl::VertexArrayBase
 VertexArrayBase (QObject *parent=nullptr)
 Default Qt object constructor.
 
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.
 

Protected Member Functions

void generate () override
 Overridden from base class.
 
- Protected Member Functions inherited from sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >
bool setup () override
 Sets up the vertex array for the OpenGL context.
 
void setupLayout ()
 Sets up the layout of the Vertex structure for OpenGL.
 
void setAttribPointer (ShaderProgram::Attribute sa, size_t offset)
 Makes a call to setVertexAttribPointer().
 
void callModifyContext (const ModeRange &mr, bool before, bool draw, size_t mode_index)
 Calls the function modifyContext when overridden.
 
bool checkData () const
 Check the data integrity of indices to vertices,.
 
- Protected Member Functions inherited from sf::xgl::VertexArrayBase
bool callGenerate ()
 Makes a call to virtual function generate() when the #_generateFlag is set using triggerGenerate().
 
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.
 

Protected Attributes

Callback _callback
 
- Protected Attributes inherited from sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >
TVector< Vertex_vertices
 Holds the data of the vertices before being copied to OpenGL memory.
 
IndexVectorType _indices
 Holds the data of the indices for solid and wire drawing.
 
TVector< ModeRange > _modes
 Modes to call glDrawArrays() or glDrawElements() depending on the _indices member not being empty.
 

Additional Inherited Members

- Static Public Member Functions inherited from sf::xgl::VertexArrayBase
static const ColorgetDefaultColor ()
 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.
 
- Public Attributes inherited from sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >
QOpenGLBuffer vbo
 Holds the vertex buffer object.
 
QOpenGLBuffer ebo
 Holds the index buffer object for solid drawing.
 
- Protected Types inherited from sf::xgl::TVertexArray< VertexArrayBase::vmPosition|VertexArrayBase::vmNormal >
using Vertex = std::conditional_t< VertexMembers==vmPosition, VT_Position, std::conditional_t< VertexMembers==(vmPosition|vmColor), VT_PositionColor, std::conditional_t< VertexMembers==(vmPosition|vmNormal), VT_PositionNormal, std::conditional_t< VertexMembers==(vmPosition|vmNormal|vmColor), VT_PositionNormalColor, std::conditional_t< VertexMembers==(vmPosition|vmTexCoord), VT_PositionTexture, std::conditional_t< VertexMembers==(vmPosition|vmNormal|vmTexCoord), VT_PositionNormalTexture, std::conditional_t< VertexMembers==(vmPosition|vmNormal|vmColor|vmTexCoord), VT_PositionNormalColorTexture, void > > > > > > >
 Conditional vertex structure type. Used for memory locations.
 
typedef TVector< GLuint > IndexVectorType
 Type definition for storing indices.
 

Detailed Description

Dynamic object .

Member Typedef Documentation

◆ Callback

Member Function Documentation

◆ addVertex()

void sf::xgl::Dynamic::addVertex ( const vector3f position,
const vector3f normal,
const Color color 
)

Adds a vertex to the vertices array.

Parameters
positionPosition of the vertex.
normalNormal of the vertex surface.
colorColor for the vertex.

◆ beginMode()

void sf::xgl::Dynamic::beginMode ( GLenum  mode,
const Matrix matrix,
const Color color,
CullingState  culling 
)

Adds an entry the modes list.

Parameters
modeMode like GL_LINES, GL_QUADS and more.
matrixMatrix for placement in 3D world space.
colorColor for this mode section.
cullingCulling state for this mode section.

◆ endMode()

void sf::xgl::Dynamic::endMode ( )

Completes the openend modes list entry setting the stop value.

◆ generate()

void sf::xgl::Dynamic::generate ( )
overrideprotectedvirtual

Overridden from base class.

Implements sf::xgl::VertexArrayBase.

◆ setCallback()

void sf::xgl::Dynamic::setCallback ( const Callback closure)

◆ TVertexArray()

sf::xgl::TVertexArray< VertexMembers >::TVertexArray ( ShaderProgram sp)
explicit

Constructor.

Parameters
spShader program instance.

Member Data Documentation

◆ _callback

Callback sf::xgl::Dynamic::_callback
protected

The documentation for this class was generated from the following file: