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

Function device_init

tutorials/bvh_builder/bvh_builder_device.cpp:142–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140
141 /* called by the C++ code for initialization */
142 extern "C" void device_init (char* cfg)
143 {
144 /* create random bounding boxes */
145 const size_t N = 2300000;
146 const size_t extraSpace = 1000000;
147 avector<RTCBuildPrimitive> prims;
148 prims.resize(N);
149 for (size_t i=0; i<N; i++)
150 {
151 const float x = float(drand48());
152 const float y = float(drand48());
153 const float z = float(drand48());
154 const Vec3fa p = 1000.0f*Vec3fa(x,y,z);
155 const BBox3fa b = BBox3fa(p,p+Vec3fa(1.0f));
156
157 RTCBuildPrimitive prim;
158 prim.lower_x = b.lower.x;
159 prim.lower_y = b.lower.y;
160 prim.lower_z = b.lower.z;
161 prim.geomID = 0;
162 prim.upper_x = b.upper.x;
163 prim.upper_y = b.upper.y;
164 prim.upper_z = b.upper.z;
165 prim.primID = (unsigned) i;
166 prims[i] = prim;
167 }
168
169 std::cout << "Low quality BVH build:" << std::endl;
170 build(RTC_BUILD_QUALITY_LOW,prims,cfg);
171
172 std::cout << "Normal quality BVH build:" << std::endl;
173 build(RTC_BUILD_QUALITY_MEDIUM,prims,cfg);
174
175 std::cout << "High quality BVH build:" << std::endl;
176 build(RTC_BUILD_QUALITY_HIGH,prims,cfg,extraSpace);
177 }
178
179 void renderFrameStandard (int* pixels,
180 const unsigned int width,

Callers

nothing calls this directly

Calls 4

drand48Function · 0.85
buildFunction · 0.70
Vec3faClass · 0.50
resizeMethod · 0.45

Tested by

no test coverage detected