Commit 74ebf5de authored by amandaghassaei's avatar amandaghassaei
Browse files

small changes

parent a66ff6eb
...@@ -158,28 +158,28 @@ function initDynamicSolver(globals){ ...@@ -158,28 +158,28 @@ function initDynamicSolver(globals){
function render(){ function render(){
var vectorLength = 2; // var vectorLength = 2;
globals.gpuMath.setProgram("packToBytes"); // globals.gpuMath.setProgram("packToBytes");
globals.gpuMath.setUniformForProgram("packToBytes", "u_vectorLength", vectorLength, "1f"); // globals.gpuMath.setUniformForProgram("packToBytes", "u_vectorLength", vectorLength, "1f");
globals.gpuMath.setUniformForProgram("packToBytes", "u_floatTextureDim", [textureDimCreases, textureDimCreases], "2f"); // globals.gpuMath.setUniformForProgram("packToBytes", "u_floatTextureDim", [textureDimCreases, textureDimCreases], "2f");
globals.gpuMath.setSize(textureDimCreases*vectorLength, textureDimCreases); // globals.gpuMath.setSize(textureDimCreases*vectorLength, textureDimCreases);
globals.gpuMath.step("packToBytes", ["u_lastTheta"], "outputBytes"); // globals.gpuMath.step("packToBytes", ["u_lastTheta"], "outputBytes");
//
if (globals.gpuMath.readyToRead()) { // if (globals.gpuMath.readyToRead()) {
var numPixels = nodes.length*vectorLength; // var numPixels = nodes.length*vectorLength;
var height = Math.ceil(numPixels/(textureDimCreases*vectorLength)); // var height = Math.ceil(numPixels/(textureDimCreases*vectorLength));
var pixels = new Uint8Array(height*textureDimCreases*4*vectorLength); // var pixels = new Uint8Array(height*textureDimCreases*4*vectorLength);
globals.gpuMath.readPixels(0, 0, textureDimCreases * vectorLength, height, pixels); // globals.gpuMath.readPixels(0, 0, textureDimCreases * vectorLength, height, pixels);
var parsedPixels = new Float32Array(pixels.buffer); // var parsedPixels = new Float32Array(pixels.buffer);
for (var i=0;i<parsedPixels.length;i+=2){ // for (var i=0;i<parsedPixels.length;i+=2){
if (Math.abs(parsedPixels[i])>Math.PI) { // if (Math.abs(parsedPixels[i])>Math.PI) {
console.log(parsedPixels[i+1]);//theta // console.log(parsedPixels[i+1]);//theta
} // }
//
} // }
} else { // } else {
console.log("here"); // console.log("here");
} // }
var vectorLength = 4; var vectorLength = 4;
globals.gpuMath.setProgram("packToBytes"); globals.gpuMath.setProgram("packToBytes");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment