Project

General

Profile

« Previous | Next » 

Revision fec1442f

Added by Leszek Koltunski over 5 years ago

Move the defualt state of an Object to be in the center of the screen (rather than the bottom-left like before)

View differences:

src/main/java/org/distorted/library/main/DistortedScreen.java
54 54
  private long lastTime=0;
55 55
  private long[] durations;
56 56
  private int currDuration;
57
  private static Static3D mMoveVector = new Static3D(5,-5,0);
57
  private static Static3D mMoveVector = new Static3D(0,0,0);
58 58
  private static MatrixEffectMove mMoveEffect = new MatrixEffectMove(mMoveVector);
59 59
  ///// END DEBUGGING //////////////////////////
60 60

  
......
107 107
      fpsCanvas.drawText(fpsString, FPS_W/2, 0.75f*FPS_H, mPaint);
108 108
      fpsTexture.setTexture(fpsBitmap);
109 109

  
110
      mMoveVector.set2(mHeight-FPS_H-5);
110
      mMoveVector.set( (-mWidth+FPS_W)/2 +5, (mHeight-FPS_H)/2 -5, 0);
111 111

  
112 112
      lastTime = time;
113 113
      }
src/main/java/org/distorted/library/main/EffectQueueMatrix.java
154 154
  void send(DistortedOutputSurface projection, float halfX, float halfY, float halfZ, int variant)
155 155
    {
156 156
    Matrix.setIdentityM(mViewMatrix, 0);
157
    Matrix.translateM(mViewMatrix, 0, -projection.mWidth/2, -projection.mHeight/2, -projection.mDistance);
157
    Matrix.translateM(mViewMatrix, 0, 0, 0, -projection.mDistance);
158

  
158 159
    float mipmap = projection.mMipmap;
159 160
    if( mipmap!=1 ) Matrix.scaleM(mViewMatrix, 0, mipmap, mipmap, mipmap);
160 161

  
161 162
    for(int i=0; i<mNumEffects; i++) ((MatrixEffect)mEffects[i]).apply(mViewMatrix,mUniforms,i);
162 163

  
163
    Matrix.translateM(mViewMatrix, 0, halfX,halfY,halfZ);
164 164
    Matrix.multiplyMM(mMVPMatrix, 0, projection.mProjectionMatrix, 0, mViewMatrix, 0);
165 165

  
166 166
    GLES31.glUniform3f( mObjDH[variant] , halfX, halfY, halfZ);

Also available in: Unified diff