Project

General

Profile

« Previous | Next » 

Revision 40eef4b9

Added by Leszek Koltunski over 7 years ago

Beginnings of split of DistortedObject into two separate classes: DistortedEffectQueues and DistortedTexture.

Still does not compile, but pushing already.

View differences:

src/main/java/org/distorted/examples/wind/WindRenderer.java
27 27
import org.distorted.examples.R;
28 28
import org.distorted.library.Distorted;
29 29
import org.distorted.library.GridCubes;
30
import org.distorted.library.DistortedObject;
30
import org.distorted.library.DistortedEffectQueues;
31
import org.distorted.library.DistortedTexture;
31 32
import org.distorted.library.type.Static1D;
32 33
import org.distorted.library.type.Static3D;
33 34

  
......
42 43
class WindRenderer implements GLSurfaceView.Renderer
43 44
{
44 45
   private GLSurfaceView mView;
45
   private DistortedObject mObject;
46
   private DistortedEffectQueues mQueues;
47
   private DistortedTexture mTexture;
46 48
   private GridCubes mGrid;
47 49
   private WindEffectsManager mEffects;
48 50
   private int mObjWidth, mObjHeight;
......
55 57
      mView = view;
56 58

  
57 59
      mGrid    = new GridCubes(50,30,false);
58
      mObject  = new DistortedObject(50,30,1);
59
      mEffects = new WindEffectsManager(mObject);
60
      mQueues  = new DistortedEffectQueues();
61
      mTexture = new DistortedTexture(50,30,1);
62
      mEffects = new WindEffectsManager(mTexture);
60 63

  
61
      mObjWidth = mObject.getWidth();
62
      mObjHeight= mObject.getHeight();
64
      mObjWidth = mTexture.getWidth();
65
      mObjHeight= mTexture.getHeight();
63 66
      }
64 67

  
65 68
///////////////////////////////////////////////////////////////////////////////////////////////////
......
75 78
   public void onDrawFrame(GL10 glUnused) 
76 79
      {
77 80
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
78
      mObject.draw(System.currentTimeMillis(),mGrid);
81
      mQueues.draw(System.currentTimeMillis(),mTexture, mGrid);
79 82
      }
80 83

  
81 84
///////////////////////////////////////////////////////////////////////////////////////////////////
82 85
    
83 86
   public void onSurfaceChanged(GL10 glUnused, int width, int height) 
84 87
      {
85
      mObject.abortAllEffects();
88
      mQueues.abortAllEffects();
86 89

  
87 90
      float factor = ( (float)(width<height? width:height) )/(mObjHeight + 1.4f*mObjWidth);
88 91

  
89
      mObject.move( new Static3D( factor*mObjHeight*0.58f , factor*mObjHeight*0.08f , 0) );
90
      mObject.scale(factor);
92
      mQueues.move( new Static3D( factor*mObjHeight*0.58f , factor*mObjHeight*0.08f , 0) );
93
      mQueues.scale(factor);
91 94

  
92 95
      Static1D angle = new Static1D(-45);
93 96
      Static3D axis  = new Static3D(0,0,1);
94 97
      Static3D center= new Static3D(0,mObjHeight/2,0);
95 98

  
96
      mObject.rotate(angle, axis, center);
99
      mQueues.rotate(angle, axis, center);
97 100

  
98
      mEffects.apply(mObject, mWind);
101
      mEffects.apply(mQueues,mWind);
99 102

  
100 103
      Distorted.onSurfaceChanged(width, height);
101 104
      }
......
122 125
        catch(IOException e) { }
123 126
        }
124 127

  
125
      mObject.setTexture(bitmap);
128
      mTexture.setTexture(bitmap);
126 129

  
127 130
      try
128 131
        {

Also available in: Unified diff