Vuo  0.5.6
 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 (VuoGlContext glContext)
 Creates a reference-counted object for rendering a scenegraph.
 
void VuoSceneRenderer_prepareContext (VuoSceneRenderer sr)
 Sets up OpenGL state on the current GL Context.
 
void VuoSceneRenderer_regenerateProjectionMatrixInternal (VuoSceneRendererInternal *sceneRenderer)
 Helper for VuoSceneRenderer_regenerateProjectionMatrix and VuoSceneRenderer_draw.
 
void VuoSceneRenderer_regenerateProjectionMatrix (VuoSceneRenderer sr, unsigned int width, unsigned int height)
 Using the first camera found in the scene (or VuoSceneObject_makeDefaultCamera() if there is no camera in the scene), 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], VuoSceneRendererInternal *sceneRenderer)
 Draws so (using the uploaded object names in soi).
 
void VuoSceneRenderer_drawElement (VuoSceneObject so, float projectionMatrix[16], float compositeModelviewMatrix[16], VuoGlContext glContext, int element, float length)
 Draws all vertex normals in so.
 
void VuoSceneRenderer_drawSceneObjectsRecursively (VuoSceneObject so, VuoSceneRendererInternal_object *soi, float projectionMatrix[16], float modelviewMatrix[16], VuoSceneRendererInternal *sceneRenderer)
 Draws so and its child objects.
 
void VuoSceneRenderer_draw (VuoSceneRenderer sr)
 Renders the scene.
 
void VuoSceneRenderer_uploadSceneObject (VuoSceneObject so, VuoSceneRendererInternal_object *soi, VuoGlContext glContext)
 Uploads so to the GPU, and stores the uploaded object names in soi.
 
void VuoSceneRenderer_uploadSceneObjectsRecursively (VuoSceneObject so, VuoSceneRendererInternal_object *soi, VuoGlContext glContext)
 Uploads so and its child objects to the GPU, and stores the uploaded object names in soi.
 
void VuoSceneRenderer_cleanupSceneObject (VuoSceneObject so, VuoSceneRendererInternal_object *soi, VuoGlContext glContext)
 Releases the GPU objects created by VuoSceneRenderer_uploadSceneObject.
 
void VuoSceneRenderer_cleanupSceneObjectsRecursively (VuoSceneObject so, VuoSceneRendererInternal_object *soi, VuoGlContext glContext)
 Releases the GPU objects created by VuoSceneRenderer_uploadSceneObjectsRecursively.
 
void VuoSceneRenderer_releaseSceneObjectsRecursively (VuoSceneObject so)
 Releases the Vuo objects related to this scenegraph.
 
void VuoSceneRenderer_retainSceneObjectsRecursively (VuoSceneObject so)
 Deeply retains so.
 
void VuoSceneRenderer_setRootSceneObject (VuoSceneRenderer sr, VuoSceneObject rootSceneObject)
 Changes the scenegraph to be rendered.
 
void VuoSceneRenderer_switchContext (VuoSceneRenderer sr, VuoGlContext newGlContext)
 Changes the OpenGL context on which the scenegraph can be rendered.
 
void VuoSceneRenderer_setCameraName (VuoSceneRenderer sr, VuoText cameraName)
 Changes the name of the camera to look for.
 
void VuoSceneRenderer_renderToImage (VuoSceneRenderer sr, VuoImage *image, VuoImage *depthImage)
 Creates an OpenGL Framebuffer Object, and uses it to render the scene to image and depthImage.
 

Class Documentation

struct VuoSceneRendererInternal_vertices
Class Members
GLuint combinedBuffer
GLuint combinedBufferSize
GLuint elementBuffer
GLuint elementBufferSize
GLuint vertexArray
class VuoSceneRendererInternal_object
Class Members
list
< VuoSceneRendererInternal_object >
childObjects
list
< VuoSceneRendererInternal_vertices >
vertices
class VuoSceneRendererInternal
Class Members
VuoText cameraName
VuoGlContext glContext
bool needToRegenerateProjectionMatrix
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
unsigned int viewportHeight
unsigned int viewportWidth

Function Documentation

void VuoSceneRenderer_cleanupSceneObject ( VuoSceneObject  so,
VuoSceneRendererInternal_object soi,
VuoGlContext  glContext 
)

Releases the GPU objects created by VuoSceneRenderer_uploadSceneObject.

Does not traverse child objects.

Must be called while scenegraphSemaphore is locked.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

void VuoSceneRenderer_cleanupSceneObjectsRecursively ( VuoSceneObject  so,
VuoSceneRendererInternal_object soi,
VuoGlContext  glContext 
)

Releases the GPU objects created by VuoSceneRenderer_uploadSceneObjectsRecursively.

Must be called while scenegraphSemaphore is locked.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

void VuoSceneRenderer_destroy ( VuoSceneRenderer  sr)

Destroys and deallocates the scene renderer.

This function may be called from any thread.

void VuoSceneRenderer_draw ( VuoSceneRenderer  sr)

Renders the scene.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

void VuoSceneRenderer_drawElement ( VuoSceneObject  so,
float  projectionMatrix[16],
float  compositeModelviewMatrix[16],
VuoGlContext  glContext,
int  element,
float  length 
)

Draws all vertex normals in so.

Must be called while scenegraphSemaphore is locked.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

void VuoSceneRenderer_drawSceneObject ( VuoSceneObject  so,
VuoSceneRendererInternal_object soi,
float  projectionMatrix[16],
float  modelviewMatrix[16],
VuoSceneRendererInternal sceneRenderer 
)

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

Does not traverse child objects.

Must be called while scenegraphSemaphore is locked.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

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

Draws so and its child objects.

Must be called while scenegraphSemaphore is locked.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

VuoSceneRenderer VuoSceneRenderer_make ( VuoGlContext  glContext)

Creates a reference-counted object for rendering a scenegraph.

This function may be called from any thread.

void VuoSceneRenderer_prepareContext ( VuoSceneRenderer  sr)

Sets up OpenGL state on the current GL Context.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

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

Using the first camera found in the scene (or VuoSceneObject_makeDefaultCamera() if there is no camera in the scene), recalculates the projection matrix based on the specified viewport width and height.

This function may be called from any thread.

void VuoSceneRenderer_regenerateProjectionMatrixInternal ( VuoSceneRendererInternal sceneRenderer)

Helper for VuoSceneRenderer_regenerateProjectionMatrix and VuoSceneRenderer_draw.

Must be called while scenegraphSemaphore is locked.

void VuoSceneRenderer_releaseSceneObjectsRecursively ( VuoSceneObject  so)

Releases the Vuo objects related to this scenegraph.

Must be called while scenegraphSemaphore is locked.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

void VuoSceneRenderer_renderToImage ( VuoSceneRenderer  sr,
VuoImage image,
VuoImage depthImage 
)

Creates an OpenGL Framebuffer Object, and uses it to render the scene to image and depthImage.

void VuoSceneRenderer_retainSceneObjectsRecursively ( VuoSceneObject  so)

Deeply retains so.

Must be called while scenegraphSemaphore is locked.

This function may be called from any thread.

void VuoSceneRenderer_setCameraName ( VuoSceneRenderer  sr,
VuoText  cameraName 
)

Changes the name of the camera to look for.

The first camera whose name contains cameraName will be rendered (next time VuoSceneRenderer_draw() is called), or, if no camera matches, VuoSceneObject_makeDefaultCamera() will be used.

This function may be called from any thread.

void VuoSceneRenderer_setRootSceneObject ( VuoSceneRenderer  sr,
VuoSceneObject  rootSceneObject 
)

Changes the scenegraph to be rendered.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

void VuoSceneRenderer_switchContext ( VuoSceneRenderer  sr,
VuoGlContext  newGlContext 
)

Changes the OpenGL context on which the scenegraph can be rendered.

Requires use of both the old and new OpenGL contexts.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

void VuoSceneRenderer_uploadSceneObject ( VuoSceneObject  so,
VuoSceneRendererInternal_object soi,
VuoGlContext  glContext 
)

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

Does not traverse child objects.

Must be called while scenegraphSemaphore is locked.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

Todo:
https://b33p.net/kosada/node/6901
Todo:
https://b33p.net/kosada/node/6901
void VuoSceneRenderer_uploadSceneObjectsRecursively ( VuoSceneObject  so,
VuoSceneRendererInternal_object soi,
VuoGlContext  glContext 
)

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

Must be called while scenegraphSemaphore is locked.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)