void RGLView::adjustZoomUpdate(int mouseX, int mouseY) { Viewpoint* viewpoint = scene->getViewpoint(); int dy = mouseY - zoomBaseY; float zoom = clamp ( viewpoint->getZoom() * exp(-dy*ZOOM_PIXELLOGSTEP), ZOOM_MIN, ZOOM_MAX); viewpoint->setZoom(zoom); View::update(); zoomBaseY = mouseY; }
void rgl_setZoom(int* successptr, double* zoom) { int success = RGL_FAIL; Device* device = deviceManager->getAnyDevice(); if ( device ) { RGLView* rglview = device->getRGLView(); Scene* scene = rglview->getScene(); Viewpoint* viewpoint = scene->getViewpoint(); viewpoint->setZoom((*zoom - 1.0f)/((float)(VIEWPOINT_MAX_ZOOM-1))); rglview->update(); success = RGL_SUCCESS; } *successptr = success; }
void rgl_setZoom(int* successptr, double* zoom) { int success = RGL_FAIL; Device* device; if (deviceManager && (device = deviceManager->getAnyDevice())) { RGLView* rglview = device->getRGLView(); Scene* scene = rglview->getScene(); Viewpoint* viewpoint = scene->getViewpoint(); viewpoint->setZoom( *zoom ); rglview->update(); success = RGL_SUCCESS; } *successptr = success; }
void RGLView::wheelRotate(int dir) { Viewpoint* viewpoint = scene->getViewpoint(); float zoom = viewpoint->getZoom(); #define ZOOM_STEP 1.05f #define ZOOM_PIXELLOGSTEP 0.02f switch(dir) { case GUI_WheelForward: zoom *= ZOOM_STEP; break; case GUI_WheelBackward: zoom /= ZOOM_STEP; break; } zoom = clamp( zoom , ZOOM_MIN, ZOOM_MAX); viewpoint->setZoom(zoom); View::update(); }