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
7f2f119c
Commit
7f2f119c
authored
May 24, 2017
by
amandaghassaei
Browse files
camera controls
parent
e592a80d
Changes
4
Hide whitespace changes
Inline
Side-by-side
dependencies/TrackballControls.js
View file @
7f2f119c
...
...
@@ -211,6 +211,7 @@ THREE.TrackballControls = function ( object, domElement ) {
_touchZoomDistanceStart
=
_touchZoomDistanceEnd
;
_eye
.
multiplyScalar
(
factor
);
}
else
{
factor
=
1.0
+
(
_zoomEnd
.
y
-
_zoomStart
.
y
)
*
_this
.
zoomSpeed
;
...
...
@@ -331,13 +332,15 @@ THREE.TrackballControls = function ( object, domElement ) {
};
this
.
reset
=
function
()
{
this
.
reset
=
function
(
position
)
{
_state
=
STATE
.
NONE
;
_prevState
=
STATE
.
NONE
;
_this
.
target
.
copy
(
_this
.
target0
);
_this
.
object
.
position
.
copy
(
_this
.
position0
);
if
(
position
===
undefined
)
position
=
_this
.
position0
;
else
position
.
normalize
().
multiplyScalar
(
_this
.
object
.
position
.
length
());
_this
.
object
.
position
.
copy
(
position
);
_this
.
object
.
up
.
copy
(
_this
.
up0
);
_eye
.
subVectors
(
_this
.
object
.
position
,
_this
.
target
);
...
...
index.html
View file @
7f2f119c
...
...
@@ -619,6 +619,13 @@
<div
id=
"VRoptions"
>
</div>
</div><br/>
View Angle:
<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=
"cameraOrtho"
class=
"btn btn-lg btn-default"
>
Ortho
</a>
</div>
</div>
</div>
...
...
js/controls.js
View file @
7f2f119c
...
...
@@ -24,6 +24,19 @@ function initControls(globals){
$
(
'
#aboutAnimationModal
'
).
modal
(
'
show
'
);
});
setLink
(
"
#cameraX
"
,
function
(){
globals
.
threeView
.
setCameraX
();
});
setLink
(
"
#cameraY
"
,
function
(){
globals
.
threeView
.
setCameraY
();
});
setLink
(
"
#cameraZ
"
,
function
(){
globals
.
threeView
.
setCameraZ
();
});
setLink
(
"
#cameraOrtho
"
,
function
(){
globals
.
threeView
.
setCameraOrtho
();
});
setLink
(
"
#exportFOLD
"
,
function
(){
updateDimensions
();
$
(
"
#foldFilename
"
).
val
(
globals
.
filename
+
"
:
"
+
parseInt
(
globals
.
creasePercent
*
100
)
+
"
PercentFolded
"
);
...
...
js/threeView.js
View file @
7f2f119c
...
...
@@ -95,6 +95,26 @@ function initThreeView(globals) {
// effectComposer.addPass( ssaoPass );
}
function
setCameraX
(){
controls
.
reset
(
new
THREE
.
Vector3
(
1
,
0
,
0
));
manuallySetCamera
();
}
function
setCameraY
(){
controls
.
reset
(
new
THREE
.
Vector3
(
0
,
1
,
0
));
manuallySetCamera
();
}
function
setCameraZ
(){
controls
.
reset
(
new
THREE
.
Vector3
(
0
,
0
,
1
));
manuallySetCamera
();
}
function
setCameraOrtho
(){
controls
.
reset
(
new
THREE
.
Vector3
(
1
,
1
,
1
));
manuallySetCamera
();
}
function
manuallySetCamera
(){
render
();
}
function
render
()
{
if
(
!
animationRunning
)
{
console
.
log
(
"
render
"
);
...
...
@@ -249,6 +269,10 @@ function initThreeView(globals) {
modelWrapper
:
modelWrapper
,
running
:
running
,
setScale
:
setScale
,
saveSVG
:
saveSVG
saveSVG
:
saveSVG
,
setCameraX
:
setCameraX
,
setCameraY
:
setCameraY
,
setCameraZ
:
setCameraZ
,
setCameraOrtho
:
setCameraOrtho
}
}
\ No newline at end of file
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