Project

General

Profile

« Previous | Next » 

Revision 84ddf691

Added by Leszek Koltunski about 4 years ago

Fixes for the Projection matrix, FOV.

There was a confusion between the Projection of the Node onto the Screen, and the Projection of the Cubits on the Node.

View differences:

src/main/java/org/distorted/magic/RubikRenderer.java
39 39

  
40 40
public class RubikRenderer implements GLSurfaceView.Renderer, EffectListener
41 41
{
42
    static final float CAMERA_DISTANCE = 0.6f;  // 0.6 of the length of min(scrHeight,scrWidth)
43 42
    public static final int NODE_FBO_SIZE = 600;
44 43

  
45 44
    private RubikSurfaceView mView;
......
311 310
      {
312 311
      if( mNewObject!=null ) mNewObject.createTexture();
313 312

  
314
      double halfFOVInRadians = Math.atan( 1.0f/(2*CAMERA_DISTANCE) );
315
      float fovInDegrees = (float)(2*halfFOVInRadians*(180/Math.PI));
316

  
317
      mScreen.setProjection( fovInDegrees, 0.1f);
318 313
      mScreen.resize(width, height);
319 314
      mView.setScreenSize(width,height);
320 315

  

Also available in: Unified diff