#include <Inventor/nodes/SoTranslation.h>SoTranslation - Узел, задающий 3D переносЭтот узел задаёт перемещения при в 3D пространстве. C++ 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <Inventor/Win/SoWin.h>
#include <Inventor/Win/viewers/SoWinExaminerViewer.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoCube.h>
#include <Inventor/nodes/SoTranslation.h>
#include <Inventor/nodes/SoBaseColor.h>
#include "SoAutoPtr.h"
int main(int argc, char* argv[])
{
HWND wnd = SoWin::init( "example" );
SoAutoPtr<SoSeparator> root;
SoAutoPtr<SoCube> cube;
SoAutoPtr<SoTranslation> move;
move->translation = SbVec3f(2.0f, 0.0f, 0);
SoAutoPtr<SoBaseColor> red;
red->rgb = SbColor(1.0f, 0, 0);
root->addChild(red);
root->addChild(cube);
root->addChild(move);
SoAutoPtr<SoBaseColor> green;
green->rgb = SbColor(0, 1.0f, 0);
root->addChild(green);
root->addChild(cube);
root->addChild(move);
SoAutoPtr<SoBaseColor> blue;
blue->rgb = SbColor(0, 0, 1.0f);
root->addChild(blue);
root->addChild(cube);
SoWinExaminerViewer * viewer = new SoWinExaminerViewer(wnd);
viewer->setSceneGraph( root );
viewer->setSize( SbVec2s(800, 600) );
viewer->show();
SoWin::mainLoop();
return 0;
}
|