Vuo  0.9.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Typedefs | Enumerations | Functions
VuoSceneObject

Description

A 3D Object: visible (mesh), or virtual (group, light, camera).

Classes

struct  VuoSceneObject
 A 3D Object: visible (mesh), or virtual (group, light, camera). More...
 

Typedefs

typedef struct VuoSceneObject VuoSceneObject
 A 3D Object: visible (mesh), or virtual (group, light, camera).
 

Enumerations

enum  VuoSceneObject_CameraType { VuoSceneObject_NotACamera, VuoSceneObject_PerspectiveCamera, VuoSceneObject_StereoCamera, VuoSceneObject_OrthographicCamera }
 The type of camera. More...
 
enum  VuoSceneObject_LightType { VuoSceneObject_NotALight, VuoSceneObject_AmbientLight, VuoSceneObject_PointLight, VuoSceneObject_Spotlight }
 The type of light. More...
 

Functions

bool VuoSceneObject_get (VuoText sceneURL, VuoSceneObject *scene, bool center, bool fit, bool hasLeftHandedCoordinates)
 Retrieves the scene at the specified sceneURL, creates a VuoSceneObject from it, and stores it in scene.
 
VuoReal VuoReal_valueFromJson (json_object *js)
 Decodes the JSON object js, expected to contain a double, to create a new value.
 
VuoSceneObject_CameraType VuoSceneObject_cameraTypeFromCString (const char *cameraTypeString)
 Returns the VuoSceneObject_CameraType corresponding with the string cameraTypeString.
 
const char * VuoSceneObject_cStringForCameraType (VuoSceneObject_CameraType cameraType)
 Returns a string constant representing cameraType.
 
VuoSceneObject VuoSceneObject_makeAmbientLight (VuoColor color, float brightness)
 Returns an ambient light with the specified color and brightness (typically between 0 and 1).
 
VuoSceneObject VuoSceneObject_makePointLight (VuoColor color, float brightness, VuoPoint3d position, float range, float sharpness)
 Returns a point light (uniform emission in all directions).
 
VuoSceneObject VuoSceneObject_makeSpotlight (VuoColor color, float brightness, VuoTransform transform, float cone, float range, float sharpness)
 Returns a spot light (emists only in the specified direction).
 
VuoSceneObject_LightType VuoSceneObject_lightTypeFromCString (const char *lightTypeString)
 Returns the VuoSceneObject_LightType corresponding with the string lightTypeString.
 
const char * VuoSceneObject_cStringForLightType (VuoSceneObject_LightType lightType)
 Returns a string constant representing lightType.
 
VuoSceneObject VuoSceneObject_valueFromJson (json_object *js)
 Decodes the JSON object js to create a new value.
 
json_object * VuoSceneObject_jsonFromValue (const VuoSceneObject value)
 Encodes value as a JSON object.
 
char * VuoSceneObject_summaryFromValue (const VuoSceneObject value)
 Produces a brief human-readable summary of value.
 
VuoSceneObject VuoSceneObject_makeEmpty (void)
 Creates a new, empty scene object.
 
VuoSceneObject VuoSceneObject_make (VuoMesh mesh, VuoShader shader, VuoTransform transform, VuoList_VuoSceneObject childObjects)
 Creates a visible (mesh) scene object.
 
VuoSceneObject VuoSceneObject_makeQuad (VuoShader shader, VuoPoint3d center, VuoPoint3d rotation, VuoReal width, VuoReal height)
 Returns a scene object that renders a quad with the specified shader.
 
VuoSceneObject VuoSceneObject_makeQuadWithNormals (VuoShader shader, VuoPoint3d center, VuoPoint3d rotation, VuoReal width, VuoReal height)
 Returns a scene object that renders a quad with the specified shader.
 
VuoSceneObject VuoSceneObject_makeImage (VuoImage image, VuoPoint3d center, VuoPoint3d rotation, VuoReal width, VuoReal alpha)
 Returns an unlit scene object with the specified image.
 
VuoSceneObject VuoSceneObject_makeLitImage (VuoImage image, VuoPoint3d center, VuoPoint3d rotation, VuoReal width, VuoReal alpha, VuoColor highlightColor, VuoReal shininess)
 Returns a lit scene object with the specified image.
 
VuoSceneObject VuoSceneObject_makeCube (VuoTransform transform, VuoShader frontShader, VuoShader leftShader, VuoShader rightShader, VuoShader backShader, VuoShader topShader, VuoShader bottomShader)
 Returns a scene object consisting of 6 child objects (square quads), each with its own shader.
 
VuoSceneObject VuoSceneObject_makePerspectiveCamera (VuoText name, VuoTransform transform, float fieldOfView, float distanceMin, float distanceMax)
 Returns a perspective camera having the position and negative-rotation specified by transform (its scale is ignored).
 
VuoSceneObject VuoSceneObject_makeStereoCamera (VuoText name, VuoTransform transform, VuoReal fieldOfView, VuoReal distanceMin, VuoReal distanceMax, VuoReal confocalDistance, VuoReal intraocularDistance)
 Returns a stereoscopic camera having the position and negative-rotation specified by transform (its scale is ignored).
 
VuoSceneObject VuoSceneObject_makeOrthographicCamera (VuoText name, VuoTransform transform, float width, float distanceMin, float distanceMax)
 Returns an orthographic camera having the position and negative-rotation specified by transform (its scale is ignored).
 
VuoSceneObject VuoSceneObject_makeDefaultCamera (void)
 Returns a perspective camera at (0,0,1), facing along -z, 90 degree FOV, and clip planes at 0.1 and 10.0.
 
bool VuoSceneObject_find (VuoSceneObject so, VuoText nameToMatch, VuoList_VuoSceneObject parentObjects, VuoSceneObject *foundObject)
 Searches the scenegraph (depth-first) for a scene object with the given name.
 
VuoSceneObject VuoSceneObject_findCamera (VuoSceneObject so, VuoText nameToMatch, bool *foundCamera)
 Performs a depth-first search of the scenegraph.
 
void VuoSceneObject_findLights (VuoSceneObject so, VuoColor *ambientColor, float *ambientBrightness, VuoList_VuoSceneObject *pointLights, VuoList_VuoSceneObject *spotLights)
 Finds and returns all the lights in the scene.
 
void VuoSceneObject_visit (VuoSceneObject object, void(^function)(VuoSceneObject currentObject))
 Applies function to object and its child objects, without preserving changes to objects.
 
void VuoSceneObject_apply (VuoSceneObject *object, void(^function)(VuoSceneObject *currentObject, float modelviewMatrix[16]))
 Applies function to object and its child objects, and outputs the modified object.
 
void VuoSceneObject_setFaceCullingMode (VuoSceneObject *object, unsigned int faceCullingMode)
 Sets the faceCullingMode on object and its child objects.
 
void VuoSceneObject_setBlendMode (VuoSceneObject *object, VuoBlendMode blendMode)
 Sets the blendMode on object and its child objects.
 
VuoSceneObject VuoSceneObject_copy (const VuoSceneObject object)
 Makes a deep copy of object.
 
VuoBox VuoSceneObject_bounds (const VuoSceneObject so)
 Get the axis aligned bounding box of this sceneobject and it's children.
 
bool VuoSceneObject_meshBounds (const VuoSceneObject so, VuoBox *bounds, float matrix[16])
 Bounding box of the vertices for this SceneObject (taking into account transform).
 
void VuoSceneObject_normalize (VuoSceneObject *so)
 Change the root sceneobject's transform such that the entire scenegraph renders within a 1x1x1 axis-aligned cube.
 
void VuoSceneObject_center (VuoSceneObject *so)
 Make the bounds center of all vertices == {0,0,0}.
 
void VuoSceneObject_dump (const VuoSceneObject so)
 Outputs information about the sceneobject (and its descendants).
 
unsigned long VuoSceneObject_getVertexCount (const VuoSceneObject value)
 Returns the total number of vertices in the scene object (but not its descendants).
 
VuoSceneObject VuoSceneObject_valueFromString (const char *str)
 Automatically generated function.
 
char * VuoSceneObject_stringFromValue (const VuoSceneObject value)
 Automatically generated function.
 
void VuoSceneObject_retain (VuoSceneObject value)
 Automatically generated function.
 
void VuoSceneObject_release (VuoSceneObject value)
 Automatically generated function.
 

Class Documentation

struct VuoSceneObject
Class Members
VuoBlendMode blendMode
float cameraConfocalDistance Distance from camera to stereoscopic confocal plane.
float cameraDistanceMax Distance from camera to far clip plane.
float cameraDistanceMin Distance from camera to near clip plane.
float cameraFieldOfView Perspective FOV, in degrees.
float cameraIntraocularDistance Distance between the stereoscopic camera pair.
VuoSceneObject_CameraType cameraType
float cameraWidth Orthographic width, in scene coordinates.
VuoList_VuoSceneObject childObjects
bool isRealSize If the object is real-size, it ignores rotations and scales, and is sized to match the shader's first image.
float lightBrightness
VuoColor lightColor
float lightCone Size (in radians) of the light's cone. Affects spotlights.
float lightRange Distance (in local coordinates) the light reaches. Affects point lights and spotlights.
float lightSharpness Sharpness of the light's distance/cone falloff. 0 means the light starts fading at distance/angle 0 and ends at 2*lightRange or 2*lightCone. 1 means the falloff is instant.
VuoSceneObject_LightType lightType
VuoMesh mesh
VuoText name
VuoShader shader
VuoTransform transform

Typedef Documentation

A 3D Object: visible (mesh), or virtual (group, light, camera).

Enumeration Type Documentation

The type of camera.

The type of light.

Function Documentation

VuoReal VuoReal_valueFromJson ( json_object *  js)

Decodes the JSON object js, expected to contain a double, to create a new value.

void VuoSceneObject_apply ( VuoSceneObject object,
void(^)(VuoSceneObject *currentObject, float modelviewMatrix[16])  function 
)

Applies function to object and its child objects, and outputs the modified object.

The value modelviewMatrix (which VuoSceneObject_apply passes to function) is the cumulative transformation matrix (from object down to the currentObject).

VuoBox VuoSceneObject_bounds ( const VuoSceneObject  so)

Get the axis aligned bounding box of this sceneobject and it's children.

VuoSceneObject_CameraType VuoSceneObject_cameraTypeFromCString ( const char *  cameraTypeString)

Returns the VuoSceneObject_CameraType corresponding with the string cameraTypeString.

If none matches, returns VuoSceneObject_NotACamera.

void VuoSceneObject_center ( VuoSceneObject so)

Make the bounds center of all vertices == {0,0,0}.

VuoSceneObject VuoSceneObject_copy ( const VuoSceneObject  object)

Makes a deep copy of object.

Each mesh is copied (see VuoMesh_copy), and each child object is copied.

You can change attributes on the copy without affecting the original.

Todo:
The shaders are not copied, so changes to the copy's shaders will affect both the original and the copy.
const char* VuoSceneObject_cStringForCameraType ( VuoSceneObject_CameraType  cameraType)

Returns a string constant representing cameraType.

const char* VuoSceneObject_cStringForLightType ( VuoSceneObject_LightType  lightType)

Returns a string constant representing lightType.

void VuoSceneObject_dump ( const VuoSceneObject  so)

Outputs information about the sceneobject (and its descendants).

bool VuoSceneObject_find ( VuoSceneObject  so,
VuoText  nameToMatch,
VuoList_VuoSceneObject  ancestorObjects,
VuoSceneObject foundObject 
)

Searches the scenegraph (depth-first) for a scene object with the given name.

Parameters
soThe root object of the scenegraph to search.
nameToMatchThe name to search for.
[out]ancestorObjectsThe ancestors of foundObject, starting with the root of the scenegraph.
[out]foundObjectThe first matching scene object found.
Returns
True if a matching scene object was found.
VuoSceneObject VuoSceneObject_findCamera ( VuoSceneObject  so,
VuoText  nameToMatch,
bool *  foundCamera 
)

Performs a depth-first search of the scenegraph.

Returns the first camera whose name contains nameToMatch (or, if nameToMatch is emptystring, just returns the first camera), with its transform altered to incorporate the transforms of its ancestor objects. Output paramater foundCamera indicates whether a camera was found. If no camera was found, returns VuoSceneObject_makeDefaultCamera().

void VuoSceneObject_findLights ( VuoSceneObject  so,
VuoColor ambientColor,
float *  ambientBrightness,
VuoList_VuoSceneObject pointLights,
VuoList_VuoSceneObject spotLights 
)

Finds and returns all the lights in the scene.

If there are multiple ambient lights, returns the weighted (by alpha) average color and summed brightness.

If there are no lights in the scene, returns some default lights.

bool VuoSceneObject_get ( VuoText  sceneURL,
VuoSceneObject scene,
bool  center,
bool  fit,
bool  hasLeftHandedCoordinates 
)

Retrieves the scene at the specified sceneURL, creates a VuoSceneObject from it, and stores it in scene.

Returns false if the scene could not be loaded.

Todo:
load and blend multiple diffuse textures
unsigned long VuoSceneObject_getVertexCount ( const VuoSceneObject  value)

Returns the total number of vertices in the scene object (but not its descendants).

struct json_object * VuoSceneObject_jsonFromValue ( const VuoSceneObject  value)
read

Encodes value as a JSON object.

VuoSceneObject_LightType VuoSceneObject_lightTypeFromCString ( const char *  lightTypeString)

Returns the VuoSceneObject_LightType corresponding with the string lightTypeString.

If none matches, returns VuoSceneObject_NotALight.

VuoSceneObject VuoSceneObject_make ( VuoMesh  mesh,
VuoShader  shader,
VuoTransform  transform,
VuoList_VuoSceneObject  childObjects 
)

Creates a visible (mesh) scene object.

VuoSceneObject VuoSceneObject_makeAmbientLight ( VuoColor  color,
float  brightness 
)

Returns an ambient light with the specified color and brightness (typically between 0 and 1).

VuoSceneObject VuoSceneObject_makeCube ( VuoTransform  transform,
VuoShader  frontShader,
VuoShader  leftShader,
VuoShader  rightShader,
VuoShader  backShader,
VuoShader  topShader,
VuoShader  bottomShader 
)

Returns a scene object consisting of 6 child objects (square quads), each with its own shader.

VuoSceneObject VuoSceneObject_makeDefaultCamera ( void  )

Returns a perspective camera at (0,0,1), facing along -z, 90 degree FOV, and clip planes at 0.1 and 10.0.

VuoSceneObject VuoSceneObject_makeEmpty ( void  )

Creates a new, empty scene object.

VuoSceneObject VuoSceneObject_makeImage ( VuoImage  image,
VuoPoint3d  center,
VuoPoint3d  rotation,
VuoReal  width,
VuoReal  alpha 
)

Returns an unlit scene object with the specified image.

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.)

VuoSceneObject VuoSceneObject_makeLitImage ( VuoImage  image,
VuoPoint3d  center,
VuoPoint3d  rotation,
VuoReal  width,
VuoReal  alpha,
VuoColor  highlightColor,
VuoReal  shininess 
)

Returns a lit scene object with the specified image.

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.)

VuoSceneObject VuoSceneObject_makeOrthographicCamera ( VuoText  name,
VuoTransform  transform,
float  width,
float  distanceMin,
float  distanceMax 
)

Returns an orthographic camera having the position and negative-rotation specified by transform (its scale is ignored).

VuoSceneObject VuoSceneObject_makePerspectiveCamera ( VuoText  name,
VuoTransform  transform,
float  fieldOfView,
float  distanceMin,
float  distanceMax 
)

Returns a perspective camera having the position and negative-rotation specified by transform (its scale is ignored).

VuoSceneObject VuoSceneObject_makePointLight ( VuoColor  color,
float  brightness,
VuoPoint3d  position,
float  range,
float  sharpness 
)

Returns a point light (uniform emission in all directions).

Parameters
colorThe light's color.
brightnessThe light's brightness multiplier (typically between 0 and 1).
positionThe light's position.
rangeThe distance (in local coordinates) the light reaches.
sharpnessThe sharpness of the light's distance falloff. 0 means the light starts fading at distance 0 and ends at 2*lightRange. 1 means the falloff is instant.
VuoSceneObject VuoSceneObject_makeQuad ( VuoShader  shader,
VuoPoint3d  center,
VuoPoint3d  rotation,
VuoReal  width,
VuoReal  height 
)

Returns a scene object that renders a quad with the specified shader.

The quad does not include normals, tangents, or bitangents.

Parameters
shaderThe shader used to render the object.
centerThe object's center, specified in scene coordinates.
rotationThe object's rotation, specified in degrees.
widthThe object's width, specified in scene coordinates.
heightThe object's height, specified in scene coordinates.
Returns
The quad scene object.

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.)

VuoSceneObject VuoSceneObject_makeQuadWithNormals ( VuoShader  shader,
VuoPoint3d  center,
VuoPoint3d  rotation,
VuoReal  width,
VuoReal  height 
)

Returns a scene object that renders a quad with the specified shader.

The quad includes normals, tangents, or bitangents.

Parameters
shaderThe shader used to render the object.
centerThe object's center, specified in scene coordinates.
rotationThe object's rotation, specified in degrees.
widthThe object's width, specified in scene coordinates.
heightThe object's height, specified in scene coordinates.
Returns
The quad scene object.

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.)

VuoSceneObject VuoSceneObject_makeSpotlight ( VuoColor  color,
float  brightness,
VuoTransform  transform,
float  cone,
float  range,
float  sharpness 
)

Returns a spot light (emists only in the specified direction).

Parameters
colorThe light's color.
brightnessThe light's brightness multiplier (typically between 0 and 1).
transformThe position and direction of the light. (The transform's scale is ignored.)
coneWidth (in radians) of the light's cone.
rangeThe distance (in local coordinates) the light reaches.
sharpnessThe sharpness of the light's distance/cone falloff. 0 means the light starts fading at distance/angle 0 and ends at 2*range or 2*cone. 1 means the falloff is instant.
VuoSceneObject VuoSceneObject_makeStereoCamera ( VuoText  name,
VuoTransform  transform,
VuoReal  fieldOfView,
VuoReal  distanceMin,
VuoReal  distanceMax,
VuoReal  confocalDistance,
VuoReal  intraocularDistance 
)

Returns a stereoscopic camera having the position and negative-rotation specified by transform (its scale is ignored).

bool VuoSceneObject_meshBounds ( const VuoSceneObject  so,
VuoBox bounds,
float  matrix[16] 
)

Bounding box of the vertices for this SceneObject (taking into account transform).

void VuoSceneObject_normalize ( VuoSceneObject so)

Change the root sceneobject's transform such that the entire scenegraph renders within a 1x1x1 axis-aligned cube.

If the scenegraph has zero size (e.g., if it is empty, or if it consists entirely of Real Size Layers), the transform is left unchanged.

void VuoSceneObject_release ( VuoSceneObject  value)

Automatically generated function.

void VuoSceneObject_retain ( VuoSceneObject  value)

Automatically generated function.

void VuoSceneObject_setBlendMode ( VuoSceneObject object,
VuoBlendMode  blendMode 
)
void VuoSceneObject_setFaceCullingMode ( VuoSceneObject object,
unsigned int  faceCullingMode 
)

Sets the faceCullingMode on object and its child objects.

faceCullingMode can be GL_NONE (show both front and back faces), GL_BACK (show only front faces), or GL_FRONT (show only back faces).

char* VuoSceneObject_stringFromValue ( const VuoSceneObject  value)

Automatically generated function.

char * VuoSceneObject_summaryFromValue ( const VuoSceneObject  value)

Produces a brief human-readable summary of value.

VuoSceneObject VuoSceneObject_valueFromJson ( json_object *  js)

Decodes the JSON object js to create a new value.

Example:
{
"mesh" : ... ,
"shader" : ... ,
"isRealSize" : false,
"childObjects" : ...,
"transform" : ...
}
Example:
{
"cameraType" : "perspective",
"cameraFieldOfView" : 90.0,
"cameraDistanceMin" : 0.1,
"cameraDistanceMax" : 10.0,
"name" : ...,
"transform" : ...
}
VuoSceneObject VuoSceneObject_valueFromString ( const char *  str)

Automatically generated function.

void VuoSceneObject_visit ( VuoSceneObject  object,
void(^)(VuoSceneObject currentObject)  function 
)

Applies function to object and its child objects, without preserving changes to objects.