2#include <QOpenGLBuffer>
3#include <QOpenGLTexture>
17template<VertexArrayBase::VertexMember VertexMembers>
94 template<typename VertexType, typename FieldType>
111 Color color{0.7f, 0.7f, 0.7f, 0.3f};
140 } VT_PositionNormalColor;
204 size_t start{std::numeric_limits<size_t>::max()};
264 QOpenGLBuffer
vbo{QOpenGLBuffer::VertexBuffer};
268 QOpenGLBuffer
ebo{QOpenGLBuffer::IndexBuffer};
274 QOpenGLTexture* _texture{
nullptr};
279#ifndef __JETBRAINS_IDE__
281 #include <xgl/TVertexArray.hpp>
Counted vector having additional methods and operators for ease of usage. This template class extends...
Definition TVector.h:19
Color class used in vertex arrays and a layout of 4 x GLfloat.
Definition Color.h:14
A 4x4 matrix class used in arrays and has a layout of 16x GLfloat.
Definition Matrix.h:15
Shader program having a default vertex and fragment shader.
Definition ShaderProgram.h:13
OpenGL base class and wrapper template for vertex arrays. Automates most of the things needed for pri...
Definition TVertexArray.h:19
TVector< Vertex > _vertices
Holds the data of the vertices before being copied to OpenGL memory.
Definition TVertexArray.h:186
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 paint() final
Overridden from base class VertexArrayBase. Uses old style OpenGL without a shader program.
~TVertexArray() override
Virtual destructor.
void draw() final
Overridden from base class VertexArrayBase. Uses new style OpenGL with a shader program.
TVertexArray(ShaderProgram *sp)
Constructor.
ShaderProgram * shaderProgram()
Gets the associated shader program.
void callModifyContext(const ModeRange &mr, bool before, bool draw, size_t mode_index)
Calls the function modifyContext when overridden.
void clearData() override
Clears the data to generate array buffers.
QOpenGLBuffer vbo
Holds the vertex buffer object.
Definition TVertexArray.h:264
void setTexture(QOpenGLTexture *texture)
Assigns the texture.
bool hasTexture() const final
Overridden from base class VertexArrayBase.
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 > > > > > > > Vertex
Conditional vertex structure type. Used for memory locations.
Definition TVertexArray.h:182
TVector< GLuint > IndexVectorType
Type definition for storing indices.
Definition TVertexArray.h:223
bool checkData() const
Check the data integrity of indices to vertices.
bool hasColor() const final
Overridden from base class VertexArrayBase.
IndexVectorType _indices
Holds the data of the indices for solid and wire drawing.
Definition TVertexArray.h:228
TVector< ModeRange > _modes
Modes to call glDrawArrays() or glDrawElements() depending on the _indices member not being empty.
Definition TVertexArray.h:233
void setAttribPointer(ShaderProgram::Attribute sa, size_t offset)
Makes a call to setVertexAttribPointer().
NormalsDataType getNormalsData() const override
Overridden from base class.
QOpenGLBuffer ebo
Holds the index buffer object for solid drawing.
Definition TVertexArray.h:268
Base class for vertex-array derived classes.
Definition VertexArrayBase.h:15
@ vmTexCoord
Definition VertexArrayBase.h:37
@ vmColor
Definition VertexArrayBase.h:35
@ vmPosition
Definition VertexArrayBase.h:31
@ vmNormal
Definition VertexArrayBase.h:33
TVector< std::pair< vector3f, vector3f > > NormalsDataType
Type for extracting normals from all used vertices.
Definition VertexArrayBase.h:118
static const Color & getDefaultColor()
Gets the default color used by the vertex structures when not set by the derived class....
Definition DemoRenderer.h:6
QFlags< ECullingFlag > CullingState
Type to contain bitmapped culling settings.
Definition Types.h:63
@ cfBackside
Definition Types.h:55
@ cfDisabled
Definition Types.h:47
@ cfCCW
Definition Types.h:51
std::array< GLfloat, 2 > vector2f
Type which corresponds with a GLSL type and used to implement Vertex structures.
Definition Types.h:17
std::array< GLfloat, 3 > vector3f
Type which corresponds with a GLSL type and used to implement Vertex structures.
Definition Types.h:21
Modes to be called on the available indices.
Definition TVertexArray.h:192
Matrix matrix
Matrix set before rendering.
Definition TVertexArray.h:213
size_t stop
Stop-index of the indices that belong to this mode.
Definition TVertexArray.h:200
GLenum mode
Mode to call glDrawArrays() with to get a wire model.
Definition TVertexArray.h:196
Color color
Color set before rendering. Only set when not (0,0,0,0).
Definition TVertexArray.h:209
size_t start
Start-index of the indices that belong to this mode.
Definition TVertexArray.h:204
CullingState culling
Required culling state.
Definition TVertexArray.h:217
Available structure for a typical selection of members.
Definition TVertexArray.h:109
vector3f position
Definition TVertexArray.h:110
Available structure for a typical selection of members.
Definition TVertexArray.h:156
vector3f normal
Definition TVertexArray.h:158
vector2f texture
Definition TVertexArray.h:160
vector3f position
Definition TVertexArray.h:157
Available structure for a typical selection of members.
Definition TVertexArray.h:136
vector3f normal
Definition TVertexArray.h:138
vector3f position
Definition TVertexArray.h:137
Available structure for a typical selection of members.
Definition TVertexArray.h:146
vector2f texture
Definition TVertexArray.h:149
vector3f normal
Definition TVertexArray.h:148
vector3f position
Definition TVertexArray.h:147
Available structure for a typical selection of members.
Definition TVertexArray.h:118
vector3f position
Definition TVertexArray.h:119
vector3f normal
Definition TVertexArray.h:120
Available structure for a typical selection of members.
Definition TVertexArray.h:127
vector3f position
Definition TVertexArray.h:128
vector2f texture
Definition TVertexArray.h:129
Available structure for a typical selection of members.
Definition TVertexArray.h:101
vector3f position
Definition TVertexArray.h:102