139 void render(
const std::function<
void()>& callback,
bool is_model =
true);
148 void drawDisk(
double innerRadius,
double outerRadius,
int slices,
int loops);
149 void drawCylinder(
double baseRadius,
double topRadius,
double height,
int slices,
int stacks);
150 void drawPlaneLines(
const Vector3D& a,
const Vector3D& b,
const Vector3D&,
const Vector3D& d,
int w_lines,
int h_lines);
170 Matrix44 _cameraMatrix;
174 Matrix44 _modelMatrix;
186 std::stack<Matrix44> _matrixStack;
190 std::stack<CullingState> _cullingStack;
194 bool _flagPaint{
false};
198 bool _flagSolid{
false};
202 CullingState _cullingState{cfDisabled};
204 Dynamic* _dynamic{
nullptr};
246#ifndef __JETBRAINS_IDE__
248 #include <xgl/Helper.hpp>
Color class used in vertex arrays and a layout of 4 x GLfloat.
Definition Color.h:14
Dynamic object .
Definition Dynamic.h:14
Keeps track of color.
Definition Helper.h:16
void pushMatrix()
Pushes the current matrix to the stack.
void setTexCoord(double x, double y)
void setLineWidth(float width=1.0f)
Sets the line width for GL_LINES and GL_LINE_STRIP.
Helper(ShaderProgram *sp)
Create a helper for a shader program.
void setVertex(double x, double y, double z)
void setFlags(bool solid, bool paint=false)
Helper flags which determine how the helper is active.
void translate(value_type x, value_type y, value_type z)
Adds a transformed (no translation) translation vector to the current matrix translation vector....
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 setColor(const Color &color)
Sets the current color using a QColor type.
ShaderProgram * shaderProgram()
Gets the Shader program.
void drawCylinder(double baseRadius, double topRadius, double height, int slices, int stacks)
Color & color()
Gets the current color as a reference. Compatible with the OpenGL function glColorXXX.
bool isSolid() const
Gets the solid flag.
void setNormal(double x, double y, double z)
void render(VertexArrayBase *object, bool is_model=true)
Draws the element setting some shader uniforms depending on the given arguments.
Matrix44::value_type value_type
Definition Helper.h:21
void beginMode(GLenum mode)
void pushCulling(CullingState state)
Pushes the current culling settings to stack.
void setVertex(Vector3D vec)
void setCameraAndModelMatrix(const QMatrix4x4 &camera, const QMatrix4x4 &model)
Sets the camera and model matrices which needed for old style OpenGL.
bool isPainting() const
Gets the paint flag.
void setColor(const QColor &color)
Sets the current color using a QColor type. Compatible with the OpenGL function glColorXXX.
void popMatrix()
Pops the stored matrix from the stack.
void drawDisk(double innerRadius, double outerRadius, int slices, int loops)
void render(const std::function< void()> &callback, bool is_model=true)
Sets the tracked state before rendering using the callback.
void popCulling()
Pops the stored culling settings to stack.
Helper(Dynamic *dynamic=nullptr)
Create a helper for a dynamic object which shader program is used to initialize the helper....
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 drawPlaneLines(const Vector3D &a, const Vector3D &b, const Vector3D &, const Vector3D &d, int w_lines, int h_lines)
void drawSphere(double radius, int slices, int stacks)
Matrix44 & matrix()
Gets the current matrix to modify.
Class to enable culling in a particular scope only.
Definition Helper.h:225
~ScopedCulling()
Disables the culling when getting out of scope.
ScopedCulling(Helper &helper, CullingState state={cfEnabled|cfCCW|cfBackside})
Create an instance culling front or back of the object.
Pushes and pops a matrix for the scope it is in.
Definition Helper.h:211
ScopedMatrix(Helper &helper)
Shader program having a default vertex and fragment shader.
Definition ShaderProgram.h:13
Base class for vertex-array derived classes.
Definition VertexArrayBase.h:15
Definition DemoRenderer.h:6
QFlags< ECullingFlag > CullingState
Type to contain bitmapped culling settings.
Definition Types.h:63
@ cfBackside
Definition Types.h:55
@ cfCCW
Definition Types.h:51
@ cfEnabled
Definition Types.h:49
std::array< GLfloat, 3 > vector3f
Type which corresponds with a GLSL type and used to implement Vertex structures.
Definition Types.h:21
#define _XGL_FUNC
Definition xgl/global.h:34
#define _XGL_CLASS
Definition xgl/global.h:35