Changeset 19916


Ignore:
Timestamp:
12/28/15 22:12:25 (9 years ago)
Author:
dlcheng
Message:

CHG (javascript): Altering modelmatrix calculation to work with translations and new camera view

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/webgl.js

    r19915 r19916  
    122122} //}}}
    123123function recalculateModelMatrix(node) { //{{{
     124        //TODO: move to 0,0,0, rotate,move back to normal space, then apply transform
    124125        var modelMatrix = mat4.create();
    125126
     
    128129        mat4.multiply(modelMatrix, scaleMatrix, modelMatrix);
    129130
     131        var translationMatrix = mat4.create();
     132        mat4.translate(translationMatrix, translationMatrix, node["translation"]); //relative translation
     133        mat4.multiply(modelMatrix, translationMatrix, modelMatrix);
     134       
    130135        var zRotationMatrix = mat4.create();   
    131136        mat4.rotate(zRotationMatrix, zRotationMatrix, node["rotation"][2] * Math.PI/180.0, [0.0, 0.0, 1.0]);
     
    137142        mat4.rotate(xRotationMatrix, xRotationMatrix, node["rotation"][0] * Math.PI/180.0, [1.0, 0.0, 0.0]);
    138143        mat4.multiply(modelMatrix, xRotationMatrix, modelMatrix);
    139 
    140         var translationMatrix = mat4.create();
    141         mat4.translate(translationMatrix, translationMatrix, node["translation"]); //relative translation
    142         mat4.multiply(modelMatrix, translationMatrix, modelMatrix);
    143144
    144145        return modelMatrix;
Note: See TracChangeset for help on using the changeset viewer.