Project

General

Profile

« Previous | Next » 

Revision c0255951

Added by Leszek Koltunski 11 months ago

Completely kick out the android.opengl.Matrix dependency from the library.

View differences:

src/main/java/org/distorted/library/effect/MatrixEffectRotate.java
32 32
  {
33 33
  private final Data1D mAngle;
34 34
  private final Data3D mAxis, mCenter;
35
  private float[] mTmp1 = new float[16];
36
  private float[] mTmp2 = new float[16];
35 37

  
36 38
///////////////////////////////////////////////////////////////////////////////////////////////////
37 39
/**
......
63 65
    float y = uniforms[NUM_FLOAT_UNIFORMS*index+CENTER_OFFSET+1];
64 66
    float z = uniforms[NUM_FLOAT_UNIFORMS*index+CENTER_OFFSET+2];
65 67

  
68
    double inRadians = Math.PI*angle/180;
69
    float sin = (float)Math.sin(inRadians);
70
    float cos = (float)Math.cos(inRadians);
71

  
66 72
    MatrixHelper.translate(matrixP, x, y, z);
67
    MatrixHelper.rotate(matrixP, angle, axisX, axisY, axisZ);
73
    MatrixHelper.rotateSinCos(matrixP, mTmp1, mTmp2, sin,cos, axisX, axisY, axisZ);
68 74
    MatrixHelper.translate(matrixP,-x,-y,-z);
69 75

  
70 76
    MatrixHelper.translate(matrixV, x, y, z);
71
    MatrixHelper.rotate(matrixV, angle, axisX, axisY, axisZ);
77
    MatrixHelper.rotateSinCos(matrixV, mTmp1, mTmp2, sin,cos, axisX, axisY, axisZ);
72 78
    MatrixHelper.translate(matrixV,-x,-y,-z);
73 79
    }
74 80

  

Also available in: Unified diff