BRender Technical Reference Manual:3 Functions (Structured Reference):Scene Rendering
Next|Prev|Up
The Rendering Engine
Initialising the Renderer
BrZbBegin()
BrZsBegin()
Pre-Rendering Pre-Processing
Hidden Surface Removal Schemes
BrZbDepthToScreenZ()
BrZbScreenZToDepth()
BrZsDepthToScreenZ()
BrZsScreenZToDepth()
Rendering Functions
BrZbSceneRender()
BrZsSceneRender()
BrZbSceneRenderBegin()
BrZsSceneRenderBegin()
BrZbSceneRenderAdd()
BrZsSceneRenderAdd()
BrZbSceneRenderEnd()
BrZsSceneRenderEnd()
BrZbRenderBoundsCallbackSet()
BrZsRenderBoundsCallbackSet()
BrZsPrimitiveCallbackSet()
Terminating the Renderer
BrZbEnd()
BrZsEnd()

Scene Rendering


The Rendering Engine

Having described a 3D scene in terms of actors (models, lights, cameras, etc.) the next step is to produce a 2D image*1. This is where BRender flexes its muscles and races through the actor hierarchy, accumulating transforms, computing lighting, and rendering faces. The process is performed in three phases:

Phase 1

Phase 2

Phase 3

Each phase produces data for the next phase to work on. It is possible in some implementations for a phase to commence before the previous phase has ended, possibly even processing in parallel.

Depending upon the platform, BRender will exploit dedicated hardware wherever possible to perform some of the phases.

In terms of how the process appears when using the BRender API, the following gives a simplified C skeleton of a possible application.

BrBegin(); /* The BRender library is Initialised */
...
/* The application is initialised */
...
BrZbBegin();/* The rendering engine is initialised */
...
/* Set up a scene in terms of an actor hierarchy */
...
/* Elements in the scene are pre-processed by being added to the registry (models, materials, textures, shade tables) */
...
do/* Main loop */
{do /* Perform rendering of the scene from each camera */
{ ...
/* Start supply of scene details to renderer */
BrZbSceneRenderBegin(world,camera,colour_buffer,depth_buffer);
	...
	for (...; ...; ...)/* Rendering one or more actor hierarchies */
		{ ...
		/* Specify each branch of world hierarchy to include in rendering */
			BrZbSceneRenderAdd(...);
			...
		}
		...
		/* End supply of scene details to renderer */
		BrZbSceneRenderEnd();
		...
	} while (...);
	...
	/* Update the scene */
	...
} while (...);
...
BrZbEnd();/* Close down the rendering engine */
...
BrEnd();/* Terminate the BRender library */
In order for the three rendering phases to take place the application must call BRender API functions to enable it to traverse an actor hierarchy. A `Begin' function (BrZbSceneRenderBegin()35 in the example above) let's BRender know that we're about to supply it with a selection of actors in a specific hierarchy, that should be viewed from a certain camera actor within it, and the resulting image to be placed in a supplied pixel map, with a certain method used to remove hidden surfaces. Each actor in our selection to be included in the rendering is then supplied by using an `Add' function (BrZbSceneRenderAdd()36 in the example). When all of the selection has been added an `End' function is called (BrZbSceneRenderEnd()37 in the example). The output from the renderer is not defined until the `End' function returns. Therefore you may make no assumptions about the contents of any output image buffers between the `Begin' and `End' functions, i.e. custom model and render bounds call-backs should not access the buffers. Furthermore, no assumption should be made regarding how the actor hierarchy is traversed during rendering, e.g. whether branch by branch or generation by generation.

Initialising the Renderer

Before rendering anything, the rendering engine must be initialised. This should be performed after library initialisation and before anything is added to the registry. Given that the registry is for performing pre-rendering preprocessing, it unsurprisingly needs to know beforehand which rendering engine is going to be used.


BrZbBegin()

Description:
Initialise the Z-buffer renderer. This is a rendering engine which utilises a depth buffer (a pixel map matching the colour buffer) containing z values for each pixel, which can be used to determine whether another pixel at the same position should be drawn over the existing one.

Declaration:
void BrZbBegin(br_uint_8 colour_type, br_uint_8 depth_type)

Arguments:
br_uint_8 colour_type

Pixel map type of buffer to render into.

br_uint_8 depth_type

Pixel map type of Z-buffer.

Preconditions:
Between BrBegin()
10 & BrEnd()11. The registry is empty. No rendering engine is currently enabled.

Effects:
Checks that the specified colour and depth types can be supported, initialises registry for this renderer.

See Also:
BrZbEnd()40, BrZsBegin()28


BrZsBegin()

Description:
Initialise the Z-sort renderer. This is a rendering engine which uses a bucket sort to determine the order in which primitives (faces, lines, points) should be rendered.

Declaration:
void BrZsBegin(br_uint_8 colour_type, void* primitive, br_uint_32 size)

Arguments:
br_uint_8 colour_type

Pixel map type of buffer to render into.

void * primitive

Non-Null pointer to an allocated block of memory to be used as a heap to hold rendered*2 primitives and referenced vertices generated during rendering.

br_uint_32 size

Size of primitive heap. To ensure that everything is rendered completely, this should be large enough for the renderer to store the temporary data structures used to hold details of each rendered primitive and the transformed vertices indexed by them. A primitive can be anything from a point to a triangle (possibly a quad). For the purposes of estimation you should allow 26 bytes for each primitive and 64 bytes for each unique vertex. The number of unique vertices can be calculated from the number of primitives, according to how vertices are shared by models' faces. At best there will be an average of one vertex per face primitive (a tetrahedron - four faces, four vertices), at worst there will be an average of three vertices per face primitive (a scene of independent triangles)*3.

Note that clipping is likely to increase the number of vertices.

If you estimate that there is an upper limit of about 1,000 faces (of front facing surfaces) in a rendering sequence with an average of 2.5 vertices per triangular face (including increases due to clipping) then the value of this member should be 1,000(26+2.564), i.e. 186,000 bytes, call it 200KB.

Preconditions:
Between BrBegin()10 & BrEnd()11. The registry is empty. No rendering engine is currently enabled.

Effects:
Checks that the specified colour types can be supported, initialises registry for this renderer.

Remarks:
If size is insufficiently large, some primitives will be omitted from the rendering. In border line cases, these are likely to be faces of models toward the end of the traversal of the actor hierarchy (which may manifest itself as deterioration of models in a particular lineage).

See Also:
BrZsEnd()40, BrZbBegin()28


Pre-Rendering Pre-Processing

There are various optimisations that BRender can perform before rendering takes place. These apply to models, materials, textures and shade tables. The way that any of these are specified to BRender before rendering is by adding them to the registry. The registry can be thought of as a container for holding elements involved in a scene. It can also be used as a simple type of database, with fairly simple search facilities. The preprocessing takes place on each item as it is added to the registry, e.g. using BrModelAdd()235. Any time an item is modified the preprocessing that BRender needs to be performed, will have to be redone. This is achieved by explicitly updating changed items using functions such as BrMaterialUpdate()159. As one would hope, such updating only needs to be performed just before rendering takes place - rather than after each change. If no actor in a scene uses a registry item then that item doesn't need to be updated. Conversely, if a actor uses a model, material, texture or shade table, that item must be in the registry and if changed must be updated before the actor is supplied to the renderer (even if indirectly).

If an item is no longer involved in a scene, then it can be removed from the registry using a function such as BrTableRemove()284.

Functions to search the registry for a particular item or to enumerate over all items of a certain type can be found in the supplementary sections of structures br_model228, br_material151, and br_pixelmap272.

Hidden Surface Removal Schemes

There are various schemes for rendering faces such that overlapping or intersecting faces are drawn correctly, i.e. nearer faces are in front of, and hide, farther faces. Each scheme is a different compromise between, quality, processing overhead, and memory overhead.

The Z-Buffer

The z buffer, or depth buffer, is a fast, high quality scheme, but uses a considerable amount of memory (something not likely to be found in abundance on games consoles).

How the depth buffer works is platform dependent, but it generally consists of a memory buffer corresponding to the display buffer, with a depth value for each pixel. The values it contains typically represent distances from the front - zero would thus represent the position of the front clip plane. Each time a face is rendered, the z value of each pixel is converted into a depth value, and only if it has a nearer (lesser) z value than the one in the depth buffer will it be plotted (the depth value in the buffer is then updated).

BRender supports 16 and 32 bit Z-Buffers, and a description of how the current implementation generally works now follows.

The depth buffer contains unsigned values representing distance from the front clip plane. A view z ordinate of hither_z (as specified in the camera) would correspond to a depth of zero. A view z ordinate of -yon_z corresponds to a depth of Depthmax, which is an unsigned value of 0xFFFFFFFF (in 32 bpp depth buffers, but 0xFFFF0000 in 16 bpp).

Note that as depth buffer values are treated by the rendering engine as unsigned words, before rendering the depth buffer should be filled to the maximum depth, i.e. 0xFFFFFFFF. The following example call will suffice whatever the word size of the depth buffer:

BrPixelmapFill(view->depth_buffer,0xFFFFFFFF);
Thus when reading values from a depth buffer, the value will be in the range [0, Depthmax], with unwritten pixels having depth buffer values of whatever was used to Initialise them, e.g. 0xFFFFFFFF.

The functions BrZbBegin()28, BrZbSceneRender()34, etc. are provided for applications requiring a Z-Buffer rendering engine.

The following functions are provided to convert between depths, screen and view co-ordinates.


BrZbDepthToScreenZ()

Description:
Convert z buffer depth [0,0xFFFFFFFF] to screen z [32,768,+~32,767.9].

Declaration:
br_scalar BrZbDepthToScreenZ(br_uint_32 depth_z, const br_camera* camera)

Arguments:
br_uint_32 depth_z

A 32 bit value read from the z buffer pixel map.

const br_camera* camera

A non-NULL pointer to the camera being used for rendering, i.e. relevant to the depth values used in the z buffer.

Result:
br_scalar

The corresponding screen z value.

See Also:
BrScreenZToCamera()
23, BrScreenXYZToCamera()24.


BrZbScreenZToDepth()

Description:
Convert screen z [32,768,+~32,767.9] to z buffer depth [0,0xFFFFFFFF].

Declaration:
br_uint_32 BrZbScreenZToDepth(br_scalar sz, const br_camera* camera)

Arguments:
br_scalar sz

A screen z value as obtained from functions such as BrOriginToScreenXYZO()252.

const br_camera* camera

A non-NULL pointer to the camera being used for rendering, i.e. relevant to the depth values used in the z buffer.

Result:
br_uint_32

A 32 bit depth value suitable for writing to a z buffer pixel map.

See Also:
BrScreenZToCamera()23, BrScreenXYZToCamera()24.


The Z-Sort

See br_order_table260{}

The Z-Sort is a very fast, low quality scheme using relatively little memory (particularly for simple scenes). Before rendering, all primitives (faces or smaller elements, such as lines or points) are sorted according to the z value of one or more of their vertices. The primitives are then rendered farthest first.

Clipping of intersecting faces involves a severe performance hit and is only likely to be implemented on very capable platforms. Checking for cyclic overlaps reduces performance still further.

The particular method BRender uses to sort primitives is to use a bucket sort. This involves the use of one or more order tables. Each order table divides a stratum (depth range) of the observer's z-axis into a number of equal sub-strata (depths). The model geometry of each model actor (using a particular order table) will be converted into rendering primitives, and each primitive will be added to the bucket (a linked list) corresponding to the sub-strata appropriate to its z-values. It is called a bucket sort because the order table may be considered as an ordered row of buckets into which items are thrown (in any order) according to their value (one bucket per range of values). Thus the order in which primitives of the same sub-strata are drawn is undefined.

Each order table effectively defines a separate layer of the rendered image, like an acetate. One should thus take care if order tables' depth ranges overlap, to avoid far faces being drawn over near faces. This is only likely to be a problem for intersecting models in separate order tables. Order tables are drawn in order of sort_z (typically the nearest end of an order table).

The application is responsible for ensuring model actors are using appropriate order tables. The rendering process can then traverse the actor hierarchy, processing each model into primitives and inserting these into the appropriate order tables. Actors can be assigned to order tables specifically, or by inheritance - there is a default, single bucket order table (spanning the entire view volume) which will be inherited if no ancestral actor defines one. Each new order table that is encountered during this process is inserted into an ordered linked list of order tables. When complete, the list of order tables is traversed, with the primitives rendered from each bucket in turn (from back to front).

Performance is relatively independent of the number of buckets you have, given the use of a radix sort to determine into which bucket a primitive should be placed. Performance does decrease however, the more order tables you have. This is due to the overhead, as each new order table is encountered, required to insert the order table at the correct position in the linked list of order tables. This is only likely to be significant with a large number of order tables.

It is difficult to give guidelines, as approaches to determining an appropriate set of order tables depends so much on the type of scene (sometimes, even from frame to frame, as models rotate and intersect). Approaches can vary from having a single order table with a large number of buckets, to a single bucket order table for each model.

The functions BrZsBegin()28, BrZsSceneRender()34, etc. are provided for applications requiring a Z-Sort rendering engine.

The following functions provide means of converting between z sort depth values (as required by order tables and supplied to primitive call-back functions). Note that the z sort depths are actually in a different range from view z values, i.e. depths are in the range [hither_z,+yon_z] whereas view z values are in the range [hither_z,yon_z] (both ranges near to far).


BrZsDepthToScreenZ()

Description:
Convert z sort depth [-hither_z,+yon_z] to screen z [32,768,+~32,767.9].

Declaration:
br_scalar BrZsDepthToScreenZ(br_scalar depth_z, const br_camera* camera)

Arguments:
br_scalar depth_z

A depth value read from an order table or obtained from a z sort primitive call-back.

const br_camera* camera

A non-NULL pointer to the camera being used for rendering, i.e. relevant to the depth values used in primitives and order tables.

Result:
br_scalar

The corresponding screen z value.

See Also:
BrScreenZToCamera()
23, BrScreenXYZToCamera()24.


BrZsScreenZToDepth()

Description:
Convert screen z [32,768,+~32,767.9] to z sort depth [-hither_z,+yon_z].

Declaration:
br_scalar BrZsScreenZToDepth(br_scalar sz, const br_camera* camera)

Arguments:
br_scalar sz

A screen z value as obtained from functions such as BrOriginToScreenXYZO()252.

const br_camera* camera

A non-NULL pointer to the camera being used for rendering, i.e. relevant to the depth values used in primitives and order tables.

Result:
br_scalar

A depth value suitable for writing to an order table or comparing with values of z obtained from a z sort primitive call-back.

See Also:
BrScreenZToCamera()23, BrScreenXYZToCamera()24.


Other Schemes

Other hidden surface removal schemes exist and sometimes are a result of the rendering method used. These include:

Binary Space Partitioning

Voxels

Ray Tracing

Scan Line Rendering

Rendering Functions

There are two ways of rendering a scene. Either the scene is defined in a single hierarchy and rendered as a whole, or a scene is defined in terms of a selection of subtrees of a single hierarchy. In the former case, only one function needs to be called, Br[Zb|Zs]SceneRender()34|34, this effectively wraps up the three functions required for the latter case, Br[Zb|Zs]SceneRenderBegin()35|35, Br[Zb|Zs]SceneRenderAdd()36|37, and Br[Zb|Zs]SceneRenderEnd()37|37. Note that in both cases, the camera must be a descendant of the scene root actor, as should all the sub-trees. If an environment actor is currently specified then it must also be a descendant of the scene root.

Note that there are two key call-back functions that can get called during rendering. These are a custom model rendering call-back (see br_renderbounds_cbfn307) and a render bounds call-back (see br_model_custom_cbfn247). The custom model rendering call-back is specified within the br_model228 structure defined for a model actor and enables an application to make a model's rendering dependent upon information only available at the time it's processed by the renderer. For similar reasons, the render bounds call-back is called for every model that affects the output image, allowing the application to take note of information only available at the time the model's are processed by the renderer. The trivial use of the render bounds call-back is to keep track of modified rectangles of the output image. The render bounds call-back is specified before rendering commences, using Br[Zb|Zs]RenderBoundsCallbackSet()38|38.

There is also a special call-back, br_primitive_cbfn307, only used in the Z-Sort renderer. This allows customised insertion of primitives into order tables.


BrZbSceneRender()

Description:
All-in-one function to render a scene using the Z-Buffer renderer.

Declaration:
void BrZbSceneRender(br_actor* world, br_actor* camera, br_pixelmap* colour_buffer, br_pixelmap* depth_buffer)

Arguments:
br_actor * world

A non-Null pointer to the root actor of a scene.

br_actor * camera

A non-Null pointer to a camera actor that is a descendant of the root actor.

br_pixelmap * colour_buffer

A non-Null pointer to the pixel map to render the scene into, whose type is colour_type as supplied to BrZbBegin()28.

br_pixelmap * depth_buffer

A non-Null pointer to the pixel map to be used as a depth buffer whose type is depth_type as supplied to BrZbBegin()28. It must have the same width and height as the colour buffer. See BrPixelmapMatch()286.

Preconditions:
Between BrBegin()10 & BrEnd()11. Between BrZbBegin()28 & BrZbEnd()40. Not currently rendering.

Effects:
Equivalent to a call of BrZbSceneRenderBegin(world,camera,colour_buffer,depth_buffer)35 followed by BrZbSceneRenderAdd(world)36 and BrZbSceneRenderEnd()37.

Remarks:
The colour buffer and depth buffer should not be texture maps (or even shade tables), though they can of course be subsequently added as such once the rendering has completed.

See Also:
BrZbRenderBoundsCallbackSet()38, BrZbModelRender()249.


BrZsSceneRender()

Description:
All-in-one function to render a scene using the Z-Sort renderer.

Declaration:
void BrZsSceneRender(br_actor* world, br_actor* camera, br_pixelmap* colour_buffer)

Arguments:
br_actor * world

A non-Null pointer to the root actor of a scene.

br_actor * camera

A non-Null pointer to a camera actor that is a descendant of the root actor.

br_pixelmap * colour_buffer

A non-Null pointer to the pixel map to render the scene into, whose type is colour_type as supplied to BrZsBegin()28.

Preconditions:
Between BrBegin()10 & BrEnd()11. Between BrZsBegin()28 & BrZsEnd()40. Not currently rendering.

Effects:
Equivalent to a call of BrZsSceneRenderBegin(world,camera,colour_buffer)35 followed by BrZsSceneRenderAdd(world)37 and BrZsSceneRenderEnd()37.

Remarks:
The colour buffer should not be a texture map (or even a shade table), though it can of course be subsequently added as such once the rendering has completed.

See Also:
BrZsRenderBoundsCallbackSet()38, BrZsModelRender()249, BrZsPrimitiveCallbackSet()39.


BrZbSceneRenderBegin()

Description:
Set up a new scene to be rendered using the Z-Buffer renderer, processing the camera, lights and environment.

Declaration:
void BrZbSceneRenderBegin(br_actor* world, br_actor* camera, br_pixelmap* colour_buffer, br_pixelmap* depth_buffer)

Arguments:
br_actor * world

A non-Null pointer to the root actor of a scene.

br_actor * camera

A non-Null pointer to a camera actor that is a descendant of the root actor.

br_pixelmap * colour_buffer

A non-Null pointer to the pixel map to render the scene into, whose type is colour_type as supplied to BrZbBegin()28.

br_pixelmap * depth_buffer

A non-Null pointer to the pixel map to be used as a depth buffer whose type is depth_type as supplied to BrZbBegin()28. It must have the same width and height as the colour buffer. See BrPixelmapMatch()286.

Preconditions:
Between BrBegin()10 & BrEnd()11. Between BrZbBegin()28 & BrZbEnd()40. Not currently rendering.

Effects:
Enter rendering state, prepare for destination buffers, preprocess view, screen and environment transforms, preprocess enabled lights, handle environment actor, preprocess enabled clip planes.

Remarks:
The colour buffer and depth buffer should not be texture maps (or even shade tables), though they can of course be subsequently added as such once the rendering has completed.

See Also:
BrZbSceneRenderAdd()36, BrZbSceneRenderEnd()37, BrZbRenderBoundsCallbackSet()38, BrZbModelRender()249.


BrZsSceneRenderBegin()

Description:
Set up a new scene to be rendered using the Z-Sort renderer, processing the camera, lights and environment.

Declaration:
void BrZsSceneRenderBegin(br_actor* world, br_actor* camera, br_pixelmap* colour_buffer)

Arguments:
br_actor * world

A non-Null pointer to the root actor of a scene.

br_actor * camera

A non-Null pointer to a camera actor that is a descendant of the root actor.

br_pixelmap * colour_buffer

A non-Null pointer to the pixel map to render the scene into, whose type is colour_type as supplied to BrZsBegin()28.

Preconditions:
Between BrBegin()10 & BrEnd()11. Between BrZsBegin()28 & BrZsEnd()40. Not currently rendering.

Effects:
Enter rendering state, prepare for destination buffer, preprocess view, screen and environment transforms, preprocess enabled lights, handle environment actor, preprocess enabled clip planes.

Remarks:
The colour buffer should not be a texture map (or even a shade table), though it can of course be subsequently added as such once the rendering has completed.

See Also:
BrZsSceneRenderAdd()37, BrZsSceneRenderEnd()37, BrZsRenderBoundsCallbackSet()38, BrZsPrimitiveCallbackSet()39, BrZsModelRender()249.


BrZbSceneRenderAdd()

Description:
Include an actor (and its descendants) of the world in the current rendering.

Declaration:
void BrZbSceneRenderAdd(br_actor* tree)

Arguments:
br_actor * tree

A non-Null pointer to an actor hierarchy, which must be a descendant of the world hierarchy supplied to BrZbSceneRenderBegin()35.

Preconditions:
Between BrBegin()10 & BrEnd()11. Between BrZbBegin()28 & BrZbEnd()40. Currently rendering, i.e. between BrZbSceneRenderBegin()35 and BrZbSceneRenderEnd()37. Not within a custom model render call-back or render bounds call-back

Effects:
Add actor to list of actors to be rendered.

Remarks:
Whether rendering takes place during this function or sometime before the return of BrZbSceneRenderEnd()37 is undefined. When custom model render and render bounds call-back functions are called is similarly undefined.

See Also:
BrZbSceneRenderBegin()35, BrZbSceneRenderEnd()37, BrZbRenderBoundsCallbackSet()38, BrZbModelRender()249.


BrZsSceneRenderAdd()

Description:
Include an actor (and its descendants) of the world in the current rendering.

Declaration:
void BrZsSceneRenderAdd(br_actor* tree)

Arguments:
br_actor * tree

A non-Null pointer to an actor hierarchy, which must be a descendant of the world hierarchy supplied to BrZsSceneRenderBegin()35.

Preconditions:
Between BrBegin()10 & BrEnd()11. Between BrZsBegin()28 & BrZsEnd()40. Currently rendering, i.e. between BrZsSceneRenderBegin()35 and BrZsSceneRenderEnd()37. Not within a custom model render call-back, render bounds call-back or primitive call-back.

Effects:
Add actor to list of actors to be rendered.

Remarks:
Whether rendering takes place during this function or sometime before the return of BrZsSceneRenderEnd()37 is undefined. When custom model render, render bounds and primitive call-back functions are called is similarly undefined.

See Also:
BrZsSceneRenderBegin()35, BrZsSceneRenderEnd()37, BrZsRenderBoundsCallbackSet()38, BrZsPrimitiveCallbackSet()39, BrZsModelRender()249.


BrZbSceneRenderEnd()

Description:
Complete the specification of actors to be rendered in a scene, and their rendering.

Declaration:
void BrZbSceneRenderEnd(void)

Preconditions:
Between BrBegin()
10 & BrEnd()11. Between BrZbBegin()28 & BrZbEnd()40. Currently rendering, i.e. after BrZbSceneRenderBegin()35. Not within a custom model render call-back or render bounds call-back

Effects:
By the time this function ends, the scene as specified in terms of world root, camera and sub-trees, will have been rendered to the output buffers.

Remarks:
Whether rendering takes place during this function or sometime before the return of BrZbSceneRenderEnd()37 is undefined. When custom model render and render bounds call-back functions are called is similarly undefined.

See Also:
BrZbSceneRenderBegin()35, BrZbSceneRenderAdd()36, BrZbRenderBoundsCallbackSet()38, BrZbModelRender()249.


BrZsSceneRenderEnd()

Description:
Complete the specification of actors to be rendered in a scene, and their rendering.

Declaration:
void BrZsSceneRenderEnd(void)

Preconditions:
Between BrBegin()
10 & BrEnd()11. Between BrZsBegin()28 & BrZsEnd()40. Currently rendering, i.e. after BrZsSceneRenderBegin()35. Not within a custom model render call-back, render bounds call-back, or primitive call-back.

Effects:
By the time this function ends, the scene as specified in terms of world root, camera and sub-trees, will have been rendered to the output buffer.

Remarks:
Whether rendering takes place during this function or sometime before the return of BrZsSceneRenderEnd()37 is undefined. When custom model render, render bounds, and primitive call-back functions are called is similarly undefined.

See Also:
BrZsSceneRenderBegin()35, BrZsSceneRenderAdd()37, BrZsRenderBoundsCallbackSet()38, BrZsPrimitiveCallbackSet()39, BrZsModelRender()249.


BrZbRenderBoundsCallbackSet()

Description:
Set the call-back function invoked for each rendered actor. For example, a call-back can be set up to log those rectangles in the colour buffer that have been written to (dirty rectangle flagging).

Declaration:
br_renderbounds_cbfn* BrZbRenderBoundsCallbackSet(br_renderbounds_cbfn* new_cbfn)

Arguments:
br_renderbounds_cbfn * new_cbfn

A pointer to the new call-back function. Specify the old call-back function when a function call-back is not required.

Preconditions:
Between BrBegin()
10 & BrEnd()11. Between BrZbBegin()28 & BrZbEnd()40. Not currently rendering.

Effects:
Defines a function that will be called during rendering for each model that affects the output buffers.

Result:
br_renderbounds_cbfn *

Returns a pointer to the old call-back function.

Remarks:
Exactly when the call-back function gets called is undefined except that it will be sometime between BrZbSceneRenderBegin()35 and BrZbSceneRenderEnd()37. It is also not necessarily associated with a particular point in the rendering process.

See Also:
br_renderbounds_cbfn307, br_model_custom_cbfn247.


BrZsRenderBoundsCallbackSet()

Description:
Set the call-back function invoked for each rendered actor. For example, a call-back can be set up to log those rectangles in the colour buffer that have been written to (dirty rectangle flagging).

Declaration:
br_renderbounds_cbfn* BrZsRenderBoundsCallbackSet(br_renderbounds_cbfn* new_cbfn)

Arguments:
br_renderbounds_cbfn * new_cbfn

A pointer to the new call-back function. Specify the old call-back function when a function call-back is not required.

Preconditions:
Between BrBegin()
10 & BrEnd()11. Between BrZsBegin()28 & BrZsEnd()40. Not currently rendering.

Effects:
Defines a function that will be called during rendering for each model that affects the output buffer.

Result:
br_renderbounds_cbfn *

Returns a pointer to the old call-back function.

Remarks:
The actor order table will be supplied to the call-back function.

Exactly when the call-back function gets called is undefined except that it will be sometime between BrZsSceneRenderBegin()35 and BrZsSceneRenderEnd()37. It is also not necessarily associated with a particular point in the rendering process.

See Also:
br_renderbounds_cbfn307, br_model_custom_cbfn247.


BrZsPrimitiveCallbackSet()

Description:
Set the call-back function invoked for each primitive generated by the Z-Sort renderer. This call-back can be used to perform customised insertion of primitives into order tables.

Declaration:
br_primitive_cbfn* BrZsPrimitiveCallbackSet(br_primitive_cbfn* new_cbfn)

Arguments:
br_renderbounds_cbfn * new_cbfn

A pointer to the new call-back function. Specify the old call-back function when a function call-back is not required. Null will indicate that the default call-back function should be used.

Preconditions:
Between BrBegin()
10 & BrEnd()11. Between BrZsBegin()28 & BrZsEnd()40. Not currently rendering.

Effects:
Defines a function that will be called during rendering for each front facing primitive that is to be inserted into the order table.

Result:
br_renderbounds_cbfn *

Returns a pointer to the old call-back function.

Remarks:
Exactly when the call-back function gets called is undefined except that it will be sometime between BrZsSceneRenderBegin()35 and BrZsSceneRenderEnd()37. However, it may be assumed that rendering to the output buffer has not yet commenced.

See Also:
br_primitive_cbfn307, br_model_custom_cbfn247.


Terminating the Renderer

Once rendering has completed, all items in the registry should be removed (not necessarily freed) and the rendering engine closed down. This should also happen before using a different rendering engine or rendering to a different type of pixel map or image, e.g. rendering to an 8 bit pixel map when the current rendering is to a 24 bit video buffer.


BrZbEnd()

Description:
Close down the Z-Buffer renderer.

Declaration:
void BrZbEnd(void)

Preconditions:
Between BrBegin()
10 & BrEnd()11. BrZbBegin()28 has been called, and BrZbEnd()40 has not yet been called since. The registry is empty. No other rendering engine is currently enabled.

Effects:
Releases resources used by the Z-Buffer renderer.

See Also:
BrZbBegin()28


BrZsEnd()

Description:
Close down the Z-Sort renderer.

Declaration:
void BrZsEnd(void)

Preconditions:
Between BrBegin()
10 & BrEnd()11. BrZsBegin()28 has been called, and BrZsEnd()40 has not yet been called since. The registry is empty. No other rendering engine is currently enabled.

Effects:
Releases resources used by the Z-Sort renderer.

See Also:
BrZsBegin()28



Generated with CERN WebMaker