Project

General

Profile

« Previous | Next » 

Revision 35476762

Added by Leszek Koltunski over 4 years ago

Convert RubikCube to the new V&F center schema!

View differences:

src/main/java/org/distorted/library/effectqueue/EffectQueue.java
118 118

  
119 119
///////////////////////////////////////////////////////////////////////////////////////////////////
120 120

  
121
  public static void send( EffectQueue[] queues, int width, int height, float distance, float mipmap,
121
  public static void send( EffectQueue[] queues, float distance, float mipmap,
122 122
                           float[] projection, float inflate, float halfW, float halfH, float halfZ, int variant )
123 123
    {
124
    ((EffectQueueMatrix  )queues[0]).send(width, height, distance, mipmap, projection, halfW, halfH, halfZ, variant);
124
    ((EffectQueueMatrix  )queues[0]).send(distance, mipmap, projection, halfW, halfH, halfZ, variant);
125 125
    ((EffectQueueVertex  )queues[1]).send(inflate, variant);
126 126
    ((EffectQueueFragment)queues[2]).send(variant);
127 127
    }
src/main/java/org/distorted/library/effectqueue/EffectQueueMatrix.java
143 143

  
144 144
///////////////////////////////////////////////////////////////////////////////////////////////////
145 145

  
146
  void send(int width, int height, float distance, float mipmap, float[] projection, float halfX, float halfY, float halfZ, int variant)
146
  void send(float distance, float mipmap, float[] projection, float halfX, float halfY, float halfZ, int variant)
147 147
    {
148 148
    Matrix.setIdentityM(mViewMatrix, 0);
149
    //Matrix.translateM(mViewMatrix, 0, -width*0.5f, -height*0.5f, -distance);
150

  
151 149
    Matrix.translateM(mViewMatrix, 0, 0,0, -distance);
152 150

  
153 151
    if( mipmap!=1 ) Matrix.scaleM(mViewMatrix, 0, mipmap, mipmap, mipmap);
154 152

  
155 153
    for(int i=mNumEffects-1; i>=0; i--) ((MatrixEffect)mEffects[i]).apply(mViewMatrix,mUniforms,i);
156

  
157
  //  Matrix.translateM(mViewMatrix, 0, halfX,halfY,halfZ);
158 154
    Matrix.multiplyMM(mMVPMatrix, 0, projection, 0, mViewMatrix, 0);
159 155

  
160 156
    GLES31.glUniform3f( mObjDH[variant] , halfX, halfY, halfZ);
src/main/java/org/distorted/library/effectqueue/EffectQueuePostprocess.java
189 189

  
190 190
      float inflate=0.0f;
191 191

  
192
      matrix.send(width, height, distance, mipmap, projection, halfW, halfH, halfZ, 2);
192
      matrix.send(distance, mipmap, projection, halfW, halfH, halfZ, 2);
193 193

  
194 194
      if( mHalo!=0.0f )
195 195
        {
src/main/java/org/distorted/library/main/DistortedLibrary.java
445 445
    float halfY       = mesh.getStretchY() / 2.0f;
446 446
    float halfZ       = mesh.getStretchZ() / 2.0f;
447 447
    float inflate     = mesh.getInflate();
448
    int width         = surface.mWidth;
449
    int height        = surface.mHeight;
450 448
    float distance    = surface.mDistance;
451 449
    float mipmap      = surface.mMipmap;
452 450
    float[] projection= surface.mProjectionMatrix;
453 451

  
454
    EffectQueue.send(queues, width, height, distance, mipmap, projection, inflate, halfX, halfY, halfZ, 1 );
452
    EffectQueue.send(queues, distance, mipmap, projection, inflate, halfX, halfY, halfZ, 1 );
455 453
    GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, mesh.getNumVertices() );
456 454

  
457 455
    if( mesh.getShowNormals() )
458 456
      {
459 457
      DistortedLibrary.mMainProgram.useProgram();
460
      EffectQueue.send(queues, width, height, distance, mipmap, projection, inflate, halfX, halfY, halfZ, 0 );
458
      EffectQueue.send(queues, distance, mipmap, projection, inflate, halfX, halfY, halfZ, 0 );
461 459
      displayNormals(queues,mesh);
462 460
      }
463 461
    }
......
479 477
    float halfY       = mesh.getStretchY() / 2.0f;
480 478
    float halfZ       = mesh.getStretchZ() / 2.0f;
481 479
    float inflate     = mesh.getInflate();
482
    int width         = surface.mWidth;
483
    int height        = surface.mHeight;
484 480
    float distance    = surface.mDistance;
485 481
    float mipmap      = surface.mMipmap;
486 482
    float[] projection= surface.mProjectionMatrix;
487 483

  
488
    EffectQueue.send(queues, width, height, distance, mipmap, projection, inflate, halfX, halfY, halfZ, 0 );
484
    EffectQueue.send(queues, distance, mipmap, projection, inflate, halfX, halfY, halfZ, 0 );
489 485
    GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, mesh.getNumVertices() );
490 486

  
491 487
    if( mesh.getShowNormals() ) displayNormals(queues,mesh);

Also available in: Unified diff