RenderContext contains the current rendering state. More...
#include <Luminous/RenderContext.hpp>
Classes | |
| struct | RenderBuilder |
| Proxy object for building rendering command. More... | |
Public Types | |
| enum | TextFlags { TextDynamic, TextStatic } |
| TextFlags can be used to give performance hint to RenderContext about the layout of the text. More... | |
| enum | TextureMappingMode { TEXTURE_MAPPING_FLAT, TEXTURE_MAPPING_TANGENT } |
| How are UV coordinates generated for objects. More... | |
Public Member Functions | |
| void | addRenderCounter () |
| Adds the render counter by one The render counter is used to track how many objects have been rendered since the counter was last reset. More... | |
| void | addUnfinishedRenderCounter () |
| Increases the unfinished render counter by one. More... | |
| float | approximateScaling () const |
| Get the approximate scaling factor applied by the transform. More... | |
| const Luminous::MultiHead::Area * | area () const |
| Returns the current area. More... | |
| const Program & | basicShader () const |
| Returns the basic shader used in Luminous. More... | |
| void | beginArea () |
| Called once for every area before rendering anything in it. More... | |
| void | beginFrame () |
| Called once for every frame before rendering. For internal implementation. | |
| void | blit (const Nimble::Recti &src, const Nimble::Recti &dst, ClearMask mask=CLEARMASK_COLOR, Texture::Filter filter=Texture::FILTER_NEAREST) |
| Copies pixels from the read frame buffer to the draw frame buffer. More... | |
| void | clear (ClearMask mask, const Radiant::Color &clearColor=Radiant::Color(0, 0, 0, 0), double clearDepth=1.0, int clearStencil=0) |
| Clears the buffers of current frame buffer. More... | |
| const Nimble::ClipStack & | clipStack () const |
| Get the active clip stack. More... | |
| Nimble::Size | contextSize () const |
| Returns the size of the window of this RenderContext object. More... | |
| template<typename Vertex , typename Uniform > | |
| RenderCommand & | createRenderCommand (bool translucent, int indexCount, int vertexCount, unsigned *&mappedIndexBuffer, Vertex *&mappedVertexBuffer, Uniform *&mappedUniformBuffer, float &depth, const Program &program, const std::map< QByteArray, const Texture * > *textures, const std::map< QByteArray, ShaderUniform > *uniforms) |
| size_t | currentClipMaskDepth () const |
| Get current clip mask recursion depth. More... | |
| const FrameBuffer & | currentFrameBuffer () const |
| Returns the target framebuffer for the current rendering operations. More... | |
| const Nimble::Recti & | currentScissorArea () const |
| Returns current scissor area. More... | |
| const Nimble::Recti & | currentViewport () const |
| Get the current viewport. More... | |
| void | disableClipPlanes (const QList< int > &planes) |
| Disable clipplanes from being used in shaders. More... | |
| void | drawArc (const Nimble::Vector2f ¢er, float radius, float fromRadians, float toRadians, const Luminous::Style &style, unsigned int lineSegments=0) |
| Draw an arc defined as a segment of circle. More... | |
| void | drawCircle (const Nimble::Vector2f ¢er, float radius, const Luminous::Style &style, unsigned int lineSegments=0, float fromRadians=0, float toRadians=Nimble::Math::TWO_PI) |
| Draw a possibly filled circle. More... | |
| void | drawDonut (const Nimble::Vector2f ¢er, Nimble::Vector2 axis, float otherAxisLength, float width, const Luminous::Style &style, unsigned int linesegments=0, float fromRadians=0, float toRadians=Nimble::Math::TWO_PI, TextureMappingMode textureMappingMode=TEXTURE_MAPPING_FLAT) |
| Draws a constant width donut defined as an ellipse and a hole in the center. More... | |
| void | drawEllipse (Nimble::Vector2f center, Nimble::Vector2f axis, float otherAxisLength, const Luminous::Style &style, unsigned int lineSegments=0, float fromRadians=0, float toRadians=Nimble::Math::TWO_PI) |
| Draws an ellipse. More... | |
| void | drawLine (const Nimble::Vector2f &p1, const Nimble::Vector2f &p2, const Luminous::Style &style) |
| Draws a line. More... | |
| template<typename InputIterator > | |
| void | drawPoints (InputIterator begin, size_t numPoints, const Luminous::Style &style) |
| Draws a set of points. More... | |
| template<typename InputIterator > | |
| void | drawPolyLine (InputIterator begin, size_t numVertices, const Luminous::Style &style) |
| Draws a polyline. More... | |
| template<typename Vertex , typename UniformBlock > | |
| RenderBuilder< Vertex, UniformBlock > | drawPrimitiveT (Luminous::PrimitiveType primType, unsigned int indexCount, unsigned int vertexCount, const Luminous::Program &shader, const Radiant::Color &color, float width, const Luminous::Style &style) |
| Returns RenderBuilder for the given drawing query. More... | |
| void | drawQuad (const Nimble::Vector2 *v, const Nimble::Vector2 *uvs, const Style &style) |
| Draws a quad with two triangles. More... | |
| void | drawRect (const Nimble::Vector2f &min, const Nimble::Vector2f &max, const Style &style) |
| Draws a rectangle. More... | |
| void | drawRect (const Nimble::Vector2f &min, const Nimble::SizeF &size, const Style &style) |
| Draws a rectangle. More... | |
| template<typename T > | |
| void | drawRect (const Nimble::RectT< T > &rect, const Style &style) |
| Draws a rectangle. More... | |
| template<typename T > | |
| void | drawRect (const Nimble::RectT< T > &rect, const Nimble::Rectf &uvs, const Style &style) |
| Draws a rectangle. More... | |
| void | drawRectWithHole (const Nimble::Rectf &area, const Nimble::Rect &hole, const Luminous::Style &style) |
| Draws a rectangle with rectangular hole. More... | |
| void | drawText (const TextLayout &layout, const Nimble::Vector2f &location, const Nimble::Rectf &viewRect, const TextStyle &style, bool ignoreVerticalAlign=false) |
| Draws text. More... | |
| void | drawText (const QString &text, const Nimble::Rectf &rect, const TextStyle &style, TextFlags flags=TextStatic) |
| Draws given string. More... | |
| void | enableClipPlanes (const QList< int > &planes) |
| Enable clipplanes for use in shaders. More... | |
| void | endArea () |
| Called once for every area after rendering it. More... | |
| void | endFrame () |
| Called once for every frame after rendering. For internal implementation. | |
| TextureGL * | findHandle (const Texture &texture) |
| void | flush () |
| Forces all queued rendering commands to execute. More... | |
| unsigned | gpuId () const |
| Returns a gpu id associated with this render context. | |
| ProgramGL & | handle (const Program &program) |
| Returns the GL resources handle corresponding to given program. More... | |
| TextureGL & | handle (const Texture &texture) |
| Returns the GL resources handle corresponding to given texture. More... | |
| FrameBufferGL & | handle (const FrameBuffer &target) |
| Returns the GL resources handle corresponding to given frame buffer. More... | |
| RenderBufferGL & | handle (const RenderBuffer &buffer) |
| Returns the GL resources handle corresponding to given render buffer. More... | |
| BufferGL & | handle (const Buffer &buffer) |
| Returns the GL resources handle corresponding to given buffer (vertex/index). More... | |
| VertexArrayGL & | handle (const VertexArray &vertexarray, ProgramGL *program) |
| Returns the GL resources handle corresponding to given vertex array. More... | |
| bool | initialize () |
| Initializes the context. More... | |
| bool | isClipStackEmpty () const |
| Check if the current clip stack is empty. More... | |
| bool | isVisible (const Nimble::Rectangle &area) |
| Checks if the given rectangle is visible (not clipped). More... | |
| float | opacity () const |
| Get the current opacity. More... | |
| void | popClipMaskStack () |
| Decrement the current clip mask recursion depth. | |
| void | popClipRect () |
| Pops a clipping rectangle from the context. | |
| void | popClipStack () |
| Restores the previously saved clipping stack. | |
| void | popFrameBuffer () |
| Pops the current frame buffer from the stack. | |
| void | popOpacity () |
| Pop the current opacity from the stack. | |
| void | popScissorRect () |
| Pop current scissor rectangle from stack. | |
| void | popViewport () |
| Pop a viewport from the viewport stack Pops the viewport from the top of the viewport stack. | |
| void | popViewTransform () |
| Pop the current matrix from view transform stack. | |
| void | pushClipMaskStack (size_t depth) |
| Increment the current clip mask recursion depth. | |
| void | pushClipRect (const Nimble::Rectangle &r) |
| Pushes a clipping rectangle to the context. | |
| void | pushClipStack () |
| Save the current clipping stack and start with a empty one. | |
| void | pushFrameBuffer (const FrameBuffer &target) |
| Pushes new frame buffer to the stack. More... | |
| void | pushOpacity (float opacity) |
| Push the given opacity to render context. More... | |
| void | pushScissorRect (const Nimble::Recti &scissorArea) |
| Push scissor rectangle into scissor stack. | |
| void | pushViewport (const Nimble::Recti &viewport) |
| Push a viewport to the viewport stack Pushes a viewport to the top of the viewport stack. More... | |
| void | pushViewTransform (const Nimble::Matrix4 &m) |
| Push new view transform to the view transform stack. More... | |
| size_t | recursionLimit () const |
| Returns the recursion limit. More... | |
| template<typename Vertex , typename UniformBlock > | |
| RenderBuilder< Vertex, UniformBlock > | render (bool translucent, Luminous::PrimitiveType type, int offset, int vertexCount, float primitiveSize, const Luminous::VertexArray &vertexArray, const Luminous::Program &program, const std::map< QByteArray, const Texture * > *textures=nullptr, const std::map< QByteArray, ShaderUniform > *uniforms=nullptr) |
| Adds rendering command to the rendering queue. More... | |
| template<typename Vertex , typename UniformBlock > | |
| RenderBuilder< Vertex, UniformBlock > | render (bool translucent, Luminous::PrimitiveType type, int indexCount, int vertexCount, float primitiveSize, const Luminous::Program &program, const std::map< QByteArray, const Texture * > *textures=nullptr, const std::map< QByteArray, ShaderUniform > *uniforms=nullptr) |
| Similar to drawPrimitiveT but has less restrictions on the uniform block. More... | |
| RenderContext (Luminous::RenderDriver &driver, const Luminous::MultiHead::Window *window=0, unsigned gpuId=0) | |
| Constructs a new render context and associates the given resources to it. More... | |
| unsigned long | renderCounter () const |
| Luminous::RenderDriver & | renderDriver () |
| void | setBlendMode (const BlendMode &mode) |
| Set the active blendmode. More... | |
| void | setCullMode (const CullMode &mode) |
| Set the active cull mode. More... | |
| void | setDefaultDrawBuffers () |
| Reset the active draw buffers to the default. | |
| void | setDefaultState () |
| Reset the OpenGL state to default. More... | |
| void | setDepthMode (const DepthMode &mode) |
| Set the active depthmode. More... | |
| void | setDrawBuffers (const std::vector< int > &buffers) |
| Set the active draw buffers. More... | |
| void | setFrontFace (enum FaceWinding winding) |
| Specify front-facing polygons. More... | |
| void | setOpacity (float opacity) |
| void | setRecursionLimit (size_t limit) |
| Sets the rendering recursion limit for the context. More... | |
| void | setRenderBuffers (bool colorBuffer, bool depthBuffer, bool stencilBuffer) |
| Set the active render buffers. More... | |
| void | setStencilMode (const StencilMode &mode) |
| Set the active stencil mode. More... | |
| void | setWindowArea (const Luminous::MultiHead::Window *window, const Luminous::MultiHead::Area *area) |
| Sets the associated area for this context at the moment. More... | |
| template<typename T > | |
| std::pair< T *, RenderContext::SharedBuffer * > | sharedBuffer (std::size_t maxVertexCount, Buffer::Type type, unsigned int &offset) |
| StencilMode | stencilMode () const |
| const Program & | texShader () const |
| Returns the shader used for texturing in Luminous. More... | |
| const Program & | trilinearTexShader () const |
| Returns the shader used for trilinear texturing in Luminous. More... | |
| unsigned long | unfinishedRenderCounter () const |
| The unfinished render counter is used to track how many objects didn't finish their rendering because of some resource wasn't ready. More... | |
| const Nimble::Matrix4 & | viewTransform () const |
| Returns transformation from the world coordinates (pixels) to projected eye coordinates (normalized device coordinates). More... | |
| const Luminous::MultiHead::Window * | window () const |
| Returns the window associated to the current area. More... | |
| virtual | ~RenderContext () |
| Closes this render context. More... | |
Public Member Functions inherited from Luminous::Transformer | |
| void | leftMul (const Nimble::Matrix4 &m) |
| Multiply the top matrix from the left with the given matrix The end result is equivalent to: More... | |
| void | popTransform () |
| Pops the top matrix from the stack. | |
| Nimble::Vector2 | project (const Nimble::Vector2 &) const |
| Apply the current transformation matrix on a 2D vector. | |
| void | pushTransform () |
| Push a new matrix to the stack, just copying the current top. | |
| void | pushTransform (const Nimble::Matrix4 &m) |
| Push the given matrix to the stack pushTransform(m) has the same effect as: More... | |
| void | pushTransform (const Nimble::Matrix3 &m) |
| void | pushTransformLeftMul (const Nimble::Matrix4 &m) |
| Multiply the top matrix from the left with the given matrix and push the result into the stack. | |
| void | pushTransformLeftMul (const Nimble::Matrix3 &m) |
| void | pushTransformRightMul (const Nimble::Matrix4 &m) |
| Multiply the top matrix from the right with the given matrix and push the result into the stack. | |
| void | pushTransformRightMul (const Nimble::Matrix3 &m) |
| void | resetTransform () |
| Clears the stack so it only contains an identity matrix. | |
| void | rightMul (const Nimble::Matrix4 &m) |
| Multiply the top matrix from the right with the given matrix The end result is equivalent to: More... | |
| void | setTransform (const Nimble::Matrix4 &m) |
| Replaces the top matrix with the given matrix. More... | |
| size_t | stackSize () const |
| Get the size of the transform stack. More... | |
| const Nimble::Matrix4 & | transform () const |
| Get the top matrix of the stack. | |
| Nimble::Matrix3 | transform3 () const |
| Get the top matrix of the stack as 3x3-matrix. | |
| Transformer () | |
| Creates an empty transformation stack. | |
| Nimble::Vector2 | unproject (const Nimble::Vector2 &) const |
| Apply inverse of the current transformation matrix on a 2D vector. | |
| virtual | ~Transformer () |
| Deletes the transformation stack. | |
Protected Member Functions | |
| virtual void | beforeTransformChange () |
| This function gets called just before the transformation matrix is changed. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Luminous::Transformer | |
|
std::stack< Nimble::Matrix4, std::vector< Nimble::Matrix4 > > | m_stack |
| The transformation stack. | |
RenderContext contains the current rendering state.
Each RenderContext is tied to single RenderThread.
TextFlags can be used to give performance hint to RenderContext about the layout of the text.
| Enumerator | |
|---|---|
| TextDynamic |
Text layout changes usually every frame. |
| TextStatic |
Text layout does not change often. |
How are UV coordinates generated for objects.
| Luminous::RenderContext::RenderContext | ( | Luminous::RenderDriver & | driver, |
| const Luminous::MultiHead::Window * | window = 0, |
||
| unsigned | gpuId = 0 |
||
| ) |
Constructs a new render context and associates the given resources to it.
| driver | render driver to use |
| window | window to associate this context with |
| gpuId | Native GPU id this render context is associated with |
|
virtual |
Closes this render context.
Invalidates all GL resources tied to this context. However note, that CPU equivalents of GL classes are still valid.
| void Luminous::RenderContext::addRenderCounter | ( | ) |
Adds the render counter by one The render counter is used to track how many objects have been rendered since the counter was last reset.
This can be useful for checking that object culling works as intended.
| void Luminous::RenderContext::addUnfinishedRenderCounter | ( | ) |
Increases the unfinished render counter by one.
| float Luminous::RenderContext::approximateScaling | ( | ) | const |
Get the approximate scaling factor applied by the transform.
| const Luminous::MultiHead::Area* Luminous::RenderContext::area | ( | ) | const |
Returns the current area.
| const Program& Luminous::RenderContext::basicShader | ( | ) | const |
Returns the basic shader used in Luminous.
This shader program transforms the geometry and paints it with single color. Needs BasicVertex for vertex type and BasicUniformBlock for uniform block type to be able to work.
|
protectedvirtual |
This function gets called just before the transformation matrix is changed.
Reimplemented from Luminous::Transformer.
| void Luminous::RenderContext::beginArea | ( | ) |
Called once for every area before rendering anything in it.
Can be called multiple times per frame depending on configuration.
| void Luminous::RenderContext::blit | ( | const Nimble::Recti & | src, |
| const Nimble::Recti & | dst, | ||
| ClearMask | mask = CLEARMASK_COLOR, |
||
| Texture::Filter | filter = Texture::FILTER_NEAREST |
||
| ) |
Copies pixels from the read frame buffer to the draw frame buffer.
| src | Rectangle defining source area in the read frame buffer |
| dst | Rectangle defining destination are in the draw frame buffer |
| mask | Buffers to blit |
| filter | Filtering mode for sampling |
| void Luminous::RenderContext::clear | ( | ClearMask | mask, |
| const Radiant::Color & | clearColor = Radiant::Color(0, 0, 0, 0), |
||
| double | clearDepth = 1.0, |
||
| int | clearStencil = 0 |
||
| ) |
Clears the buffers of current frame buffer.
| mask | Mask to define what buffers to clear |
| clearColor | All values in color buffer will be initialized to this if it is cleared |
| clearDepth | All values in depth buffer will be initialized to this if it is cleared |
| clearStencil | All values in stencil buffer will be initialized to this if it is cleared |
| const Nimble::ClipStack& Luminous::RenderContext::clipStack | ( | ) | const |
Get the active clip stack.
The clip stack is only valid during rendering. Do not call this function if the clip stack is empty.
| Nimble::Size Luminous::RenderContext::contextSize | ( | ) | const |
Returns the size of the window of this RenderContext object.
| size_t Luminous::RenderContext::currentClipMaskDepth | ( | ) | const |
Get current clip mask recursion depth.
| const FrameBuffer& Luminous::RenderContext::currentFrameBuffer | ( | ) | const |
Returns the target framebuffer for the current rendering operations.
| const Nimble::Recti& Luminous::RenderContext::currentScissorArea | ( | ) | const |
Returns current scissor area.
| const Nimble::Recti& Luminous::RenderContext::currentViewport | ( | ) | const |
Get the current viewport.
| void Luminous::RenderContext::disableClipPlanes | ( | const QList< int > & | planes | ) |
Disable clipplanes from being used in shaders.
| planes | a list of planes that will be disabled |
| void Luminous::RenderContext::drawArc | ( | const Nimble::Vector2f & | center, |
| float | radius, | ||
| float | fromRadians, | ||
| float | toRadians, | ||
| const Luminous::Style & | style, | ||
| unsigned int | lineSegments = 0 |
||
| ) |
Draw an arc defined as a segment of circle.
| center | Center of the arc |
| radius | Radius of the arc |
| fromRadians | Start angle in radians |
| toRadians | End angle in radians |
| style | Stroke definition of the arc (color, width) |
| lineSegments | Number of steps (precision) |
| void Luminous::RenderContext::drawCircle | ( | const Nimble::Vector2f & | center, |
| float | radius, | ||
| const Luminous::Style & | style, | ||
| unsigned int | lineSegments = 0, |
||
| float | fromRadians = 0, |
||
| float | toRadians = Nimble::Math::TWO_PI |
||
| ) |
Draw a possibly filled circle.
| center | Center of the circle |
| radius | Radius of the circle |
| style | Stroke and fill definitions of the circle (colors and stroke width) |
| lineSegments | Number of steps (precision) |
| fromRadians | Start angle in radians |
| toRadians | End angle in radians |
| void Luminous::RenderContext::drawDonut | ( | const Nimble::Vector2f & | center, |
| Nimble::Vector2 | axis, | ||
| float | otherAxisLength, | ||
| float | width, | ||
| const Luminous::Style & | style, | ||
| unsigned int | linesegments = 0, |
||
| float | fromRadians = 0, |
||
| float | toRadians = Nimble::Math::TWO_PI, |
||
| TextureMappingMode | textureMappingMode = TEXTURE_MAPPING_FLAT |
||
| ) |
Draws a constant width donut defined as an ellipse and a hole in the center.
| center | Center of the donut |
| axis | Axis of the ellipse (orientation and size) |
| otherAxisLength | Other axis legth of the ellipse. |
| width | The width of the donut. |
| style | Stroke, fill and texturing definitions. |
| linesegments | Number of steps (precision) |
| fromRadians | Start angle in radians |
| toRadians | End angle in radians |
| textureCoordMode | How are the texture coordinates generated |
| void Luminous::RenderContext::drawEllipse | ( | Nimble::Vector2f | center, |
| Nimble::Vector2f | axis, | ||
| float | otherAxisLength, | ||
| const Luminous::Style & | style, | ||
| unsigned int | lineSegments = 0, |
||
| float | fromRadians = 0, |
||
| float | toRadians = Nimble::Math::TWO_PI |
||
| ) |
Draws an ellipse.
| center | Center of the ellipse |
| axis | Axis of the ellipse (orientation and size) |
| otherAxisLength | The length of the other axis |
| style | Stroke and fill definitions similar to circle |
| lineSegments | Number of steps (precision) |
| fromRadians | Start angle in radians |
| toRadians | End angle in radians |
| void Luminous::RenderContext::drawLine | ( | const Nimble::Vector2f & | p1, |
| const Nimble::Vector2f & | p2, | ||
| const Luminous::Style & | style | ||
| ) |
Draws a line.
| p1 | Start point of the line |
| p2 | End point of the line |
| style | Stroke definition of a line. |
| void Luminous::RenderContext::drawPoints | ( | InputIterator | begin, |
| size_t | numPoints, | ||
| const Luminous::Style & | style | ||
| ) |
Draws a set of points.
| begin | Initial position of sequence |
| numPoints | Number of points |
| style | Color and size passed as stroke parameters |
| InputIterator | Iterator to vertices. Needs to have operator++ and operator* |
| void Luminous::RenderContext::drawPolyLine | ( | InputIterator | begin, |
| size_t | numVertices, | ||
| const Luminous::Style & | style | ||
| ) |
Draws a polyline.
| begin | Initial position of sequence |
| numVertices | Number of vertices (one more than lines in polyline) |
| style | Stroke definition of a line. |
| InputIterator | Iterator to vertices. Needs to have operator++ and operator* |
| RenderBuilder<Vertex, UniformBlock> Luminous::RenderContext::drawPrimitiveT | ( | Luminous::PrimitiveType | primType, |
| unsigned int | indexCount, | ||
| unsigned int | vertexCount, | ||
| const Luminous::Program & | shader, | ||
| const Radiant::Color & | color, | ||
| float | width, | ||
| const Luminous::Style & | style | ||
| ) |
Returns RenderBuilder for the given drawing query.
Call to this function allocates the queried resources from driver and associates those with the given shader and other parameters. After calling this function user needs to feed data through the returned builder object.
| primType | Primitives to render |
| indexCount | How many indices are to be specified. If zero, indices are effectively set to 0,1,...,vertexCount-1 |
| vertexCount | How many vertices are to be specified. |
| shader | GLSL-program to use. |
| color | Color for the corresponding uniform. |
| width | Width for the rendered primitive. Only for points and lines. |
| style | Style for the rendering. |
| Vertex | Type of the vertex feed to the shader shader. |
| UniformBlock | Type of the uniformblock. Needs at least to include public fields projMatrix (Nimble::Matrix4), modelMatrix (Nimble::Matrix4), color (Nimble::Vector4) and depth (float) (see Luminous::BasicUniformBlock). |
| void Luminous::RenderContext::drawQuad | ( | const Nimble::Vector2 * | v, |
| const Nimble::Vector2 * | uvs, | ||
| const Style & | style | ||
| ) |
Draws a quad with two triangles.
The vertices of the first triangle are v[0], v[1], v[2]. The second triangle is defined by vertices v[1], v[3] and v[2]. Both of the triangles are assumed to have a counterclockwise orientation.
| void Luminous::RenderContext::drawRect | ( | const Nimble::Vector2f & | min, |
| const Nimble::Vector2f & | max, | ||
| const Style & | style | ||
| ) |
Draws a rectangle.
| min | Bottom left corner of a rectangle |
| max | Top right corner of a rectangle |
| style | Stroke, fill and texturing options |
| void Luminous::RenderContext::drawRect | ( | const Nimble::Vector2f & | min, |
| const Nimble::SizeF & | size, | ||
| const Style & | style | ||
| ) |
Draws a rectangle.
| min | Bottom left corner of a rectangle |
| size | Rectangle size |
| style | Stroke, fill and texturing options |
| void Luminous::RenderContext::drawRect | ( | const Nimble::RectT< T > & | rect, |
| const Style & | style | ||
| ) |
Draws a rectangle.
| rext | Rectangle to draw |
| style | Stroke, fill and texturing options |
| void Luminous::RenderContext::drawRect | ( | const Nimble::RectT< T > & | rect, |
| const Nimble::Rectf & | uvs, | ||
| const Style & | style | ||
| ) |
| void Luminous::RenderContext::drawRectWithHole | ( | const Nimble::Rectf & | area, |
| const Nimble::Rect & | hole, | ||
| const Luminous::Style & | style | ||
| ) |
Draws a rectangle with rectangular hole.
| area | Outer rectangle |
| hole | Inner rectangle defining the hole |
| style | Stroke, fill and texturing options |
| void Luminous::RenderContext::drawText | ( | const TextLayout & | layout, |
| const Nimble::Vector2f & | location, | ||
| const Nimble::Rectf & | viewRect, | ||
| const TextStyle & | style, | ||
| bool | ignoreVerticalAlign = false |
||
| ) |
Draws text.
| layout | Text object to render |
| location | Text location in viewRect. Anything outside will be clipped. |
| viewRect | Where the text is located |
| style | Text style properties |
| ignoreVerticalAlign | If true the rendering assumes that vertical alignment is already handled and baked in rendering location. Layout's options about vertical alignment are ignored in that case. |
| void Luminous::RenderContext::drawText | ( | const QString & | text, |
| const Nimble::Rectf & | rect, | ||
| const TextStyle & | style, | ||
| TextFlags | flags = TextStatic |
||
| ) |
Draws given string.
| text | String to render |
| rect | Where to render, acts also as a clipping rectangle |
| style | Text style properties |
| flags | Will text layout be dynamic or static |
| void Luminous::RenderContext::enableClipPlanes | ( | const QList< int > & | planes | ) |
Enable clipplanes for use in shaders.
| planes | a list of planes that will be enabled |
| void Luminous::RenderContext::endArea | ( | ) |
Called once for every area after rendering it.
Can be called multiple times per frame depending on configuration.
| void Luminous::RenderContext::flush | ( | ) |
Forces all queued rendering commands to execute.
Is called internally at the end of frame so under normal conditions there is no need call it manually.
Returns the GL resources handle corresponding to given program.
| program | CPU side object representing the shader program |
Returns the GL resources handle corresponding to given texture.
| texture | CPU side object representing the texture |
| FrameBufferGL& Luminous::RenderContext::handle | ( | const FrameBuffer & | target | ) |
Returns the GL resources handle corresponding to given frame buffer.
| target | CPU side object representing the frame buffer |
| RenderBufferGL& Luminous::RenderContext::handle | ( | const RenderBuffer & | buffer | ) |
Returns the GL resources handle corresponding to given render buffer.
| buffer | CPU side object representing the render buffer |
Returns the GL resources handle corresponding to given buffer (vertex/index).
| buffer | CPU side object representing the buffer |
| VertexArrayGL& Luminous::RenderContext::handle | ( | const VertexArray & | vertexarray, |
| ProgramGL * | program | ||
| ) |
Returns the GL resources handle corresponding to given vertex array.
| vertexarray | CPU side object representing the vertex array |
| program | Handle to OpenGL program associated with vertexarray |
| bool Luminous::RenderContext::initialize | ( | ) |
Initializes the context.
Is called automatically by rendering thread.
| bool Luminous::RenderContext::isClipStackEmpty | ( | ) | const |
Check if the current clip stack is empty.
| bool Luminous::RenderContext::isVisible | ( | const Nimble::Rectangle & | area | ) |
Checks if the given rectangle is visible (not clipped).
| area | Area to check |
| float Luminous::RenderContext::opacity | ( | ) | const |
Get the current opacity.
| void Luminous::RenderContext::pushFrameBuffer | ( | const FrameBuffer & | target | ) |
Pushes new frame buffer to the stack.
| target | frame buffer for rendering commands. |
| void Luminous::RenderContext::pushOpacity | ( | float | opacity | ) |
Push the given opacity to render context.
The resulting opacity will be the current opacity multiplied by the given value.
| opacity | opacity to push |
| void Luminous::RenderContext::pushViewport | ( | const Nimble::Recti & | viewport | ) |
Push a viewport to the viewport stack Pushes a viewport to the top of the viewport stack.
| viewport | viewport to push |
| void Luminous::RenderContext::pushViewTransform | ( | const Nimble::Matrix4 & | m | ) |
Push new view transform to the view transform stack.
| m | Matrix representing view transform |
| size_t Luminous::RenderContext::recursionLimit | ( | ) | const |
Returns the recursion limit.
| RenderBuilder<Vertex, UniformBlock> Luminous::RenderContext::render | ( | bool | translucent, |
| Luminous::PrimitiveType | type, | ||
| int | offset, | ||
| int | vertexCount, | ||
| float | primitiveSize, | ||
| const Luminous::VertexArray & | vertexArray, | ||
| const Luminous::Program & | program, | ||
| const std::map< QByteArray, const Texture * > * | textures = nullptr, |
||
| const std::map< QByteArray, ShaderUniform > * | uniforms = nullptr |
||
| ) |
Adds rendering command to the rendering queue.
The difference between this and render is that this version enables manual management of vertex data with the vertex array. In addition the used uniform block has free form. User needs to do his/hers own geometry transformations when using this function.
| translucent | Does this rendering command involve transparency |
| type | Primitives to render |
| offset | Geometry and index offset in given vertex array |
| vertexCount | Number of vertices to draw |
| primitiveSize | Size of the point/line |
| vertexArray | Storage of the vertex data |
| program | Shader program to use in rendering |
| textures | Mapping from names to textures. Each texture is fed with the given name to shader |
| uniforms | Mapping from names to uniforms. Each uniform is fed with the given name to shader |
| Vertex | C++ class describing the vertex used in shader program. Doesn't require anything from this class |
| UniformBlock | C++ class corresponding the uniform block used by shader program. Doesn't require anything from this class |
| RenderBuilder<Vertex, UniformBlock> Luminous::RenderContext::render | ( | bool | translucent, |
| Luminous::PrimitiveType | type, | ||
| int | indexCount, | ||
| int | vertexCount, | ||
| float | primitiveSize, | ||
| const Luminous::Program & | program, | ||
| const std::map< QByteArray, const Texture * > * | textures = nullptr, |
||
| const std::map< QByteArray, ShaderUniform > * | uniforms = nullptr |
||
| ) |
Similar to drawPrimitiveT but has less restrictions on the uniform block.
It is enough for the uniform block to have fields projMatrix and vievMatrix (both Nimble::Matrix4).
| translucent | Does this rendering command involve transparency |
| type | Primitives to render |
| offset | Geometry and index offset in given vertex array |
| vertexCount | Number of vertices to draw |
| primitiveSize | Size of the point/line |
| vertexArray | Storage of the vertex data |
| program | Shader program to use in rendering |
| textures | Mapping from names to textures. Each texture is fed with the given name to shader |
| uniforms | Mapping from names to uniforms. Each uniform is fed with the given name to shader |
| Vertex | C++ class describing the vertex used in shader program. |
| UniformBlock | C++ class corresponding the uniform block used by shader program. See the applying restrictions above. |
| void Luminous::RenderContext::setBlendMode | ( | const BlendMode & | mode | ) |
Set the active blendmode.
| mode | Description of new blend mode. |
| void Luminous::RenderContext::setCullMode | ( | const CullMode & | mode | ) |
Set the active cull mode.
| mode | Cull mode to use |
| void Luminous::RenderContext::setDefaultState | ( | ) |
Reset the OpenGL state to default.
The usage of this function by manually is not recommended
| void Luminous::RenderContext::setDepthMode | ( | const DepthMode & | mode | ) |
Set the active depthmode.
| mode | Description of the new depth mode |
| void Luminous::RenderContext::setDrawBuffers | ( | const std::vector< int > & | buffers | ) |
Set the active draw buffers.
| buffers | List of buffers to use The buffers may be one or more of the following: GL_NONE, GL_FRONT_LEFT, GL_FRONT_RIGHT, GL_BACK_LEFT, GL_BACK_RIGHT, GL_COLOR_ATTACHMENTn where n is a numerical value starting at 0 |
| void Luminous::RenderContext::setFrontFace | ( | enum FaceWinding | winding | ) |
Specify front-facing polygons.
| winding | Winding of the front-facing polygons |
| void Luminous::RenderContext::setRecursionLimit | ( | size_t | limit | ) |
Sets the rendering recursion limit for the context.
This is relevant for ViewWidgets which can cause recursive rendering of the scene.
| limit | recursion depth limit |
| void Luminous::RenderContext::setRenderBuffers | ( | bool | colorBuffer, |
| bool | depthBuffer, | ||
| bool | stencilBuffer | ||
| ) |
Set the active render buffers.
| colorBuffer | enables drawing to colorbuffer if set to true |
| depthBuffer | enables drawing to depthbuffer if set to true |
| stencilBuffer | enables drawing to stencilbuffer if set to true |
| void Luminous::RenderContext::setStencilMode | ( | const StencilMode & | mode | ) |
Set the active stencil mode.
| mode | Stencil mode to use |
| void Luminous::RenderContext::setWindowArea | ( | const Luminous::MultiHead::Window * | window, |
| const Luminous::MultiHead::Area * | area | ||
| ) |
Sets the associated area for this context at the moment.
| area | area to associate |
| const Program& Luminous::RenderContext::texShader | ( | ) | const |
Returns the shader used for texturing in Luminous.
This shader program does the same as the one returned by basicShader but also textures the geometry. Needs BasicVertexUV for vertex type and BasicUniformBlock for uniform block type to be able to work. The texture used is the one set as fill texture to Luminous::Style (or the one with name "tex"). Final color for the fragment is texture sample modulated with uniform color.
| const Program& Luminous::RenderContext::trilinearTexShader | ( | ) | const |
Returns the shader used for trilinear texturing in Luminous.
Similar to texShader, but needs two textures "tex[0]" and "tex[1]" and works only with TrilinearFilteringUniformBlock. This is mostly used internally by ImageWidget and Widget background image renderer
| unsigned long Luminous::RenderContext::unfinishedRenderCounter | ( | ) | const |
The unfinished render counter is used to track how many objects didn't finish their rendering because of some resource wasn't ready.
For example ImageWidget increases this counter if the best mipmap level wasn't yet generated and VideoWidget does the same if required video frame wasn't decoded yet. Unfixable permanent errors do not increase this counter. This is useful for example when rendering a scene to FBO and checking if everything was rendered there properly already this frame, or should the rendering be tried again on next frame.
| const Nimble::Matrix4& Luminous::RenderContext::viewTransform | ( | ) | const |
Returns transformation from the world coordinates (pixels) to projected eye coordinates (normalized device coordinates).
| Matrix | representing current view transform |
| const Luminous::MultiHead::Window* Luminous::RenderContext::window | ( | ) | const |
Returns the window associated to the current area.