Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
OrigamiSimulator
Commits
6ae0a8fb
Commit
6ae0a8fb
authored
May 30, 2017
by
amandaghassaei
Browse files
reset thetas
parent
3fc66b45
Changes
3
Hide whitespace changes
Inline
Side-by-side
index.html
View file @
6ae0a8fb
...
...
@@ -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>
...
...
js/dynamic/dynamicSolver.js
View file @
6ae0a8fb
...
...
@@ -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
"
);
...
...
js/model.js
View file @
6ae0a8fb
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment