![]() |
Scanframe Modular Application 0.1.0
|
Keeps track of color. More...
#include <Helper.h>
Public Types | |
typedef Matrix44::value_type | value_type |
Public Member Functions | |
Helper (ShaderProgram *sp) | |
Create helper for a shader program. | |
Helper (Dynamic *dynamic=nullptr) | |
Create helper for a dynamic object which shader program is used to initialize the helper. Method setVertex() passes the data to the given dynamic object as are methods beginMode() and endMode(). | |
void | setFlags (bool solid, bool paint=false) |
Helper flags which determine how the helper is active. | |
void | setCameraAndModelMatrix (const QMatrix4x4 &camera, const QMatrix4x4 &model) |
Sets the camera and model matrices which needed for old style OpenGL. | |
bool | isSolid () const |
Gets the solid flag. | |
bool | isPainting () const |
Gets the paint flag. | |
void | pushMatrix () |
Pushes the current matrix to stack. | |
void | popMatrix () |
Pops the stored matrix from stack. | |
void | pushCulling (CullingState state) |
Pushes the current culling settings to stack. | |
void | popCulling () |
Pops the stored culling settings to stack. | |
Matrix44 & | matrix () |
Gets the current matrix to modify. | |
void | translate (value_type x, value_type y, value_type z) |
Performs a translation on the current matrix. Compatible with the OpenGL function. | |
void | rotate (value_type angle, value_type x, value_type y, value_type z) |
Performs a rotation on the current matrix. Compatible with the OpenGL function. | |
void | setColor (const Color &color) |
Sets the current color using a QColor type. | |
void | setColor (const QColor &color) |
Sets the current color using a QColor type. | |
void | setColor (float r, float g, float b, float a) |
Sets the current color using the rgba values. Compatible with the OpenGL function glColorXXX. | |
void | setLineWidth (float width=1.0f) |
Sets the line width for GL_LINES and GL_LINE_STRIP. | |
void | render (VertexArrayBase *object, bool is_model=true) |
Draws the element setting some shader uniforms depending on the given arguments. | |
void | render (const std::function< void()> &callback, bool is_model=true) |
Sets the tracked state before rendering using the callback. | |
void | beginMode (GLenum mode) |
void | endMode () |
void | setNormal (double x, double y, double z) |
void | setVertex (double x, double y, double z) |
void | setVertex (Vector3D vec) |
void | setTexCoord (double x, double y) |
void | drawSphere (double radius, int slices, int stacks) |
void | drawDisk (double innerRadius, double outerRadius, int slices, int loops) |
void | drawCylinder (double baseRadius, double topRadius, double height, int slices, int stacks) |
void | drawPlaneLines (const Vector3D &a, const Vector3D &b, const Vector3D &, const Vector3D &d, int w_lines, int h_lines) |
ShaderProgram * | shaderProgram () |
Gets the Shader program. | |
Keeps track of color.
typedef Matrix44::value_type sf::xgl::Helper::value_type |
Type to use for OpenGL like functions.
|
explicit |
Create helper for a shader program.
|
explicit |
Create helper for a dynamic object which shader program is used to initialize the helper. Method setVertex() passes the data to the given dynamic object as are methods beginMode() and endMode().
void sf::xgl::Helper::beginMode | ( | GLenum | mode | ) |
void sf::xgl::Helper::drawCylinder | ( | double | baseRadius, |
double | topRadius, | ||
double | height, | ||
int | slices, | ||
int | stacks | ||
) |
void sf::xgl::Helper::drawDisk | ( | double | innerRadius, |
double | outerRadius, | ||
int | slices, | ||
int | loops | ||
) |
void sf::xgl::Helper::drawPlaneLines | ( | const Vector3D & | a, |
const Vector3D & | b, | ||
const Vector3D & | , | ||
const Vector3D & | d, | ||
int | w_lines, | ||
int | h_lines | ||
) |
void sf::xgl::Helper::drawSphere | ( | double | radius, |
int | slices, | ||
int | stacks | ||
) |
void sf::xgl::Helper::endMode | ( | ) |
bool sf::xgl::Helper::isPainting | ( | ) | const |
Gets the paint flag.
bool sf::xgl::Helper::isSolid | ( | ) | const |
Gets the solid flag.
Matrix44 & sf::xgl::Helper::matrix | ( | ) |
Gets the current matrix to modify.
void sf::xgl::Helper::popCulling | ( | ) |
Pops the stored culling settings to stack.
void sf::xgl::Helper::popMatrix | ( | ) |
Pops the stored matrix from stack.
void sf::xgl::Helper::pushCulling | ( | CullingState | state | ) |
Pushes the current culling settings to stack.
void sf::xgl::Helper::pushMatrix | ( | ) |
Pushes the current matrix to stack.
void sf::xgl::Helper::render | ( | const std::function< void()> & | callback, |
bool | is_model = true |
||
) |
Sets the tracked state before rendering using the callback.
callback | Lambda function containing setVertex() methods wrappen with beginMode() and endMode(). |
is_model | Determines if the model matrix applies when rendering. |
void sf::xgl::Helper::render | ( | VertexArrayBase * | object, |
bool | is_model = true |
||
) |
Draws the element setting some shader uniforms depending on the given arguments.
object | When NULL the object is not drawn. |
is_model | True when the object is part of the model and not a static object as e.g. axes for orientation. |
void sf::xgl::Helper::rotate | ( | value_type | angle, |
value_type | x, | ||
value_type | y, | ||
value_type | z | ||
) |
Performs a rotation on the current matrix. Compatible with the OpenGL function.
void sf::xgl::Helper::setCameraAndModelMatrix | ( | const QMatrix4x4 & | camera, |
const QMatrix4x4 & | model | ||
) |
Sets the camera and model matrices which needed for old style OpenGL.
camera | |
model |
void sf::xgl::Helper::setColor | ( | const Color & | color | ) |
Sets the current color using a QColor type.
color | Qt color value. Compatible with the OpenGL function glColorXXX. |
void sf::xgl::Helper::setColor | ( | const QColor & | color | ) |
Sets the current color using a QColor type.
color | Qt color value. Compatible with the OpenGL function glColorXXX. |
void sf::xgl::Helper::setColor | ( | float | r, |
float | g, | ||
float | b, | ||
float | a | ||
) |
Sets the current color using the rgba values. Compatible with the OpenGL function glColorXXX.
void sf::xgl::Helper::setFlags | ( | bool | solid, |
bool | paint = false |
||
) |
Helper flags which determine how the helper is active.
solid | Determines if a filled solid or wire frame is rendered. |
paint | Determines if OpenGL old style (true) or new style (false) is used for rendering. |
void sf::xgl::Helper::setLineWidth | ( | float | width = 1.0f | ) |
Sets the line width for GL_LINES and GL_LINE_STRIP.
width | Default OpenGL value is 1. |
void sf::xgl::Helper::setNormal | ( | double | x, |
double | y, | ||
double | z | ||
) |
void sf::xgl::Helper::setTexCoord | ( | double | x, |
double | y | ||
) |
void sf::xgl::Helper::setVertex | ( | double | x, |
double | y, | ||
double | z | ||
) |
void sf::xgl::Helper::setVertex | ( | Vector3D | vec | ) |
ShaderProgram * sf::xgl::Helper::shaderProgram | ( | ) |
Gets the Shader program.
void sf::xgl::Helper::translate | ( | value_type | x, |
value_type | y, | ||
value_type | z | ||
) |
Performs a translation on the current matrix. Compatible with the OpenGL function.