Project

General

Profile

« Previous | Next » 

Revision c7e79b69

Added by Leszek Koltunski over 3 years ago

Progress with Dino Movement

View differences:

src/main/java/org/distorted/main/RubikSurfaceView.java
58 58
    // Moving the finger by 0.3 of an inch will start a Rotation.
59 59
    private final static float ROTATION_SENSITIVITY = 0.3f;
60 60

  
61
    // Where did we get this sqrt(3)/2 ? From the (default, i.e. 60 degrees - see InternalOutputSurface!)
62
    // FOV of the projection matrix of the Node onto the Screen.
63
    // Take a look how the CAMERA_POINT is used in onTouchEvent - (x,y) there are expressed in sort of
64
    // 'half-NDC' coordinates i.e. they range from +0.5 to -0.5; thus CAMERA_POINT also needs to be
65
    // in 'half-NDC'. Since in this coordinate system the height of the screen is equal to 1, then the
66
    // Z-distance from the center of the object to the camera is equal to (scrHeight/2)/tan(FOV/2) =
67
    // 0.5/tan(30) = sqrt(3)/2.
68
    // Why is the Z-distance between the camera and the object equal to (scrHeight/2)/tan(FOV/2)?
69
    // Because of the way the View part of the ModelView matrix is constructed in EffectQueueMatrix.send().
70
    private final Static4D CAMERA_POINT = new Static4D(0, 0, (float)Math.sqrt(3)*0.5f, 0);
61
    private final Static4D CAMERA_POINT = new Static4D(0, 0, 1, 0);
71 62

  
72 63
    private RubikRenderer mRenderer;
73 64
    private RubikPreRender mPreRender;

Also available in: Unified diff