Project

General

Profile

« Previous | Next » 

Revision 0ec011a7

Added by Leszek Koltunski about 5 years ago

Fix the PINCH effect in the Earth App.

View differences:

src/main/java/org/distorted/examples/earth/EarthRenderer.java
201 201
      double cosLAT = Math.cos(latitude);
202 202

  
203 203
      float x = (float)(sinLON*cosLAT)/2.0f;
204
      float y = (float)       -sinLAT /2.0f;
204
      float y = (float)        sinLAT /2.0f;
205 205
      float z = (float)(cosLON*cosLAT)/2.0f;
206 206

  
207 207
      Static3D center = new Static3D( (0.5f+x)*mObjWidth, (0.5f+y)*mObjHeight, (0.5f+z)*mObjDepth);
......
213 213
        case DEFORM           : vector = new Static3D( +x*mObjWidth/CORR, +y*mObjHeight/CORR, +z*mObjDepth/CORR);
214 214
                                effect = new VertexEffectDeform (   vector, center, mRegionV); break;
215 215
        case SINK             : effect = new VertexEffectSink   (mStrength, center, mRegionV); break;
216
        case PINCH            : mPinch.set2(latitude);//>0 ? (float)(Math.PI/2 - latitude) : (float)(-Math.PI/2 - latitude) );
217
                                mPinch.set3(longitude);// (float)(Math.PI+longitude) );
216
        case PINCH            : float lat = latitude>0 ? (float)(-Math.PI/2 + latitude) : (float)(Math.PI/2 + latitude);
217
                                float lon = longitude;
218
                                float latInDegrees = (float)(lat*180.0f/Math.PI);
219
                                float lonInDegrees = (float)(lon*180.0f/Math.PI);
220
                                mPinch.set2(latInDegrees);
221
                                mPinch.set3(lonInDegrees);
218 222
                                effect = new VertexEffectPinch  (mPinch   , center, mRegionV); break;
219 223
        case SWIRL            : effect = new VertexEffectSwirl  (mSwirl   , center, mRegionV); break;      // SWIRL & WAVE are not really fully
220 224
        case WAVE             : Static5D wave = new Static5D( RADIUS_V/2, RADIUS_V/2, 0, 90-latitude, 90); // 3D effects. They will not look

Also available in: Unified diff