[Музей программирования ]
Главная » 2015 » Сентябрь » 10 » SoShuttle
07:10
SoShuttle
#include <Inventor/nodes/SoShuttle.h>SoShuttle - Узел анимированных циклицеских перемещений.Этот узел применяет перемещения к текущей матрице трансформаций. Перемещение происходит между двумя заданными положениями. Скорость анимации задаётся в циклах в секунду. 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 49 50 51 52    #include <Inventor/Win/SoWin.h> #include <Inventor/Win/viewers/SoWinExaminerViewer.h> #include <Inventor/nodes/SoSeparator.h> #include <Inventor/nodes/SoCube.h> #include <Inventor/nodes/SoShuttle.h> #include <Inventor/nodes/SoTranslation.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[2]; colors[0]->rgb = SbColor(1.0f, 0, 0); colors[1]->rgb = SbColor(0,0, 1.0f); SoAutoPtr<SoSeparator> group1; SoAutoPtr<SoTranslation> move; move->translation = SbVec3f(10.0f,0,0); group1->addChild( colors[1] ); group1->addChild(cube); group1->addChild(move); group1->addChild(cube); root->addChild(group1); SoAutoPtr<SoShuttle> shuttle; shuttle->translation0 = SbVec3f( 2.0f, 0.0f, 0.0f ); shuttle->translation1 = SbVec3f( 8.0f, 0.0f, 0.0f ); shuttle->speed = 2.0f; SoAutoPtr<SoSeparator> group2; group2->addChild( colors[0] ); group2->addChild( shuttle ); group2->addChild( cube ); root->addChild( group2 ); SoWinExaminerViewer * viewer = new SoWinExaminerViewer(wnd); viewer->setSceneGraph( root ); viewer->setSize( SbVec2s(800, 600) ); viewer->show(); SoWin::mainLoop(); return 0; }
Просмотров: 279 | Добавил: admin | Рейтинг: 0.0/0
Всего комментариев: 0
avatar