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
d1d4b185
Commit
d1d4b185
authored
Jun 01, 2017
by
amandaghassaei
Browse files
sim finished for now
parent
438e1bc8
Changes
3
Hide whitespace changes
Inline
Side-by-side
index.html
View file @
d1d4b185
...
...
@@ -142,6 +142,7 @@
uniform
vec2
u_textureDimNodeFaces
;
uniform
float
u_creasePercent
;
uniform
float
u_dt
;
uniform
float
u_axialStiffness
;
uniform
sampler2D
u_lastPosition
;
uniform
sampler2D
u_lastVelocity
;
uniform
sampler2D
u_originalPosition
;
...
...
@@ -304,8 +305,7 @@
vec3
normal
=
getFromArray
(
faceMeta
[
0
],
u_textureDimFaces
,
u_normals
).
xyz
;
//calc forces
float
triangleStiffness
=
0.1
;
anglesDiff
*=
triangleStiffness
;
anglesDiff
*=
u_axialStiffness
/
100.0
;
if
(
faceIndex
==
0
){
//a
vec3
normalCrossAC
=
cross
(
normal
,
ac
)
/
lengthAC
;
vec3
normalCrossAB
=
cross
(
normal
,
ab
)
/
lengthAB
;
...
...
js/controls.js
View file @
d1d4b185
...
...
@@ -179,10 +179,10 @@ function initControls(globals){
globals
.
materialHasChanged
=
true
;
});
setSliderInput
(
"
#triStiffness
"
,
globals
.
triStiffness
,
0
,
10
,
0.01
,
function
(
val
){
globals
.
triStiffness
=
val
;
//todo update
// globals.materialHasChanged = true;
});
//
setSliderInput("#triStiffness", globals.triStiffness, 0, 10, 0.01, function(val){
//
globals.triStiffness = val;//todo update
//
// globals.materialHasChanged = true;
//
});
setSliderInput
(
"
#creaseStiffness
"
,
globals
.
creaseStiffness
,
0
,
3
,
0.01
,
function
(
val
){
globals
.
creaseStiffness
=
val
;
...
...
js/dynamic/dynamicSolver.js
View file @
d1d4b185
...
...
@@ -308,6 +308,7 @@ function initDynamicSolver(globals){
gpuMath
.
setUniformForProgram
(
"
velocityCalc
"
,
"
u_textureDimNodeCreases
"
,
[
textureDimNodeCreases
,
textureDimNodeCreases
],
"
2f
"
);
gpuMath
.
setUniformForProgram
(
"
velocityCalc
"
,
"
u_textureDimNodeFaces
"
,
[
textureDimNodeFaces
,
textureDimNodeFaces
],
"
2f
"
);
gpuMath
.
setUniformForProgram
(
"
velocityCalc
"
,
"
u_creasePercent
"
,
globals
.
creasePercent
,
"
1f
"
);
gpuMath
.
setUniformForProgram
(
"
velocityCalc
"
,
"
u_axialStiffness
"
,
globals
.
axialStiffness
,
"
1f
"
);
gpuMath
.
createProgram
(
"
thetaCalc
"
,
vertexShader
,
document
.
getElementById
(
"
thetaCalcShader
"
).
text
);
gpuMath
.
setUniformForProgram
(
"
thetaCalc
"
,
"
u_normals
"
,
0
,
"
1i
"
);
...
...
@@ -383,8 +384,13 @@ function initDynamicSolver(globals){
}
}
globals
.
gpuMath
.
initTextureFromData
(
"
u_beamMeta
"
,
textureDimEdges
,
textureDimEdges
,
"
FLOAT
"
,
beamMeta
,
true
);
//recalc dt
if
(
programsInited
)
setSolveParams
();
if
(
programsInited
)
{
globals
.
gpuMath
.
setProgram
(
"
velocityCalc
"
);
globals
.
gpuMath
.
setUniformForProgram
(
"
velocityCalc
"
,
"
u_axialStiffness
"
,
globals
.
axialStiffness
,
"
1f
"
);
setSolveParams
();
//recalc dt
}
}
function
updateExternalForces
(){
...
...
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