creates a ground plane */
| 45 | |
| 46 | /* creates a ground plane */ |
| 47 | unsigned int createGroundPlane (RTCScene scene) |
| 48 | { |
| 49 | /* create a triangulated plane with 2 triangles and 4 vertices */ |
| 50 | std::unique_ptr<collide2::Mesh> plane (new collide2::Mesh()); |
| 51 | plane->x_.resize (4); |
| 52 | plane->tris_.resize (2); |
| 53 | |
| 54 | /* set plane->x_ */ |
| 55 | plane->x_[0].x = -10; plane->x_[0].y = -2; plane->x_[0].z = -10; |
| 56 | plane->x_[1].x = -10; plane->x_[1].y = -2; plane->x_[1].z = +10; |
| 57 | plane->x_[2].x = +10; plane->x_[2].y = -2; plane->x_[2].z = -10; |
| 58 | plane->x_[3].x = +10; plane->x_[3].y = -2; plane->x_[3].z = +10; |
| 59 | |
| 60 | /* set plane->tris_ */ |
| 61 | plane->tris_[0].v0 = 0; plane->tris_[0].v1 = 1; plane->tris_[0].v2 = 2; |
| 62 | plane->tris_[1].v0 = 1; plane->tris_[1].v1 = 3; plane->tris_[1].v2 = 2; |
| 63 | |
| 64 | RTCGeometry geom = rtcNewGeometry (g_device, RTC_GEOMETRY_TYPE_TRIANGLE); |
| 65 | rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_VERTEX,0,RTC_FORMAT_FLOAT3,plane->x_.data(),0,sizeof(collide2::vec_t),plane->x_.size()); |
| 66 | rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_INDEX,0,RTC_FORMAT_UINT3,plane->tris_.data(),0,sizeof(Triangle),plane->tris_.size ()); |
| 67 | rtcCommitGeometry(geom); |
| 68 | unsigned int geomID = rtcAttachGeometry(scene,geom); |
| 69 | rtcReleaseGeometry(geom); |
| 70 | meshes.push_back (std::move (plane)); |
| 71 | return geomID; |
| 72 | } |
| 73 | |
| 74 | unsigned int createTriangulatedSphere (RTCScene scene, const Vec3fa& p, float r) |
| 75 | { |
nothing calls this directly
no test coverage detected