Vuo  2.0.0
Classes | Macros | Typedefs | Enumerations | Functions

Description

Vertices representing a 3D object.

Classes

struct  VuoSubmesh
 One set of vertices, with associated normals and other per-vertex data, within a mesh. More...
 
struct  VuoSubmesh.glUpload
 References to mesh data uploaded to the GPU. More...
 
struct  _VuoMesh
 A 3D mesh that contains one or more submeshes (allowing each submesh to have a different element assembly method). More...
 

Macros

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

Typedefs

typedef struct _VuoMeshVuoMesh
 A 3D mesh that contains one or more submeshes (allowing each submesh to have a different element assembly method). 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...
 

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 * VuoSubmesh_getSummary (const VuoSubmesh value)
 A brief summary of the contents of this submesh. More...
 
char * VuoMesh_getSummary (const VuoMesh value)
 A brief summary of the contents of this mesh, including a list of sub-meshes. More...
 
VuoSubmesh VuoSubmesh_make (unsigned int vertexCount, unsigned int elementCount)
 Allocates the vertex (position, normal, ...) and element arrays. More...
 
VuoSubmesh VuoSubmesh_makeFromBuffers (unsigned int vertexCount, VuoPoint4d *positions, VuoPoint4d *normals, VuoPoint4d *tangents, VuoPoint4d *bitangents, VuoPoint4d *textureCoordinates, unsigned int elementCount, unsigned int *elements, VuoMesh_ElementAssemblyMethod elementAssemblyMethod)
 Creates a VuoSubmesh consisting of data that already exists in CPU RAM. More...
 
VuoSubmesh VuoSubmesh_makeGl (unsigned int vertexCount, unsigned int combinedBuffer, unsigned int combinedBufferSize, unsigned int combinedBufferStride, void *normalOffset, void *tangentOffset, void *bitangentOffset, void *textureCoordinateOffset, 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...
 
unsigned long VuoSubmesh_getGlMode (VuoSubmesh submesh)
 Returns the GL mode (e.g., GL_TRIANGLES) that submesh should be interpreted as. More...
 
unsigned long VuoSubmesh_getSplitPrimitiveCount (VuoSubmesh submesh)
 Returns the number of split primitives in submesh. More...
 
unsigned long VuoSubmesh_getSplitVertexCount (VuoSubmesh submesh)
 Returns the number of split vertices in submesh. More...
 
unsigned long VuoSubmesh_getCompleteElementCount (const VuoSubmesh submesh)
 Returns the number of complete elements in submesh. More...
 
unsigned long VuoSubmesh_getStride (const VuoSubmesh submesh)
 Returns the number of bytes per combined-buffer entry. More...
 
VuoMesh VuoMesh_make (unsigned int itemCount)
 Creates and registers a mesh with empty slots for the given number of sub-meshes. More...
 
void VuoMesh_upload (VuoMesh mesh)
 Uploads mesh to the GPU. More...
 
VuoMesh VuoMesh_makeFromSingleSubmesh (VuoSubmesh submesh)
 Creates and registers a mesh with space for one submesh, and sets it to the given submesh. 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_make_VuoPoint2d (VuoList_VuoPoint2d positions, 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, VuoMesh_ElementAssemblyMethod elementAssemblyMethod, VuoReal primitiveSize)
 Returns a VuoMesh consisting of the given positions and element assembly method. More...
 
VuoMesh VuoMesh_copy (const VuoMesh mesh)
 Makes a copy of the mesh and its submeshes. More...
 
VuoMesh VuoMesh_copyShallow (const VuoMesh mesh)
 Makes a shallow copy of the mesh and its submeshes. More...
 
const char * VuoMesh_cStringForElementAssemblyMethod (VuoMesh_ElementAssemblyMethod elementAssemblyMethod)
 Returns a string constant representing elementAssemblyMethod. More...
 
VuoBox VuoMesh_bounds (const VuoMesh mesh, float matrix[16])
 Iterates through mesh's vertices finding the center and extents. More...
 
bool VuoMesh_isPopulated (const VuoMesh mesh)
 Returns true if the mesh has at least one submesh with a non-zero vertex count. More...
 
void VuoSubmesh_download (VuoSubmesh *submesh)
 Copies element data from GPU back to the CPU. 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

◆ VuoSubmesh

struct VuoSubmesh
Class Members
VuoPoint4d * bitangents Vertex bitangents. May be NULL.
VuoMesh_ElementAssemblyMethod elementAssemblyMethod The way in which the elements array should be interpreted during rasterization.
unsigned int elementCount Number of elements in elements.
unsigned int * elements An array of size elementCount of integer elements (triangle indices) which are indexes into positions.

(Requires conversion to i16 for OpenGL ES unless GL_OES_element_index_uint.)

unsigned int faceCullingMode GL_BACK (default), GL_NONE, or GL_FRONT.
struct VuoSubmesh glUpload References to mesh data uploaded to the GPU.
VuoPoint4d * normals Vertex normals. May be NULL.
VuoPoint4d * positions XYZW vertex positions. May be NULL.
VuoReal primitiveSize For lines, the width (in scene units).

For points, the width and height (in scene units).

VuoPoint4d * tangents Vertex tangents. May be NULL.
VuoPoint4d * textureCoordinates STRQ texture coordinates. May be NULL.
unsigned int vertexCount Number of vertices in positions, normals, tangents, bitangents, and textureCoordinates.

◆ VuoSubmesh.glUpload

struct VuoSubmesh.glUpload
Class Members
void * bitangentOffset
unsigned int combinedBuffer
unsigned int combinedBufferSize
unsigned int combinedBufferStride
unsigned int elementBuffer
unsigned int elementBufferSize
void * normalOffset
void * tangentOffset
void * textureCoordinateOffset

◆ _VuoMesh

struct _VuoMesh
Class Members
unsigned int submeshCount Number of items in submeshes.
VuoSubmesh * submeshes The submeshes that together define the shape of the mesh. All VuoSubmeshes are assumed to have the same primitive type (points, lines, triangles), but the assembly can vary (e.g., a single mesh can contain submeshes with VuoMesh_IndividualLines and VuoMesh_LineStrip).

Macro Definition Documentation

◆ VuoMesh_REQUIRES_INTERPROCESS_JSON

#define VuoMesh_REQUIRES_INTERPROCESS_JSON

This type has a _getInterprocessJson() function.

Definition at line 131 of file VuoMesh.h.

Typedef Documentation

◆ VuoMesh

typedef struct _VuoMesh * VuoMesh

A 3D mesh that contains one or more submeshes (allowing each submesh to have a different element assembly method).

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 29 of file VuoMesh.h.

Function Documentation

◆ VuoMesh_bounds()

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

Iterates through mesh's vertices finding the center and extents.

Returns the axis aligned bounding box taking into account the passed transform.

Definition at line 1166 of file VuoMesh.c.

◆ VuoMesh_copy()

VuoMesh VuoMesh_copy ( const VuoMesh  mesh)

Makes a copy of the mesh and its submeshes.

CPU mesh data is duplicated.

Definition at line 890 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 977 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 1038 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 1015 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 139 of file VuoMesh.h.

◆ VuoMesh_getInterprocessJson()

struct json_object * VuoMesh_getInterprocessJson ( const VuoMesh  value)

Calls VuoMesh_getJson().

Interprocess support is not yet implemented.

Definition at line 1256 of file VuoMesh.c.

◆ VuoMesh_getJson()

struct json_object * VuoMesh_getJson ( const VuoMesh  value)

Encodes value as a JSON object.

Definition at line 1242 of file VuoMesh.c.

◆ VuoMesh_getString()

char* VuoMesh_getString ( const VuoMesh  value)

Automatically generated function.

◆ VuoMesh_getSummary()

char * VuoMesh_getSummary ( const VuoMesh  value)

A brief summary of the contents of this mesh, including a list of sub-meshes.

Definition at line 1337 of file VuoMesh.c.

◆ VuoMesh_isPopulated()

bool VuoMesh_isPopulated ( const VuoMesh  mesh)

Returns true if the mesh has at least one submesh with a non-zero vertex count.

Definition at line 1207 of file VuoMesh.c.

◆ VuoMesh_make()

VuoMesh VuoMesh_make ( unsigned int  submeshCount)

Creates and registers a mesh with empty slots for the given number of sub-meshes.

After you've populated the sub-meshes, call VuoMesh_upload().

Definition at line 300 of file VuoMesh.c.

◆ VuoMesh_make_VuoPoint2d()

VuoMesh VuoMesh_make_VuoPoint2d ( VuoList_VuoPoint2d  positions,
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 842 of file VuoMesh.c.

◆ VuoMesh_make_VuoPoint3d()

VuoMesh VuoMesh_make_VuoPoint3d ( VuoList_VuoPoint3d  positions,
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 866 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 827 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 607 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 1228 of file VuoMesh.c.

◆ VuoMesh_makeFromSingleSubmesh()

VuoMesh VuoMesh_makeFromSingleSubmesh ( VuoSubmesh  submesh)

Creates and registers a mesh with space for one submesh, and sets it to the given submesh.

Uploads the submesh to the GPU.

Definition at line 413 of file VuoMesh.c.

◆ VuoMesh_makeFromString()

VuoMesh VuoMesh_makeFromString ( const char *  str)

Automatically generated function.

◆ 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 573 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 591 of file VuoMesh.c.

◆ VuoMesh_release()

void VuoMesh_release ( const VuoMesh  v)

Automatically generated function.

◆ VuoMesh_retain()

void VuoMesh_retain ( const VuoMesh  v)

Automatically generated function.

◆ VuoMesh_upload()

void VuoMesh_upload ( VuoMesh  mesh)

Uploads mesh to the GPU.

Definition at line 315 of file VuoMesh.c.

◆ VuoSubmesh_download()

void VuoSubmesh_download ( VuoSubmesh submesh)

Copies element data from GPU back to the CPU.

Changed in Vuo 2.0.0:
New.

Definition at line 1121 of file VuoMesh.c.

◆ VuoSubmesh_getCompleteElementCount()

unsigned long VuoSubmesh_getCompleteElementCount ( const VuoSubmesh  submesh)

Returns the number of complete elements in submesh.

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 209 of file VuoMesh.c.

◆ VuoSubmesh_getGlMode()

unsigned long VuoSubmesh_getGlMode ( VuoSubmesh  submesh)

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

Definition at line 127 of file VuoMesh.c.

◆ VuoSubmesh_getSplitPrimitiveCount()

unsigned long VuoSubmesh_getSplitPrimitiveCount ( VuoSubmesh  submesh)

Returns the number of split primitives in submesh.

For example:

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

Definition at line 153 of file VuoMesh.c.

◆ VuoSubmesh_getSplitVertexCount()

unsigned long VuoSubmesh_getSplitVertexCount ( VuoSubmesh  submesh)

Returns the number of split vertices in submesh.

For example:

  • If the submesh 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 submesh 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 179 of file VuoMesh.c.

◆ VuoSubmesh_getStride()

unsigned long VuoSubmesh_getStride ( const VuoSubmesh  submesh)

Returns the number of bytes per combined-buffer entry.

Definition at line 1060 of file VuoMesh.c.

◆ VuoSubmesh_getSummary()

char* VuoSubmesh_getSummary ( const VuoSubmesh  value)

A brief summary of the contents of this submesh.

Example:
4 vertices in a fan of 2 triangles
with first position (0,0,0,0)
Example:
8 vertices, 12 triangles
with first position (-0.5,-0.5,-0.5,0)

Definition at line 1270 of file VuoMesh.c.

◆ VuoSubmesh_make()

VuoSubmesh VuoSubmesh_make ( unsigned int  vertexCount,
unsigned int  elementCount 
)

Allocates the vertex (position, normal, ...) and element arrays.

Definition at line 48 of file VuoMesh.c.

◆ VuoSubmesh_makeFromBuffers()

VuoSubmesh VuoSubmesh_makeFromBuffers ( unsigned int  vertexCount,
VuoPoint4d *  positions,
VuoPoint4d *  normals,
VuoPoint4d *  tangents,
VuoPoint4d *  bitangents,
VuoPoint4d *  textureCoordinates,
unsigned int  elementCount,
unsigned int *  elements,
VuoMesh_ElementAssemblyMethod  elementAssemblyMethod 
)

Creates a VuoSubmesh consisting of data that already exists in CPU RAM.

Definition at line 71 of file VuoMesh.c.

◆ VuoSubmesh_makeGl()

VuoSubmesh VuoSubmesh_makeGl ( unsigned int  vertexCount,
unsigned int  combinedBuffer,
unsigned int  combinedBufferSize,
unsigned int  combinedBufferStride,
void *  normalOffset,
void *  tangentOffset,
void *  bitangentOffset,
void *  textureCoordinateOffset,
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 96 of file VuoMesh.c.