-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathcube.cpp
More file actions
34 lines (26 loc) · 900 Bytes
/
cube.cpp
File metadata and controls
34 lines (26 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Draw a cube with RhomboVisual
#include <sm/vec>
#include <mplot/compoundray/Visual.h>
#include <mplot/RhomboVisual.h>
int main()
{
// Create a scene
mplot::compoundray::Visual v(1024, 768, "A cube");
v.showCoordArrows (true);
v.lightingEffects();
// Parameters of the model
sm::vec<float, 3> offset = { 1, -0.5, -0.5 }; // a within-scene offset
sm::vec<float, 3> e1 = { 1, 0, 0 };
sm::vec<float, 3> e2 = { 0, 1, 0 };
sm::vec<float, 3> e3 = { 0, 0, 1 };
sm::vec<float, 3> colour1 = { 0.35, 0.76, 0.98 }; // RGB colour triplet
auto rv = std::make_unique<mplot::RhomboVisual<>> (offset, e1, e2, e3, colour1);
v.bindmodel (rv);
rv->name = "Cube.002";
rv->facecm = mplot::ColourMapType::Rainbow; // Try Rainbow, Batlow, Tofino
rv->annotate = true;
rv->finalize();
v.addVisualModel (rv);
v.keepOpen();
return 0;
}