Voxvision  1
Creating and manipulating voxel octrees
Functions
lights.h File Reference

Light manager. More...

#include "../voxtrees/mtree.h"

Go to the source code of this file.

Functions

VOX_EXPORT int vox_insert_shadowless_light (struct vox_light_manager *light_manager, const vox_dot center, float radius, const vox_dot color)
 Insert a shadowless light. More...
 
VOX_EXPORT int vox_delete_shadowless_light (struct vox_light_manager *light_manager, const vox_dot center, float radius)
 Delete a shadowless light with given specifications. More...
 
VOX_EXPORT void vox_delete_shadowless_lights (struct vox_light_manager *light_manager)
 Delete all shadowless lights.
 
VOX_EXPORT int vox_shadowless_lights_number (const struct vox_light_manager *light_manager)
 Return a number of shadowless lights.
 
VOX_EXPORT int vox_set_ambient_light (struct vox_light_manager *light_manager, const vox_dot color)
 Set an ambient light. More...
 
VOX_EXPORT struct vox_light_manager * vox_make_light_manager ()
 Create a new light manager with no lights.
 
VOX_EXPORT void vox_destroy_light_manager (struct vox_light_manager *light_manager)
 Destroy a light manager.
 

Detailed Description

Light manager.

The light manager which supports a few types of light. This manager operates with color as with floating point triplet (of type vox_dot). The first number is amount of red, the second is amount of green and the third is amount of blue. Accepted range is [0, 1], zero meaning "null intensity" and one meaning "full intensity".

Function Documentation

◆ vox_delete_shadowless_light()

VOX_EXPORT int vox_delete_shadowless_light ( struct vox_light_manager *  light_manager,
const vox_dot  center,
float  radius 
)

Delete a shadowless light with given specifications.

The specifications must match exactly to the specifications of the light you wish to be removed (with exception of color, which may be any).

◆ vox_insert_shadowless_light()

VOX_EXPORT int vox_insert_shadowless_light ( struct vox_light_manager *  light_manager,
const vox_dot  center,
float  radius,
const vox_dot  color 
)

Insert a shadowless light.

This function inserts a soft, shadowless light which is bound by a sphere. Its intensity is at its maximum in the center of that sphere and is lineary faded to zero on its surface.

Parameters
light_managerA light manager
centerCenter of the bounding sphere
radiusRadius of the bounding sphere
colorColor of the light.
Returns
1 on success (there was no such light in this place before), 0 otherwise.

◆ vox_set_ambient_light()

VOX_EXPORT int vox_set_ambient_light ( struct vox_light_manager *  light_manager,
const vox_dot  color 
)

Set an ambient light.

The ambient light is added to all visible voxels on the screen.

Returns
1 on success, 0 otherwise.