Renderer is the core component for assigning lights, meshes, cameras, skin animations etc. More...
#include <kanzi/graphics_3d/renderer3d.hpp>
Public Types | |
typedef kzsError(* | ApplyObjectFunction )(KzuTransformedObjectNode *transformedObjectNode, Renderer3D *renderer) |
Function pointer for applying specific type of object for rendering. More... | |
typedef kzsError(* | OverrideMaterialCallback )(const KzuTransformedObjectNode *transformedObjectNode, Material *material, unsigned int cluster, void *userData, Material **out_material) |
Callback function for override materials. More... | |
typedef void(* | FramebufferCallback )(unsigned int framebufferHandle) |
Callback prototype for setActiveFramebuffer. More... | |
Public Member Functions | |
Renderer3D (const KzcMemoryManager *memoryManager, unsigned int quickMemorySize, Domain *domain) | |
~Renderer3D () | |
Domain * | getDomain () const |
ShapeRenderer * | getShapeRenderer () const |
void | setLogging (bool logging) |
Enables or disables debug log writing. More... | |
void | reset () |
Resets renderer, that is, puts it to initial state. More... | |
void | resetFrame () |
Resets user renderer for frame, that is, clear property stack and core renderer per-frame variables. More... | |
void | endFrame () |
Ends a frame. More... | |
unsigned int | getFrameCount () const |
Gets number of frames rendered by renderer. More... | |
void | resetPass () |
Resets pass for renderer, that is, per-render pass specific properties, such as lighting. More... | |
void | printInfo () const |
Ends frame for renderer. More... | |
void | applyLight (Light *lightNode, const KzcMatrix4x4 *worldTransformation) |
Adds light property to rendering pipeline. More... | |
void | applyRenderable (KzuTransformedObjectNode *transformedObjectNode) |
Applies renderable object for rendering. More... | |
void | setTransformedObjectList (KzcDynamicArray *transformedObjectList) |
Sets transformed object list for renderer, used for fetching bones for mesh. More... | |
KzcDynamicArray * | getTransformedObjectList () const |
Gets transformed object list from renderer. More... | |
void | drawBuffers (Mesh *mesh, Node *baseNode, unsigned int cluster, const Material *material) |
Applies transformation and draws vertex and index buffers with current settings. More... | |
void | drawBuffers (Morph *morph, Node *baseNode, unsigned int cluster, const Material *material) |
void | resolveBatchQueue () |
Resolves renderer batch queue, if there's such (queue generated by batch sorting). More... | |
void | setSortByShader (bool sortByShader) |
Sets renderer sort by shader enabled. More... | |
bool | isSortByShader () const |
Returns if sort by shader is enabled. More... | |
ResourceManager * | getResourceManager () const |
Gets renderer resource manager. More... | |
KzuPropertyQuery * | getPropertyQuery () const |
Gets renderer property query. More... | |
bool | applyMaterial (const Material *material) |
Applies material to renderer, attaches the shader and uniforms. More... | |
bool | applyMaterialStrict (const Material *material) |
Applies material to renderer, attaches the shader and uniforms. More... | |
void | applyCameraMatrix (KzcMatrix4x4 cameraProjectionMatrix, KzcMatrix4x4 cameraTransformationMatrix, float near, float far) const |
Applies camera matrices to renderer so that they can be applied as uniforms to shaders. More... | |
MaterialSharedPtr | getDebugLightMaterial () |
Returns debug light material. More... | |
MaterialSharedPtr | getDefaultMaterial () |
Returns default material from renderer. More... | |
MaterialSharedPtr | getErrorMaterial () |
Returns error material from renderer. More... | |
MaterialSharedPtr | getSolidColorMaterial () |
Returns solid color material. More... | |
MaterialSharedPtr | getTexturedMaterial () |
Gets textured material from renderer. More... | |
void | setClearColorOverride (const KzcColorRGBA *colorRGBA) |
Sets clear color override for rendering. More... | |
bool | getClearColorOverride (KzcColorRGBA *out_colorRGBA) const |
Gets clear color override from renderer. More... | |
void | setCullFaceOverride (bool enabled, GraphicsCullMode overriddenCullMode) |
Sets cull mode override. More... | |
bool | getCullFaceOverride (GraphicsCullMode *out_overriddenCullMode) const |
Returns cull face override. More... | |
void | setClearColorBufferOverride (bool enabled) |
Sets clear color buffer override for renderer. More... | |
bool | getClearColorBufferOverride () const |
Returns if clear color buffer override is set. More... | |
void | setDisableColorWrite (bool setDisabled) |
Sets color write disabled, overrides render pass settings. More... | |
bool | isColorWriteDisabled () const |
Returns if color write is disabled. More... | |
void | createMeshVertexCombiningArray () |
Create vertex combining array from quick memory manager. More... | |
void | setMeshVertexCombiningEnabled (bool enabled) |
Sets vertex array combine enabled. More... | |
bool | isMeshVertexCombiningEnabled () const |
Returns if vertex array combine is enabled. More... | |
void | addMeshVertexCombiningArrayVertices (const float *vertices, unsigned int vertexCount) |
Adds vertices for vertex combining. More... | |
float * | getMeshVertexCombiningArray (unsigned int *out_vertexCount) const |
Gets vertices from vertex combining. More... | |
void | setRenderPassInputObjectSourceOverride (FilterObjectSourceSharedPtr overrideObjectSource) |
Sets render pass input object source override. More... | |
FilterObjectSourceSharedPtr | getRenderPassInputObjectSourceOverride () const |
Gets render pass input object source override. More... | |
void | setForcedMaterial (Material *material) |
Sets forced material for rendering, none of the properties are inherited from the object node. More... | |
void | setOverrideMaterial (Material *material) |
Sets current override material, which is used instead of all default materials. More... | |
Material * | getOverrideClusterMaterial (const KzuTransformedObjectNode *transformedObjectNode, Material *clusterMaterial, unsigned int clusterIndex, bool &out_overridden) const |
If object node's material is overridden, sets out_overridden to KZ_TRUE and the overriding material to out_material. More... | |
Material * | getValidMaterial (Material *material) |
Returns the given material if it is valid, otherwise either renderer's default material or error material. More... | |
void | setActiveRenderTarget (const RenderTarget *renderTarget) |
Sets active render target for renderer. More... | |
const RenderTarget * | getActiveRenderTarget () const |
Gets active render target from renderer. More... | |
void | setViewport (float x, float y, float width, float height, bool relative) |
Sets viewport for renderer. More... | |
void | getViewport (float *out_x, float *out_y, float *out_width, float *out_height, bool *out_relative) const |
Gets viewport from renderer. More... | |
void | getAdjustedViewport (const KzcVector2 *limits, float *out_x, float *out_y, float *out_width, float *out_height) const |
Gets adjusted viewport from renderer. More... | |
void | getAdjustedViewportFromRenderTarget (const RenderTarget &renderTarget, float *out_x, float *out_y, float *out_width, float *out_height) const |
As Renderer3DGetAdjustedViewport, but get viewport limits from render target. More... | |
void | setSubRectangleProjection (float x, float y, float width, float height) |
Turn on sub-rectangle of what would be the normal projection with given relative parameters. More... | |
void | disableSubRectangleProjection () |
Disable sub-rectangle of projection. More... | |
float | getInheritedAspectRatioMultiplier () const |
Get the multiplier to inherited aspect ratio. More... | |
Renderer * | getCoreRenderer () const |
Returns core renderer from user renderer. More... | |
void | setBoundingBoxVisualizationEnabled (bool enabled) |
Sets bounding box visualization enabled / disabled. More... | |
bool | isBoundingBoxVisualizationEnabled () const |
Returns if bounding box visualization is enabled. More... | |
void | setSkeletonVisualizationEnabled (bool enabled) |
Sets skeleton visualization enabled / disabled. More... | |
bool | isSkeletonVisualizationEnabled () const |
Returns if skeleton visualization is enabled. More... | |
float * | getFloatBuffer () const |
Returns float buffer from renderer. More... | |
void | setOverrideMaterialCallback (OverrideMaterialCallback callbackFunction, void *userData) |
Set override material callback. More... | |
OverrideMaterialCallback | getOverrideMaterialCallback () const |
Gets override material callback from renderer, 0 if not enabled. More... | |
void * | getOverrideMaterialCallbackUserData () const |
Gets override material callback user data from renderer. More... | |
void | setFramebufferCallback (FramebufferCallback callbackFunction) |
Sets callback function for setActiveFrameBuffer. More... | |
void | addBatchToQueue (KzuTransformedObjectNode *objectNode, Mesh *mesh, unsigned int clusterIndex, const Material *material, const KzcMatrix4x4 *transformation) |
Adds batch to batch queue. More... | |
RenderContextStack & | getRenderContextStack () |
Returns the render context stack. More... | |
void | drawUntexturedLayerQuad (Vector2 renderOffset, Vector2 renderSize, const Material *material, const Matrix4x4 &worldTransformation) |
void | drawLayerQuad (Vector2 renderOffset, Vector2 renderSize, Vector2 contentOffset, Vector2 contentSize, float depth, const Matrix3x3 &renderTransform) |
void | drawLayerQuadWithMaterial (const Material *material, Vector2 renderOffset, Vector2 renderSize, Vector2 contentOffset, Vector2 contentSize, float depth, const Matrix3x3 &renderTransform) |
void | frawLayerOutlineQuad (float width, float height, const Material *material, float textureHeight, float textureOffset, const KzcColorRGBA *color, const Matrix4x4 &worldTransformation) |
void | frawViewportQuadWithTextureSpan (Vector2 offset, Vector2 limits, Material *material, TextureSharedPtr texture, Vector2 textureSpan) |
void | setSolidColor (const KzcColorRGBA *color) |
Sets solid color for rendering. More... | |
bool | applySolidColorMaterial (const KzcColorRGBA *color) |
Applies a material with the given solid color for rendering. More... | |
bool | applyDebugLightMaterial (const KzcColorRGBA *color) |
Applies a material with the given debug color for rendering. More... | |
void | drawLayoutBox (const KzcVector3 *backBottomLeft, const KzcVector3 *frontTopRight, const KzcMatrix4x4 *transform, const KzcColorRGBA *color) |
Draws a box with the default parameters for layout visualization. More... | |
void | drawBoundingVolume (const KzuBoundingVolume *boundingVolume, const KzcMatrix4x4 *worldTransformation, GraphicsFillMode fillMode) |
Draws a bounding volume. More... | |
void | drawBoundingVolumeColor (const KzuBoundingVolume *boundingVolume, const KzcMatrix4x4 *worldTransformation, GraphicsFillMode fillMode, const KzcColorRGBA *color) |
Draws a bounding volume. More... | |
void | drawBoundingVolumeRaw (const KzuBoundingVolume *boundingVolume, const KzcMatrix4x4 *worldTransformation, GraphicsFillMode fillMode) |
Draws a bounding volume. More... | |
void | drawTransformedBoundingVolumeColor (const KzuTransformedBoundingVolume *volume, GraphicsFillMode fillMode, const KzcColorRGBA *color) |
Draws a transformed bounding volume. More... | |
void | drawTransformedBoundingVolumeRaw (const KzuTransformedBoundingVolume *volume, GraphicsFillMode fillMode) |
Draws a transformed bounding volume. More... | |
void | drawSelectionIndicator (const KzuBoundingVolume *boundingVolume, const KzcMatrix4x4 *worldTransformation, const KzcColorRGBA *color) |
Draws a selection indicator, resembles a bounding volume. More... | |
void | drawBoxColor (const KzcVector3 *backBottomLeft, const KzcVector3 *frontTopRight, const KzcMatrix4x4 *transform, GraphicsFillMode fillMode, const KzcColorRGBA *color) |
Draws a box given by two opposing corner points. More... | |
void | drawPrimitives (const float *vertexList, unsigned int vertexCount, GraphicsPrimitiveType type, const KzcMatrix4x4 *worldTransformation) const |
Draws primitives of the given type. More... | |
void | drawPrimitivesNormal (const float *vertexList, const float *normalList, unsigned int vertexCount, GraphicsPrimitiveType type, const KzcMatrix4x4 *worldTransformation) |
Draws primitives of the given type. More... | |
void | drawLineList (const float *lineList, unsigned int lineCount, const KzcMatrix4x4 *worldTransformation) const |
Draws a line list with current settings. More... | |
void | drawPrimitiveBufferUntextured (const float *coordinateBuffer, const KzcMatrix4x4 &worldTransform, GraphicsPrimitiveType type, unsigned int count) const |
Draw primitive buffer. More... | |
void | drawPrimitiveBufferTextured (const float *coordinateBuffer, const float *texCoordBuffer, const KzcMatrix4x4 &worldTransform, GraphicsPrimitiveType type, unsigned int count) const |
Draw primitive buffer. More... | |
void | drawQuad (const KzcVector3 *p1, const KzcVector3 *p2, const KzcVector3 *p3, const KzcVector3 *p4, const KzcVector2 *textureSpan, const Material *material, const KzcColorRGBA *color, const KzcMatrix4x4 *worldTransformation) |
void | drawLayerQuad (const KzcVector2 *renderOffset, const KzcVector2 *renderSize, const KzcVector2 *contentOffset, const KzcVector2 *contentSize, float depth, const KzcMatrix3x3 *renderTransform) |
Render a layer quad. More... | |
void | drawLayerQuadWithMaterial (const Material *material, const KzcVector2 *renderOffset, const KzcVector2 *renderSize, const KzcVector2 *contentOffset, const KzcVector2 *contentSize, float depth, const KzcMatrix3x3 *renderTransform) |
Render a layer quad. More... | |
void | drawUntexturedLayerQuad (const KzcVector2 *renderOffset, const KzcVector2 *renderSize, const Material *material, const KzcMatrix4x4 *worldTransformation) |
As rendering a layer quad, but omit everything concerning texture coordinates. More... | |
void | drawLayerOutlineQuad (float width, float height, const Material *material, float textureHeight, float textureOffset, const KzcColorRGBA *color, const Matrix4x4 &worldTransformation) |
void | drawViewportQuad (const KzcVector2 *offset, const KzcVector2 *limits, Material *material, TextureSharedPtr texture) |
Draws viewport quad, fills with given pattern. More... | |
void | drawViewportQuadWithTextureSpan (Vector2 offset, Vector2 limits, Material *material, TextureSharedPtr texture, Vector2 textureSpan) |
void | drawViewportQuadWithTextureSpan (const KzcVector2 *offset, const KzcVector2 *limits, Material *material, TextureSharedPtr texture, const KzcVector2 *textureSpan) |
Draws viewport quad, fills with given pattern. More... | |
void | applyStencilSettings (bool stencilTestEnabled, unsigned int stencilRef, unsigned int stencilMask, GraphicsCompareFunction stencilFunction, GraphicsStencilOperation stencilOperationStencilFail, GraphicsStencilOperation stencilOperationStencilPassDepthFail, GraphicsStencilOperation stencilOperationStencilPassDepthPass) const |
Applies stencil settings with overrides for rendering. More... | |
void | setDefaultOrthoProjection () const |
Sets default orthogonal projection and viewport for renderer. More... | |
void | drawWireframeGrid (float spacing) |
Draws a wire frame grid with default colors. More... | |
void | drawBoneIdentifier (const KzcVector3 *position, const KzcMatrix4x4 *orientation) |
Draws a bone identifier. More... | |
void | drawLight (const Light *lightNode, const KzcMatrix4x4 *worldTransformation) |
Draws a wire frame light symbol. More... | |
void | drawEmptyObject (const KzcMatrix4x4 *worldTransformation) |
Draws an empty object symbol with wire frame lines. More... | |
void | drawCamera (const Camera *cameraNode, const KzcMatrix4x4 *worldTransformation) |
Draws a wire frame camera symbol. More... | |
void | drawSkeleton (const Mesh *mesh) |
Draws skeleton with wire frame lines. More... | |
void | drawTrajectory (Trajectory *trajectory, const KzcMatrix4x4 *worldTransformation, const Matrix4x4 &arrangeTransform, const Vector3 &scaling) |
Draws a trajectory with wire frame lines. More... | |
Renderer is the core component for assigning lights, meshes, cameras, skin animations etc.
to lower level rendering.
typedef kzsError(* kanzi::Renderer3D::ApplyObjectFunction)(KzuTransformedObjectNode *transformedObjectNode, Renderer3D *renderer) |
Function pointer for applying specific type of object for rendering.
typedef kzsError(* kanzi::Renderer3D::OverrideMaterialCallback)(const KzuTransformedObjectNode *transformedObjectNode, Material *material, unsigned int cluster, void *userData, Material **out_material) |
Callback function for override materials.
typedef void(* kanzi::Renderer3D::FramebufferCallback)(unsigned int framebufferHandle) |
Callback prototype for setActiveFramebuffer.
|
explicit |
kanzi::Renderer3D::~Renderer3D | ( | ) |
Domain* kanzi::Renderer3D::getDomain | ( | ) | const |
ShapeRenderer* kanzi::Renderer3D::getShapeRenderer | ( | ) | const |
void kanzi::Renderer3D::setLogging | ( | bool | logging | ) |
Enables or disables debug log writing.
void kanzi::Renderer3D::reset | ( | ) |
Resets renderer, that is, puts it to initial state.
void kanzi::Renderer3D::resetFrame | ( | ) |
Resets user renderer for frame, that is, clear property stack and core renderer per-frame variables.
void kanzi::Renderer3D::endFrame | ( | ) |
Ends a frame.
unsigned int kanzi::Renderer3D::getFrameCount | ( | ) | const |
Gets number of frames rendered by renderer.
void kanzi::Renderer3D::resetPass | ( | ) |
Resets pass for renderer, that is, per-render pass specific properties, such as lighting.
void kanzi::Renderer3D::printInfo | ( | ) | const |
Ends frame for renderer.
void kanzi::Renderer3D::applyLight | ( | Light * | lightNode, |
const KzcMatrix4x4 * | worldTransformation | ||
) |
Adds light property to rendering pipeline.
Lights should be reset each pass by calling Renderer3DResetPass.
void kanzi::Renderer3D::applyRenderable | ( | KzuTransformedObjectNode * | transformedObjectNode | ) |
Applies renderable object for rendering.
Called from render pass.
void kanzi::Renderer3D::setTransformedObjectList | ( | KzcDynamicArray * | transformedObjectList | ) |
Sets transformed object list for renderer, used for fetching bones for mesh.
KzcDynamicArray* kanzi::Renderer3D::getTransformedObjectList | ( | ) | const |
Gets transformed object list from renderer.
void kanzi::Renderer3D::drawBuffers | ( | Mesh * | mesh, |
Node * | baseNode, | ||
unsigned int | cluster, | ||
const Material * | material | ||
) |
Applies transformation and draws vertex and index buffers with current settings.
void kanzi::Renderer3D::drawBuffers | ( | Morph * | morph, |
Node * | baseNode, | ||
unsigned int | cluster, | ||
const Material * | material | ||
) |
void kanzi::Renderer3D::resolveBatchQueue | ( | ) |
Resolves renderer batch queue, if there's such (queue generated by batch sorting).
void kanzi::Renderer3D::setSortByShader | ( | bool | sortByShader | ) |
Sets renderer sort by shader enabled.
bool kanzi::Renderer3D::isSortByShader | ( | ) | const |
Returns if sort by shader is enabled.
ResourceManager* kanzi::Renderer3D::getResourceManager | ( | ) | const |
Gets renderer resource manager.
KzuPropertyQuery* kanzi::Renderer3D::getPropertyQuery | ( | ) | const |
Gets renderer property query.
bool kanzi::Renderer3D::applyMaterial | ( | const Material * | material | ) |
Applies material to renderer, attaches the shader and uniforms.
bool kanzi::Renderer3D::applyMaterialStrict | ( | const Material * | material | ) |
Applies material to renderer, attaches the shader and uniforms.
Does not allow material which shader has samplers without corresponding texture properties
void kanzi::Renderer3D::applyCameraMatrix | ( | KzcMatrix4x4 | cameraProjectionMatrix, |
KzcMatrix4x4 | cameraTransformationMatrix, | ||
float | near, | ||
float | far | ||
) | const |
Applies camera matrices to renderer so that they can be applied as uniforms to shaders.
MaterialSharedPtr kanzi::Renderer3D::getDebugLightMaterial | ( | ) |
Returns debug light material.
Uses color property "Emissive" to specify rendering color.
MaterialSharedPtr kanzi::Renderer3D::getDefaultMaterial | ( | ) |
Returns default material from renderer.
MaterialSharedPtr kanzi::Renderer3D::getErrorMaterial | ( | ) |
Returns error material from renderer.
MaterialSharedPtr kanzi::Renderer3D::getSolidColorMaterial | ( | ) |
Returns solid color material.
Uses color property "Emissive" to specify solid color.
MaterialSharedPtr kanzi::Renderer3D::getTexturedMaterial | ( | ) |
Gets textured material from renderer.
void kanzi::Renderer3D::setClearColorOverride | ( | const KzcColorRGBA * | colorRGBA | ) |
Sets clear color override for rendering.
0 to colorRGBA to disable.
bool kanzi::Renderer3D::getClearColorOverride | ( | KzcColorRGBA * | out_colorRGBA | ) | const |
Gets clear color override from renderer.
Returns KZ_TRUE if override enabled.
void kanzi::Renderer3D::setCullFaceOverride | ( | bool | enabled, |
GraphicsCullMode | overriddenCullMode | ||
) |
Sets cull mode override.
bool kanzi::Renderer3D::getCullFaceOverride | ( | GraphicsCullMode * | out_overriddenCullMode | ) | const |
Returns cull face override.
void kanzi::Renderer3D::setClearColorBufferOverride | ( | bool | enabled | ) |
Sets clear color buffer override for renderer.
bool kanzi::Renderer3D::getClearColorBufferOverride | ( | ) | const |
Returns if clear color buffer override is set.
void kanzi::Renderer3D::setDisableColorWrite | ( | bool | setDisabled | ) |
Sets color write disabled, overrides render pass settings.
bool kanzi::Renderer3D::isColorWriteDisabled | ( | ) | const |
Returns if color write is disabled.
void kanzi::Renderer3D::createMeshVertexCombiningArray | ( | ) |
Create vertex combining array from quick memory manager.
After this vertices added with addMeshVertexCombiningArrayVertices will be combined into one big single mesh.
void kanzi::Renderer3D::setMeshVertexCombiningEnabled | ( | bool | enabled | ) |
Sets vertex array combine enabled.
bool kanzi::Renderer3D::isMeshVertexCombiningEnabled | ( | ) | const |
Returns if vertex array combine is enabled.
void kanzi::Renderer3D::addMeshVertexCombiningArrayVertices | ( | const float * | vertices, |
unsigned int | vertexCount | ||
) |
Adds vertices for vertex combining.
float* kanzi::Renderer3D::getMeshVertexCombiningArray | ( | unsigned int * | out_vertexCount | ) | const |
Gets vertices from vertex combining.
void kanzi::Renderer3D::setRenderPassInputObjectSourceOverride | ( | FilterObjectSourceSharedPtr | overrideObjectSource | ) |
Sets render pass input object source override.
0 to not override.
FilterObjectSourceSharedPtr kanzi::Renderer3D::getRenderPassInputObjectSourceOverride | ( | ) | const |
Gets render pass input object source override.
void kanzi::Renderer3D::setForcedMaterial | ( | Material * | material | ) |
Sets forced material for rendering, none of the properties are inherited from the object node.
void kanzi::Renderer3D::setOverrideMaterial | ( | Material * | material | ) |
Sets current override material, which is used instead of all default materials.
Setting material to 0 disables overrides.
Material* kanzi::Renderer3D::getOverrideClusterMaterial | ( | const KzuTransformedObjectNode * | transformedObjectNode, |
Material * | clusterMaterial, | ||
unsigned int | clusterIndex, | ||
bool & | out_overridden | ||
) | const |
If object node's material is overridden, sets out_overridden to KZ_TRUE and the overriding material to out_material.
Otherwise sets out_overridden to KZ_FALSE.
Returns the given material if it is valid, otherwise either renderer's default material or error material.
void kanzi::Renderer3D::setActiveRenderTarget | ( | const RenderTarget * | renderTarget | ) |
Sets active render target for renderer.
const RenderTarget* kanzi::Renderer3D::getActiveRenderTarget | ( | ) | const |
Gets active render target from renderer.
void kanzi::Renderer3D::setViewport | ( | float | x, |
float | y, | ||
float | width, | ||
float | height, | ||
bool | relative | ||
) |
Sets viewport for renderer.
void kanzi::Renderer3D::getViewport | ( | float * | out_x, |
float * | out_y, | ||
float * | out_width, | ||
float * | out_height, | ||
bool * | out_relative | ||
) | const |
Gets viewport from renderer.
out_x | Viewport X coordinate in relative / absolute coordinates. 0 if not needed. |
out_y | Viewport Y coordinate in relative / absolute coordinates. 0 if not needed. |
out_width | Viewport Width in relative / absolute coordinates. 0 if not needed. |
out_height | Viewport Height in relative / absolute coordinates. 0 if not needed. |
out_relative | Is this window relative (absolute if not). 0 if not needed. |
void kanzi::Renderer3D::getAdjustedViewport | ( | const KzcVector2 * | limits, |
float * | out_x, | ||
float * | out_y, | ||
float * | out_width, | ||
float * | out_height | ||
) | const |
Gets adjusted viewport from renderer.
Adjusted viewport calculates real viewport size according to window size,
limits | Size of the available rendering area, for example X and Y sizes taken from a window. |
out_x | Viewport X coordinate in absolute (pixel) coordinates. |
out_y | Viewport Y coordinate in absolute (pixel) coordinates. |
out_width | Viewport Width in absolute (pixel) coordinates. |
out_height | Viewport Height in absolute (pixel) coordinates. |
void kanzi::Renderer3D::getAdjustedViewportFromRenderTarget | ( | const RenderTarget & | renderTarget, |
float * | out_x, | ||
float * | out_y, | ||
float * | out_width, | ||
float * | out_height | ||
) | const |
As Renderer3DGetAdjustedViewport, but get viewport limits from render target.
void kanzi::Renderer3D::setSubRectangleProjection | ( | float | x, |
float | y, | ||
float | width, | ||
float | height | ||
) |
Turn on sub-rectangle of what would be the normal projection with given relative parameters.
void kanzi::Renderer3D::disableSubRectangleProjection | ( | ) |
Disable sub-rectangle of projection.
float kanzi::Renderer3D::getInheritedAspectRatioMultiplier | ( | ) | const |
Get the multiplier to inherited aspect ratio.
Renderer* kanzi::Renderer3D::getCoreRenderer | ( | ) | const |
Returns core renderer from user renderer.
void kanzi::Renderer3D::setBoundingBoxVisualizationEnabled | ( | bool | enabled | ) |
Sets bounding box visualization enabled / disabled.
bool kanzi::Renderer3D::isBoundingBoxVisualizationEnabled | ( | ) | const |
Returns if bounding box visualization is enabled.
void kanzi::Renderer3D::setSkeletonVisualizationEnabled | ( | bool | enabled | ) |
Sets skeleton visualization enabled / disabled.
bool kanzi::Renderer3D::isSkeletonVisualizationEnabled | ( | ) | const |
Returns if skeleton visualization is enabled.
float* kanzi::Renderer3D::getFloatBuffer | ( | ) | const |
Returns float buffer from renderer.
Float buffer contains maximum of KZU_RENDERER_FLOAT_BUFFER_LENGTH elements, and it's used for dynamic vertex arrays.
void kanzi::Renderer3D::setOverrideMaterialCallback | ( | OverrideMaterialCallback | callbackFunction, |
void * | userData | ||
) |
Set override material callback.
Pass 0 to disable.
OverrideMaterialCallback kanzi::Renderer3D::getOverrideMaterialCallback | ( | ) | const |
Gets override material callback from renderer, 0 if not enabled.
void* kanzi::Renderer3D::getOverrideMaterialCallbackUserData | ( | ) | const |
Gets override material callback user data from renderer.
void kanzi::Renderer3D::setFramebufferCallback | ( | FramebufferCallback | callbackFunction | ) |
Sets callback function for setActiveFrameBuffer.
Called each time engine changes framebuffer.
void kanzi::Renderer3D::addBatchToQueue | ( | KzuTransformedObjectNode * | objectNode, |
Mesh * | mesh, | ||
unsigned int | clusterIndex, | ||
const Material * | material, | ||
const KzcMatrix4x4 * | transformation | ||
) |
Adds batch to batch queue.
RenderContextStack& kanzi::Renderer3D::getRenderContextStack | ( | ) |
Returns the render context stack.
renderer | Renderer to access. |
void kanzi::Renderer3D::drawUntexturedLayerQuad | ( | Vector2 | renderOffset, |
Vector2 | renderSize, | ||
const Material * | material, | ||
const Matrix4x4 & | worldTransformation | ||
) |
void kanzi::Renderer3D::drawLayerQuad | ( | Vector2 | renderOffset, |
Vector2 | renderSize, | ||
Vector2 | contentOffset, | ||
Vector2 | contentSize, | ||
float | depth, | ||
const Matrix3x3 & | renderTransform | ||
) |
void kanzi::Renderer3D::drawLayerQuadWithMaterial | ( | const Material * | material, |
Vector2 | renderOffset, | ||
Vector2 | renderSize, | ||
Vector2 | contentOffset, | ||
Vector2 | contentSize, | ||
float | depth, | ||
const Matrix3x3 & | renderTransform | ||
) |
void kanzi::Renderer3D::frawLayerOutlineQuad | ( | float | width, |
float | height, | ||
const Material * | material, | ||
float | textureHeight, | ||
float | textureOffset, | ||
const KzcColorRGBA * | color, | ||
const Matrix4x4 & | worldTransformation | ||
) |
void kanzi::Renderer3D::frawViewportQuadWithTextureSpan | ( | Vector2 | offset, |
Vector2 | limits, | ||
Material * | material, | ||
TextureSharedPtr | texture, | ||
Vector2 | textureSpan | ||
) |
void kanzi::Renderer3D::setSolidColor | ( | const KzcColorRGBA * | color | ) |
Sets solid color for rendering.
Has to be called after material has been applied.
bool kanzi::Renderer3D::applySolidColorMaterial | ( | const KzcColorRGBA * | color | ) |
Applies a material with the given solid color for rendering.
bool kanzi::Renderer3D::applyDebugLightMaterial | ( | const KzcColorRGBA * | color | ) |
Applies a material with the given debug color for rendering.
void kanzi::Renderer3D::drawLayoutBox | ( | const KzcVector3 * | backBottomLeft, |
const KzcVector3 * | frontTopRight, | ||
const KzcMatrix4x4 * | transform, | ||
const KzcColorRGBA * | color | ||
) |
Draws a box with the default parameters for layout visualization.
void kanzi::Renderer3D::drawBoundingVolume | ( | const KzuBoundingVolume * | boundingVolume, |
const KzcMatrix4x4 * | worldTransformation, | ||
GraphicsFillMode | fillMode | ||
) |
Draws a bounding volume.
Uses the default color. The box is transformed with the given matrix before drawing.
void kanzi::Renderer3D::drawBoundingVolumeColor | ( | const KzuBoundingVolume * | boundingVolume, |
const KzcMatrix4x4 * | worldTransformation, | ||
GraphicsFillMode | fillMode, | ||
const KzcColorRGBA * | color | ||
) |
Draws a bounding volume.
Uses the given color. The box is transformed with the given matrix before drawing.
void kanzi::Renderer3D::drawBoundingVolumeRaw | ( | const KzuBoundingVolume * | boundingVolume, |
const KzcMatrix4x4 * | worldTransformation, | ||
GraphicsFillMode | fillMode | ||
) |
Draws a bounding volume.
Uses the current settings. The box is transformed with the given matrix before drawing.
void kanzi::Renderer3D::drawTransformedBoundingVolumeColor | ( | const KzuTransformedBoundingVolume * | volume, |
GraphicsFillMode | fillMode, | ||
const KzcColorRGBA * | color | ||
) |
Draws a transformed bounding volume.
Uses the given color.
void kanzi::Renderer3D::drawTransformedBoundingVolumeRaw | ( | const KzuTransformedBoundingVolume * | volume, |
GraphicsFillMode | fillMode | ||
) |
Draws a transformed bounding volume.
Uses the current settings.
void kanzi::Renderer3D::drawSelectionIndicator | ( | const KzuBoundingVolume * | boundingVolume, |
const KzcMatrix4x4 * | worldTransformation, | ||
const KzcColorRGBA * | color | ||
) |
Draws a selection indicator, resembles a bounding volume.
void kanzi::Renderer3D::drawBoxColor | ( | const KzcVector3 * | backBottomLeft, |
const KzcVector3 * | frontTopRight, | ||
const KzcMatrix4x4 * | transform, | ||
GraphicsFillMode | fillMode, | ||
const KzcColorRGBA * | color | ||
) |
Draws a box given by two opposing corner points.
Uses the given color. The box is transformed with the given matrix before drawing.
void kanzi::Renderer3D::drawPrimitives | ( | const float * | vertexList, |
unsigned int | vertexCount, | ||
GraphicsPrimitiveType | type, | ||
const KzcMatrix4x4 * | worldTransformation | ||
) | const |
Draws primitives of the given type.
Takes vertex position data as a parameter.
void kanzi::Renderer3D::drawPrimitivesNormal | ( | const float * | vertexList, |
const float * | normalList, | ||
unsigned int | vertexCount, | ||
GraphicsPrimitiveType | type, | ||
const KzcMatrix4x4 * | worldTransformation | ||
) |
Draws primitives of the given type.
Takes vertex position and normal data as parameters. When Renderer3DIsMeshVertexCombiningEnabled returns true, draws nothing but populates renderer combined vertex array.
void kanzi::Renderer3D::drawLineList | ( | const float * | lineList, |
unsigned int | lineCount, | ||
const KzcMatrix4x4 * | worldTransformation | ||
) | const |
Draws a line list with current settings.
Handles only position data.
void kanzi::Renderer3D::drawPrimitiveBufferUntextured | ( | const float * | coordinateBuffer, |
const KzcMatrix4x4 & | worldTransform, | ||
GraphicsPrimitiveType | type, | ||
unsigned int | count | ||
) | const |
Draw primitive buffer.
renderer | Renderer to use. |
coordinateBuffer | Coordinate buffer to bind. |
worldTransform | World transformation. |
type | Primitive type to render. |
count | Number of vertices to send. |
void kanzi::Renderer3D::drawPrimitiveBufferTextured | ( | const float * | coordinateBuffer, |
const float * | texCoordBuffer, | ||
const KzcMatrix4x4 & | worldTransform, | ||
GraphicsPrimitiveType | type, | ||
unsigned int | count | ||
) | const |
void kanzi::Renderer3D::drawQuad | ( | const KzcVector3 * | p1, |
const KzcVector3 * | p2, | ||
const KzcVector3 * | p3, | ||
const KzcVector3 * | p4, | ||
const KzcVector2 * | textureSpan, | ||
const Material * | material, | ||
const KzcColorRGBA * | color, | ||
const KzcMatrix4x4 * | worldTransformation | ||
) |
void kanzi::Renderer3D::drawLayerQuad | ( | const KzcVector2 * | renderOffset, |
const KzcVector2 * | renderSize, | ||
const KzcVector2 * | contentOffset, | ||
const KzcVector2 * | contentSize, | ||
float | depth, | ||
const KzcMatrix3x3 * | renderTransform | ||
) |
Render a layer quad.
Material used for rendering the quad must be applied prior to this call, one way or another.
renderer | Renderer to use. |
renderOffset | Quad start offset. |
renderSize | Quad start size. |
contentOffset | Texture coordinate start offset. |
contentSize | Texture corodinate size. |
depth | Render depth. |
renderTransform | Render transformation. |
void kanzi::Renderer3D::drawLayerQuadWithMaterial | ( | const Material * | material, |
const KzcVector2 * | renderOffset, | ||
const KzcVector2 * | renderSize, | ||
const KzcVector2 * | contentOffset, | ||
const KzcVector2 * | contentSize, | ||
float | depth, | ||
const KzcMatrix3x3 * | renderTransform | ||
) |
Render a layer quad.
renderer | Renderer to use. |
material | Material to be applied before rendering the quad. |
renderOffset | Quad start offset. |
renderSize | Quad start size. |
contentOffset | Texture coordinate start offset. |
contentSize | Texture corodinate size. |
depth | Render depth. |
renderTransform | Render transformation. |
void kanzi::Renderer3D::drawUntexturedLayerQuad | ( | const KzcVector2 * | renderOffset, |
const KzcVector2 * | renderSize, | ||
const Material * | material, | ||
const KzcMatrix4x4 * | worldTransformation | ||
) |
As rendering a layer quad, but omit everything concerning texture coordinates.
When Renderer3DIsMeshVertexCombiningEnabled returns true, draws nothing but populates the vertex array.
void kanzi::Renderer3D::drawLayerOutlineQuad | ( | float | width, |
float | height, | ||
const Material * | material, | ||
float | textureHeight, | ||
float | textureOffset, | ||
const KzcColorRGBA * | color, | ||
const Matrix4x4 & | worldTransformation | ||
) |
void kanzi::Renderer3D::drawViewportQuad | ( | const KzcVector2 * | offset, |
const KzcVector2 * | limits, | ||
Material * | material, | ||
TextureSharedPtr | texture | ||
) |
Draws viewport quad, fills with given pattern.
If texture is non-null, use texture span from it.
void kanzi::Renderer3D::drawViewportQuadWithTextureSpan | ( | Vector2 | offset, |
Vector2 | limits, | ||
Material * | material, | ||
TextureSharedPtr | texture, | ||
Vector2 | textureSpan | ||
) |
void kanzi::Renderer3D::drawViewportQuadWithTextureSpan | ( | const KzcVector2 * | offset, |
const KzcVector2 * | limits, | ||
Material * | material, | ||
TextureSharedPtr | texture, | ||
const KzcVector2 * | textureSpan | ||
) |
Draws viewport quad, fills with given pattern.
If textureSpan is null, it is taken from texture.
void kanzi::Renderer3D::applyStencilSettings | ( | bool | stencilTestEnabled, |
unsigned int | stencilRef, | ||
unsigned int | stencilMask, | ||
GraphicsCompareFunction | stencilFunction, | ||
GraphicsStencilOperation | stencilOperationStencilFail, | ||
GraphicsStencilOperation | stencilOperationStencilPassDepthFail, | ||
GraphicsStencilOperation | stencilOperationStencilPassDepthPass | ||
) | const |
Applies stencil settings with overrides for rendering.
void kanzi::Renderer3D::setDefaultOrthoProjection | ( | ) | const |
Sets default orthogonal projection and viewport for renderer.
void kanzi::Renderer3D::drawWireframeGrid | ( | float | spacing | ) |
Draws a wire frame grid with default colors.
void kanzi::Renderer3D::drawBoneIdentifier | ( | const KzcVector3 * | position, |
const KzcMatrix4x4 * | orientation | ||
) |
Draws a bone identifier.
void kanzi::Renderer3D::drawLight | ( | const Light * | lightNode, |
const KzcMatrix4x4 * | worldTransformation | ||
) |
Draws a wire frame light symbol.
void kanzi::Renderer3D::drawEmptyObject | ( | const KzcMatrix4x4 * | worldTransformation | ) |
Draws an empty object symbol with wire frame lines.
void kanzi::Renderer3D::drawCamera | ( | const Camera * | cameraNode, |
const KzcMatrix4x4 * | worldTransformation | ||
) |
Draws a wire frame camera symbol.
void kanzi::Renderer3D::drawSkeleton | ( | const Mesh * | mesh | ) |
Draws skeleton with wire frame lines.
void kanzi::Renderer3D::drawTrajectory | ( | Trajectory * | trajectory, |
const KzcMatrix4x4 * | worldTransformation, | ||
const Matrix4x4 & | arrangeTransform, | ||
const Vector3 & | scaling | ||
) |
Draws a trajectory with wire frame lines.