BBMOD_Renderer

Extends BBMOD_Class

constructor

new BBMOD_Renderer()

Description

Implements a basic renderer, which executes render commands created with method render. Currently supports two render passes - BBMOD_ERenderPass.Shadows and BBMOD_ERenderPass.Forward.

Properties

Name Description
Antialiasing Antialiasing technique to use. Defaults to BBMOD_EAntialiasing.None.
ChromaticAberration The strength of the chromatic aberration effect. Use 0 to disable the effect. Defaults to 0.
ColorGradingLUT The lookup table texture used for color grading.
EnablePostProcessing Enables post-processing effects. Defaults to false. Enabling this requires the Post-processing submodule!
EnableShadows Enables rendering into a shadowmap in the shadows render pass. Defauls to false.
Gizmo A gizmo that is automatically rendered and can be mouse-picked using method BBMOD_Renderer.select_gizmo. Default value is undefined.
Grayscale The strength of the grayscale effect. Use values in range 0..1, where 0 means the original color and 1 means grayscale. Defaults to 0.
Height The height of the renderer on the screen. If undefined then the window height is used. Default value is undefined.
InstanceHighlightColor Outline color of instances selected by gizmo. Default value is BBMOD_C_ORANGE.
RenderInstanceIDs If true then rendering of instance IDs into an off-screen surface is enabled. This must be enabled if you would like to use method BBMOD_Renderer.get_instance_id for mouse-picking instances. Default value is false.
RenderScale Resolution multiplier for the application_surface. BBMOD_Renderer.UseAppSurface must be enabled for this to have any effect. Defaults to 1. Use lower values to improve framerate.
Renderables <Struct.BBMOD_IRenderable>} An array of renderable objects and structs. These are automatically rendered in BBMOD_Renderer.render.
ShadowmapArea The area captured by the shadowmap. Defaults to 1024.
ShadowmapNormalOffset When rendering shadows, offsets vertex position by its normal scaled by this value. Defaults to 1. Increasing the value can remove some artifacts but using too high value could make the objects appear flying above the ground.
ShadowmapResolution The resolution of the shadowmap surface. Must be power of 2. Defaults to 4096.
UseAppSurface Set to true to enable the application_surface. Use method BBMOD_Renderer.present to draw the application_surface to the screen. Defaults to false.
Vignette The strength of the vignette effect. Defaults to 0.
VignetteColor The color of the vignette effect. Defaults to c_black.
Width The width of the renderer on the screen. If undefined then the window width is used. Default value is undefined.
X The X position of the renderer on the screen. Default value is 0.
Y The Y position of the renderer on the screen. Default value is 0.

Methods

Name Description
add Adds a renderable object or struct to the renderer.
get_height Retrieves the height of the renderer on the screen.
get_instance_id Retrieves an ID of an instance at given position on the screen.
get_render_height Retrieves the height of the renderer with BBMOD_Renderer.RenderScale applied.
get_render_width Retrieves the width of the renderer with BBMOD_Renderer.RenderScale applied.
get_width Retrieves the width of the renderer on the screen.
present Presents the rendered graphics on the screen.
remove Removes a renderable object or a struct from the renderer.
render Renders all added renderables to the current render target.
select_gizmo Tries to select a gizmo at given screen coordinates and automatically changes its BBMOD_Gizmo.EditAxis and BBMOD_Gizmo.EditType based on which part of the gizmo was selected.
set_position Changes the renderer's position on the screen.
set_rectangle Changes the renderer's position and size on the screen.
set_size Changes the renderer's size on the screen.
update Updates the renderer. This should be called in the Step event.

Example

Following code is a typical use of the renderer.

// Create event
renderer = new BBMOD_Renderer()
    .add(OCharacter)
    .add(OTree)
    .add(OTerrain)
    .add(OSky);
renderer.UseAppSurface = true;
renderer.EnableShadows = true;

camera = new BBMOD_Camera();
camera.FollowObject = OPlayer;

// Step event
camera.set_mouselook(true);
camera.update(delta_time);
renderer.update(delta_time);

// Draw event
camera.apply();
renderer.render();

// Post-Draw event
renderer.present();

// Clean Up event
renderer.destroy();

See also

BBMOD_Camera, BBMOD_IRenderable

Do you find this page helpful?

Copyright © 2022, BlueBurn. Built on May 18, 2022 using GMDoc.