Project

General

Profile

« Previous | Next » 

Revision f6d884d5

Added by Leszek Koltunski over 7 years ago

Complete the split DistortedObject -> (DistortedTexture,DistortedEffectQueue)

View differences:

src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java
32 32
import org.distorted.library.type.Dynamic;
33 33
import org.distorted.library.type.DynamicQuat;
34 34
import org.distorted.library.GridCubes;
35
import org.distorted.library.DistortedObject;
35
import org.distorted.library.DistortedTexture;
36
import org.distorted.library.DistortedEffectQueues;
36 37
import org.distorted.library.type.Static4D;
37 38
import org.distorted.library.type.Static3D;
38 39
import org.distorted.library.Distorted;
......
49 50
  private static final int NUM_QUATERNIONS = 5;
50 51

  
51 52
  private GLSurfaceView mView;
52
  private DistortedObject mCube;
53
  private DistortedTexture mTexture;
54
  private DistortedEffectQueues mQueues;
53 55
  private GridCubes mGrid;
54

  
55 56
  private DynamicQuat mRot;
56 57
    
57 58
///////////////////////////////////////////////////////////////////////////////////////////////////
58 59

  
59 60
  QuaternionRenderer(GLSurfaceView v)
60 61
    {
61
    mView = v;
62
    mGrid = new GridCubes(1,1,false);
63
    mCube = new DistortedObject(1,1,1);
64

  
65
    mRot = new DynamicQuat();
62
    mView    = v;
63
    mGrid    = new GridCubes(1,1,false);
64
    mTexture = new DistortedTexture(1,1,1);
65
    mQueues  = new DistortedEffectQueues();
66
    mRot     = new DynamicQuat();
66 67

  
67 68
    Random rnd = new Random(System.currentTimeMillis());
68 69
    float x,y,z,w, len;
......
89 90
  public void onDrawFrame(GL10 glUnused) 
90 91
    {
91 92
    GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
92
    mCube.draw(System.currentTimeMillis(), mGrid);
93
    mQueues.draw(System.currentTimeMillis(), mTexture,mGrid);
93 94
    }
94 95

  
95 96
///////////////////////////////////////////////////////////////////////////////////////////////////
......
98 99
    {
99 100
    float scaleFactor = width>height ? height/3:width/3;
100 101

  
101
    mCube.abortEffects(EffectTypes.MATRIX);
102
    mCube.move( new Static3D( (width-scaleFactor)/2 , (height-scaleFactor)/2 , 0) );
103
    mCube.scale(scaleFactor);
104
    mCube.quaternion( mRot, new Static3D(0.5f,0.5f,0) );
102
    mQueues.abortEffects(EffectTypes.MATRIX);
103
    mQueues.move( new Static3D( (width-scaleFactor)/2 , (height-scaleFactor)/2 , 0) );
104
    mQueues.scale(scaleFactor);
105
    mQueues.quaternion( mRot, new Static3D(0.5f,0.5f,0) );
105 106
       
106 107
    Distorted.onSurfaceChanged(width, height); 
107 108
    }
......
128 129
      catch(IOException e) { }
129 130
      }  
130 131
      
131
    mCube.setTexture(bitmap);
132
    mTexture.setTexture(bitmap);
132 133
      
133 134
    try
134 135
      {

Also available in: Unified diff