[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Matrix objects in JavaScript



I think this misses some qualities that WebGL requires or would benefit of:

  1. Running operations without incurring GC overhead (for instance operand1.multiply(operand2, intoTarget))
  2. The abiliy to use array buffers as backing store (for instance mymat = new Mat4(somearraybuffer, offset))
  3. Missing methods:
    1. Optimized inverse().transpose().copyToMat3(target) commonly used to build rotation matrices
    2. Building perspective and inverse perspective matrices
    3. Building orthographic and inverse orthographic matrices
    4. copying
    5. setting to zero
    6. setting to identity
    7. transpose
    8. determinant
    9. adjugate
    10. setting from quaternion
    11. lookAt
  4. No 2x2, 3x3 matrices, no 2-component and 3-component vectors.
  5. If introducing points, why not introduce common methods useful for points (length, multiply, divide, add, subtract, dot, cross, normalize, max, min, etc.)?
There's also minor points in that it doesn't do chaining (for instance mymat.translate().rotatex(45)) which will trigger the more user-friendly minded developers to wrap each matrix in a JS decorator, kinda defeating the point.

Due to matrices not accepting a backing store, and not being able to target without copy, it would also make it useless for libraries such as glMatrix to use as a "backend" since glMatrix is carefully optimized to not require copying and to be able to use array buffer backing stores, and logically can't use functionality that does not support that. So any argument of "oh the missing things will be added by <insert library here>" is illusionary at this point.