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

Method createGarbageHair

tutorials/common/scenegraph/geometry_creation.cpp:595–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

593 }
594
595 Ref<SceneGraph::Node> SceneGraph::createGarbageHair (int hash, size_t numHairs, bool mblur, Ref<MaterialNode> material)
596 {
597 RandomSampler sampler;
598 RandomSampler_init(sampler,hash);
599 Ref<SceneGraph::HairSetNode> mesh = new SceneGraph::HairSetNode(RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE,material,BBox1f(0,1),mblur?2:1);
600
601 mesh->hairs.resize(numHairs);
602 for (size_t i=0; i<numHairs; i++) {
603 const unsigned v0 = (RandomSampler_getInt(sampler) % 32 == 0) ? RandomSampler_getUInt(sampler) : unsigned(4*i);
604 mesh->hairs[i] = HairSetNode::Hair(v0,0);
605 }
606
607 mesh->positions[0].resize(4*numHairs);
608 for (size_t i=0; i<4*numHairs; i++) {
609 const float x = cast_i2f(RandomSampler_getUInt(sampler));
610 const float y = cast_i2f(RandomSampler_getUInt(sampler));
611 const float z = cast_i2f(RandomSampler_getUInt(sampler));
612 const float r = cast_i2f(RandomSampler_getUInt(sampler));
613 mesh->positions[0][i] = Vec3ff(x,y,z,r);
614 }
615
616 if (mblur)
617 {
618 mesh->positions[1].resize(4*numHairs);
619 for (size_t i=0; i<4*numHairs; i++) {
620 const float x = cast_i2f(RandomSampler_getUInt(sampler));
621 const float y = cast_i2f(RandomSampler_getUInt(sampler));
622 const float z = cast_i2f(RandomSampler_getUInt(sampler));
623 const float r = cast_i2f(RandomSampler_getUInt(sampler));
624 mesh->positions[1][i] = Vec3ff(x,y,z,r);
625 }
626 }
627
628 return mesh.dynamicCast<SceneGraph::Node>();
629 }
630
631 Ref<SceneGraph::Node> SceneGraph::createGarbageSubdivMesh (int hash, size_t numFaces, bool mblur, Ref<MaterialNode> material)
632 {

Callers

nothing calls this directly

Calls 6

RandomSampler_initFunction · 0.85
RandomSampler_getIntFunction · 0.85
RandomSampler_getUIntFunction · 0.85
HairClass · 0.85
cast_i2fFunction · 0.50
resizeMethod · 0.45

Tested by

no test coverage detected