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
279baaeb
Commit
279baaeb
authored
May 24, 2017
by
amandaghassaei
Browse files
animation settings
parent
7f2f119c
Changes
5
Hide whitespace changes
Inline
Side-by-side
index.html
View file @
279baaeb
...
...
@@ -620,11 +620,14 @@
</div>
</div><br/>
View Angle:
<br/>
View Angle:
<br/>
<br/>
<div
class=
"indent"
>
<a
href=
"#"
id=
"cameraX"
class=
"btn btn-lg btn-default"
>
X
</a>
<a
href=
"#"
id=
"cameraY"
class=
"btn btn-lg btn-default"
>
Y
</a>
<a
href=
"#"
id=
"cameraZ"
class=
"btn btn-lg btn-default"
>
Z
</a>
<a
href=
"#"
id=
"cameraZ"
class=
"paddingBottom btn btn-lg btn-default"
>
Front
</a>
<a
href=
"#"
id=
"cameraMinusZ"
class=
"paddingBottom btn btn-lg btn-default"
>
Back
</a>
<a
href=
"#"
id=
"cameraX"
class=
"paddingBottom btn btn-lg btn-default"
>
Right
</a>
<a
href=
"#"
id=
"cameraMinusX"
class=
"paddingBottom btn btn-lg btn-default"
>
Left
</a><br/>
<a
href=
"#"
id=
"cameraY"
class=
"btn btn-lg btn-default"
>
Top
</a>
<a
href=
"#"
id=
"cameraMinusY"
class=
"btn btn-lg btn-default"
>
Bottom
</a>
<a
href=
"#"
id=
"cameraOrtho"
class=
"btn btn-lg btn-default"
>
Ortho
</a>
</div>
</div>
...
...
js/controls.js
View file @
279baaeb
...
...
@@ -25,13 +25,22 @@ function initControls(globals){
});
setLink
(
"
#cameraX
"
,
function
(){
globals
.
threeView
.
setCameraX
();
globals
.
threeView
.
setCameraX
(
1
);
});
setLink
(
"
#cameraY
"
,
function
(){
globals
.
threeView
.
setCameraY
();
globals
.
threeView
.
setCameraY
(
1
);
});
setLink
(
"
#cameraZ
"
,
function
(){
globals
.
threeView
.
setCameraZ
();
globals
.
threeView
.
setCameraZ
(
1
);
});
setLink
(
"
#cameraMinusX
"
,
function
(){
globals
.
threeView
.
setCameraX
(
-
1
);
});
setLink
(
"
#cameraMinusY
"
,
function
(){
globals
.
threeView
.
setCameraY
(
-
1
);
});
setLink
(
"
#cameraMinusZ
"
,
function
(){
globals
.
threeView
.
setCameraZ
(
-
1
);
});
setLink
(
"
#cameraOrtho
"
,
function
(){
globals
.
threeView
.
setCameraOrtho
();
...
...
js/dynamic/dynamicSolver.js
View file @
279baaeb
...
...
@@ -60,7 +60,6 @@ function initDynamicSolver(globals){
globals
.
gpuMath
.
step
(
"
zeroTexture
"
,
[],
"
u_lastPosition
"
);
globals
.
gpuMath
.
step
(
"
zeroTexture
"
,
[],
"
u_velocity
"
);
globals
.
gpuMath
.
step
(
"
zeroTexture
"
,
[],
"
u_lastVelocity
"
);
//todo reset theta
render
();
}
...
...
js/model.js
View file @
279baaeb
...
...
@@ -60,7 +60,6 @@ function initModel(globals){
}
object3D
.
material
=
material
;
object3D2
.
material
=
material2
;
globals
.
threeView
.
render
();
}
function
updateEdgeVisibility
(){
...
...
@@ -74,7 +73,6 @@ function initModel(globals){
for
(
var
i
=
0
;
i
<
creases
.
length
;
i
++
){
creases
[
i
].
setVisibility
();
}
globals
.
threeView
.
render
();
}
function
updateMeshVisibility
(){
...
...
@@ -150,23 +148,21 @@ function initModel(globals){
// });
function
pause
(){
globals
.
threeView
.
pause
Anim
ation
();
globals
.
threeView
.
pause
Simul
ation
();
}
function
resume
(){
startSolver
();
globals
.
threeView
.
startSimulation
();
}
function
reset
(){
getSolver
().
reset
();
setGeoUpdates
();
globals
.
threeView
.
render
();
}
function
step
(
numSteps
){
getSolver
().
solve
(
numSteps
);
setGeoUpdates
();
globals
.
threeView
.
render
();
}
function
setGeoUpdates
(){
...
...
js/threeView.js
View file @
279baaeb
...
...
@@ -16,7 +16,7 @@ function initThreeView(globals) {
// var depthMaterial, effectComposer, depthRenderTarget;
// var ssaoPass;
var
anim
ationRunning
=
false
;
var
simul
ationRunning
=
false
;
var
pauseFlag
=
false
;
init
();
...
...
@@ -66,7 +66,7 @@ function initThreeView(globals) {
controls
.
noPan
=
true
;
controls
.
staticMoving
=
true
;
controls
.
dynamicDampingFactor
=
0.3
;
controls
.
addEventListener
(
"
change
"
,
render
);
//
controls.addEventListener("change", render);
// var renderPass = new THREE.RenderPass( scene, camera );
...
...
@@ -95,50 +95,37 @@ function initThreeView(globals) {
// effectComposer.addPass( ssaoPass );
}
function
setCameraX
(){
controls
.
reset
(
new
THREE
.
Vector3
(
1
,
0
,
0
));
manuallySetCamera
();
function
setCameraX
(
sign
){
controls
.
reset
(
new
THREE
.
Vector3
(
sign
,
0
,
0
));
}
function
setCameraY
(){
controls
.
reset
(
new
THREE
.
Vector3
(
0
,
1
,
0
));
manuallySetCamera
();
function
setCameraY
(
sign
){
controls
.
reset
(
new
THREE
.
Vector3
(
0
,
sign
,
0
));
}
function
setCameraZ
(){
controls
.
reset
(
new
THREE
.
Vector3
(
0
,
0
,
1
));
manuallySetCamera
();
function
setCameraZ
(
sign
){
controls
.
reset
(
new
THREE
.
Vector3
(
0
,
0
,
sign
));
}
function
setCameraOrtho
(){
controls
.
reset
(
new
THREE
.
Vector3
(
1
,
1
,
1
));
manuallySetCamera
();
}
function
manuallySetCamera
(){
render
();
}
function
render
()
{
if
(
!
animationRunning
)
{
console
.
log
(
"
render
"
);
_render
();
}
}
function
startAnimation
(
callback
){
console
.
log
(
"
starting animation
"
);
if
(
animationRunning
){
console
.
warn
(
"
animation already running
"
);
return
;
}
animationRunning
=
true
;
simulationRunning
=
true
;
_loop
(
callback
);
}
function
pauseAnimation
(){
if
(
animationRunning
)
pauseFlag
=
true
;
function
pauseSimulation
(){
if
(
simulationRunning
)
pauseFlag
=
true
;
}
function
startSimulation
(){
console
.
log
(
"
starting simulation
"
);
simulationRunning
=
true
;
}
function
running
(){
return
anim
ationRunning
;
return
simul
ationRunning
;
}
function
_render
(){
...
...
@@ -159,7 +146,12 @@ function initThreeView(globals) {
}
function
_loop
(
callback
){
callback
();
if
(
pauseFlag
)
{
pauseFlag
=
false
;
simulationRunning
=
false
;
console
.
log
(
"
pausing simulation
"
);
}
if
(
simulationRunning
)
callback
();
if
(
globals
.
vrEnabled
){
globals
.
vive
.
effect
.
requestAnimationFrame
(
function
(){
_loop
(
callback
);
...
...
@@ -168,13 +160,6 @@ function initThreeView(globals) {
return
;
}
requestAnimationFrame
(
function
(){
if
(
pauseFlag
)
{
pauseFlag
=
false
;
animationRunning
=
false
;
console
.
log
(
"
pausing animation
"
);
render
();
//for good measure
return
;
}
_loop
(
callback
);
});
controls
.
update
();
...
...
@@ -258,10 +243,10 @@ function initThreeView(globals) {
return
{
sceneAddModel
:
sceneAddModel
,
sceneClearModel
:
sceneClearModel
,
render
:
render
,
onWindowResize
:
onWindowResize
,
startAnimation
:
startAnimation
,
pauseAnimation
:
pauseAnimation
,
startSimulation
:
startSimulation
,
pauseSimulation
:
pauseSimulation
,
enableControls
:
enableControls
,
scene
:
scene
,
camera
:
camera
,
...
...
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