Commit 6ae0a8fb authored by amandaghassaei's avatar amandaghassaei
Browse files

reset thetas

parent 3fc66b45
......@@ -77,10 +77,22 @@
</script>
<script id="zeroTexture" type="x-shader/x-fragment">
precision mediump float;
void main(){
gl_FragColor = vec4(0.0);
}
</script>
<script id="zeroThetaTexture" type="x-shader/x-fragment">
precision mediump float;
uniform sampler2D u_theta;
uniform vec2 u_textureDimCreases;
void main(){
vec2 fragCoord = gl_FragCoord.xy;
vec2 scaledFragCoord = fragCoord/u_textureDimCreases;
vec4 theta = texture2D(u_theta, scaledFragCoord);
gl_FragColor = vec4(0.0, 0.0, theta[2], theta[3]);
}
</script>
<script id="centerTexture" type="x-shader/x-fragment">
precision mediump float;
uniform sampler2D u_lastPosition;
......@@ -704,6 +716,7 @@
<a href="#" id="cameraMinusY" class="btn btn-sm btn-default">Bottom</a>
<a href="#" id="cameraOrtho" class="btn btn-sm btn-default">Ortho</a>
</div>
<div class="extraSpace"></div>
</div>
</div>
</div>
......
......@@ -60,6 +60,8 @@ function initDynamicSolver(globals){
globals.gpuMath.step("zeroTexture", [], "u_lastPosition");
globals.gpuMath.step("zeroTexture", [], "u_velocity");
globals.gpuMath.step("zeroTexture", [], "u_lastVelocity");
globals.gpuMath.step("zeroThetaTexture", ["u_lastTheta"], "u_theta");
globals.gpuMath.step("zeroThetaTexture", ["u_theta"], "u_lastTheta");
render();
}
......@@ -321,6 +323,10 @@ function initDynamicSolver(globals){
gpuMath.setUniformForProgram("packToBytes", "u_floatTexture", 0, "1i");
gpuMath.createProgram("zeroTexture", vertexShader, document.getElementById("zeroTexture").text);
gpuMath.createProgram("zeroThetaTexture", vertexShader, document.getElementById("zeroThetaTexture").text);
gpuMath.setUniformForProgram("zeroThetaTexture", "u_theta", 0, "1i");
gpuMath.setUniformForProgram("zeroThetaTexture", "u_textureDimCreases", [textureDimCreases, textureDimCreases], "2f");
gpuMath.createProgram("centerTexture", vertexShader, document.getElementById("centerTexture").text);
gpuMath.setUniformForProgram("centerTexture", "u_lastPosition", 0, "1i");
gpuMath.setUniformForProgram("centerTexture", "u_textureDim", [textureDim, textureDim], "2f");
......
......@@ -308,7 +308,6 @@ function initModel(globals){
edges[i].recalcOriginalLength();
}
console.log(allTypes[4]);
hingeLines.geometry.setDrawRange(0, allTypes[0]*2);
mountainLines.geometry.setDrawRange(allTypes[0]*2, allTypes[1]*2);
valleyLines.geometry.setDrawRange((allTypes[0]+allTypes[1])*2, allTypes[2]*2);
......
Markdown is supported
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