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

Method createGarbageSubdivMesh

tutorials/common/scenegraph/geometry_creation.cpp:631–663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

629 }
630
631 Ref<SceneGraph::Node> SceneGraph::createGarbageSubdivMesh (int hash, size_t numFaces, bool mblur, Ref<MaterialNode> material)
632 {
633 RandomSampler sampler;
634 RandomSampler_init(sampler,hash);
635 Ref<SceneGraph::SubdivMeshNode> mesh = new SceneGraph::SubdivMeshNode(material,BBox1f(0,1),mblur?2:1);
636
637 for (size_t i=0; i<numFaces; i++)
638 {
639 const unsigned f = RandomSampler_getInt(sampler) % 20;
640 mesh->verticesPerFace.push_back(f);
641 for (size_t j=0; j<f; j++)
642 {
643 mesh->position_indices.push_back((RandomSampler_getInt(sampler) % 32 == 0) ? RandomSampler_getUInt(sampler) : unsigned(mesh->numPositions()));
644
645 const float x = cast_i2f(RandomSampler_getUInt(sampler));
646 const float y = cast_i2f(RandomSampler_getUInt(sampler));
647 const float z = cast_i2f(RandomSampler_getUInt(sampler));
648 const float w = cast_i2f(RandomSampler_getUInt(sampler));
649 mesh->positions[0].push_back(Vec3fa(Vec3ff(x,y,z,w)));
650
651 if (mblur)
652 {
653 const float x = cast_i2f(RandomSampler_getUInt(sampler));
654 const float y = cast_i2f(RandomSampler_getUInt(sampler));
655 const float z = cast_i2f(RandomSampler_getUInt(sampler));
656 const float w = cast_i2f(RandomSampler_getUInt(sampler));
657 mesh->positions[1].push_back(Vec3fa(Vec3ff(x,y,z,w)));
658 }
659 }
660 }
661
662 return mesh.dynamicCast<SceneGraph::Node>();
663 }
664
665
666 Ref<SceneGraph::Node> SceneGraph::createGarbagePointSet(int hash, size_t numPoints, bool mblur, Ref<MaterialNode> material)

Callers

nothing calls this directly

Calls 7

RandomSampler_initFunction · 0.85
RandomSampler_getIntFunction · 0.85
RandomSampler_getUIntFunction · 0.85
numPositionsMethod · 0.80
cast_i2fFunction · 0.50
Vec3faClass · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected