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 struct
42 {
43  unsigned int vertexCount;
44  VuoPoint4d * positions;
46  VuoPoint4d * normals;
47  VuoPoint4d * tangents;
48  VuoPoint4d * bitangents;
49  VuoPoint4d * textureCoordinates;
50 
51  unsigned int elementCount;
52 
56  unsigned int * elements;
57 
60 
66 
68  unsigned int faceCullingMode;
69 
73  struct
74  {
75  unsigned int combinedBuffer;
76  unsigned int combinedBufferSize;
77  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.
78 
79  void *normalOffset;
80  void *tangentOffset;
81  void *bitangentOffset;
82  void *textureCoordinateOffset;
83 
84  unsigned int elementBuffer;
85  unsigned int elementBufferSize;
86  } glUpload;
87 } VuoSubmesh;
88 
92 typedef struct _VuoMesh
93 {
94  unsigned int submeshCount;
96 } *VuoMesh;
97 
98 VuoSubmesh VuoSubmesh_make(unsigned int vertexCount, unsigned int elementCount);
99 VuoSubmesh VuoSubmesh_makeFromBuffers(unsigned int vertexCount,
100  VuoPoint4d *positions, VuoPoint4d *normals, VuoPoint4d *tangents, VuoPoint4d *bitangents, VuoPoint4d *textureCoordinates,
101  unsigned int elementCount, unsigned int *elements, VuoMesh_ElementAssemblyMethod elementAssemblyMethod);
102 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);
103 unsigned long VuoSubmesh_getGlMode(VuoSubmesh submesh);
104 unsigned long VuoSubmesh_getSplitPrimitiveCount(VuoSubmesh submesh);
105 unsigned long VuoSubmesh_getSplitVertexCount(VuoSubmesh submesh);
106 unsigned long VuoSubmesh_getCompleteElementCount(const VuoSubmesh submesh);
107 unsigned long VuoSubmesh_getStride(const VuoSubmesh submesh);
108 
109 VuoMesh VuoMesh_make(unsigned int itemCount);
110 void VuoMesh_upload(VuoMesh mesh);
116 VuoMesh VuoMesh_make_VuoPoint2d(VuoList_VuoPoint2d positions, VuoMesh_ElementAssemblyMethod elementAssemblyMethod, VuoReal primitiveSize);
117 VuoMesh VuoMesh_make_VuoPoint3d(VuoList_VuoPoint3d positions, VuoMesh_ElementAssemblyMethod elementAssemblyMethod, VuoReal primitiveSize);
118 
119 VuoMesh VuoMesh_copy(const VuoMesh mesh);
121 
123 VuoBox VuoMesh_bounds(const VuoMesh mesh, float matrix[16]);
124 bool VuoMesh_isPopulated(const VuoMesh mesh);
125 void VuoSubmesh_download(VuoSubmesh *submesh);
126 
128 struct json_object * VuoMesh_getJson(const VuoMesh value);
129 
131 #define VuoMesh_REQUIRES_INTERPROCESS_JSON
132 struct json_object * VuoMesh_getInterprocessJson(const VuoMesh value);
133 
134 char * VuoMesh_getSummary(const VuoMesh value);
135 
140 {
141  if (inputMode == VuoMesh_IndividualTriangles
142  || inputMode == VuoMesh_TriangleFan
143  || inputMode == VuoMesh_TriangleStrip)
145  else if (inputMode == VuoMesh_IndividualLines
146  || inputMode == VuoMesh_LineStrip)
148  else
149  return VuoMesh_Points;
150 }
151 
153 
156 VuoMesh VuoMesh_makeFromString(const char *str);
157 char * VuoMesh_getString(const VuoMesh value);
158 void VuoMesh_retain(const VuoMesh v);
159 void VuoMesh_release(const VuoMesh v);
161