Vuo  0.5.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
VuoSceneRenderer.cc File Reference

Description

VuoSceneRenderer implementation.

Classes

struct  VuoSceneRendererInternal_vertices
 GL Objects corresponding with a VuoVertices instance. More...
 
class  VuoSceneRendererInternal_object
 GL Objects corresponding with a VuoSceneObject instance. More...
 
class  VuoSceneRendererInternal
 Internal state data for a VuoSceneRenderer instance. More...
 

Macros

#define glGenVertexArrays   glGenVertexArraysAPPLE
 
#define glBindVertexArray   glBindVertexArrayAPPLE
 
#define glDeleteVertexArrays   glDeleteVertexArraysAPPLE
 

Functions

void VuoSceneRenderer_destroy (VuoSceneRenderer sr)
 Destroys and deallocates the scene renderer.
 
VuoSceneRenderer VuoSceneRenderer_make (void)
 Creates a reference-counted object for rendering a scenegraph.
 
void VuoSceneRenderer_prepareContext (VuoSceneRenderer sceneRenderer)
 Sets up OpenGL state on the current GL Context.
 
void VuoSceneRenderer_regenerateProjectionMatrix (VuoSceneRenderer sr, unsigned int width, unsigned int height)
 Recalculates the projection matrix based on the specified viewport width and height.
 
void VuoSceneRenderer_drawSceneObject (VuoSceneObject so, VuoSceneRendererInternal_object *soi, float projectionMatrix[16], float modelviewMatrix[16])
 Draws so (using the uploaded object names in soi).
 
void VuoSceneRenderer_drawSceneObjectsRecursively (VuoSceneObject so, VuoSceneRendererInternal_object *soi, float projectionMatrix[16], float modelviewMatrix[16])
 Draws so and its child objects.
 
void VuoSceneRenderer_draw (VuoSceneRenderer sr)
 Renders the scene.
 
void VuoSceneRenderer_drawElement (VuoSceneRenderer sr, int element, float length)
 Draws all vertex normals in sceneRenderer-rootSceneObject.
 
void VuoSceneRenderer_uploadSceneObject (VuoSceneObject so, VuoSceneRendererInternal_object *soi)
 Uploads so to the GPU, and stores the uploaded object names in soi.
 
void VuoSceneRenderer_uploadSceneObjectsRecursively (VuoSceneObject so, VuoSceneRendererInternal_object *soi)
 Uploads so and its child objects to the GPU, and stores the uploaded object names in soi.
 
void VuoSceneRenderer_releaseSceneObject (VuoSceneObject so, VuoSceneRendererInternal_object *soi)
 Releases the GPU objects created by VuoSceneRenderer_uploadSceneObject.
 
void VuoSceneRenderer_releaseSceneObjectsRecursively (VuoSceneObject so, VuoSceneRendererInternal_object *soi)
 Releases the GPU objects created by VuoSceneRenderer_uploadSceneObjectsRecursively.
 
void VuoSceneRenderer_retainSceneObjectsRecursively (VuoSceneObject so)
 Deeply retains so.
 
void VuoSceneRenderer_setRootSceneObject (VuoSceneRenderer sr, VuoSceneObject rootSceneObject)
 Changes the scenegraph to be rendered.
 

Class Documentation

struct VuoSceneRendererInternal_vertices
Class Members
GLuint bitangentBuffer
GLuint elementBuffer
GLuint normalBuffer
GLuint positionBuffer
GLuint tangentBuffer
GLuint textureCoordinateBuffer
GLuint vertexArray
class VuoSceneRendererInternal_object
Class Members
list
< VuoSceneRendererInternal_object >
childObjects
list
< VuoSceneRendererInternal_vertices >
vertices
class VuoSceneRendererInternal
Class Members
float projectionMatrix[16] Column-major 4x4 matrix.
VuoSceneObject rootSceneObject
VuoSceneRendererInternal_object rootSceneObjectInternal
dispatch_semaphore_t scenegraphSemaphore Serializes access to other data in this structure.
bool scenegraphValid

Macro Definition Documentation

#define glBindVertexArray   glBindVertexArrayAPPLE
Todo:
After we drop 10.6 support, switch back to gl3 and remove the below 4 lines. See also r15430 for shader changes.
#define glDeleteVertexArrays   glDeleteVertexArraysAPPLE
Todo:
After we drop 10.6 support, switch back to gl3 and remove the below 4 lines. See also r15430 for shader changes.
#define glGenVertexArrays   glGenVertexArraysAPPLE
Todo:
After we drop 10.6 support, switch back to gl3 and remove the below 4 lines. See also r15430 for shader changes.

Function Documentation

void VuoSceneRenderer_destroy ( VuoSceneRenderer  sr)

Destroys and deallocates the scene renderer.

May be called from any thread (automatically uses and disuses a GL Context).

void VuoSceneRenderer_draw ( VuoSceneRenderer  sr)

Renders the scene.

Must be called from a thread with an active GL Context.

void VuoSceneRenderer_drawElement ( VuoSceneRenderer  sr,
int  element,
float  length 
)

Draws all vertex normals in sceneRenderer-rootSceneObject.

Must be called from a thread with an active GL Context.

Todo:
update VuoSceneRenderer_draw() to call this for each VuoSceneObject when debugging
void VuoSceneRenderer_drawSceneObject ( VuoSceneObject  so,
VuoSceneRendererInternal_object soi,
float  projectionMatrix[16],
float  modelviewMatrix[16] 
)

Draws so (using the uploaded object names in soi).

Does not traverse child objects.

Must be called from a thread with an active GL Context.

void VuoSceneRenderer_drawSceneObjectsRecursively ( VuoSceneObject  so,
VuoSceneRendererInternal_object soi,
float  projectionMatrix[16],
float  modelviewMatrix[16] 
)

Draws so and its child objects.

Must be called from a thread with an active GL Context.

VuoSceneRenderer VuoSceneRenderer_make ( void  )

Creates a reference-counted object for rendering a scenegraph.

May be called from any thread (doesn't require a GL Context).

void VuoSceneRenderer_prepareContext ( VuoSceneRenderer  sceneRenderer)

Sets up OpenGL state on the current GL Context.

Must be called from a thread with an active GL Context.

void VuoSceneRenderer_regenerateProjectionMatrix ( VuoSceneRenderer  sr,
unsigned int  width,
unsigned int  height 
)

Recalculates the projection matrix based on the specified viewport width and height.

May be called from any thread (doesn't require a GL Context).

Todo:
Where to place clip planes?
void VuoSceneRenderer_releaseSceneObject ( VuoSceneObject  so,
VuoSceneRendererInternal_object soi 
)

Releases the GPU objects created by VuoSceneRenderer_uploadSceneObject.

Does not traverse child objects.

Must be called from a thread with an active GL Context.

void VuoSceneRenderer_releaseSceneObjectsRecursively ( VuoSceneObject  so,
VuoSceneRendererInternal_object soi 
)

Releases the GPU objects created by VuoSceneRenderer_uploadSceneObjectsRecursively.

Must be called from a thread with an active GL Context.

void VuoSceneRenderer_retainSceneObjectsRecursively ( VuoSceneObject  so)

Deeply retains so.

May be called from any thread (doesn't require a GL Context).

void VuoSceneRenderer_setRootSceneObject ( VuoSceneRenderer  sr,
VuoSceneObject  rootSceneObject 
)

Changes the scenegraph to be rendered.

May be called from any thread (automatically uses and disuses a GL Context).

void VuoSceneRenderer_uploadSceneObject ( VuoSceneObject  so,
VuoSceneRendererInternal_object soi 
)

Uploads so to the GPU, and stores the uploaded object names in soi.

Does not traverse child objects.

Must be called from a thread with an active GL Context.

void VuoSceneRenderer_uploadSceneObjectsRecursively ( VuoSceneObject  so,
VuoSceneRendererInternal_object soi 
)

Uploads so and its child objects to the GPU, and stores the uploaded object names in soi.

Must be called from a thread with an active GL Context.