Project

General

Profile

« Previous | Next » 

Revision 16b22aab

Added by Leszek Koltunski about 5 years ago

Fix several more apps for the 'center-of-matrix-effects-in-screen-center' change.

View differences:

src/main/java/org/distorted/examples/earth/EarthRenderer.java
70 70
    private static final int   RADIUS_F= SIZE/15;
71 71
    private static final int   LEVEL   =      40;
72 72
    private static final float FOV     =   30.0f;
73
    private static final float NEAR    =    0.1f;
73
    private static final float NEAR    =   0.01f;
74 74
    private static final int   MAX_EFF =      20;
75 75
    private static final float SCALE   =   1.10f;
76 76

  
......
80 80
    private MeshBase mMesh;
81 81
    private DistortedScreen mScreen;
82 82
    private int mObjWidth, mObjHeight, mObjDepth;
83
    private Static3D mMove, mScaleFactor, mCenter;
83
    private Static3D mMove, mScaleFactor;
84 84

  
85 85
    private int mScrWidth, mScrHeight;
86 86
    private float mLevel;
......
109 109
      mRegionV    = new Static4D(0,0,0,RADIUS_V);
110 110
      mMove       = new Static3D(0,0,0);
111 111
      mScaleFactor= new Static3D(1,1,1);
112
      mCenter     = new Static3D(0,0,0);
113 112
      mPinch      = new Static2D(0.5f,0.0f);
114 113
      mSwirl      = new Static1D(45.0f);
115 114

  
115
      Static3D center = new Static3D(0,0,0);
116

  
116 117
      Dynamic3D scale = new Dynamic3D(0,0.5f);
117 118
      scale.add(mScaleFactor);
118 119

  
......
135 136
      mEffects = new DistortedEffects();
136 137
      mEffects.apply( new MatrixEffectMove(mMove) );
137 138
      mEffects.apply( new MatrixEffectScale(scale));
138
      mEffects.apply( new MatrixEffectQuaternion(quatInt1, mCenter) );
139
      mEffects.apply( new MatrixEffectQuaternion(quatInt2, mCenter) );
139
      mEffects.apply( new MatrixEffectQuaternion(quatInt1, center) );
140
      mEffects.apply( new MatrixEffectQuaternion(quatInt2, center) );
140 141

  
141 142
      mScreen = new DistortedScreen();
142 143
      mScreen.setProjection(FOV, NEAR);
......
159 160

  
160 161
      adjustFactor();
161 162

  
162
      mCenter.set( (float)mObjWidth/2, (float)mObjHeight/2, (float)mObjDepth/2 );
163 163
      mScreen.resize(width, height);
164 164
      }
165 165

  
......
167 167

  
168 168
    void setLevel(int level)
169 169
      {
170
      float N=3.0f;
170
      final float N=2.2f;
171 171

  
172 172
      // MAP: 0--> SCALE/N   50-->SCALE   100->SCALE*N
173 173
      mLevel = SCALE* (1.0f+  (level>=50 ? N-1 : (N-1)/N) * (level-50)/50.0f);
......
184 184

  
185 185
      float factor = xW>xH ? mLevel*xH : mLevel*xW;
186 186

  
187
      mMove.set( (mScrWidth-factor*mObjWidth)/2 , (mScrHeight-factor*mObjHeight)/2 , -factor*mObjDepth );
187
      mMove.set( 0, 0, -factor*mObjDepth );
188 188
      mScaleFactor.set(factor,factor,factor);
189 189
      }
190 190

  

Also available in: Unified diff