Vuo  2.3.2
Classes | Macros | Enumerations | Functions

Description

Vertices representing a 3D object.

Classes

struct  VuoMesh
 A 3D mesh, consisting of CPU and/or GPU data describing a list of elements (positions; and optionally normals, texture coordinates, and colors) which represent points or are assembled into lines or triangles. More...
 

Macros

#define VuoMesh_REQUIRES_INTERPROCESS_JSON
 This type has a _getInterprocessJson() function. More...
 

Enumerations

enum  VuoMesh_ElementAssemblyMethod {
  VuoMesh_IndividualTriangles , VuoMesh_TriangleStrip , VuoMesh_TriangleFan , VuoMesh_IndividualLines ,
  VuoMesh_LineStrip , VuoMesh_Points
}
 The way in which an elements array should be interpreted during rasterization. More...
 
enum  VuoMesh_FaceCulling { VuoMesh_CullNone , VuoMesh_CullBackfaces , VuoMesh_CullFrontfaces }
 Which triangles to render. More...
 

Functions

VuoMesh_ElementAssemblyMethod VuoMesh_elementAssemblyMethodFromCString (const char *elementAssemblyMethodString)
 Returns the VuoMesh_ElementAssemblyMethod corresponding with the string elementAssemblyMethodString. More...
 
VuoMesh VuoMesh_makeFromJson (json_object *js)
 Decodes the JSON object js to create a new value. More...
 
json_objectVuoMesh_getJson (const VuoMesh value)
 Encodes value as a JSON object. More...
 
json_objectVuoMesh_getInterprocessJson (const VuoMesh value)
 Calls VuoMesh_getJson(). More...
 
char * VuoMesh_getSummary (const VuoMesh mesh)
 Returns a brief summary of the contents of this mesh. More...
 
VuoMesh VuoMesh_makeQuad (void)
 Returns a quad with dimensions 1x1, on the XY plane, centered at the origin. More...
 
VuoMesh VuoMesh_makeQuadWithoutNormals (void)
 Returns a quad with dimensions 1x1, on the XY plane, centered at the origin. More...
 
VuoMesh VuoMesh_makeEquilateralTriangle (void)
 Returns an equilateral triangle with bottom edge length 1, pointing upward on the XY plane, centered at the origin. More...
 
VuoMesh VuoMesh_makeCube (void)
 Returns a cube of size 1x1. More...
 
VuoMesh VuoMesh_makePlane (VuoInteger columns, VuoInteger rows)
 Creates a flat mesh subdivided into rows and columns. More...
 
VuoMesh VuoMesh_make_VuoPoint2d (VuoList_VuoPoint2d positions, VuoList_VuoColor colors, VuoMesh_ElementAssemblyMethod elementAssemblyMethod, VuoReal primitiveSize)
 Returns a VuoMesh consisting of the given positions and element assembly method. More...
 
VuoMesh VuoMesh_make_VuoPoint3d (VuoList_VuoPoint3d positions, VuoList_VuoColor colors, VuoMesh_ElementAssemblyMethod elementAssemblyMethod, VuoReal primitiveSize)
 Returns a VuoMesh consisting of the given positions and element assembly method. More...
 
void VuoMesh_allocateCPUBuffers (unsigned int vertexCount, float **positions, float **normals, float **textureCoordinates, float **colors, unsigned int elementCount, unsigned int **elements)
 Allocates: More...
 
VuoMesh VuoMesh_makeFromCPUBuffers (unsigned int vertexCount, float *positions, float *normals, float *textureCoordinates, float *colors, unsigned int elementCount, unsigned int *elements, VuoMesh_ElementAssemblyMethod elementAssemblyMethod)
 Creates a mesh consisting of data that already exists in CPU RAM, and uploads it to the GPU. More...
 
VuoMesh VuoMesh_makeFromGPUBuffers (unsigned int vertexCount, unsigned int combinedBuffer, unsigned int combinedBufferSize, void *normalOffset, void *textureCoordinateOffset, void *colorOffset, unsigned int elementCount, unsigned int elementBuffer, unsigned int elementBufferSize, VuoMesh_ElementAssemblyMethod elementAssemblyMethod)
 Creates a VuoSubmesh consisting of data that's already been uploaded to the GPU. More...
 
VuoMesh VuoMesh_copy (const VuoMesh mesh)
 Duplicates the mesh's CPU data, and retains the mesh's GPU data. More...
 
VuoMesh VuoMesh_copyShallow (const VuoMesh mesh)
 Makes a shallow copy of the mesh and its submeshes. More...
 
void VuoMesh_removeTextureCoordinates (VuoMesh mesh)
 Deallocates and clears the texture coordinate arrays associated with this mesh. More...
 
void VuoMesh_getCPUBuffers (const VuoMesh mesh, unsigned int *vertexCount, float **positions, float **normals, float **textureCoordinates, float **colors, unsigned int *elementCount, unsigned int **elements)
 Outputs vertex and element information, downloading the data from the GPU if needed. More...
 
void VuoMesh_getGPUBuffers (const VuoMesh mesh, unsigned int *vertexCount, unsigned int *combinedBuffer, void **normalOffset, void **textureCoordinateOffset, void **colorOffset, unsigned int *elementCount, unsigned int *elementBuffer)
 Outputs OpenGL vertex and element buffer information, uploading the data to the GPU if needed. More...
 
VuoMesh_ElementAssemblyMethod VuoMesh_getElementAssemblyMethod (const VuoMesh mesh)
 Returns the mesh's element assembly method. More...
 
VuoMesh_FaceCulling VuoMesh_getFaceCulling (const VuoMesh mesh)
 Returns the mesh's face culling mode. More...
 
unsigned int VuoMesh_getFaceCullingGL (const VuoMesh mesh)
 Returns the OpenGL enum value for the mesh's face culling mode. More...
 
VuoReal VuoMesh_getPrimitiveSize (const VuoMesh mesh)
 Returns the size, in Vuo Coordinates, at which lines and points should be rendered. More...
 
unsigned long VuoMesh_getGlMode (const VuoMesh mesh)
 Returns the GL mode (e.g., GL_TRIANGLES) that the mesh should be interpreted as. More...
 
unsigned long VuoMesh_getSplitPrimitiveCount (const VuoMesh mesh)
 Returns the number of split primitives in the mesh. More...
 
unsigned long VuoMesh_getSplitVertexCount (const VuoMesh mesh)
 Returns the number of split vertices in the mesh. More...
 
unsigned long VuoMesh_getCompleteElementCount (const VuoMesh mesh)
 Returns the number of complete elements in the mesh. More...
 
unsigned int VuoMesh_getElementBufferSize (const VuoMesh mesh)
 Returns the size, in bytes, of the GPU element buffer. More...
 
void VuoMesh_setCPUBuffers (VuoMesh mesh, unsigned int vertexCount, float *positions, float *normals, float *textureCoordinates, float *colors, unsigned int elementCount, unsigned int *elements)
 Changes the mesh's CPU buffers, and uploads them to the GPU. More...
 
void VuoMesh_setFaceCulling (VuoMesh mesh, VuoMesh_FaceCulling faceCulling)
 Changes the mesh's face culling mode. More...
 
void VuoMesh_setPrimitiveSize (VuoMesh mesh, VuoReal primitiveSize)
 Changes the size, in Vuo Coordinates, at which lines and points should be rendered. More...
 
const char * VuoMesh_cStringForElementAssemblyMethod (VuoMesh_ElementAssemblyMethod elementAssemblyMethod)
 Returns a string constant representing elementAssemblyMethod. More...
 
VuoBox VuoMesh_bounds (const VuoMesh mesh, float matrix[16])
 Finds the mesh's center and axis-aligned extents, taking into account the passed transform. More...
 
bool VuoMesh_isPopulated (const VuoMesh mesh)
 Returns true if the mesh has any vertices. More...
 
static VuoMesh_ElementAssemblyMethod VuoMesh_getExpandedPrimitiveMode (const VuoMesh_ElementAssemblyMethod inputMode)
 For a given element assembly method, returns the equivalent assembly method for individual elements (i.e., after they've been expanded from strips/fans). More...
 
VuoMesh VuoMesh_makeFromString (const char *str)
 Automatically generated function. More...
 
char * VuoMesh_getString (const VuoMesh value)
 Automatically generated function. More...
 
void VuoMesh_retain (const VuoMesh v)
 Automatically generated function. More...
 
void VuoMesh_release (const VuoMesh v)
 Automatically generated function. More...
 

Class Documentation

◆ VuoMesh

struct VuoMesh
Class Members
void * l

Macro Definition Documentation

◆ VuoMesh_REQUIRES_INTERPROCESS_JSON

#define VuoMesh_REQUIRES_INTERPROCESS_JSON

This type has a _getInterprocessJson() function.

Definition at line 121 of file VuoMesh.h.

Enumeration Type Documentation

◆ VuoMesh_ElementAssemblyMethod

The way in which an elements array should be interpreted during rasterization.

Enumerator
VuoMesh_IndividualTriangles 

GL_TRIANGLES, requires elementCount % 3 == 0.

VuoMesh_TriangleStrip 

GL_TRIANGLE_STRIP, requires elementCount >= 3.

VuoMesh_TriangleFan 

GL_TRIANGLE_FAN, requires elementCount >= 3.

VuoMesh_IndividualLines 

GL_LINES, requires elementCount % 2 == 0.

VuoMesh_LineStrip 

GL_LINE_STRIP, requires elementCount >= 2.

VuoMesh_Points 

GL_POINTS.

Definition at line 31 of file VuoMesh.h.

◆ VuoMesh_FaceCulling

Which triangles to render.

Enumerator
VuoMesh_CullNone 

Render all triangles.

VuoMesh_CullBackfaces 

Cull backward-facing triangles.

VuoMesh_CullFrontfaces 

Cull forward-facing triangles.

Definition at line 43 of file VuoMesh.h.

Function Documentation

◆ VuoMesh_allocateCPUBuffers()

void VuoMesh_allocateCPUBuffers ( unsigned int  vertexCount,
float **  positions,
float **  normals,
float **  textureCoordinates,
float **  colors,
unsigned int  elementCount,
unsigned int **  elements 
)

Allocates:

  • positions — 3 floats per vertex
  • normals — 3 floats per vertex
  • texture coordinates — 2 floats per vertex
  • colors — 4 floats per vertex
  • elements — 1 unsigned int per element
Changed in Vuo 2.0.0:
New.

Definition at line 105 of file VuoMesh.c.

◆ VuoMesh_bounds()

VuoBox VuoMesh_bounds ( const VuoMesh  mesh,
float  matrix[16] 
)

Finds the mesh's center and axis-aligned extents, taking into account the passed transform.

Definition at line 1419 of file VuoMesh.c.

◆ VuoMesh_copy()

VuoMesh VuoMesh_copy ( const VuoMesh  mesh)

Duplicates the mesh's CPU data, and retains the mesh's GPU data.

Definition at line 956 of file VuoMesh.c.

◆ VuoMesh_copyShallow()

VuoMesh VuoMesh_copyShallow ( const VuoMesh  mesh)

Makes a shallow copy of the mesh and its submeshes.

CPU mesh data is not present in the copy. GPU mesh data is retained.

Changed in Vuo 2.0.0:
New.

Definition at line 1033 of file VuoMesh.c.

◆ VuoMesh_cStringForElementAssemblyMethod()

const char* VuoMesh_cStringForElementAssemblyMethod ( VuoMesh_ElementAssemblyMethod  elementAssemblyMethod)

Returns a string constant representing elementAssemblyMethod.

Do not free the value returned from this function.

Definition at line 1340 of file VuoMesh.c.

◆ VuoMesh_elementAssemblyMethodFromCString()

VuoMesh_ElementAssemblyMethod VuoMesh_elementAssemblyMethodFromCString ( const char *  elementAssemblyMethodString)

Returns the VuoMesh_ElementAssemblyMethod corresponding with the string elementAssemblyMethodString.

If none matches, returns VuoMesh_IndividualTriangles.

Definition at line 1317 of file VuoMesh.c.

◆ VuoMesh_getCompleteElementCount()

unsigned long VuoMesh_getCompleteElementCount ( const VuoMesh  mesh)

Returns the number of complete elements in the mesh.

If elementCount represents an incomplete element, this function returns the rounded-down number of elements.

For example, if elementCount = 5 and elementAssemblyMethod = VuoMesh_IndividualTriangles, this function returns 3, discarding the last 2 elements that fail to form a complete triangle.

Definition at line 318 of file VuoMesh.c.

◆ VuoMesh_getCPUBuffers()

void VuoMesh_getCPUBuffers ( const VuoMesh  mesh,
unsigned int *  vertexCount,
float **  positions,
float **  normals,
float **  textureCoordinates,
float **  colors,
unsigned int *  elementCount,
unsigned int **  elements 
)

Outputs vertex and element information, downloading the data from the GPU if needed.

You may pass NULL to any of the output variables.

Do not modify or free the output arrays; the mesh continues to own them.

Changed in Vuo 2.0.0:
New.

Definition at line 1091 of file VuoMesh.c.

◆ VuoMesh_getElementAssemblyMethod()

VuoMesh_ElementAssemblyMethod VuoMesh_getElementAssemblyMethod ( const VuoMesh  mesh)

Returns the mesh's element assembly method.

Changed in Vuo 2.0.0:
New.

Definition at line 1154 of file VuoMesh.c.

◆ VuoMesh_getElementBufferSize()

unsigned int VuoMesh_getElementBufferSize ( const VuoMesh  mesh)

Returns the size, in bytes, of the GPU element buffer.

Changed in Vuo 2.0.0:
New.

Definition at line 1215 of file VuoMesh.c.

◆ VuoMesh_getExpandedPrimitiveMode()

static VuoMesh_ElementAssemblyMethod VuoMesh_getExpandedPrimitiveMode ( const VuoMesh_ElementAssemblyMethod  inputMode)
inlinestatic

For a given element assembly method, returns the equivalent assembly method for individual elements (i.e., after they've been expanded from strips/fans).

Definition at line 129 of file VuoMesh.h.

◆ VuoMesh_getFaceCulling()

VuoMesh_FaceCulling VuoMesh_getFaceCulling ( const VuoMesh  mesh)

Returns the mesh's face culling mode.

Changed in Vuo 2.0.0:
New.

Definition at line 1168 of file VuoMesh.c.

◆ VuoMesh_getFaceCullingGL()

unsigned int VuoMesh_getFaceCullingGL ( const VuoMesh  mesh)

Returns the OpenGL enum value for the mesh's face culling mode.

Changed in Vuo 2.0.0:
New.

Definition at line 1182 of file VuoMesh.c.

◆ VuoMesh_getGlMode()

unsigned long VuoMesh_getGlMode ( const VuoMesh  mesh)

Returns the GL mode (e.g., GL_TRIANGLES) that the mesh should be interpreted as.

Definition at line 219 of file VuoMesh.c.

◆ VuoMesh_getGPUBuffers()

void VuoMesh_getGPUBuffers ( const VuoMesh  mesh,
unsigned int *  vertexCount,
unsigned int *  combinedBuffer,
void **  normalOffset,
void **  textureCoordinateOffset,
void **  colorOffset,
unsigned int *  elementCount,
unsigned int *  elementBuffer 
)

Outputs OpenGL vertex and element buffer information, uploading the data to the GPU if needed.

You may pass NULL to any of the output variables.

Changed in Vuo 2.0.0:
New.

Definition at line 1123 of file VuoMesh.c.

◆ VuoMesh_getInterprocessJson()

struct json_object * VuoMesh_getInterprocessJson ( const VuoMesh  value)

Calls VuoMesh_getJson().

Interprocess support is not yet implemented.

Definition at line 1506 of file VuoMesh.c.

◆ VuoMesh_getJson()

struct json_object * VuoMesh_getJson ( const VuoMesh  value)

Encodes value as a JSON object.

Definition at line 1492 of file VuoMesh.c.

◆ VuoMesh_getPrimitiveSize()

VuoReal VuoMesh_getPrimitiveSize ( const VuoMesh  mesh)

Returns the size, in Vuo Coordinates, at which lines and points should be rendered.

Changed in Vuo 2.0.0:
New.

Definition at line 1201 of file VuoMesh.c.

◆ VuoMesh_getSplitPrimitiveCount()

unsigned long VuoMesh_getSplitPrimitiveCount ( VuoMesh  mesh)

Returns the number of split primitives in the mesh.

For example:

  • If the mesh is VuoMesh_IndividualTriangles and has elementCount=6, it would render 2 triangles, so this function returns 2.
  • If the mesh is VuoMesh_TriangleStrip and has elementCount=6, it would render 4 triangles, so this function returns 4.

Definition at line 250 of file VuoMesh.c.

◆ VuoMesh_getSplitVertexCount()

unsigned long VuoMesh_getSplitVertexCount ( VuoMesh  mesh)

Returns the number of split vertices in the mesh.

For example:

  • If the mesh is VuoMesh_IndividualTriangles and has elementCount=6, it would render 2 triangles, each of which has 3 vertices, so this function returns 6.
  • If the mesh is VuoMesh_TriangleStrip and has elementCount=6, it would render 4 triangles, each of which has 3 vertices, so this function returns 12.

Definition at line 281 of file VuoMesh.c.

◆ VuoMesh_getString()

char* VuoMesh_getString ( const VuoMesh  value)

Automatically generated function.

◆ VuoMesh_getSummary()

char * VuoMesh_getSummary ( const VuoMesh  mesh)

Returns a brief summary of the contents of this mesh.

Definition at line 1515 of file VuoMesh.c.

◆ VuoMesh_isPopulated()

bool VuoMesh_isPopulated ( const VuoMesh  mesh)

Returns true if the mesh has any vertices.

Definition at line 1463 of file VuoMesh.c.

◆ VuoMesh_make_VuoPoint2d()

VuoMesh VuoMesh_make_VuoPoint2d ( VuoList_VuoPoint2d  positions,
VuoList_VuoColor  colors,
VuoMesh_ElementAssemblyMethod  elementAssemblyMethod,
VuoReal  primitiveSize 
)

Returns a VuoMesh consisting of the given positions and element assembly method.

Its normals, tangents, bitangents, and texture coordinates are all null.

Definition at line 864 of file VuoMesh.c.

◆ VuoMesh_make_VuoPoint3d()

VuoMesh VuoMesh_make_VuoPoint3d ( VuoList_VuoPoint3d  positions,
VuoList_VuoColor  colors,
VuoMesh_ElementAssemblyMethod  elementAssemblyMethod,
VuoReal  primitiveSize 
)

Returns a VuoMesh consisting of the given positions and element assembly method.

Its normals, tangents, bitangents, and texture coordinates are all null.

Definition at line 912 of file VuoMesh.c.

◆ VuoMesh_makeCube()

VuoMesh VuoMesh_makeCube ( void  )

Returns a cube of size 1x1.

This mesh is shared. Don't modify its contents.

Definition at line 768 of file VuoMesh.c.

◆ VuoMesh_makeEquilateralTriangle()

VuoMesh VuoMesh_makeEquilateralTriangle ( void  )

Returns an equilateral triangle with bottom edge length 1, pointing upward on the XY plane, centered at the origin.

This mesh is shared. Don't modify its contents.

Definition at line 608 of file VuoMesh.c.

◆ VuoMesh_makeFromCPUBuffers()

VuoMesh VuoMesh_makeFromCPUBuffers ( unsigned int  vertexCount,
float *  positions,
float *  normals,
float *  textureCoordinates,
float *  colors,
unsigned int  elementCount,
unsigned int *  elements,
VuoMesh_ElementAssemblyMethod  elementAssemblyMethod 
)

Creates a mesh consisting of data that already exists in CPU RAM, and uploads it to the GPU.

The mesh object takes ownership of the arrays passed into it, which it will eventually release using free().

See also
VuoMesh_getCPUBuffers
Changed in Vuo 2.0.0:
positions and normals are now VuoPoint3d; textureCoordinates is now VuoPoint2d; tangents and bitangents are no longer stored (they're now calculated when needed).

Definition at line 176 of file VuoMesh.c.

◆ VuoMesh_makeFromGPUBuffers()

VuoMesh VuoMesh_makeFromGPUBuffers ( unsigned int  vertexCount,
unsigned int  combinedBuffer,
unsigned int  combinedBufferSize,
void *  normalOffset,
void *  textureCoordinateOffset,
void *  colorOffset,
unsigned int  elementCount,
unsigned int  elementBuffer,
unsigned int  elementBufferSize,
VuoMesh_ElementAssemblyMethod  elementAssemblyMethod 
)

Creates a VuoSubmesh consisting of data that's already been uploaded to the GPU.

Definition at line 198 of file VuoMesh.c.

◆ VuoMesh_makeFromJson()

VuoMesh VuoMesh_makeFromJson ( json_object js)

Decodes the JSON object js to create a new value.

Parameters
jsA JSON array of elements of the format parsed by VuoSubmesh_makeFromJson().

Definition at line 1478 of file VuoMesh.c.

◆ VuoMesh_makeFromString()

VuoMesh VuoMesh_makeFromString ( const char *  str)

Automatically generated function.

◆ VuoMesh_makePlane()

VuoMesh VuoMesh_makePlane ( VuoInteger  columns,
VuoInteger  rows 
)

Creates a flat mesh subdivided into rows and columns.

Changed in Vuo 2.0.0:
New.

Definition at line 784 of file VuoMesh.c.

◆ VuoMesh_makeQuad()

VuoMesh VuoMesh_makeQuad ( void  )

Returns a quad with dimensions 1x1, on the XY plane, centered at the origin.

This mesh is shared. Don't modify its contents.

Definition at line 574 of file VuoMesh.c.

◆ VuoMesh_makeQuadWithoutNormals()

VuoMesh VuoMesh_makeQuadWithoutNormals ( void  )

Returns a quad with dimensions 1x1, on the XY plane, centered at the origin.

The quad consists of only positions and texture coordinates (without normals, tangents, or bitangents).

This mesh is shared. Don't modify its contents.

Definition at line 592 of file VuoMesh.c.

◆ VuoMesh_release()

void VuoMesh_release ( const VuoMesh  v)

Automatically generated function.

◆ VuoMesh_removeTextureCoordinates()

void VuoMesh_removeTextureCoordinates ( VuoMesh  mesh)

Deallocates and clears the texture coordinate arrays associated with this mesh.

Changed in Vuo 2.0.0:
New.

Definition at line 1060 of file VuoMesh.c.

◆ VuoMesh_retain()

void VuoMesh_retain ( const VuoMesh  v)

Automatically generated function.

◆ VuoMesh_setCPUBuffers()

void VuoMesh_setCPUBuffers ( VuoMesh  mesh,
unsigned int  vertexCount,
float *  positions,
float *  normals,
float *  textureCoordinates,
float *  colors,
unsigned int  elementCount,
unsigned int *  elements 
)

Changes the mesh's CPU buffers, and uploads them to the GPU.

The mesh takes ownership of the buffers, and will free() them when finished.

See also
VuoMesh_makeFromCPUBuffers
Changed in Vuo 2.0.0:
New.

Definition at line 1232 of file VuoMesh.c.

◆ VuoMesh_setFaceCulling()

void VuoMesh_setFaceCulling ( VuoMesh  mesh,
VuoMesh_FaceCulling  faceCulling 
)

Changes the mesh's face culling mode.

Changed in Vuo 2.0.0:
New.

Definition at line 1290 of file VuoMesh.c.

◆ VuoMesh_setPrimitiveSize()

void VuoMesh_setPrimitiveSize ( VuoMesh  mesh,
VuoReal  primitiveSize 
)

Changes the size, in Vuo Coordinates, at which lines and points should be rendered.

Changed in Vuo 2.0.0:
New.

Definition at line 1304 of file VuoMesh.c.