Voxvision
1
Creating and manipulating voxel octrees
|
The renderer. More...
Go to the source code of this file.
Data Structures | |
struct | vox_rnd_ctx |
A renderer context. More... | |
Macros | |
#define | VOX_QUALITY_BEST 0b00 |
Best rendering quality. More... | |
#define | VOX_QUALITY_FAST 0b01 |
Fast rendering, middle quality. More... | |
#define | VOX_QUALITY_ADAPTIVE 0b10 |
Average rendering speed, good quality. More... | |
#define | VOX_QUALITY_RAY_MERGE 0b0100 |
Enable ray merging mode. More... | |
#define | VOX_QUALITY_RAY_MERGE_ACCURATE 0b1000 |
Accurate ray merging mode. More... | |
#define | VOX_QUALITY_RM_MASK 0b1100 /* RM stands for Ray Merge */ |
Ray merging mode mask. | |
#define | VOX_QUALITY_MODE_MASK 0b11 |
Rendering mode mask. | |
Functions | |
VOX_EXPORT struct vox_rnd_ctx * | vox_make_context_from_surface (SDL_Surface *surface) |
Make a renderer context from SDL surface. More... | |
VOX_EXPORT struct vox_rnd_ctx * | vox_make_context_and_window (unsigned int width, unsigned int height) |
Create a window and attach context to it. More... | |
VOX_EXPORT void | vox_redraw (struct vox_rnd_ctx *ctx) |
Redraw a window associated with this context. More... | |
VOX_EXPORT void | vox_context_set_scene (struct vox_rnd_ctx *ctx, struct vox_node *scene) |
Scene setter for renderer context. | |
VOX_EXPORT void | vox_context_set_camera (struct vox_rnd_ctx *ctx, struct vox_camera *camera) |
Camera setter for renderer context. | |
VOX_EXPORT void | vox_context_set_light_manager (struct vox_rnd_ctx *ctx, struct vox_light_manager *light_manager) |
Light manager setter for renderer context. | |
VOX_EXPORT int | vox_context_set_quality (struct vox_rnd_ctx *ctx, unsigned int quality) |
Set quality of the renderer. More... | |
VOX_EXPORT void | vox_destroy_context (struct vox_rnd_ctx *ctx) |
Free context after use. | |
VOX_EXPORT void | vox_render (struct vox_rnd_ctx *ctx) |
Render a scene on SDL surface. More... | |
The renderer.
#define VOX_QUALITY_ADAPTIVE 0b10 |
Average rendering speed, good quality.
This settings tells the renderer to choose between VOX_QUALITY_FAST
and VOX_QUALITY_BEST
settings for each block of 4x4 pixels.
#define VOX_QUALITY_BEST 0b00 |
Best rendering quality.
This quality setting forces the renderer to perform a full search for every rendered pixel starting from root of the tree.
#define VOX_QUALITY_FAST 0b01 |
Fast rendering, middle quality.
This quality setting enables the renderer to reuse the tree leafs from a previous search to find an intersection of a ray from the camera and the tree. This may cause artifacts on edges of rendered objects.
#define VOX_QUALITY_RAY_MERGE 0b0100 |
Enable ray merging mode.
This mode allows a ray which belongs to every second column on the screen to be merged with a ray from every first if this ray travels a long distance from the origin. This mode works ONLY in conjunction with adaptive mode.
#define VOX_QUALITY_RAY_MERGE_ACCURATE 0b1000 |
Accurate ray merging mode.
This mode is like standard ray merging mode, but it disables ray merging on edges of objects.
VOX_EXPORT int vox_context_set_quality | ( | struct vox_rnd_ctx * | ctx, |
unsigned int | quality | ||
) |
Set quality of the renderer.
ctx | The renderer's context. |
quality | Currently one of QUALITY_BEST , QUALITY_FAST or QUALITY_ADAPTIVE . |
quality
parameter is wrong. VOX_EXPORT struct vox_rnd_ctx* vox_make_context_and_window | ( | unsigned int | width, |
unsigned int | height | ||
) |
Create a window and attach context to it.
This function creates a window and a context associated with it. vox_render() will render frames to an internal surface which can be shown on window with vox_redraw(). User must free it with vox_destroy_context() after use.
width | Width of the window. |
height | Height of the window. |
NB: width must be multiple of 16 and heigth must be multiple of 4. If this does not hold, function silently returns NULL.
VOX_EXPORT struct vox_rnd_ctx* vox_make_context_from_surface | ( | SDL_Surface * | surface | ) |
Make a renderer context from SDL surface.
This function creates a renderer context based upon earlier created SDL surface. vox_render() will render frames to that surface. User must free it with vox_destroy_context() after use. The underlying surface will not be freed.
NB: Surface width must be multiple of 16 and surface heigth must be multiple of 4. If this does not hold, function silently returns NULL.
VOX_EXPORT void vox_redraw | ( | struct vox_rnd_ctx * | ctx | ) |
Redraw a window associated with this context.
This function will redraw window after call to vox_render() if context has a window.
VOX_EXPORT void vox_render | ( | struct vox_rnd_ctx * | ctx | ) |
Render a scene on SDL surface.
ctx | a renderer context |