sio2_camera.cc File Reference

#include "sio2.h"

Include dependency graph for sio2_camera.cc:


Functions

SIO2camerasio2CameraInit (char *_name)
SIO2camerasio2CameraFree (SIO2camera *_SIO2camera)
unsigned char sio2CameraLoad (char *_root, char *_tok, char *_val)
void sio2CameraUpdateFrustum (SIO2camera *_SIO2camera)
void sio2CameraGetProjectionMatrix (SIO2camera *_SIO2camera)
void sio2CameraGetModelviewMatrix (SIO2camera *_SIO2camera)
void sio2CameraRender (SIO2camera *_SIO2camera)
float sio2CameraSphereDistInFrustum (SIO2camera *_SIO2camera, vec3 *_v, float _r)
unsigned char sio2CameraPointInFrustum (SIO2camera *_SIO2camera, vec3 *_v)
unsigned char sio2CameraSphereInFrustum (SIO2camera *_SIO2camera, vec3 *_v, float _r)
unsigned char sio2CameraCubeInFrustum (SIO2camera *_SIO2camera, vec3 *_v, vec3 *_dim)
unsigned char sio2CameraCubeIntersectFrustum (SIO2camera *_SIO2camera, vec3 *_v, vec3 *_dim)
unsigned char sio2CameraSphereIntersectFrustum (SIO2camera *_SIO2camera, vec3 *_v, float _r)
unsigned char sio2CameraGeometryInFrustum (SIO2camera *_SIO2camera, unsigned int _nvert, float *_vert)

Function Documentation

unsigned char sio2CameraCubeInFrustum ( SIO2camera _SIO2camera,
vec3 _v,
vec3 _dim 
)

Determine whether or not a cube is inside the frustum.

_SIO2camera: A valid SIO2camera pointer.
_v: A 3D position in world coordinate, representing the pivot point of the cube.
_dim: The XYZ size from its origin.

return 1 if the point is inside the frustum, else return 0.

References SIO2camera::frustum, vec3::x, vec3::y, and vec3::z.

unsigned char sio2CameraCubeIntersectFrustum ( SIO2camera _SIO2camera,
vec3 _v,
vec3 _dim 
)

Determine where is a cube from the SIO2camera frustum.

_SIO2camera: A valid SIO2camera pointer.
_v: A 3D position in world coordinate, representing the pivot point of the cube.
_dim: The XYZ size from its origin.

return 0 if it is outside.
return 1 if it intersect the frustum.
return 2 if it is inside the frustum.

References SIO2camera::frustum, vec3::x, vec3::y, and vec3::z.

SIO2camera* sio2CameraFree ( SIO2camera _SIO2camera  ) 

Free a previously initialized SIO2camera structure from the memory. The SIO2camera will be removed from the global sio2 SIO2resource handle.

_SIO2camera: The SIO2camera handle to remove.

return a NULL SIO2camera pointer.

References SIO2::_SIO2resource, sio2, SIO2_CAMERA, and sio2ResourceDel().

Referenced by sio2ResourceUnload().

Here is the call graph for this function:

unsigned char sio2CameraGeometryInFrustum ( SIO2camera _SIO2camera,
unsigned int  _nvert,
float *  _vert 
)

Determine if a geometry constructed from point cloud is inside the frustum.

_SIO2camera: A valid SIO2camera pointer.
_nvert: The number of vertices.
_vert: An array of vertices ordered in a standard XYZ fashion for every vertice.

return 1 if inside, 0 if not.

References SIO2camera::frustum.

void sio2CameraGetModelviewMatrix ( SIO2camera _SIO2camera  ) 

Get the current OpenGL modelview matrix.

_SIO2camera: A valid SIO2camera pointer.

References SIO2camera::mat_modelview.

void sio2CameraGetProjectionMatrix ( SIO2camera _SIO2camera  ) 

Get the current OpenGL projection matrix.

_SIO2camera: A valid SIO2camera pointer.

References SIO2camera::mat_projection.

SIO2camera* sio2CameraInit ( char _name  ) 

Initialize a new SIO2camera structure. This new SIO2camera will be added to the global sio2 SIO2resource handle.

_name: The name to use for the new SIO2camera.

return a new SIO2camera structure pointer.

References SIO2::_SIO2resource, SIO2camera::_SIO2transform, SIO2camera::name, sio2, SIO2_CAMERA, sio2ResourceAdd(), sio2StringCpy(), sio2TransformLoadIdentity(), SIO2camera::up_vector, vec3::x, vec3::y, and vec3::z.

Referenced by sio2CameraLoad().

Here is the call graph for this function:

unsigned char sio2CameraLoad ( char _root,
char _tok,
char _val 
)

Function callback used by the parser to parse an SIO2camera file.

_root: The root token.
_tok: The current token to parse.
_val: The value of the token.

return 1 or 0 if the token have been found.

References SIO2::_SIO2camera, SIO2camera::_SIO2transform, SIO2camera::cend, SIO2camera::cstart, SIO2transform::dir, SIO2camera::fov, SIO2camera::iponame, SIO2transform::loc, sio2, SIO2_MAX_CHAR, sio2CameraInit(), sio2StringCmp(), sio2StringScanf(), vec3::x, vec3::y, and vec3::z.

Referenced by sio2ResourceCreateDictionary().

Here is the call graph for this function:

unsigned char sio2CameraPointInFrustum ( SIO2camera _SIO2camera,
vec3 _v 
)

Determine whether or not a 3D point is inside the frustum.

_SIO2camera: A valid SIO2camera pointer.
_v: A 3D point in world coordinate.

return 1 if the point is inside the frustum, else return 0.

References SIO2camera::frustum, vec3::x, vec3::y, and vec3::z.

void sio2CameraRender ( SIO2camera _SIO2camera  ) 

Render an SIO2camera based on its current transformation information. Please take note that the SIO2camera render function is a lite version of sio2LookAt. It is build around the same concept at the exception that no extensive check or normalization is done on the vector. And it assume that the data have already been properly set. The main information needed by this function in order to render the SIO2camera properly is the SIO2transform->loc which represent the camera position in world space. And SIO2transform->dir that represent a normalized direction vector. In addition, as no extensive checks are done, if you are experiencing issues (in example your SIO2camera is looking straight down on the negative axis of the direction vector) please use sio2LookAt, that is basically the same implementation as the well known gluLookAt function.

_SIO2camera: A valid SIO2camera pointer.

References SIO2camera::_SIO2ipo, SIO2ipo::_SIO2transform, SIO2camera::_SIO2transform, SIO2transform::dir, SIO2transform::loc, SIO2transform::mat, SIO2transform::rot, SIO2_PLAY, sio2Rotate3D(), sio2TransformRender(), sio2TransformSetLoc(), sio2TransformSetRot(), sio2Vec3Diff(), SIO2ipo::state, SIO2camera::up_vector, vec3::x, vec3::y, and vec3::z.

Here is the call graph for this function:

float sio2CameraSphereDistInFrustum ( SIO2camera _SIO2camera,
vec3 _v,
float  _r 
)

Get the distance of a sphere located inside the SIO2camera frustum.

_SIO2camera: A valid SIO2camera pointer.
_v: The position in world space, representing the pivot point of the sphere.
_r: The radius of the sphere.

return the distance of the sphere within the frustum. Instead return 0.

References SIO2camera::frustum, vec3::x, vec3::y, and vec3::z.

Referenced by sio2ResourceCull().

unsigned char sio2CameraSphereInFrustum ( SIO2camera _SIO2camera,
vec3 _v,
float  _r 
)

Determine whether or not a sphere is inside the frustum.

_SIO2camera: A valid SIO2camera pointer.
_v: A 3D point in world coordinate, representing the pivot point of the sphere.
_r: The radius of the sphere.

return 1 if the point is inside the frustum, else return 0.

References SIO2camera::frustum, vec3::x, vec3::y, and vec3::z.

unsigned char sio2CameraSphereIntersectFrustum ( SIO2camera _SIO2camera,
vec3 _v,
float  _r 
)

Determine where is a sphere from the SIO2camera frustum.

_SIO2camera: A valid SIO2camera pointer.
_v: The position in world space, representing the pivot point of the sphere.
_r: The radius of the sphere.

return 0 if it is outside.
return 1 if it intersect the frustum.
return 2 if it is inside the frustum.

References SIO2camera::frustum, vec3::x, vec3::y, and vec3::z.

void sio2CameraUpdateFrustum ( SIO2camera _SIO2camera  ) 

Update the SIO2camera frustum information (6 clipping planes) based on the current SIO2camera modelview and projection matrix.

_SIO2camera: A valid SIO2camera pointer.

References SIO2camera::frustum, SIO2camera::mat_modelview, and SIO2camera::mat_projection.


Generated on Thu Mar 4 15:41:42 2010 for SIO2 Engine by  doxygen 1.5.6