Project

General

Profile

« Previous | Next » 

Revision 10585385

Added by Leszek Koltunski almost 4 years ago

More progreess porting RubikCube.

View differences:

src/main/java/org/distorted/objects/RubikObject.java
30 30
import org.distorted.library.effect.MatrixEffectMove;
31 31
import org.distorted.library.effect.MatrixEffectQuaternion;
32 32
import org.distorted.library.effect.MatrixEffectScale;
33
import org.distorted.library.effect.VertexEffectQuaternion;
33 34
import org.distorted.library.effect.VertexEffectRotate;
34 35
import org.distorted.library.main.DistortedEffects;
35 36
import org.distorted.library.main.DistortedNode;
......
53 54
  private static final int POST_ROTATION_MILLISEC = 500;
54 55
  private static final int TEXTURE_HEIGHT = 128;
55 56

  
56
  final float[] LEGAL_QUATS;
57 57
  final Static3D[] ROTATION_AXIS;
58 58
  final int NUM_FACES;
59 59

  
......
95 95
    mList = list;
96 96
    mOrigPos = getCubitPositions(size);
97 97

  
98
    LEGAL_QUATS = getLegalQuats();
98
    Static4D[] quats = getQuats();
99 99
    NUM_CUBITS  = mOrigPos.length;
100 100
    ROTATION_AXIS = getRotationAxis();
101 101
    OBJECT_SCREEN_RATIO = getScreenRatio();
......
131 131
      mCubits[i] = new Cubit(this,mOrigPos[i]);
132 132
      cubitMesh[i] = createCubitMesh(i);
133 133
      cubitMesh[i].apply(new MatrixEffectMove(mOrigPos[i]),1,0);
134
      cubitMesh[i].setEffectAssociation(0, mCubits[i].computeAssociation(), i);
134
      cubitMesh[i].setEffectAssociation(0, mCubits[i].computeAssociation(), 0);
135 135
      }
136 136

  
137 137
    mMesh = new MeshJoined(cubitMesh);
......
139 139
    resetAllTextureMaps();
140 140

  
141 141
    mEffects = new DistortedEffects();
142

  
143
    int num_quats = quats.length;
144
    for(int q=0; q<num_quats; q++)
145
      {
146
      VertexEffectQuaternion vq = new VertexEffectQuaternion(quats[q],CENTER);
147
      vq.setMeshAssociation(0,q);
148
      mEffects.apply(vq);
149
      }
150

  
142 151
    mEffects.apply(mRotateEffect);
143 152
    mEffects.apply(mQuatAEffect);
144 153
    mEffects.apply(mQuatCEffect);
......
383 392
  public void releaseResources()
384 393
    {
385 394
    mTexture.markForDeletion();
386

  
387
    // TODO ?
388 395
    }
389 396

  
390 397
///////////////////////////////////////////////////////////////////////////////////////////////////
......
614 621

  
615 622
  abstract float getScreenRatio();
616 623
  abstract Static3D[] getCubitPositions(int size);
617
  abstract float[] getLegalQuats();
624
  abstract Static4D[] getQuats();
618 625
  abstract int getNumFaces();
619 626
  abstract MeshBase createCubitMesh(int cubit);
620 627
  abstract void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top, int side);

Also available in: Unified diff