faogenlib Namespace Reference

fast ambient occlusion generator library More...


Typedefs

typedef unsigned int size_type
 A type that counts various numeric parameters.
typedef int obj_handle
 A type that represents object handle.

Enumerations

enum  e_index_type { INDEX_U16, INDEX_U32 }
 Selects index type. More...

Functions

FAOGEN_API bool __stdcall initialize ()
FAOGEN_API void __stdcall shutdown ()
FAOGEN_API obj_handle __stdcall create_object_v (float const *vertices3f, size_type vertices_stride, size_type num_vertices, e_index_type index_type, void const *triangle_indices, size_type num_indices)
FAOGEN_API obj_handle __stdcall create_object_vn (float const *vertices3f, size_type vertices_stride, float const *normals3f, size_type normals_stride, size_type num_vertices, e_index_type index_type, void const *triangle_indices, size_type num_indices)
FAOGEN_API obj_handle __stdcall create_object_vnt (float const *vertices3f, size_type vertices_stride, float const *normals3f, size_type normals_stride, float const *texcoords2f, size_type texcoords_stride, size_type num_vertices, e_index_type index_type, void const *triangle_indices, size_type num_indices)
FAOGEN_API obj_handle __stdcall create_object_vnta (float const *vertices3f, size_type vertices_stride, float const *normals3f, size_type normals_stride, float const *texcoords2f, size_type texcoords_stride, float const *atest_texcoords2f, size_type atest_texcoords_stride, size_type num_vertices, e_index_type index_type, void const *triangle_indices, size_type num_indices)
FAOGEN_API void __stdcall set_object_alphamap (obj_handle object_id, size_type width, size_type height, size_type num_channels, unsigned char const *pixels)
FAOGEN_API void __stdcall set_object_matrix (obj_handle object_id, float const *matrix)
FAOGEN_API bool __stdcall start_ao_gen_vert (obj_handle object_id, size_type depth_size, float zoffset, float overbright, size_type quality, bool cosine_mode, int hemisphere_mode, bool bent_n)
FAOGEN_API bool __stdcall start_ao_gen_tex (obj_handle object_id, size_type depth_size, float zoffset, float overbright, size_type quality, bool cosine_mode, size_type width, size_type height, int hemisphere_mode, bool bent_n)
size_type num_iterations (size_type quality)
FAOGEN_API void __stdcall ao_vert_generate (size_type iterations)
FAOGEN_API void __stdcall ao_tex_generate (size_type iterations)
FAOGEN_API bool __stdcall results_ready ()
FAOGEN_API float const *__stdcall get_vert_results ()
FAOGEN_API float const *__stdcall get_tex_results (size_type edge_padding)
FAOGEN_API void __stdcall destroy_object (obj_handle object_id)


Detailed Description

fast ambient occlusion generator library

Typedef Documentation

typedef int faogenlib::obj_handle
 

A type that represents object handle.

Definition at line 16 of file faogenlib.h.

typedef unsigned int faogenlib::size_type
 

A type that counts various numeric parameters.

Definition at line 13 of file faogenlib.h.


Enumeration Type Documentation

enum faogenlib::e_index_type
 

Selects index type.

Enumerator:
INDEX_U16  16-bit unsigned integer
INDEX_U32  32-bit unsigned integer

Definition at line 27 of file faogenlib.h.


Function Documentation

FAOGEN_API void __stdcall faogenlib::ao_tex_generate size_type  iterations  ) 
 

Perform texture ao generation.

Parameters:
iterations number of iterations in this step.

Referenced by generate_example().

FAOGEN_API void __stdcall faogenlib::ao_vert_generate size_type  iterations  ) 
 

Perform per-vertex ao generation.

Parameters:
iterations number of iterations in this step.

Referenced by generate_example().

FAOGEN_API obj_handle __stdcall faogenlib::create_object_v float const *  vertices3f,
size_type  vertices_stride,
size_type  num_vertices,
e_index_type  index_type,
void const *  triangle_indices,
size_type  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.

Parameters:
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.
Returns:
Handle to created object.

Referenced by generate_example().

FAOGEN_API obj_handle __stdcall faogenlib::create_object_vn float const *  vertices3f,
size_type  vertices_stride,
float const *  normals3f,
size_type  normals_stride,
size_type  num_vertices,
e_index_type  index_type,
void const *  triangle_indices,
size_type  num_indices
 

Create object. For objects, created with this function only per-vertex ambient occlusion data can be generated.

Parameters:
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.
Returns:
Handle to created object.

Referenced by generate_example().

FAOGEN_API obj_handle __stdcall faogenlib::create_object_vnt float const *  vertices3f,
size_type  vertices_stride,
float const *  normals3f,
size_type  normals_stride,
float const *  texcoords2f,
size_type  texcoords_stride,
size_type  num_vertices,
e_index_type  index_type,
void const *  triangle_indices,
size_type  num_indices
 

Create object. For objects, created with this function both per-vertex and texture ambient occlusion can be generated.

Parameters:
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.
Returns:
Handle to created object.

Referenced by generate_example().

FAOGEN_API obj_handle __stdcall faogenlib::create_object_vnta float const *  vertices3f,
size_type  vertices_stride,
float const *  normals3f,
size_type  normals_stride,
float const *  texcoords2f,
size_type  texcoords_stride,
float const *  atest_texcoords2f,
size_type  atest_texcoords_stride,
size_type  num_vertices,
e_index_type  index_type,
void const *  triangle_indices,
size_type  num_indices
 

Create object with alpha-tested transparency. For objects, created with this function both per-vertex and texture ambient occlusion can be generated.

Parameters:
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.
atest_texcoords2f A pointer to the first component of the first alphatest texcoord in the array. Each texcoord has 2 components - U, V.
atest_texcoords_stride The byte offset between consecutive alphatest 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.
Returns:
Handle to created object.

FAOGEN_API void __stdcall faogenlib::destroy_object obj_handle  object_id  ) 
 

Destroy object from scene.

Parameters:
object_id handle, returned by create_object_v, create_object_vn or create_object_vnt

FAOGEN_API float const* __stdcall faogenlib::get_tex_results size_type  edge_padding  ) 
 

Retrieve generated texture ao data.

Parameters:
edge_padding maximum distance of "edge flood" post processing. Used to prevent "bleeding" of background pixels on the UV edges of generated map.
Returns:
pointer to array of floating-point values, representing ambient occlusion texture - total of width * height values if bent normals calculation was disabled, or width * height * 4 values (bent normal x, bent normal y, bent normal z, occlusion) if bent normals calculation was enabled. Pointer is valid until next successful call to start_ao_gen_vert, start_ao_gen_vert or shutdown

Referenced by generate_example().

FAOGEN_API float const* __stdcall faogenlib::get_vert_results  ) 
 

Retrieve generated per-vertex ao data.

Returns:
pointer to array of floating-point values, representing ambient occlusion - one for each vertex if bent normals calculation was disabled, or 4 values (bent normal x, bent normal y, bent normal z, occlusion) if bent normals calculation was enabled. Pointer is valid until next successful call to start_ao_gen_vert, start_ao_gen_vert or shutdown

Referenced by generate_example().

FAOGEN_API bool __stdcall faogenlib::initialize  ) 
 

Initialize faogenlib.

Returns:
true if initialization was successful.

Referenced by generate_example().

size_type faogenlib::num_iterations size_type  quality  )  [inline]
 

Helper function to calculate actual number of iterations for specified quality value.

Definition at line 241 of file faogenlib.h.

Referenced by generate_example().

FAOGEN_API bool __stdcall faogenlib::results_ready  ) 
 

Check if ao data is generated.

Returns:
true if results generated

Referenced by generate_example().

FAOGEN_API void __stdcall faogenlib::set_object_alphamap obj_handle  object_id,
size_type  width,
size_type  height,
size_type  num_channels,
unsigned char const *  pixels
 

Set alpha-test texture map for object.

Parameters:
object_id handle, returned by create_object_vnt or create_object_vnta
width texture width
height texture height
num_channels number of channels in texture. Valid values are 1, 2 and 4. Only the last (alpha) channel is used.
pixels pointer to texture pixels

FAOGEN_API void __stdcall faogenlib::set_object_matrix obj_handle  object_id,
float const *  matrix
 

Set transformation matrix for object.

Parameters:
object_id handle, returned by create_object_v, create_object_vn or create_object_vnt
matrix pointer to 4*4 matrix

Referenced by generate_example().

FAOGEN_API void __stdcall faogenlib::shutdown  ) 
 

Shutdown faogenlib. Destroys all left objects.

Referenced by generate_example().

FAOGEN_API bool __stdcall faogenlib::start_ao_gen_tex obj_handle  object_id,
size_type  depth_size,
float  zoffset,
float  overbright,
size_type  quality,
bool  cosine_mode,
size_type  width,
size_type  height,
int  hemisphere_mode,
bool  bent_n
 

Start texture ambient occlusion generation.

Parameters:
object_id object_id handle, returned by create_object_vnt
depth_size Size of the depth map used in AO generation. faogenlib uses hardware shadow mapping to compute AO data and increasing depth map size will produce better results at the cost of computation time. Must be power of 2 and in [1, 4096] range.
zoffset Amount of geometry depth offset to avoid aliasing artifacts. If this value is too small result texture will have lighter lines along convex edges and dark along concave.
overbright Constant used to scale calculated AO.
quality This parameter controls number of iterations. Must be in [1, 200] range.
cosine_mode faogenlib has two modes of AO calculation: "Cosine" mode, with which ambient occlusion is weighted by dot-product of surface normal and sample direction, and "Non-Cosine", which produces just occlusion value. In most cases "Cosine" mode gives more natural results.
width Width of the AO map to be generated. Must be power of 2 and in [1, 4096] range.
height Height of the AO map to be generated. Must be power of 2 and in [1, 4096] range.
hemisphere_mode 0 for no hemisphere, 1 for y-axis up, 2 for z-axis up.
bent_n calculate bent normals, if true result will contain 4 values for each texel (x, y, z, ao)
Returns:
true if there was no errors

Referenced by generate_example().

FAOGEN_API bool __stdcall faogenlib::start_ao_gen_vert obj_handle  object_id,
size_type  depth_size,
float  zoffset,
float  overbright,
size_type  quality,
bool  cosine_mode,
int  hemisphere_mode,
bool  bent_n
 

Start per-vertex ambient occlusion generation.

Parameters:
object_id Handle, returned by create_object_vn or create_object_vnt
depth_size Size of the depth map used in AO generation. faogenlib uses hardware shadow mapping to compute AO data and increasing depth map size will produce better results at the cost of computation time. Must be power of 2 and in [1, 4096] range
zoffset Amount of geometry depth offset to avoid aliasing artifacts. If this value is too small result texture will have lighter lines along convex edges and dark along concave.
overbright Constant used to scale calculated AO.
quality This parameter controls number of iterations. Must be in [1, 200] range.
cosine_mode faogenlib has two modes of AO calculation: "Cosine" mode, with which ambient occlusion is weighted by dot-product of surface normal and sample direction, and "Non-Cosine", which produces just occlusion value. In most cases "Cosine" mode gives more natural results.
hemisphere_mode 0 for no hemisphere, 1 for y-axis up, 2 for z-axis up.
bent_n calculate bent normals, if true result will contain 4 values for each vertex (x, y, z, ao)
Returns:
true if there was no errors

Referenced by generate_example().


Generated on Fri Aug 15 20:07:46 2008 for faogenlib by  doxygen 1.4.6-NO