Project

General

Profile

« Previous | Next » 

Revision 39a0d81b

Added by Leszek Koltunski about 7 years ago

Convert next 4 APPs to the new Matrix effects.

View differences:

src/main/java/org/distorted/examples/cubes/CubesRenderer.java
96 96
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
97 97
      {
98 98
      mScreenMin = width<height ? width:height;
99
    	
100
      mEffects.abortEffects(EffectTypes.MATRIX);
101
      float factor;
102

  
103
      if( width*mObjHeight > height*mObjWidth ) // screen is more 'horizontal' than the Object
104
        {
105
        factor = (0.75f*height)/mObjHeight;
106
        }
107
      else
108
        {
109
        factor = (0.75f*width)/mObjWidth;
110
        }
111 99

  
112
      mEffects.move( new Static3D( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0) );
113
      mEffects.scale(factor);
114
      Static3D center = new Static3D( (float)mObjWidth/2, (float)mObjHeight/2, 0.0f );
100
    	float q= ((float)width/height)*((float)mObjHeight/mObjWidth);
101
      float scale = 0.7f;
102
      Static3D center = new Static3D(0,0,0);
115 103

  
104
      mEffects.abortEffects(EffectTypes.MATRIX);
116 105
      mEffects.quaternion(mQuatInt1, center);
117 106
      mEffects.quaternion(mQuatInt2, center);
118
       
107
      mEffects.scale(  q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q)) );
108

  
119 109
      mScreen.resize(width, height);
120 110
      }
121 111

  

Also available in: Unified diff