| 206 | } |
| 207 | |
| 208 | LazyGeometry* createLazyObject (RTCScene scene, int userID, const Vec3fa& center, const float radius) |
| 209 | { |
| 210 | LazyGeometry* instance = (LazyGeometry*) alignedUSMMalloc(sizeof(LazyGeometry),16); |
| 211 | instance->state = LAZY_INVALID; |
| 212 | instance->object = nullptr; |
| 213 | instance->userID = userID; |
| 214 | instance->center = center; |
| 215 | instance->radius = radius; |
| 216 | instance->geometry = rtcNewGeometry(g_device, RTC_GEOMETRY_TYPE_USER); |
| 217 | rtcSetGeometryUserPrimitiveCount(instance->geometry,1); |
| 218 | rtcSetGeometryUserData(instance->geometry,instance); |
| 219 | rtcSetGeometryBoundsFunction(instance->geometry,instanceBoundsFunc,nullptr); |
| 220 | rtcSetGeometryIntersectFunction(instance->geometry,instanceIntersectFuncN); |
| 221 | rtcSetGeometryOccludedFunction (instance->geometry,instanceOccludedFuncN); |
| 222 | rtcCommitGeometry(instance->geometry); |
| 223 | rtcAttachGeometry(scene,instance->geometry); |
| 224 | rtcReleaseGeometry(instance->geometry); |
| 225 | |
| 226 | /* if we do not support the join mode then Embree also does not |
| 227 | * support lazy build */ |
| 228 | if (!rtcGetDeviceProperty(g_device,RTC_DEVICE_PROPERTY_JOIN_COMMIT_SUPPORTED)) |
| 229 | eagerCreate(instance); |
| 230 | |
| 231 | return instance; |
| 232 | } |
| 233 | |
| 234 | /* creates a ground plane */ |
| 235 | unsigned int createGroundPlane (RTCScene scene) |
no test coverage detected