Project

General

Profile

« Previous | Next » 

Revision 1dec66e0

Added by Leszek Koltunski 11 months ago

Implement the android.opengl.Matrix functions ourselves.

View differences:

src/main/java/org/distorted/library/effect/MatrixEffectShear.java
20 20

  
21 21
package org.distorted.library.effect;
22 22

  
23
import android.opengl.Matrix;
24

  
23
import org.distorted.library.helpers.MatrixHelper;
25 24
import org.distorted.library.type.Data3D;
26 25

  
27 26
///////////////////////////////////////////////////////////////////////////////////////////////////
......
63 62
    float y  = uniforms[NUM_FLOAT_UNIFORMS*index+CENTER_OFFSET+1];
64 63
    float z  = uniforms[NUM_FLOAT_UNIFORMS*index+CENTER_OFFSET+2];
65 64

  
66
    Matrix.translateM(matrixP, 0, x, y, z);
65
    MatrixHelper.translate(matrixP, x, y, z);
67 66

  
68 67
    matrixP[4] += sx*matrixP[0]; // Multiply viewMatrix by 1 x 0 0 , i.e. X-shear.
69 68
    matrixP[5] += sx*matrixP[1]; //                        0 1 0 0
......
80 79
    matrixP[6] += sz*matrixP[10];//                        0 z 1 0
81 80
    matrixP[7] += sz*matrixP[11];//                        0 0 0 1
82 81

  
83
    Matrix.translateM(matrixP, 0,-x,-y,-z);
84

  
85
    Matrix.translateM(matrixV, 0, x, y, z);
82
    MatrixHelper.translate(matrixP,-x,-y,-z);
83
    MatrixHelper.translate(matrixV, x, y, z);
86 84

  
87 85
    matrixV[0] -= sx*matrixV[4]; // Multiply viewMatrix by 1 0 0 0 , i.e. vector X-shear.
88 86
    matrixV[1] -= sx*matrixV[5]; //                       -x 1 0 0
......
99 97
    matrixV[10]-= sz*matrixV[6]; //                        0 0 1 0
100 98
    matrixV[11]-= sz*matrixV[7]; //                        0 0 0 1
101 99

  
102
    Matrix.translateM(matrixV, 0,-x,-y,-z);
100
    MatrixHelper.translate(matrixV,-x,-y,-z);
103 101
    }
104 102

  
105 103
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff