Changeset 4358 in orxonox.OLD for orxonox/trunk/src/subprojects
- Timestamp:
- May 28, 2005, 12:33:39 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/subprojects/framework.cc
r4349 r4358 35 35 { 36 36 #ifdef GUI_MODULE 37 while(gtk_events_pending()) 37 while(gtk_events_pending()) 38 38 gtk_main_iteration(); 39 39 #endif … … 60 60 61 61 camera->apply(); 62 printf("distance: %f\n", (camera->getTarget()->getAbsCoor()-camera->getAbsCoor()).len()); 62 63 63 64 SDL_GL_SwapBuffers(); // Swap the buffers … … 97 98 h.normalize(); 98 99 v.normalize(); 100 float distance = view.len(); 101 102 Vector newCameraPos = camera->getAbsCoor(); 103 Vector newTargetPos = camera->getTarget()->getAbsCoor(); 104 int changed = 0; 99 105 100 106 if (mouseDown[1]) 101 camera->setRelCoor(camera->getRelCoor()+ h * event.motion.xrel *.05 - v * event.motion.yrel * .05); 107 { 108 newCameraPos = camera->getRelCoor()+ (h * event.motion.xrel - v * event.motion.yrel) * .005 * distance; 109 changed += 1; 110 } 102 111 if (mouseDown[3]) 103 camera->getTarget()->setRelCoor(camera->getTarget()->getRelCoor()+ h * event.motion.xrel *.05 - v * event.motion.yrel * .05); 112 { 113 newTargetPos = camera->getTarget()->getRelCoor() + (h * event.motion.xrel - v * event.motion.yrel) * .005 * distance; 114 changed += 2; 115 } 116 117 Vector newView = newTargetPos - newCameraPos; 118 119 if (changed == 1) 120 camera->setRelCoor(newCameraPos + newView * (1- distance/newView.len())); 121 else if (changed == 2) 122 camera->getTarget()->setRelCoor(newTargetPos - newView * (1-distance/newView.len())); 123 else if (changed == 3) 124 { 125 camera->setRelCoor(newCameraPos); 126 camera->getTarget()->setRelCoor(newTargetPos); 127 } 104 128 105 129 }
Note: See TracChangeset
for help on using the changeset viewer.