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

Method instantiate

tutorials/convert/convert.cpp:104–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102 }
103
104 void instantiate(Ref<SceneGraph::GroupNode>& group)
105 {
106 for (size_t i=0; i<N; i++)
107 {
108 Vec2f r = Vec2f(random<float>(),random<float>());
109 Vec2f p = dist->sample(r);
110 p.x *= rcp(float(dist->width)); p.y *= rcp(float(dist->height));
111 float angle = 2.0f*float(pi)*random<float>();
112 const AffineSpace3fa space = heightField->get(p)*AffineSpace3fa::rotate(Vec3fa(0,1,0),angle);
113 group->add(new SceneGraph::TransformNode(space,object));
114 }
115 }
116
117 private:
118 Ref<HeightField> heightField;

Callers 1

parseCommandLineFunction · 0.80

Calls 6

rotateFunction · 0.85
rcpFunction · 0.50
Vec3faClass · 0.50
sampleMethod · 0.45
getMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected