[Музей программирования ]
Главная » 2015 » Сентябрь » 10 » SoTransform
07:05
SoTransform
#include <Inventor/nodes/SoTransform.h>SoTransform - Узел, задающий 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    #include <Inventor/Win/SoWin.h> #include <Inventor/Win/viewers/SoWinExaminerViewer.h> #include <Inventor/nodes/SoSeparator.h> #include <Inventor/nodes/SoCube.h> #include <Inventor/nodes/SoTransform.h> #include <Inventor/nodes/SoBaseColor.h> #include "SoAutoPtr.h" #include <math.h> int main(int argc, char* argv[]) { HWND wnd = SoWin::init( "example" ); SoAutoPtr<SoSeparator> root; SoAutoPtr<SoCube> cube; SoAutoPtr<SoBaseColor> colors[3]; colors[0]->rgb = SbColor(1.0f, 0, 0); colors[1]->rgb = SbColor(0, 1.0f, 0); colors[2]->rgb = SbColor(0, 0, 1.0f); SoAutoPtr<SoTransform> transform; transform->translation = SbVec3f(4.0f, 0, 0); transform->rotation.setValue( SbVec3f(0,0,1.0f), float(40.0*M_PI/180.0) ); for( int i = 0; i < 9; ++i ) { root->addChild(transform); root->addChild( colors[i%3] ); root->addChild(cube); } SoWinExaminerViewer * viewer = new SoWinExaminerViewer(wnd); viewer->setSceneGraph( root ); viewer->setSize( SbVec2s(800, 600) ); viewer->show(); SoWin::mainLoop(); return 0; }
Просмотров: 298 | Добавил: admin | Рейтинг: 0.0/0
Всего комментариев: 0
avatar