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

Method createGarbageGridMesh

tutorials/common/scenegraph/geometry_creation.cpp:523–557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521 }
522
523 Ref<SceneGraph::Node> SceneGraph::createGarbageGridMesh (int hash, size_t numGrids, bool mblur, Ref<MaterialNode> material)
524 {
525 RandomSampler sampler;
526 RandomSampler_init(sampler,hash);
527 Ref<SceneGraph::GridMeshNode> mesh = new SceneGraph::GridMeshNode(material,BBox1f(0,1),mblur?2:1);
528
529 mesh->grids.resize(numGrids);
530 for (size_t i=0; i<numGrids; i++) {
531 const unsigned v0 = (RandomSampler_getInt(sampler) % 32 == 0) ? RandomSampler_getUInt(sampler) : unsigned(4*i+0);
532 mesh->grids[i] = GridMeshNode::Grid(v0,2,2,2);
533 }
534
535 mesh->positions[0].resize(4*numGrids);
536 for (size_t i=0; i<4*numGrids; i++) {
537 const float x = cast_i2f(RandomSampler_getUInt(sampler));
538 const float y = cast_i2f(RandomSampler_getUInt(sampler));
539 const float z = cast_i2f(RandomSampler_getUInt(sampler));
540 const float w = cast_i2f(RandomSampler_getUInt(sampler));
541 mesh->positions[0][i] = Vec3fa(Vec3ff(x,y,z,w));
542 }
543
544 if (mblur)
545 {
546 mesh->positions[1].resize(4*numGrids);
547 for (size_t i=0; i<4*numGrids; i++) {
548 const float x = cast_i2f(RandomSampler_getUInt(sampler));
549 const float y = cast_i2f(RandomSampler_getUInt(sampler));
550 const float z = cast_i2f(RandomSampler_getUInt(sampler));
551 const float w = cast_i2f(RandomSampler_getUInt(sampler));
552 mesh->positions[1][i] = Vec3fa(Vec3ff(x,y,z,w));
553 }
554 }
555
556 return mesh.dynamicCast<SceneGraph::Node>();
557 }
558
559 Ref<SceneGraph::Node> SceneGraph::createGarbageLineSegments (int hash, size_t numLineSegments, bool mblur, Ref<MaterialNode> material)
560 {

Callers

nothing calls this directly

Calls 7

RandomSampler_initFunction · 0.85
RandomSampler_getIntFunction · 0.85
RandomSampler_getUIntFunction · 0.85
GridClass · 0.70
cast_i2fFunction · 0.50
Vec3faClass · 0.50
resizeMethod · 0.45

Tested by

no test coverage detected