Created
          December 26, 2014 16:37 
        
      - 
      
- 
        Save indefinit/bdc35728cf7e05626eba to your computer and use it in GitHub Desktop. 
    Cinder glNext: Mapping mousewheel/scroll to Cinder's CameraPersp zoom
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // CameraPersp mCameraPersp; | |
| // float newEyeZ; //holds our current eye Z point | |
| // | |
| void mouseWheel(MouseEvent event) | |
| { | |
| float mouseDelta = event.getWheelIncrement() *5.f; | |
| float newCOI = powf( 2.71828183f, -mouseDelta / 500.0f ) * mCameraPersp.getCenterOfInterest(); | |
| vec3 oldTarget = mCameraPersp.getCenterOfInterestPoint(); | |
| vec3 newEye = oldTarget - mCameraPersp.getViewDirection() * newCOI; | |
| newEyeZ = newEye.z; | |
| mCameraPersp.setEyePoint( newEye ); | |
| mCameraPersp.setCenterOfInterest( newCOI ); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment