MCPcopy Create free account
hub / github.com/RenderKit/ospray / SetUp

Method SetUp

apps/ospTestSuite/test_volumetric.cpp:49–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void TextureVolumeTransform::SetUp()
50{
51 Base::SetUp();
52
53 camera.setParam("position", vec3f(.66f, .66f, -2.5f));
54 camera.setParam("direction", vec3f(0.f, 0.f, 1.f));
55 camera.setParam("up", vec3f(0.f, 1.f, 0.f));
56
57 // Create transfer function
58 cpp::TransferFunction transferFun("piecewiseLinear");
59 {
60 std::vector<vec3f> colors = {vec3f(1.f, 0.f, 0.f),
61 vec3f(0.f, 1.f, 0.f),
62 vec3f(0.f, 1.f, 1.f),
63 vec3f(1.f, 1.f, 0.f),
64 vec3f(1.f, 1.f, 1.f),
65 vec3f(1.f, 0.f, 1.f)};
66 std::vector<float> opacities = {1.f, 1.f};
67
68 transferFun.setParam("value", range1f(-10000.f, 100.f));
69 transferFun.setParam("color", cpp::CopiedData(colors));
70 transferFun.setParam("opacity", cpp::CopiedData(opacities));
71 transferFun.commit();
72 }
73
74 // Create volumetric model
75 cpp::Volume volume = CreateTorus(256);
76 volume.commit();
77
78 // Create volume texture
79 cpp::Texture tex("volume");
80 tex.setParam("volume", volume);
81 tex.setParam("transferFunction", transferFun);
82 tex.commit();
83
84 // Create a single sphere geometry
85 cpp::Geometry sphere("sphere");
86 {
87 sphere.setParam("sphere.position", cpp::CopiedData(vec3f(0.f)));
88 sphere.setParam("radius", 0.51f);
89 sphere.commit();
90 }
91
92 // Prepare material array
93 constexpr uint32_t cols = 2;
94 constexpr uint32_t rows = 2;
95 std::array<cpp::Material, cols * rows> materials;
96 {
97 // Create materials
98 for (uint32_t i = 0; i < cols * rows; i++) {
99 cpp::Material mat("obj");
100 mat.setParam("map_kd", tex);
101 mat.commit();
102 materials[i] = mat;
103 }
104
105 // Set scale
106 materials[1].setParam("map_kd.transform", affine3f::scale(vec3f(1.2f)));

Callers

nothing calls this directly

Calls 13

CreateTorusFunction · 0.85
newBuilderFunction · 0.85
setParamFunction · 0.85
buildWorldFunction · 0.85
eyePosMethod · 0.80
lookDirMethod · 0.80
upDirMethod · 0.80
commitFunction · 0.50
releaseFunction · 0.50
setParamMethod · 0.45
commitMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected