MCPcopy Create free account
hub / github.com/RenderKit/embree / addCurve

Function addCurve

tutorials/interpolation/interpolation_device.cpp:277–304  ·  view source on GitHub ↗

add curve geometry */

Source from the content-addressed store, hash-verified

275
276/* add curve geometry */
277unsigned int addCurve (RTCScene scene, const Vec3fa& pos)
278{
279 RTCGeometry geom = rtcNewGeometry (g_device, RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE);
280
281 //rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX, hair_vertices, 0, sizeof(Vec3fa), NUM_HAIR_VERTICES);
282 Vec3ff* vtx = (Vec3ff*) rtcSetNewGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX, 0, RTC_FORMAT_FLOAT4, sizeof(Vec3ff), NUM_HAIR_VERTICES);
283 for (unsigned int i=0; i<NUM_HAIR_VERTICES; i++) {
284 vtx[i].x = hair_vertices[i][0]+pos.x;
285 vtx[i].y = hair_vertices[i][1]+pos.y;
286 vtx[i].z = hair_vertices[i][2]+pos.z;
287 vtx[i].w = hair_vertices[i][3];
288 }
289
290 rtcSetGeometryVertexAttributeCount(geom,1);
291
292 //rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT, hair_indices, 0, sizeof(unsigned int), 1);
293 void* indices = rtcSetNewGeometryBuffer(geom, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT, sizeof(unsigned int), 1);
294 memcpy(indices, hair_indices, 1*sizeof(unsigned int));
295
296 //rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 0, RTC_FORMAT_FLOAT3, hair_vertex_colors, 0, sizeof(Vec3fa), NUM_HAIR_VERTICES);
297 void* colors = rtcSetNewGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 0, RTC_FORMAT_FLOAT3, sizeof(Vec3fa), NUM_HAIR_VERTICES);
298 memcpy(colors, hair_vertex_colors, NUM_HAIR_VERTICES*sizeof(Vec3fa));
299
300 rtcCommitGeometry(geom);
301 unsigned int geomID = rtcAttachGeometry(scene, geom);
302 rtcReleaseGeometry(geom);
303 return geomID;
304}
305
306/* adds a ground plane to the scene */
307unsigned int addGroundPlane (RTCScene scene_i)

Callers 1

device_initFunction · 0.70

Calls 5

rtcSetNewGeometryBufferFunction · 0.85
rtcCommitGeometryFunction · 0.85
rtcAttachGeometryFunction · 0.85
rtcReleaseGeometryFunction · 0.85

Tested by

no test coverage detected