Project

General

Profile

« Previous | Next » 

Revision a9716c0f

Added by Leszek Koltunski almost 7 years ago

Further progress with Apps: 27 (out of 31) compile now.

View differences:

src/main/java/org/distorted/examples/wind/WindRenderer.java
24 24
import android.opengl.GLSurfaceView;
25 25

  
26 26
import org.distorted.examples.R;
27
import org.distorted.library.effect.EffectName;
28
import org.distorted.library.effect.MatrixEffectMove;
29
import org.distorted.library.effect.MatrixEffectRotate;
30
import org.distorted.library.effect.MatrixEffectScale;
27 31
import org.distorted.library.main.Distorted;
28 32
import org.distorted.library.main.DistortedScreen;
29
import org.distorted.library.EffectNames;
30 33
import org.distorted.library.main.MeshCubes;
31 34
import org.distorted.library.main.DistortedEffects;
32 35
import org.distorted.library.main.DistortedTexture;
......
48 51
   private DistortedTexture mTexture;
49 52
   private DistortedScreen mScreen;
50 53
   private WindEffectsManager mManager;
54
   private Static3D mMove, mScale;
51 55
   private int mObjWidth, mObjHeight;
52 56
   private int mWind;
53 57

  
......
66 70

  
67 71
      mObjWidth = mTexture.getWidth();
68 72
      mObjHeight= mTexture.getHeight();
73

  
74
      mMove = new Static3D(0,0,0);
75
      mScale= new Static3D(1,1,1);
76
      mEffects.apply( new MatrixEffectMove(mMove));
77
      mEffects.apply( new MatrixEffectScale(mScale));
78

  
79
      Static1D angle = new Static1D(-45);
80
      Static3D axis  = new Static3D(0,0,1);
81
      Static3D center= new Static3D(0,mObjHeight/2,0);
82

  
83
      mEffects.apply( new MatrixEffectRotate(angle, axis, center) );
84
      mManager.apply(mEffects,mWind);
69 85
      }
70 86

  
71 87
///////////////////////////////////////////////////////////////////////////////////////////////////
......
87 103
    
88 104
   public void onSurfaceChanged(GL10 glUnused, int width, int height) 
89 105
      {
90
      mEffects.abortAllEffects();
91

  
92 106
      float factor = ( (float)(width<height? width:height) )/(mObjHeight + 1.4f*mObjWidth);
93

  
94
      mEffects.move( new Static3D( factor*mObjHeight*0.58f , factor*mObjHeight*0.08f , 0) );
95
      mEffects.scale(factor);
96

  
97
      Static1D angle = new Static1D(-45);
98
      Static3D axis  = new Static3D(0,0,1);
99
      Static3D center= new Static3D(0,mObjHeight/2,0);
100

  
101
      mEffects.rotate(angle, axis, center);
102
      mManager.apply(mEffects,mWind);
107
      mMove.set( factor*mObjHeight*0.58f , factor*mObjHeight*0.08f , 0 );
108
      mScale.set(factor,factor,factor);
103 109
      mScreen.resize(width, height);
104 110
      }
105 111

  
......
125 131

  
126 132
      mTexture.setTexture(bitmap);
127 133

  
128
      DistortedEffects.enableEffect(EffectNames.DEFORM);
129
      DistortedEffects.enableEffect(EffectNames.WAVE);
134
      DistortedEffects.enableEffect(EffectName.DEFORM);
135
      DistortedEffects.enableEffect(EffectName.WAVE);
130 136

  
131 137
      try
132 138
        {

Also available in: Unified diff