Vuo  2.0.2
Classes | Functions
VuoMesh.c File Reference

Description

VuoMesh implementation.

Definition in file VuoMesh.c.

Go to the source code of this file.

Classes

struct  VuoMesh_internal.glUpload
 References to mesh data uploaded to the GPU. More...
 

Macros

#define glGenVertexArrays   glGenVertexArraysAPPLE
 Stub. More...
 
#define glBindVertexArray   glBindVertexArrayAPPLE
 Stub. More...
 
#define glDeleteVertexArrays   glDeleteVertexArraysAPPLE
 Stub. More...
 

Functions

void VuoMesh_allocateCPUBuffers (unsigned int vertexCount, float **positions, float **normals, float **textureCoordinates, float **colors, unsigned int elementCount, unsigned int **elements)
 Allocates: More...
 
static void VuoMesh_free (void *value)
 Frees the mesh and each of its submeshes, including the vertex and element arrays within it. More...
 
static void VuoMesh_upload (VuoMesh_internal *m)
 Uploads mesh to the GPU. 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...
 
unsigned long VuoMesh_getGlMode (VuoMesh mesh)
 Returns the GL mode (e.g., GL_TRIANGLES) that the mesh should be interpreted as. More...
 
unsigned long VuoMesh_getSplitPrimitiveCount (VuoMesh mesh)
 Returns the number of split primitives in the mesh. More...
 
unsigned long VuoMesh_getSplitVertexCount (VuoMesh mesh)
 Returns the number of split vertices in the mesh. More...
 
static unsigned long VuoMesh_getCompleteElementCountInternal (unsigned long elementCount, VuoMesh_ElementAssemblyMethod elementAssemblyMethod)
 Helper for VuoMesh_make_VuoPoint* and VuoMesh_getCompleteElementCount. More...
 
unsigned long VuoMesh_getCompleteElementCount (const VuoMesh mesh)
 Returns the number of complete elements in the mesh. More...
 
static VuoMesh VuoMesh_makeQuadWithNormalsInternal (void)
 Returns a quad with dimensions 1x1, on the XY plane, centered at the origin. More...
 
static VuoMesh VuoMesh_makeQuadWithoutNormalsInternal (void)
 Returns a quad with dimensions 1x1, on the XY plane, centered at the origin. More...
 
static VuoMesh VuoMesh_makeEquilateralTriangleInternal (void)
 Returns an equilateral triangle with bottom edge length 1, pointing upward on the XY plane, centered at the origin. 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...
 
static VuoMesh VuoMesh_makeCubeInternal (void)
 Returns a cube of size 1x1. 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...
 
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...
 
static void VuoMesh_download (VuoMesh_internal *m)
 Copies element data from the GPU back to the CPU. 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 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...
 
VuoMesh_ElementAssemblyMethod VuoMesh_elementAssemblyMethodFromCString (const char *elementAssemblyMethodString)
 
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...
 
VuoMesh VuoMesh_makeFromJson (json_object *js)
 
json_objectVuoMesh_getJson (const VuoMesh value)
 
json_objectVuoMesh_getInterprocessJson (const VuoMesh value)
 
char * VuoMesh_getSummary (const VuoMesh mesh)
 

Class Documentation

◆ VuoMesh_internal.glUpload

struct VuoMesh_internal.glUpload
Class Members
void * colorOffset
unsigned int combinedBuffer
unsigned int combinedBufferSize
unsigned int combinedBufferStride Number of bytes per buffer entry. If 0, the stride is calculated automatically based on sizeof(VuoPoint4d) multiplied by 1 (position) + the number of non-NULL offsets below.
unsigned int elementBuffer
unsigned int elementBufferSize
void * normalOffset
void * textureCoordinateOffset

Macro Definition Documentation

◆ glBindVertexArray

#define glBindVertexArray   glBindVertexArrayAPPLE

Stub.

Definition at line 17 of file VuoMesh.c.

◆ glDeleteVertexArrays

#define glDeleteVertexArrays   glDeleteVertexArraysAPPLE

Stub.

Definition at line 18 of file VuoMesh.c.

◆ glGenVertexArrays

#define glGenVertexArrays   glGenVertexArraysAPPLE

Stub.

Definition at line 16 of file VuoMesh.c.

Function Documentation

◆ VuoMesh_download()

static void VuoMesh_download ( VuoMesh_internal *  m)
static

Copies element data from the GPU back to the CPU.

Definition at line 1361 of file VuoMesh.c.

◆ VuoMesh_free()

static void VuoMesh_free ( void *  value)
static

Frees the mesh and each of its submeshes, including the vertex and element arrays within it.

Definition at line 123 of file VuoMesh.c.

◆ VuoMesh_getCompleteElementCountInternal()

static unsigned long VuoMesh_getCompleteElementCountInternal ( unsigned long  elementCount,
VuoMesh_ElementAssemblyMethod  elementAssemblyMethod 
)
static

Helper for VuoMesh_make_VuoPoint* and VuoMesh_getCompleteElementCount.

Definition at line 829 of file VuoMesh.c.

◆ VuoMesh_makeCubeInternal()

static VuoMesh VuoMesh_makeCubeInternal ( void  )
static

Returns a cube of size 1x1.

Definition at line 621 of file VuoMesh.c.

◆ VuoMesh_makeEquilateralTriangleInternal()

static VuoMesh VuoMesh_makeEquilateralTriangleInternal ( void  )
static

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

Definition at line 535 of file VuoMesh.c.

◆ VuoMesh_makeQuadWithNormalsInternal()

static VuoMesh VuoMesh_makeQuadWithNormalsInternal ( void  )
static

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

Definition at line 437 of file VuoMesh.c.

◆ VuoMesh_makeQuadWithoutNormalsInternal()

static VuoMesh VuoMesh_makeQuadWithoutNormalsInternal ( void  )
static

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

Definition at line 480 of file VuoMesh.c.

◆ VuoMesh_upload()

static void VuoMesh_upload ( VuoMesh_internal *  m)
static

Uploads mesh to the GPU.

Definition at line 331 of file VuoMesh.c.