| 407 | } |
| 408 | |
| 409 | Ref<SceneGraph::Node> SceneGraph::createHairyPlane (int hash, const Vec3fa& pos, const Vec3fa& dx, const Vec3fa& dy, const float len, const float r, size_t numHairs, CurveSubtype subtype, Ref<MaterialNode> material) |
| 410 | { |
| 411 | RandomSampler sampler; |
| 412 | RandomSampler_init(sampler,hash); |
| 413 | |
| 414 | RTCGeometryType type = (subtype == ROUND_CURVE) ? RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE : RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE; |
| 415 | Ref<SceneGraph::HairSetNode> mesh = new SceneGraph::HairSetNode(type,material,BBox1f(0,1),1); |
| 416 | |
| 417 | if (numHairs == 1) { |
| 418 | const Vec3fa p0 = pos; |
| 419 | const Vec3fa p1 = p0 + len*Vec3fa(1,0,0); |
| 420 | const Vec3fa p2 = p0 + len*Vec3fa(0,1,1); |
| 421 | const Vec3fa p3 = p0 + len*Vec3fa(0,1,0); |
| 422 | mesh->hairs.push_back(HairSetNode::Hair(0,0)); |
| 423 | mesh->positions[0].push_back(Vec3ff(p0,r)); |
| 424 | mesh->positions[0].push_back(Vec3ff(p1,r)); |
| 425 | mesh->positions[0].push_back(Vec3ff(p2,r)); |
| 426 | mesh->positions[0].push_back(Vec3ff(p3,r)); |
| 427 | return mesh.dynamicCast<SceneGraph::Node>(); |
| 428 | } |
| 429 | |
| 430 | Vec3fa dz = cross(dx,dy); |
| 431 | for (size_t i=0; i<numHairs; i++) |
| 432 | { |
| 433 | const Vec3fa p0 = pos + RandomSampler_getFloat(sampler)*dx + RandomSampler_getFloat(sampler)*dy; |
| 434 | const Vec3fa p1 = p0 + len*normalize(dx); |
| 435 | const Vec3fa p2 = p0 + len*(normalize(dz)+normalize(dy)); |
| 436 | const Vec3fa p3 = p0 + len*normalize(dz); |
| 437 | mesh->hairs.push_back(HairSetNode::Hair(unsigned(4*i),unsigned(i))); |
| 438 | mesh->positions[0].push_back(Vec3ff(p0,r)); |
| 439 | mesh->positions[0].push_back(Vec3ff(p1,r)); |
| 440 | mesh->positions[0].push_back(Vec3ff(p2,r)); |
| 441 | mesh->positions[0].push_back(Vec3ff(p3,r)); |
| 442 | } |
| 443 | return mesh.dynamicCast<SceneGraph::Node>(); |
| 444 | } |
| 445 | |
| 446 | Ref<SceneGraph::Node> SceneGraph::createGarbageTriangleMesh (int hash, size_t numTriangles, bool mblur, Ref<MaterialNode> material) |
| 447 | { |
nothing calls this directly
no test coverage detected