Project

General

Profile

« Previous | Next » 

Revision c1a38ba3

Added by Leszek Koltunski almost 6 years ago

Progress with non-postprocessed OIT.

Status: compiles, but fails to work on both Adreno and Mali. Crashes the app (Adreno) or the whole system (Mali)

View differences:

src/main/java/org/distorted/library/main/EffectQueueMatrix.java
43 43
  private static float mMiny;
44 44
  private static float mMaxy;
45 45

  
46
  private static int mObjDH;      // This is a handle to half a Object dimensions
47
  private static int mMVPMatrixH; // the transformation matrix
48
  private static int mMVMatrixH;  // the modelview matrix.
46
  private static int mObjDH;         // This is a handle to half a Object dimensions
47
  private static int mMVPMatrixH;    // the transformation matrix
48
  private static int mMVMatrixH;     // the modelview matrix.
49

  
50
  private static int mObjDOITH;      //
51
  private static int mMVPMatrixOITH; // Same like above, but in main OIT program.
52
  private static int mMVMatrixOITH;  //
49 53

  
50 54
///////////////////////////////////////////////////////////////////////////////////////////////////
51 55
   
......
108 112
    mMVMatrixH = GLES31.glGetUniformLocation(mProgramH, "u_MVMatrix"); 
109 113
    }
110 114

  
115
///////////////////////////////////////////////////////////////////////////////////////////////////
116

  
117
  static void getUniformsOIT(int mProgramH)
118
    {
119
    mObjDOITH     = GLES31.glGetUniformLocation(mProgramH, "u_objD");
120
    mMVPMatrixOITH= GLES31.glGetUniformLocation(mProgramH, "u_MVPMatrix");
121
    mMVMatrixOITH = GLES31.glGetUniformLocation(mProgramH, "u_MVMatrix");
122
    }
123

  
111 124
///////////////////////////////////////////////////////////////////////////////////////////////////
112 125

  
113 126
  void compute(long currTime)
......
162 175
    GLES31.glUniformMatrix4fv(mMVMatrixH , 1, false, mViewMatrix, 0);
163 176
    GLES31.glUniformMatrix4fv(mMVPMatrixH, 1, false, mMVPMatrix , 0);
164 177
    }
178

  
179
///////////////////////////////////////////////////////////////////////////////////////////////////
180

  
181
  void sendOIT(DistortedOutputSurface projection, float halfX, float halfY, float halfZ, float marginInPixels)
182
    {
183
    Matrix.setIdentityM(mViewMatrix, 0);
184
    Matrix.translateM(mViewMatrix, 0, -projection.mWidth/2, projection.mHeight/2, -projection.mDistance);
185
    float mipmap = projection.mMipmap;
186
    if( mipmap!=1 ) Matrix.scaleM(mViewMatrix, 0, mipmap, mipmap, mipmap);
187

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

  
190
    Matrix.translateM(mViewMatrix, 0, halfX,-halfY,-halfZ);
191
    if( marginInPixels!=0 ) magnify(projection,halfX,halfY,halfZ, marginInPixels);
192
    Matrix.multiplyMM(mMVPMatrix, 0, projection.mProjectionMatrix, 0, mViewMatrix, 0);
193

  
194
    GLES31.glUniform3f( mObjDOITH , halfX, halfY, halfZ);
195
    GLES31.glUniformMatrix4fv(mMVMatrixOITH , 1, false, mViewMatrix, 0);
196
    GLES31.glUniformMatrix4fv(mMVPMatrixOITH, 1, false, mMVPMatrix , 0);
197
    }
165 198
  }

Also available in: Unified diff