Project

General

Profile

« Previous | Next » 

Revision 62c869ad

Added by Leszek Koltunski over 3 years ago

Fix normals in case of MatrixEffectScale / Shear.
Fix displaying the normal vector.

View differences:

src/main/java/org/distorted/library/effect/MatrixEffectQuaternion.java
54 54
 *
55 55
 * @y.exclude
56 56
 */
57
  public void apply(float[] matrix, float[] uniforms, int index)
57
  public void apply(float[] matrixP, float[] matrixV, float[] uniforms, int index)
58 58
    {
59 59
    float qX = uniforms[NUM_UNIFORMS*index  ];
60 60
    float qY = uniforms[NUM_UNIFORMS*index+1];
......
65 65
    float y = uniforms[NUM_UNIFORMS*index+CENTER_OFFSET+1];
66 66
    float z = uniforms[NUM_UNIFORMS*index+CENTER_OFFSET+2];
67 67

  
68
    Matrix.translateM(matrix, 0, x, y, z);
69
    multiplyByQuat( matrix, qX, qY, qZ, qW);
70
    Matrix.translateM(matrix, 0,-x,-y,-z);
68
    Matrix.translateM(matrixP, 0, x, y, z);
69
    multiplyByQuat   (matrixP, qX, qY, qZ, qW);
70
    Matrix.translateM(matrixP, 0,-x,-y,-z);
71

  
72
    Matrix.translateM(matrixV, 0, x, y, z);
73
    multiplyByQuat   (matrixV, qX, qY, qZ, qW);
74
    Matrix.translateM(matrixV, 0,-x,-y,-z);
71 75
    }
72 76

  
73 77
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff