commit e83350b4f4b3d0fae624974eadd175e226d8cf3b
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Thu Jan 3 01:32:44 2019 +0000

    Progress with the Earth app.

diff --git a/src/main/java/org/distorted/examples/earth/EarthRenderer.java b/src/main/java/org/distorted/examples/earth/EarthRenderer.java
index 5e4a1de..28ac71b 100644
--- a/src/main/java/org/distorted/examples/earth/EarthRenderer.java
+++ b/src/main/java/org/distorted/examples/earth/EarthRenderer.java
@@ -62,13 +62,13 @@ import javax.microedition.khronos.opengles.GL10;
 
 class EarthRenderer implements GLSurfaceView.Renderer
 {
-    private static final float D      = (float)Math.sqrt(2.0)/2.0f;
+    private static final int   SIZE    =   500;
+    private static final int   RADIUS  =    30;
+    private static final int   LEVEL   =    32;
+    private static final float FOV     = 30.0f;
+    private static final float NEAR    =  0.1f;
+    private static final int   MAX_EFF =    20;
 
-    private static final int   SIZE   =   500;
-    private static final int   RADIUS =   (int)(SIZE*D);
-    private static final int   LEVEL  =    32;
-    private static final float FOV    = 30.0f;
-    private static final float NEAR   =  0.1f;
 
     private GLSurfaceView mView;
     private DistortedTexture mTexture;
@@ -91,6 +91,9 @@ class EarthRenderer implements GLSurfaceView.Renderer
       {
       mView = v;
 
+      DistortedEffects.setMax(EffectType.VERTEX  , MAX_EFF);
+      DistortedEffects.setMax(EffectType.FRAGMENT, MAX_EFF);
+
       mStrength = new Static1D(0.5f);
       mColor    = new Static3D(255,0,0);
       mRegionF  = new Static3D(RADIUS,RADIUS,RADIUS);
@@ -120,10 +123,6 @@ class EarthRenderer implements GLSurfaceView.Renderer
       mEffects.apply( new MatrixEffectQuaternion(quatInt1, mCenter) );
       mEffects.apply( new MatrixEffectQuaternion(quatInt2, mCenter) );
 
-
-      Static3D center = new Static3D(0.5f*mObjWidth,0.5f*mObjHeight,0.5f*mObjDepth);
-      mEffects.apply( new FragmentEffectChroma(mStrength, mColor,center, mRegionF, false) );
-
       mScreen = new DistortedScreen();
       mScreen.setProjection(FOV, NEAR);
       }
@@ -139,7 +138,7 @@ class EarthRenderer implements GLSurfaceView.Renderer
     
     public void onSurfaceChanged(GL10 glUnused, int width, int height) 
       {
-      final float SCALE = 0.75f;
+      final float SCALE = 1.10f;
 
       mScreenMin = width<height ? width:height;
       float factor = ( width*mObjHeight > height*mObjWidth ) ? (SCALE*height)/mObjHeight :  (SCALE*width)/mObjWidth;
@@ -168,14 +167,14 @@ class EarthRenderer implements GLSurfaceView.Renderer
       double sinLAT = Math.sin(latitude);
       double cosLAT = Math.cos(latitude);
 
-      float x = 0.7071f*(float)(sinLON*cosLAT);
-      float y = 0.7071f*(float)(cosLON*cosLAT);
-      float z = 0.7071f*(float)        sinLAT ;
+      float x = (float)(sinLON*cosLAT)/2.0f;
+      float y = (float)        sinLAT /2.0f;
+      float z = (float)(cosLON*cosLAT)/2.0f;
 
-      Static3D center = new Static3D(x*mObjWidth,y*mObjHeight,z*mObjDepth);
+      Static3D center = new Static3D( (0.5f+x)*mObjWidth, (0.5f+y)*mObjHeight, (0.5f-z)*mObjDepth);
 
-      android.util.Log.e("earth", "center "+(x*mObjWidth)+" "+(y*mObjHeight)+" "+(z*mObjDepth));
-      android.util.Log.e("earth", "longitude: "+longitude+" latitude:"+latitude);
+      //android.util.Log.e("earth", "center "+(x*mObjWidth)+" "+(y*mObjHeight)+" "+(z*mObjDepth));
+      //android.util.Log.e("earth", "longitude: "+longitude+" latitude:"+latitude);
 
       switch(name)
         {
diff --git a/src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java b/src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
index 6596b0b..de5f354 100644
--- a/src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
+++ b/src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
@@ -36,6 +36,7 @@ import org.distorted.library.main.DistortedScreen;
 import org.distorted.library.main.DistortedTexture;
 import org.distorted.library.mesh.MeshBase;
 import org.distorted.library.mesh.MeshFlat;
+import org.distorted.library.mesh.MeshSphere;
 import org.distorted.library.type.Static3D;
 import org.distorted.library.type.Static4D;
 
@@ -63,6 +64,7 @@ class Effects3DRenderer implements GLSurfaceView.Renderer
     private boolean mShowingRegion=false;
     private float mFactorObj, mFactorReg;
     private int mWidth;
+    private float mFactor;
 
     Static4D mQuat1, mQuat2;
     int mScreenMin;
@@ -97,6 +99,8 @@ class Effects3DRenderer implements GLSurfaceView.Renderer
       MeshBase mesh    = act.getMesh();
       MeshFlat quad    = new MeshFlat(1,1);
 
+      mFactor = mesh instanceof MeshSphere ? 1.0f : 0.7f;
+
       mObjWidth = mObjectTexture.getWidth();
       mObjHeight= mObjectTexture.getHeight();
       mObjDepth = mObjectTexture.getDepth(mesh);
@@ -235,13 +239,13 @@ class Effects3DRenderer implements GLSurfaceView.Renderer
 
       if( width*mObjHeight > height*mObjWidth ) // screen is more 'horizontal' than the Object
         {
-        mFactorObj = (0.70f*height)/mObjHeight;
-        factorCen  = (0.08f*height)/centerSize;
+        mFactorObj = (mFactor*height)/mObjHeight;
+        factorCen  = (0.08f  *height)/centerSize;
         }
       else
         {
-        mFactorObj = (0.70f*width)/mObjWidth;
-        factorCen  = (0.08f*width)/centerSize;
+        mFactorObj = (mFactor*width)/mObjWidth;
+        factorCen  = (0.08f  *width)/centerSize;
         }
 
       Effects3DActivity2 act = (Effects3DActivity2)mView.getContext();
