Vuo  2.0.0
VuoMesh.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include "VuoPoint2d.h"
13 #include "VuoPoint3d.h"
14 #include "VuoPoint4d.h"
15 #include "VuoList_VuoPoint2d.h"
16 #include "VuoList_VuoPoint3d.h"
17 
29 typedef enum {
37 
41 typedef enum {
46 
55 typedef const struct { void *l; } * VuoMesh;
56 
57 // Constructors
62 VuoMesh VuoMesh_make_VuoPoint2d(VuoList_VuoPoint2d positions, VuoMesh_ElementAssemblyMethod elementAssemblyMethod, VuoReal primitiveSize);
63 VuoMesh VuoMesh_make_VuoPoint3d(VuoList_VuoPoint3d positions, VuoMesh_ElementAssemblyMethod elementAssemblyMethod, VuoReal primitiveSize);
64 
65 void VuoMesh_allocateCPUBuffers(unsigned int vertexCount,
66  VuoPoint4d **positions, VuoPoint4d **normals, VuoPoint4d **tangents, VuoPoint4d **bitangents, VuoPoint4d **textureCoordinates,
67  unsigned int elementCount, unsigned int **elements);
68 
69 VuoMesh VuoMesh_makeFromCPUBuffers(unsigned int vertexCount,
70  VuoPoint4d *positions, VuoPoint4d *normals, VuoPoint4d *tangents, VuoPoint4d *bitangents, VuoPoint4d *textureCoordinates,
71  unsigned int elementCount, unsigned int *elements, VuoMesh_ElementAssemblyMethod elementAssemblyMethod);
72 VuoMesh VuoMesh_makeFromGPUBuffers(unsigned int vertexCount,
73  unsigned int combinedBuffer, unsigned int combinedBufferSize, unsigned int combinedBufferStride,
74  void *normalOffset, void *tangentOffset, void *bitangentOffset, void *textureCoordinateOffset,
75  unsigned int elementCount, unsigned int elementBuffer, unsigned int elementBufferSize, VuoMesh_ElementAssemblyMethod elementAssemblyMethod);
76 
77 VuoMesh VuoMesh_copy(const VuoMesh mesh);
79 
80 // Mutators
82 
83 // Getters
84 void VuoMesh_getCPUBuffers(const VuoMesh mesh, unsigned int *vertexCount,
85  VuoPoint4d **positions, VuoPoint4d **normals, VuoPoint4d **tangents, VuoPoint4d **bitangents, VuoPoint4d **textureCoordinates,
86  unsigned int *elementCount, unsigned int **elements);
87 void VuoMesh_getGPUBuffers(const VuoMesh mesh, unsigned int *vertexCount,
88  unsigned int *combinedBuffer,
89  void **normalOffset, void **tangentOffset, void **bitangentOffset, void **textureCoordinateOffset,
90  unsigned int *elementCount, unsigned int *elementBuffer);
91 
94 unsigned int VuoMesh_getFaceCullingGL(const VuoMesh mesh);
96 
97 unsigned long VuoMesh_getGlMode(const VuoMesh mesh);
98 unsigned long VuoMesh_getSplitPrimitiveCount(const VuoMesh mesh);
99 unsigned long VuoMesh_getSplitVertexCount(const VuoMesh mesh);
100 unsigned long VuoMesh_getCompleteElementCount(const VuoMesh mesh);
101 unsigned long VuoMesh_getStride(const VuoMesh mesh);
102 unsigned int VuoMesh_getElementBufferSize(const VuoMesh mesh);
103 
104 // Setters
105 void VuoMesh_setCPUBuffers(VuoMesh mesh, unsigned int vertexCount,
106  VuoPoint4d *positions, VuoPoint4d *normals, VuoPoint4d *tangents, VuoPoint4d *bitangents, VuoPoint4d *textureCoordinates,
107  unsigned int elementCount, unsigned int *elements);
108 void VuoMesh_setFaceCulling(VuoMesh mesh, VuoMesh_FaceCulling faceCulling);
109 void VuoMesh_setPrimitiveSize(VuoMesh mesh, VuoReal primitiveSize);
110 
112 VuoBox VuoMesh_bounds(const VuoMesh mesh, float matrix[16]);
113 bool VuoMesh_isPopulated(const VuoMesh mesh);
114 
116 struct json_object * VuoMesh_getJson(const VuoMesh value);
117 
119 #define VuoMesh_REQUIRES_INTERPROCESS_JSON
120 struct json_object * VuoMesh_getInterprocessJson(const VuoMesh value);
121 
122 char * VuoMesh_getSummary(const VuoMesh value);
123 
128 {
129  if (inputMode == VuoMesh_IndividualTriangles
130  || inputMode == VuoMesh_TriangleFan
131  || inputMode == VuoMesh_TriangleStrip)
133  else if (inputMode == VuoMesh_IndividualLines
134  || inputMode == VuoMesh_LineStrip)
136  else
137  return VuoMesh_Points;
138 }
139 
141 
144 VuoMesh VuoMesh_makeFromString(const char *str);
145 char * VuoMesh_getString(const VuoMesh value);
146 void VuoMesh_retain(const VuoMesh v);
147 void VuoMesh_release(const VuoMesh v);
149