faogenlib3
|
fast ambient occlusion generator library More...
Typedefs | |
typedef int | obj_handle |
A type that represents object handle. | |
Enumerations | |
enum | e_index_type { INDEX_U16, INDEX_U32 } |
Selects index type. More... | |
Functions | |
bool | initialize () |
void | shutdown () |
obj_handle | create_object_v (float const *vertices3f, size_t vertices_stride, size_t num_vertices, e_index_type index_type, void const *triangle_indices, size_t num_indices) |
obj_handle | create_object_vn (float const *vertices3f, size_t vertices_stride, float const *normals3f, size_t normals_stride, size_t num_vertices, e_index_type index_type, void const *triangle_indices, size_t num_indices) |
obj_handle | create_object_vnt (float const *vertices3f, size_t vertices_stride, float const *normals3f, size_t normals_stride, float const *texcoords2f, size_t texcoords_stride, size_t num_vertices, e_index_type index_type, void const *triangle_indices, size_t num_indices) |
void | set_object_matrix (obj_handle object_id, float const *matrix) |
bool | start_ao_gen_vert (obj_handle object_id, unsigned quality, int hemisphere_mode) |
bool | start_ao_gen_tex (obj_handle object_id, unsigned quality, unsigned width, unsigned height, int hemisphere_mode) |
unsigned | num_iterations (unsigned quality) |
void | ao_vert_generate (size_t iterations) |
void | ao_tex_generate (size_t iterations) |
bool | results_ready () |
float const * | get_vert_results () |
float const * | get_tex_results () |
void | destroy_object (obj_handle object_id) |
fast ambient occlusion generator library
void faogenlib3::ao_tex_generate | ( | size_t | iterations | ) |
Perform texture ao generation.
iterations | number of iterations in this step. |
void faogenlib3::ao_vert_generate | ( | size_t | iterations | ) |
Perform per-vertex ao generation.
iterations | number of iterations in this step. |
obj_handle faogenlib3::create_object_v | ( | float const * | vertices3f, |
size_t | vertices_stride, | ||
size_t | num_vertices, | ||
e_index_type | index_type, | ||
void const * | triangle_indices, | ||
size_t | num_indices | ||
) |
Create object. For objects, created with this function ambient occlusion data can't be generated, they will serve only as occludders for other objects.
vertices3f | A pointer to the first coordinate of the first vertex in the array. Each vertex has 3 coordinates - X, Y, Z. |
vertices_stride | The byte offset between consecutive vertices. When stride is zero, the vertices are tightly packed in the array. |
num_vertices | Total number of vertices. |
index_type | The type of the values in triangle_indices |
triangle_indices | A pointer to the location where the indices are stored |
num_indices | Number of indices. Must be a multiple of 3. |
obj_handle faogenlib3::create_object_vn | ( | float const * | vertices3f, |
size_t | vertices_stride, | ||
float const * | normals3f, | ||
size_t | normals_stride, | ||
size_t | num_vertices, | ||
e_index_type | index_type, | ||
void const * | triangle_indices, | ||
size_t | num_indices | ||
) |
Create object. For objects, created with this function only per-vertex ambient occlusion data can be generated.
vertices3f | A pointer to the first coordinate of the first vertex in the array. Each vertex has 3 coordinates - X, Y, Z. |
vertices_stride | The byte offset between consecutive vertices. When stride is zero, the vertices are tightly packed in the array. |
normals3f | A pointer to the first coordinate of the first normal in the array. Each normal has 3 coordinates - X, Y, Z. |
normals_stride | The byte offset between consecutive normals. When stride is zero, the normals are tightly packed in the array. |
num_vertices | Total number of vertices. |
index_type | The type of the values in triangle_indices |
triangle_indices | A pointer to the location where the indices are stored |
num_indices | Number of indices. Must be a multiple of 3. |
obj_handle faogenlib3::create_object_vnt | ( | float const * | vertices3f, |
size_t | vertices_stride, | ||
float const * | normals3f, | ||
size_t | normals_stride, | ||
float const * | texcoords2f, | ||
size_t | texcoords_stride, | ||
size_t | num_vertices, | ||
e_index_type | index_type, | ||
void const * | triangle_indices, | ||
size_t | num_indices | ||
) |
Create object. For objects, created with this function both per-vertex and texture ambient occlusion can be generated.
vertices3f | A pointer to the first coordinate of the first vertex in the array. Each vertex has 3 coordinates - X, Y, Z. |
vertices_stride | The byte offset between consecutive vertices. When stride is zero, the vertices are tightly packed in the array. |
normals3f | A pointer to the first coordinate of the first normal in the array. Each normal has 3 coordinates - X, Y, Z. |
normals_stride | The byte offset between consecutive normals. When stride is zero, the normals are tightly packed in the array. |
texcoords2f | A pointer to the first component of the first texcoord in the array. Each texcoord has 2 components - U, V. |
texcoords_stride | The byte offset between consecutive texcoords. When stride is zero, the texcoords are tightly packed in the array. |
num_vertices | Total number of vertices. |
index_type | The type of the values in triangle_indices |
triangle_indices | A pointer to the location where the indices are stored |
num_indices | Number of indices. Must be a multiple of 3. |
void faogenlib3::destroy_object | ( | obj_handle | object_id | ) |
Delete object from the scene.
object_id | handle, returned by create_object_v, create_object_vn or create_object_vnt |
float const* faogenlib3::get_tex_results | ( | ) |
Retrieve generated texture ao data.
float const* faogenlib3::get_vert_results | ( | ) |
Retrieve generated per-vertex ao data.
bool faogenlib3::initialize | ( | ) |
Initialize faogenlib.
|
inline |
Helper function to calculate actual number of iterations for specified quality value.
bool faogenlib3::results_ready | ( | ) |
Check if ao data is generated.
void faogenlib3::set_object_matrix | ( | obj_handle | object_id, |
float const * | matrix | ||
) |
Set transformation matrix for object.
object_id | handle, returned by create_object_v, create_object_vn or create_object_vnt |
matrix | pointer to 4*4 matrix |
void faogenlib3::shutdown | ( | ) |
Shutdown faogenlib. Destroys all left objects.
bool faogenlib3::start_ao_gen_tex | ( | obj_handle | object_id, |
unsigned | quality, | ||
unsigned | width, | ||
unsigned | height, | ||
int | hemisphere_mode | ||
) |
Start texture ambient occlusion generation.
object_id | object_id handle, returned by create_object_vnt |
quality | This parameter controls number of iterations. Must be in [1, 100] range. |
width | Width of the AO map to be generated. Must be a power of 2 and in [1, 4096] range. |
height | Height of the AO map to be generated. Must be a power of 2 and in [1, 4096] range. |
hemisphere_mode | 0 for no hemisphere, 1 for y-axis up, 2 for z-axis up. |
bool faogenlib3::start_ao_gen_vert | ( | obj_handle | object_id, |
unsigned | quality, | ||
int | hemisphere_mode | ||
) |
Start per-vertex ambient occlusion generation.
object_id | Handle, returned by create_object_vn or create_object_vnt |
quality | This parameter controls number of iterations. Must be in [1, 100] range. |
hemisphere_mode | 0 for no hemisphere, 1 for y-axis up, 2 for z-axis up. |