Project

General

Profile

« Previous | Next » 

Revision fec27f16

Added by Leszek Koltunski over 7 years ago

Fix the final 'Vertex & Fragment Effects' APP. All APPs work now!

View differences:

src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
58 58
    private DistortedNode mCenterNode, mRegionNode;
59 59
    private int mObjWidth, mObjHeight;
60 60
    private Static3D mCenterPoint, mRegionPoint, mRegionScalePoint;
61
    private Static3D mRotateCen, mMoveObject, mMoveCenter, mScaleCenter, mMoveRegion, mMoveBackground, mScaleBackground;
62

  
61
    private Static3D mRotateCen, mMoveObject, mScaleObject, mMoveCenter, mScaleCenter, mMoveRegion, mMoveBackground, mScaleBackground;
62
    private boolean mShowingCenter=false;
63
    private boolean mShowingRegion=false;
63 64
    private float mFactorObj, mFactorReg;
64 65

  
65 66
    Static4D mQuat1, mQuat2;
66 67
    int mScreenMin;
67
    private boolean mShowingCenter=false;
68
    private boolean mShowingRegion=false;
69 68

  
70 69
///////////////////////////////////////////////////////////////////////////////////////////////////
71 70

  
......
77 76

  
78 77
      mRotateCen      = new Static3D(0,0,0);
79 78
      mMoveObject     = new Static3D(0,0,0);
79
      mScaleObject    = new Static3D(1,1,1);
80 80
      mMoveCenter     = new Static3D(0,0,0);
81 81
      mScaleCenter    = new Static3D(1,1,1);
82 82
      mMoveRegion     = new Static3D(0,0,0);
......
126 126
      MatrixEffectMove centerMove = new MatrixEffectMove(mCenterPoint);
127 127

  
128 128
      objectEffects.apply( new MatrixEffectMove(mMoveObject));
129
      objectEffects.apply( new MatrixEffectScale(mFactorObj) );
129
      objectEffects.apply( new MatrixEffectScale(mScaleObject) );
130 130
      objectEffects.apply(quat1obj);
131 131
      objectEffects.apply(quat2obj);
132 132

  
......
182 182
    void setRegion(float x, float y, float r)
183 183
      {
184 184
      mFactorReg = 2*mFactorObj*r/mRegionTexture.getWidth();
185
      mRegionPoint.set(mFactorObj*x,mFactorObj*y,0);
185
      mRegionPoint.set(mFactorObj*x,-mFactorObj*y,0);
186 186
      mRegionScalePoint.set(mFactorReg,mFactorReg,mFactorReg);
187 187
      }
188 188

  
......
215 215
        }
216 216

  
217 217
      Effects3DActivity act = (Effects3DActivity)mView.getContext();
218
      mCenterPoint.set(mFactorObj*act.getCenterX(),mFactorObj*act.getCenterY(),0);
219
      mRegionPoint.set(mFactorObj*act.getRegionX(),mFactorObj*act.getRegionY(),0);
218
      mCenterPoint.set(mFactorObj*act.getCenterX(),+mFactorObj*act.getCenterY(),0);
219
      mRegionPoint.set(mFactorObj*act.getRegionX(),-mFactorObj*act.getRegionY(),0);
220 220
      mFactorReg = 2*mFactorObj*act.getRegionR()/regionSize;
221 221
      mRegionScalePoint.set(mFactorReg,mFactorReg,mFactorReg);
222 222
      mMoveObject.set( (width-mFactorObj*mObjWidth)/2 , (height-mFactorObj*mObjHeight)/2 , 0 );
223 223
      mRotateCen.set(width/2,height/2, 0);
224

  
224
      mScaleObject.set(mFactorObj,mFactorObj,mFactorObj);
225 225
      mMoveCenter.set( (width -factorCen*centerSize-mFactorObj*mObjWidth )/2 ,
226 226
                       (height-factorCen*centerSize-mFactorObj*mObjHeight)/2 , 15 );
227 227
      mScaleCenter.set(factorCen,factorCen,factorCen);

Also available in: Unified diff