Project

General

Profile

« Previous | Next » 

Revision a4d59c0b

Added by Leszek Koltunski over 5 years ago

Massive: make the coordinate system agree with that of OpenGL (i.e. invert the Y axis).

View differences:

src/main/java/org/distorted/examples/mirror/MirrorRenderer.java
50 50
   private static final float HEAD_SCALE       =0.30f;  // Head's height will be 30% of the height of the mirror
51 51
   private static final float MIRROR_BRIGHTNESS=0.70f;  // Each next mirror 30% darker
52 52
   private static final float MIRROR_MARGIN    =0.11f;  // The frame of the mirror takes up 11% of its width
53
   private static final float MIRROR_MOVE      =0.12f;  // Each next mirror is moved to the right by 12% of
53
   private static final float MIRROR_MOVE_H    =0.12f;  // Each next mirror is moved to the left by 12% of
54 54
                                                        // the length of the previous one
55
   private static final float MIRROR_MOVE_V    =0.22f;  // Move the mirror up
55 56

  
56 57
   private GLSurfaceView mView;
57 58
   private DistortedEffects mEffectsMirror, mEffectsHead, mEffectsNull;
......
141 142
        mOffScreen2 = new DistortedFramebuffer( (int)(MIRROR_SCALE*mScreenW), (int)(MIRROR_SCALE*mScreenH), 1, DistortedFramebuffer.NO_DEPTH_NO_STENCIL );
142 143

  
143 144
        mScaleMirror.set( (float)mScreenW/mMirrorW, (float)mScreenH/mMirrorH, 1.0f);
144
        mMoveOffscreen2.set( MIRROR_MOVE*mScreenW, MIRROR_MOVE*mScreenH*mMirrorW/mMirrorH, 0);
145
        mMoveOffscreen2.set( MIRROR_MOVE_H*mScreenW, MIRROR_MOVE_V*mScreenH*mMirrorW/mMirrorH, 0);
145 146

  
146 147
        float headScale = HEAD_SCALE *mScreenH/ mHeadH;
147 148
        mScaleHead.set(headScale,headScale,headScale);
148
        mHeadPosition.set2( mScreenH*(1.0f-MIRROR_MARGIN*mMirrorW/mMirrorH) - headScale* mHeadH);
149
        mHeadPosition.set2( mScreenH*MIRROR_MARGIN*mMirrorW/mMirrorH );
149 150
        setPosition(mX);
150 151

  
151 152
        mOffScreen1.attach( mTextureMirror, mEffectsMirror    , mQuad );

Also available in: Unified diff