Revision c374e9c3
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/EffectQueueMatrix.java | ||
---|---|---|
107 | 107 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
108 | 108 |
// here construct the ModelView and the ModelViewProjection Matrices |
109 | 109 |
|
110 |
void constructMatrices(DistortedOutputSurface projection, float halfX, float halfY) |
|
110 |
private void constructMatrices(DistortedOutputSurface projection, float halfX, float halfY)
|
|
111 | 111 |
{ |
112 | 112 |
Matrix.setIdentityM(mViewMatrix, 0); |
113 | 113 |
Matrix.translateM(mViewMatrix, 0, -projection.mWidth/2, projection.mHeight/2, -projection.mDistance); |
... | ... | |
197 | 197 |
mMVMatrixH = GLES30.glGetUniformLocation(mProgramH, "u_MVMatrix"); |
198 | 198 |
} |
199 | 199 |
|
200 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
201 |
|
|
202 |
float[] getMVP() |
|
203 |
{ |
|
204 |
return mMVPMatrix; |
|
205 |
} |
|
206 |
|
|
207 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
208 |
// return true if in the queue there are only translations, scales, x- and y-shears, and rotations along |
|
209 |
// a vector which is perpendicular to the screen, i.e. if the resulting matrix keeps the front wall of the |
|
210 |
// Mesh parallel to the screen. |
|
211 |
|
|
212 |
boolean canUseShortcut() |
|
213 |
{ |
|
214 |
for(int i=0; i<mNumEffects; i++) |
|
215 |
{ |
|
216 |
if (mName[i] == EffectNames.ROTATE.ordinal() ) |
|
217 |
{ |
|
218 |
if( mUniforms[NUM_UNIFORMS*i] != 0.0f || mUniforms[NUM_UNIFORMS*i+1] != 0.0f ) return false; // rotation along vector with x or y non-zero |
|
219 |
} |
|
220 |
else if(mName[i] == EffectNames.QUATERNION.ordinal() ) |
|
221 |
{ |
|
222 |
if( mUniforms[NUM_UNIFORMS*i] != 0.0f || mUniforms[NUM_UNIFORMS*i+1] != 0.0f ) return false; // quaternion rotation along vector with x or y non-zero |
|
223 |
} |
|
224 |
else if(mName[i] == EffectNames.SHEAR.ordinal() ) |
|
225 |
{ |
|
226 |
if( mUniforms[NUM_UNIFORMS*i+2] != 0.0f ) return false; // shear with non-zero Z |
|
227 |
} |
|
228 |
} |
|
229 |
|
|
230 |
return true; |
|
231 |
} |
|
232 |
|
|
233 | 200 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
234 | 201 |
|
235 | 202 |
synchronized void compute(long currTime) |
Also available in: Unified diff
Minor