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

Function createPoints

tutorials/voronoi/voronoi_device.cpp:122–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void createPoints (TutorialData& data)
123{
124 RTCGeometry geom = rtcNewGeometry(g_device, RTC_GEOMETRY_TYPE_USER);
125 data.points = (Point*) alignedMalloc(data.num_points*sizeof(Point), 16);
126 data.points_tmp = (Point*) alignedMalloc(data.num_points*sizeof(Point), 16);
127 unsigned int geomID = rtcAttachGeometry(data.scene, geom);
128 for (int i=0; i<data.num_points; i++) {
129 data.points[i].geometry = geom;
130 data.points[i].geomID = geomID;
131 data.points_tmp[i].geometry = geom;
132 data.points_tmp[i].geomID = geomID;
133 }
134 rtcSetGeometryUserPrimitiveCount(geom, data.num_points);
135 rtcSetGeometryUserData(geom, data.points);
136 rtcSetGeometryBoundsFunction(geom, pointBoundsFunc, nullptr);
137 rtcCommitGeometry(geom);
138 rtcReleaseGeometry(geom);
139
140 RandomSampler rs;
141 RandomSampler_init(rs, 42);
142 for (int i = 0; i < data.num_points; ++i)
143 {
144 float xi1 = RandomSampler_getFloat(rs);
145 float xi2 = RandomSampler_getFloat(rs);
146 data.points[i].p = Vec3f(xi1, 0.f, xi2);
147 }
148
149 g_num_points_current = data.num_points;
150}
151
152/* called by the C++ code for initialization */
153extern "C" void device_init (char* cfg)

Callers 2

device_initFunction · 0.70
device_renderFunction · 0.70

Calls 9

alignedMallocFunction · 0.85
rtcAttachGeometryFunction · 0.85
rtcSetGeometryUserDataFunction · 0.85
rtcCommitGeometryFunction · 0.85
rtcReleaseGeometryFunction · 0.85
RandomSampler_initFunction · 0.85
RandomSampler_getFloatFunction · 0.85

Tested by

no test coverage detected