void CameraToolKit::setCameraUpVector( unsigned int iID, Vector up ) { ICameraSceneNode *pCamera = getCamera( iID ); if ( pCamera ) pCamera->setUpVector( up ); }
void CSceneNodeAnimatorCameraFollowShip::animateNode( ISceneNode* node, u32 timeMs ) { ICameraSceneNode* camera = static_cast<ICameraSceneNode*>( node ); IShip* ship = static_cast<IShip*>(Target); vector3df direction = (ship->getTarget() - ship->getPosition()).normalize(); vector3df offset = direction * Distance; /*vector3df upoffset = ship->getUpVector(); upoffset = upoffset.normalize() * 10;*/ camera->setPosition( ship->getPosition() + offset/* + upoffset */); camera->setRotation( ship->getRotation() ); camera->setUpVector( ship->getUpVector() ); camera->setTarget( ship->getTarget() ); }
bool terrainSceneNode(void) { IrrlichtDevice *device = createDevice(video::EDT_OPENGL, dimension2di(160, 120), 32); IVideoDriver* driver = device->getVideoDriver(); ISceneManager* smgr = device->getSceneManager(); ITerrainSceneNode* terrain = smgr->addTerrainSceneNode( "../media/terrain-heightmap.bmp"); terrain->setScale(core::vector3df(40.f, .1f, 40.f)); terrain->setMaterialFlag(video::EMF_LIGHTING, false); terrain->setMaterialTexture(0, driver->getTexture("../media/terrain-texture.jpg")); terrain->setDebugDataVisible(scene::EDS_FULL); ICameraSceneNode* camera = smgr->addCameraSceneNode(); const core::vector3df center (terrain->getBoundingBox().getCenter()); camera->setTarget (center); // yes, Y is intentionally being set to X here const core::vector3df above (center.X, center.X, center.Z); camera->setPosition (above); camera->setUpVector(vector3df(1.f, 0.f, 0.f)); camera->setFarValue(above.Y); device->run(); smgr->drawAll(); // This shouldn't cause a recalc camera->setUpVector(vector3df(1.f, 0.f, .01f).normalize()); device->run(); driver->beginScene(true, true, video::SColor(255,100,101,140)); smgr->drawAll(); driver->endScene(); // Note that this has to be a slightly fuzzier than usual compare to satisfy multiple OpenGL environments bool result = takeScreenshotAndCompareAgainstReference(driver, "-terrainSceneNode-1.png", 98.3f); if(!result) { logTestString("Small camera up rotation caused bad recalc.\n"); assert(false); } // This is big enough to cause a recalc camera->setUpVector(vector3df(1.f, 0.f, .1f).normalize()); device->run(); driver->beginScene(true, true, video::SColor(255,100,101,140)); smgr->drawAll(); driver->endScene(); result &= takeScreenshotAndCompareAgainstReference(driver, "-terrainSceneNode-2.png", 98.9f); if(!result) { logTestString("Large camera up rotation caused bad recalc.\n"); assert(false); } device->drop(); return result; }
void loop_ctr(s4 &game_state) { ISceneNode* empty_node = irrlicht->smgr->addEmptySceneNode(); empty_node->setPosition(vector3df(0,0,0)); ICameraSceneNode* camera = irrlicht->smgr->addCameraSceneNode(); camera->setPosition({0,-250,-100}); camera->setUpVector({0,0,-1}); camera->setTarget({0,0,0}); camera->setParent(empty_node); camera->setFOV(70); irrlicht->device->getCursorControl()->setVisible(false); irrlicht->smgr->setAmbientLight(SColorf(1,1,1,1)); irrlicht->hud = irrlicht->smgr->createNewSceneManager(false); ICameraSceneNode* hud_camera = irrlicht->hud->addCameraSceneNode(); matrix4 ortho; ortho.buildProjectionMatrixOrthoLH( irrlicht->driver->getScreenSize().Width/ortho_scale, irrlicht->driver->getScreenSize().Height/ortho_scale,-1.0,1000.0); hud_camera->setProjectionMatrix(ortho); hud_camera->setPosition({0,0,-100}); hud_camera->setTarget({0,0,0}); // temp objects ---------------------------------- blist cmpnt_list, joint_list, tree_list; b_set(cmpnt_list,memory,sizeof(Component)); b_set(joint_list,memory,sizeof(Joint)); b_set(tree_list,memory,sizeof(CTree)); irr::core::map<ISceneNode*,Component*> node_cmpnt_map; ISceneNode* ctr_parent = irrlicht->smgr->addEmptySceneNode(); IMesh* cube_mesh = irrlicht->smgr->getGeometryCreator()->createCubeMesh(); auto add_object_to_world = [&] (vec3 pos, vec3 scale, s4 a, s4 r, s4 g, s4 b) -> Component* { const f4 floor_position = 10.0f; Component make_cmpnt; make_cmpnt.id = CMPNT_ID; CMPNT_ID++; make_cmpnt.node = irrlicht->smgr->addMeshSceneNode(cube_mesh,ctr_parent); make_cmpnt.node->setPosition(pos.irr()); make_cmpnt.node->setScale(scale.irr()); make_cmpnt.node->getMaterial(0).AmbientColor.set(a,r,g,b); make_cmpnt.shadow = irrlicht->smgr->addMeshSceneNode(cube_mesh,0); make_cmpnt.shadow->setScale({scale.x, scale.y, 0.1f}); make_cmpnt.shadow->setPosition({pos.x, pos.y,floor_position}); make_cmpnt.shadow->getMaterial(0).AmbientColor.set(GREY_BLUE_SHADOW); for (s4 i = 0; i < MAX_JOINTS; i++) make_cmpnt.joints[i] = 0; make_cmpnt.tree = 0; b_copy(cmpnt_list,&make_cmpnt); node_cmpnt_map.insert(make_cmpnt.node, (Component*)blast_address(cmpnt_list) ); return (Component*)blast_address(cmpnt_list); }; auto add_joint = [&] (Component* A, Component* B, vec3 posA, vec3 posB) { Joint C; C.A = A; C.posA = A->node->getTransformedBoundingBox().getExtent() * A->node->getScale(); C.posA *= (posA * 0.5f); C.B = B; C.posB = B->node->getTransformedBoundingBox().getExtent() * B->node->getScale(); C.posB *= (posB * 0.5f); C.type = Joint::SNAP; C.is_connected = false; b_copy(joint_list,&C); for (s4 i = 0; i < MAX_JOINTS; i++) { if (C.A->joints[i] == 0) { C.A->joints[i] = (Joint*)blast_address(joint_list); break; } else if (i == MAX_JOINTS-1) { std::cout << "ERROR: Joint could not be added to C.A." << std::endl; } } for (s4 i = 0; i < MAX_JOINTS; i++) { if (C.B->joints[i] == 0) { C.B->joints[i] = (Joint*)blast_address(joint_list); break; } else if (i == MAX_JOINTS-1) { std::cout << "ERROR: Joint could not be added to C.B." << std::endl; } } }; { Component* A = add_object_to_world(vec3(0,30,-20),vec3(3,3,3),BLUE_LIGHT); Component* B = add_object_to_world(vec3(0,60,-20),vec3(9,3,2),BLACK); add_joint(A,B,vec3(0.0f,0.0f,1.0f),vec3(0.0f,0.0f,-1.0f)); Component* C = add_object_to_world(vec3(0,-90,-20),vec3(3,3,3),YELLOW_LIGHT); Component* D = add_object_to_world(vec3(0,-40,-20),vec3(8,10,4),GREEN_LIGHT); add_joint(C,D,vec3(0.0f,1.0f,0.0f),vec3(0.0f,-1.0f,0.0f)); add_joint(A,D,vec3(0.0f,0.0f,-1.0f),vec3(0.0f,0.0f,1.0f)); } // temp objects ---------------------------------- SimpleNodeEditor* sneditor = simple_node_editor_init(); sneditor->root_node = ctr_parent; f4 target_z_rotation = empty_node->getRotation().Z; p("---- Game loop start ----"); f4 dt = 0.0f; const f4 maxDelta = 1.0f/60.0f * 5.0f; const f4 tick_ms = 0.01666f; f4 render_dt = 0.0f; const f4 render_ms = 0.016667f; u4 time_physics_prev = btclock->getTimeMicroseconds(); while(irrlicht->device->run() && game_state == GAME_STATE_PLAY) { const u4 time_physics_curr = btclock->getTimeMicroseconds(); const f4 frameTime = ((f4)(time_physics_curr - time_physics_prev)) / 1000000.0; // todo: is this truncated correctly? time_physics_prev = time_physics_curr; f4 capped_dt = frameTime; if (capped_dt > maxDelta) { capped_dt = maxDelta; } render_dt += capped_dt; if ( render_dt >= render_ms ) { render_dt = 0.0f; f4 curr_rotation = empty_node->getRotation().Z; if (curr_rotation != target_z_rotation) { weighted_average(curr_rotation,target_z_rotation, 20.0f); if (curr_rotation >= 360.0f) { curr_rotation -= 360.0f; target_z_rotation -= 360.0f; } else if (curr_rotation < 0) { curr_rotation += 360.0f; target_z_rotation += 360.0f; } empty_node->setRotation({0,0,curr_rotation}); } if (sneditor->selected_node) { position2d<s32> screen_coord = irrlicht->colmgr->getScreenCoordinatesFrom3DPosition(sneditor->selected_node->getPosition(), camera); sneditor->hand_icon->setPosition({(screen_coord.X - (SCREEN_WIDTH/2)) / ortho_scale, (screen_coord.Y - (SCREEN_HEIGHT/2)) / -ortho_scale,0}); } else { sneditor->hand_icon->setPosition({(sneditor->cursor->getPosition().X - (SCREEN_WIDTH/2)) / ortho_scale, (sneditor->cursor->getPosition().Y - (SCREEN_HEIGHT/2)) / -ortho_scale,0}); } // Render irrlicht->driver->beginScene(true, true, SColor(GREY_BLUE)); irrlicht->smgr->drawAll(); irrlicht->driver->clearZBuffer(); irrlicht->hud->drawAll(); irrlicht->driver->endScene(); } dt += capped_dt; while( dt >= tick_ms ) { dt -= tick_ms; receiver->input(); if (receiver->a.state) target_z_rotation -= 90.0f; if (receiver->d.state) target_z_rotation += 90.0f; simple_node_editor_update( sneditor, receiver->mouse.left.state, receiver->mouse.left.released, receiver->mouse.right.state, false, receiver->tab.state, camera, &node_cmpnt_map); // TODO: Change this to: // - only test what the user is holding // - and only if the user is holding the smaller inserting part. // example: holding a screw in a large box bloop(joint_list, i) { Joint* c = (Joint*)b_get_mem_address(joint_list,i); if (c->A->tree != sneditor->selected_tree && c->B->tree != sneditor->selected_tree ) { continue; } if (!c->is_connected) { vec3 A = c->A->node->getPosition(); vec3 B = c->B->node->getPosition(); A += c->posA; B += c->posB; if (A.distance(B) < 13 /* && receiver->spacebar*/) { std::cout << "Comparing " << i << std::endl; c->is_connected = true; connect_joints(c,sneditor,camera,tree_list); } } } bloop(tree_list, i) { CTree* tree = (CTree*)b_get_mem_address(tree_list,i); if (tree->translation == vec3(0,0,0)) { continue; } for (s4 k = 0; k < tree->child_list.length;k++) { Component* cmpnt = (Component*)b_get_value(tree->child_list,k); cmpnt->node->setPosition(cmpnt->node->getPosition() + tree->translation.irr()); cmpnt->shadow->setPosition(cmpnt->node->getPosition() * vector3df(1,1,0) + vector3df(0,0,10)); } tree->translation = vec3(0,0,0); } if (receiver->restart.state) { game_state = GAME_STATE_RESET; } if (receiver->QUIT) { game_state = GAME_STATE_QUIT; } }
//! OnAnimate() is called just before rendering the whole scene. //! nodes may calculate or store animations here, and may do other useful things, //! dependent on what they are. void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs) { //Alt + LM = Rotate around camera pivot //Alt + LM + MM = Dolly forth/back in view direction (speed % distance camera pivot - max distance to pivot) //Alt + MM = Move on camera plane (Screen center is about the mouse pointer, depending on move speed) if (node->getType() != ESNT_CAMERA) return; ICameraSceneNode* camera = static_cast<ICameraSceneNode*>(node); if (OldCamera != camera) { OldTarget = camera->getTarget(); OldCamera = camera; } Target = camera->getTarget(); const SViewFrustum* va = camera->getViewFrustum(); f32 nRotX = RotX; f32 nRotY = RotY; f32 nZoom = CurrentZoom; if ( (isMouseKeyDown(0) && isMouseKeyDown(2)) || isMouseKeyDown(1) ) { if (!Zooming) { ZoomStartX = MousePos.X; ZoomStartY = MousePos.Y; Zooming = true; nZoom = CurrentZoom; } else { f32 old = nZoom; nZoom += (ZoomStartX - MousePos.X) * ZoomSpeed; f32 targetMinDistance = 0.1f; if (nZoom < targetMinDistance) // jox: fixed bug: bounce back when zooming to close nZoom = targetMinDistance; if (nZoom < 0) nZoom = old; } } else { if (Zooming) { f32 old = CurrentZoom; CurrentZoom = CurrentZoom + (ZoomStartX - MousePos.X ) * ZoomSpeed; nZoom = CurrentZoom; if (nZoom < 0) nZoom = CurrentZoom = old; } Zooming = false; } // Translation --------------------------------- core::vector3df translate(OldTarget), UpVector(camera->getUpVector()); core::vector3df tvectX = Pos - Target; tvectX = tvectX.crossProduct(UpVector); tvectX.normalize(); core::vector3df tvectY = (va->getFarLeftDown() - va->getFarRightDown()); tvectY = tvectY.crossProduct(UpVector.Y > 0 ? Pos - Target : Target - Pos); tvectY.normalize(); if (isMouseKeyDown(2) && !Zooming) { if (!Translating) { TranslateStartX = MousePos.X; TranslateStartY = MousePos.Y; Translating = true; } else { translate += tvectX * (TranslateStartX - MousePos.X)*TranslateSpeed + tvectY * (TranslateStartY - MousePos.Y)*TranslateSpeed; } } else { if (Translating) { translate += tvectX * (TranslateStartX - MousePos.X)*TranslateSpeed + tvectY * (TranslateStartY - MousePos.Y)*TranslateSpeed; OldTarget = translate; } Translating = false; } // Rotation ------------------------------------ if (isMouseKeyDown(0) && !Zooming) { if (!Rotating) { RotateStartX = MousePos.X; RotateStartY = MousePos.Y; Rotating = true; nRotX = RotX; nRotY = RotY; } else { nRotX += (RotateStartX - MousePos.X) * RotateSpeed; nRotY += (RotateStartY - MousePos.Y) * RotateSpeed; } } else { if (Rotating) { RotX = RotX + (RotateStartX - MousePos.X) * RotateSpeed; RotY = RotY + (RotateStartY - MousePos.Y) * RotateSpeed; nRotX = RotX; nRotY = RotY; } Rotating = false; } // Set Pos ------------------------------------ Target = translate; Pos.X = nZoom + Target.X; Pos.Y = Target.Y; Pos.Z = Target.Z; Pos.rotateXYBy(nRotY, Target); Pos.rotateXZBy(-nRotX, Target); // Rotation Error ---------------------------- // jox: fixed bug: jitter when rotating to the top and bottom of y UpVector.set(0,1,0); UpVector.rotateXYBy(-nRotY); UpVector.rotateXZBy(-nRotX+180.f); camera->setPosition(Pos); camera->setTarget(Target); camera->setUpVector(UpVector); }
//! OnAnimate() is called just before rendering the whole scene. //! nodes may calculate or store animations here, and may do other useful things, //! dependent on what they are. void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs) { //Alt + LM = Rotate around camera pivot //Alt + LM + MM = Dolly forth/back in view direction (speed % distance camera pivot - max distance to pivot) //Alt + MM = Move on camera plane (Screen center is about the mouse pointer, depending on move speed) if (!node || node->getType() != ESNT_CAMERA) return; ICameraSceneNode* camera = static_cast<ICameraSceneNode*>(node); // If the camera isn't the active camera, and receiving input, then don't process it. if(!camera->isInputReceiverEnabled()) return; scene::ISceneManager * smgr = camera->getSceneManager(); if(smgr && smgr->getActiveCamera() != camera) return; if (OldCamera != camera) { OldTarget = camera->getTarget(); OldCamera = camera; LastCameraTarget = OldTarget; } else { OldTarget += camera->getTarget() - LastCameraTarget; } core::vector3df target = camera->getTarget(); f32 nRotX = RotX; f32 nRotY = RotY; f32 nZoom = CurrentZoom; if ( (isMouseKeyDown(0) && isMouseKeyDown(2)) || isMouseKeyDown(1) ) { if (!Zooming) { ZoomStart = MousePos; Zooming = true; nZoom = CurrentZoom; } else { const f32 targetMinDistance = 0.1f; nZoom += (ZoomStart.X - MousePos.X) * ZoomSpeed; if (nZoom < targetMinDistance) // jox: fixed bug: bounce back when zooming to close nZoom = targetMinDistance; } } else if (Zooming) { const f32 old = CurrentZoom; CurrentZoom = CurrentZoom + (ZoomStart.X - MousePos.X ) * ZoomSpeed; nZoom = CurrentZoom; if (nZoom < 0) nZoom = CurrentZoom = old; Zooming = false; } // Translation --------------------------------- core::vector3df translate(OldTarget), upVector(camera->getUpVector()); core::vector3df tvectX = Pos - target; tvectX = tvectX.crossProduct(upVector); tvectX.normalize(); const SViewFrustum* const va = camera->getViewFrustum(); core::vector3df tvectY = (va->getFarLeftDown() - va->getFarRightDown()); tvectY = tvectY.crossProduct(upVector.Y > 0 ? Pos - target : target - Pos); tvectY.normalize(); if (isMouseKeyDown(2) && !Zooming) { if (!Translating) { TranslateStart = MousePos; Translating = true; } else { translate += tvectX * (TranslateStart.X - MousePos.X)*TranslateSpeed + tvectY * (TranslateStart.Y - MousePos.Y)*TranslateSpeed; } } else if (Translating) { translate += tvectX * (TranslateStart.X - MousePos.X)*TranslateSpeed + tvectY * (TranslateStart.Y - MousePos.Y)*TranslateSpeed; OldTarget = translate; Translating = false; } // Rotation ------------------------------------ if (isMouseKeyDown(0) && !Zooming) { if (!Rotating) { RotateStart = MousePos; Rotating = true; nRotX = RotX; nRotY = RotY; } else { nRotX += (RotateStart.X - MousePos.X) * RotateSpeed; nRotY += (RotateStart.Y - MousePos.Y) * RotateSpeed; } } else if (Rotating) { RotX += (RotateStart.X - MousePos.X) * RotateSpeed; RotY += (RotateStart.Y - MousePos.Y) * RotateSpeed; nRotX = RotX; nRotY = RotY; Rotating = false; } // Set Pos ------------------------------------ target = translate; Pos.X = nZoom + target.X; Pos.Y = target.Y; Pos.Z = target.Z; Pos.rotateXYBy(nRotY, target); Pos.rotateXZBy(-nRotX, target); // Rotation Error ---------------------------- // jox: fixed bug: jitter when rotating to the top and bottom of y upVector.set(0,1,0); upVector.rotateXYBy(-nRotY); upVector.rotateXZBy(-nRotX+180.f); camera->setPosition(Pos); camera->setTarget(target); camera->setUpVector(upVector); LastCameraTarget = camera->getTarget(); }
int main() { // create device EventHandler receiver; Init(); Output(); ISceneNode* objects [MAX_OBJECTS]; IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<u32>(ResX, ResY), 32, fullscreen, false, vsync, &receiver); receiver.device = device; if (!device) return 1; IVideoDriver* driver = device->getVideoDriver(); ISceneManager* smgr = device->getSceneManager(); IGUIEnvironment* guienv = device->getGUIEnvironment(); HMDDescriptor HMD; // Parameters from the Oculus Rift DK1 HMD.hResolution = ResX; HMD.vResolution = ResY; HMD.hScreenSize = 0.14976; HMD.vScreenSize = 0.0936; HMD.interpupillaryDistance = 0.064; HMD.lensSeparationDistance = 0.064; HMD.eyeToScreenDistance = 0.041; HMD.distortionK[0] = 1.0; HMD.distortionK[1] = 0.22; HMD.distortionK[2] = 0.24; HMD.distortionK[3] = 0.0; HMDStereoRender renderer(device, HMD, 10); #ifdef OCCULUS ICameraSceneNode* camera = smgr->addCameraSceneNode(); camera->bindTargetAndRotation(false); camera->setTarget(vector3df(1,0,0)); #else ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(); #endif device->getCursorControl()->setVisible(false); // load a faerie IAnimatedMesh* faerie = smgr->getMesh("media/faerie.md2"); IAnimatedMeshSceneNode* faerieNode = smgr->addAnimatedMeshSceneNode(faerie); faerieNode->setMaterialTexture(0, driver->getTexture("media/faerie2.bmp")); faerieNode->setMaterialFlag(EMF_LIGHTING, false); faerieNode->setPosition(vector3df(40,190,-1030)); faerieNode->setRotation(vector3df(0,-90,0)); faerieNode->setMD2Animation(EMAT_SALUTE); // load a dwarf IAnimatedMesh* dwarf = smgr->getMesh("media/dwarf.x"); IAnimatedMeshSceneNode* dwarfNode = smgr->addAnimatedMeshSceneNode(dwarf); dwarfNode->setPosition(vector3df(40,-25,20)); Level currentLevel(device); currentLevel.makeLevel(0); smgr->setAmbientLight(video::SColorf(0.1,0.1,0.1,1)); ILightSceneNode* light1 = smgr->addLightSceneNode( camera , vector3df(0,0,0), video::SColorf(0.3f,0.4f,0.4f), 80.0f, 1 ); vector3df pos = vector3df(0,0,0); //naplníme tunel pøekážkama srand (time(NULL)); /* generate secret number between 1 and 10: */ for(int i = 0; i < MAX_OBJECTS; i++){ objects[i] = smgr->addCubeSceneNode(2); objects[i]->setMaterialFlag(EMF_LIGHTING, false); objects[i]->setPosition( vector3df( (rand() % 30) - 5, (rand() % 30) - 5, rand() % 80) ); } //device->setInputReceivingSceneManager(smgr); //použivane pro vector3df tempRot; irr::core::quaternion tempQ; irr::core::matrix4 tempM; float round = 0; while(device->run()) { round += 0.01; driver->beginScene(true, true, SColor(255,100,101,140)); for(int i = 0; i < MAX_OBJECTS; i++){ vector3df tmpPos = objects[i]->getPosition(); if(tmpPos.Z > pos.Z) continue; objects[i]->setPosition( vector3df( (rand() % 30) - 15, (rand() % 30) - 15, rand() % 80 + pos.Z) ); } #ifndef OCCULUS tempM.setRotationDegrees(vector3df(sin(round*0.5)*360-180, sin(round)*360-180, cos(round*0.8)*360-180)); // transform forward vector of camera irr::core::vector3df frv = irr::core::vector3df (0.0f, 0.0f, 1.0f); tempM.transformVect(frv); // transform upvector of camera irr::core::vector3df upv = irr::core::vector3df (0.0f, 1.0f, 0.0f); tempM.transformVect(upv); camera->setUpVector(upv); //set up vector of camera camera->setTarget(frv); //set target of camera (look at point) (thx Zeuss for correcting it) #endif if(pSensor){ Quatf quaternion = FusionResult.GetOrientation(); ICameraSceneNode* camera = smgr->getActiveCamera(); tempQ.set(-quaternion.z,quaternion.y,-quaternion.x, quaternion.w); tempQ.normalize(); tempQ.toEuler(tempRot); tempM.setRotationDegrees(tempRot); // transform forward vector of camera irr::core::vector3df frv = irr::core::vector3df (0.0f, 0.0f, 1.0f); tempM.transformVect(frv); // transform upvector of camera irr::core::vector3df upv = irr::core::vector3df (0.0f, 1.0f, 0.0f); tempM.transformVect(upv); camera->setUpVector(upv); //set up vector of camera camera->setTarget(frv); //set target of camera (look at point) (thx Zeuss for correcting it) // update absolute position camera->updateAbsolutePosition(); float yaw, pitch, roll; quaternion.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll); camera->getParent()->setRotation( vector3df(RadToDegree(pitch),RadToDegree(yaw),RadToDegree(roll))); //camera->setRotation( vector3df(RadToDegree(-pitch),RadToDegree(-yaw),RadToDegree(roll))); //camera->setProjectionMatrix(ToMatrix(quaternion)); cout << " Yaw: " << RadToDegree(yaw) << ", Pitch: " << RadToDegree(pitch) << ", Roll: " << RadToDegree(roll) << endl; if (_kbhit()) exit(0); } #ifdef OCCULUS renderer.drawAll(smgr); #else smgr->drawAll(); #endif guienv->drawAll(); driver->endScene(); } device->drop(); Clear(); return 0; }