Project

General

Profile

« Previous | Next » 

Revision c622889d

Added by Leszek Koltunski over 5 years ago

Invert the order of Matrix Effects. Now, just as in the other queues, the first matrix effect is actually the first to act on the object - not the other way around!

View differences:

src/main/java/org/distorted/effect/AppearEffectMove.java
32 32
  {
33 33
  public int createEffects(int duration)
34 34
    {
35
    mCubeEffectPosition = new int[] {2};
35
    mCubeEffectPosition = new int[] {6};
36 36
    mCubeEffects        = new Effect[mCubeEffectPosition.length];
37 37

  
38 38
    Dynamic3D oldCube0 = new Dynamic3D(duration, 0.5f);
src/main/java/org/distorted/effect/AppearEffectRound.java
33 33
  {
34 34
  public int createEffects(int duration)
35 35
    {
36
    mCubeEffectPosition = new int[] {2, 2};
37
    mCubeEffects        = new Effect[mCubeEffectPosition.length];
38

  
39
    Dynamic3D oldCube0 = new Dynamic3D(duration/2, 0.5f);
40
    oldCube0.add(new Static3D(-TEXTURE_SIZE,0,0));
41
    oldCube0.add(new Static3D(            0,0,0));
42
    mCubeEffects[0] = new MatrixEffectMove(oldCube0);
36
    float X = TEXTURE_SIZE;
43 37

  
44
    Dynamic3D oldCube1 = new Dynamic3D(duration/2, 0.5f);
45
    oldCube1.add(new Static3D(0.01f, 0.01f, 0.01f));
46
    oldCube1.add(new Static3D(1.00f, 1.00f, 1.00f));
47
    mCubeEffects[1] = new MatrixEffectScale(oldCube1);
38
    mCubeEffectPosition = new int[] {6};
39
    mCubeEffects        = new Effect[mCubeEffectPosition.length];
40
/*
41
    Dynamic3D d0 = new Dynamic3D(duration, 0.5f);
42
    d0.add(new Static3D( 0.01f, 0.01f, 0.01f));
43
    d0.add(new Static3D( 1.00f, 1.00f, 1.00f));
44
    mCubeEffects[0] = new MatrixEffectScale(d0);
45
*/
46
    Dynamic3D d1 = new Dynamic3D(duration, 0.5f);
47
    d1.add(new Static3D( 0, 0, 0));
48
    d1.add(new Static3D(-X, 0, 0));
49
    d1.add(new Static3D( 0, 0, 0));
50
    mCubeEffects[0] = new MatrixEffectMove(d1);
48 51

  
49
    return 2;
52
    return 1;
50 53
    }
51 54

  
52 55
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/effect/AppearEffectScale.java
30 30
  {
31 31
  public int createEffects(int duration)
32 32
    {
33
    mCubeEffectPosition = new int[] {5};
33
    mCubeEffectPosition = new int[] {6};
34 34
    mCubeEffects        = new Effect[mCubeEffectPosition.length];
35 35

  
36 36
    Dynamic3D oldCube0 = new Dynamic3D(duration, 0.5f);
src/main/java/org/distorted/effect/DisappearEffectMove.java
32 32
  {
33 33
  public int createEffects(int duration)
34 34
    {
35
    mCubeEffectPosition = new int[] {2};
35
    mCubeEffectPosition = new int[] {6};
36 36
    mCubeEffects        = new Effect[mCubeEffectPosition.length];
37 37

  
38 38
    Dynamic3D oldCube0 = new Dynamic3D(duration, 0.5f);
src/main/java/org/distorted/effect/DisappearEffectRound.java
33 33
  {
34 34
  public int createEffects(int duration)
35 35
    {
36
    mCubeEffectPosition = new int[] {2, 2};
37
    mCubeEffects        = new Effect[mCubeEffectPosition.length];
38

  
39
    Dynamic3D oldCube0 = new Dynamic3D(duration/2, 0.5f);
40
    oldCube0.add(new Static3D(           0,0,0));
41
    oldCube0.add(new Static3D(TEXTURE_SIZE,0,0));
42
    mCubeEffects[0] = new MatrixEffectMove(oldCube0);
36
    float X = TEXTURE_SIZE;
43 37

  
44
    Dynamic3D oldCube1 = new Dynamic3D(duration/2, 0.5f);
45
    oldCube1.add(new Static3D(1.0f, 1.0f, 1.0f));
46
    oldCube1.add(new Static3D(0.01f, 0.01f, 0.01f));
47
    mCubeEffects[1] = new MatrixEffectScale(oldCube1);
38
    mCubeEffectPosition = new int[] {6};
39
    mCubeEffects        = new Effect[mCubeEffectPosition.length];
40
/*
41
    Dynamic3D d0 = new Dynamic3D(duration, 0.5f);
42
    d0.add(new Static3D( 1.00f, 1.00f, 1.00f));
43
    d0.add(new Static3D( 0.01f, 0.01f, 0.01f));
44
    mCubeEffects[0] = new MatrixEffectScale(d0);
45
*/
46
    Dynamic3D d1 = new Dynamic3D(duration, 0.5f);
47
    d1.add(new Static3D( 0, 0, 0));
48
    d1.add(new Static3D(+X, 0, 0));
49
    d1.add(new Static3D( 0, 0, 0));
50
    mCubeEffects[0] = new MatrixEffectMove(d1);
48 51

  
49
    return 2;
52
    return 1;
50 53
    }
51 54

  
52 55
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/effect/DisappearEffectScale.java
30 30
  {
31 31
  public int createEffects(int duration)
32 32
    {
33
    mCubeEffectPosition = new int[] {5};
33
    mCubeEffectPosition = new int[] {6};
34 34
    mCubeEffects        = new Effect[mCubeEffectPosition.length];
35 35

  
36 36
    Dynamic3D oldCube0 = new Dynamic3D(duration, 0.5f);
src/main/java/org/distorted/magic/RubikCube.java
102 102

  
103 103
      Static3D[][][] cubeVectors = new Static3D[mSize][mSize][mSize];
104 104

  
105
      Static3D center = new Static3D(TEXTURE_SIZE*0.5f, TEXTURE_SIZE*0.5f, TEXTURE_SIZE*0.5f);
105
      Static3D sinkCenter = new Static3D(TEXTURE_SIZE*0.5f, TEXTURE_SIZE*0.5f, TEXTURE_SIZE*0.5f);
106
      Static3D matrCenter = new Static3D(0,0,0);
106 107
      Static4D region = new Static4D(0,0,0, TEXTURE_SIZE*0.72f);
107 108

  
108
      VertexEffectSink        sinkEffect = new VertexEffectSink( new Static1D(getSinkStrength()), center, region );
109
      VertexEffectSink        sinkEffect = new VertexEffectSink( new Static1D(getSinkStrength()), sinkCenter, region );
109 110
      MatrixEffectMove        moveEffect = new MatrixEffectMove(mMove);
110 111
      MatrixEffectScale      scaleEffect = new MatrixEffectScale(mScale);
111
      MatrixEffectQuaternion quatCEffect = new MatrixEffectQuaternion(quatC, center);
112
      MatrixEffectQuaternion quatAEffect = new MatrixEffectQuaternion(quatA, center);
112
      MatrixEffectQuaternion quatCEffect = new MatrixEffectQuaternion(quatC, matrCenter);
113
      MatrixEffectQuaternion quatAEffect = new MatrixEffectQuaternion(quatA, matrCenter);
113 114

  
114 115
      MatrixEffectMove       nodeMoveEffect  = new MatrixEffectMove(mNodeMove);
115 116
      MatrixEffectScale      nodeScaleEffect = new MatrixEffectScale(mNodeScale);
116 117

  
117
      effects.apply(nodeMoveEffect);
118 118
      effects.apply(nodeScaleEffect);
119
      effects.apply(nodeMoveEffect);
119 120

  
120 121
      // 3x2 bitmap = 6 squares:
121 122
      //
......
138 139
      final Static4D mapBlack = new Static4D(ze,ze, ze+of,ze+of);
139 140

  
140 141
      Static4D tmpFront, tmpBack, tmpLeft, tmpRight, tmpTop, tmpBottom;
141
      float nc = 0.5f*(mSize-1);
142
      float nc = 0.5f*mSize;
142 143
      int vertices = (int)(24.0f/mSize + 2.0f);
143 144

  
144 145
      for(int x = 0; x< mSize; x++)
......
160 161
              mRotationAngle[x][y][z]   = new Dynamic1D();
161 162
              mRotationAxis[x][y][z]    = new Static3D(1,0,0);
162 163
              mCurrentPosition[x][y][z] = new Static3D(x,y,z);
163
              mRotateEffect[x][y][z]    = new MatrixEffectRotate(mRotationAngle[x][y][z], mRotationAxis[x][y][z], center);
164
              mRotateEffect[x][y][z]    = new MatrixEffectRotate(mRotationAngle[x][y][z], mRotationAxis[x][y][z], matrCenter);
164 165

  
165 166
              mEffects[x][y][z] = new DistortedEffects();
166 167
              mEffects[x][y][z].apply(sinkEffect);
167
              mEffects[x][y][z].apply(moveEffect);
168
              mEffects[x][y][z].apply(scaleEffect);
169
              mEffects[x][y][z].apply(quatCEffect);
170
              mEffects[x][y][z].apply(quatAEffect);
171
              mEffects[x][y][z].apply(mRotateEffect[x][y][z]);
172
              mEffects[x][y][z].apply( new MatrixEffectQuaternion(mQuatScramble[x][y][z], center));
173 168
              mEffects[x][y][z].apply( new MatrixEffectMove(cubeVectors[x][y][z]) );
169
              mEffects[x][y][z].apply( new MatrixEffectQuaternion(mQuatScramble[x][y][z], matrCenter));
170
              mEffects[x][y][z].apply(mRotateEffect[x][y][z]);
171
              mEffects[x][y][z].apply(quatAEffect);
172
              mEffects[x][y][z].apply(quatCEffect);
173
              mEffects[x][y][z].apply(scaleEffect);
174
              mEffects[x][y][z].apply(moveEffect);
174 175

  
175 176
              mNodes[x][y][z] = new DistortedNode(mTexture,mEffects[x][y][z],mCubes[x][y][z]);
176 177

  
......
481 482

  
482 483
     float scaleFactor = (size/(TEXTURE_SIZE*mSize)) * (float)texW/(screenWidth>screenHeight ? screenHeight:screenWidth);
483 484

  
484
     mMove.set( (texW-scaleFactor*TEXTURE_SIZE)/2 , (texH-scaleFactor*TEXTURE_SIZE)/2 , -scaleFactor*TEXTURE_SIZE/2 );
485
     mMove.set( texW*0.5f , texH*0.5f , 0.0f );
485 486
     mScale.set(scaleFactor,scaleFactor,scaleFactor);
486 487
     }
487 488

  

Also available in: Unified diff