Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
OrigamiSimulator
Commits
58564e71
Commit
58564e71
authored
Mar 03, 2017
by
amandaghassaei
Browse files
rendering
parent
e3e1c192
Changes
3
Hide whitespace changes
Inline
Side-by-side
js/dynamicModel.js
View file @
58564e71
...
...
@@ -53,8 +53,10 @@ function initDynamicModel(globals){
geometry
.
computeBoundingSphere
();
var
bounds
=
geometry
.
boundingBox
;
var
avg
=
(
bounds
.
min
.
add
(
bounds
.
max
)).
multiplyScalar
(
0.5
);
object3D
.
position
.
set
(
-
avg
.
x
,
0
,
-
avg
.
z
);
var
avg
=
(
bounds
.
min
.
add
(
bounds
.
max
)).
multiplyScalar
(
-
0.5
);
object3D
.
position
.
set
(
avg
.
x
,
0
,
avg
.
z
);
globals
.
threeView
.
centerModel
(
avg
);
initTypedArrays
();
if
(
firstTime
===
undefined
)
firstTime
=
false
;
...
...
js/model.js
View file @
58564e71
...
...
@@ -34,7 +34,6 @@ function initModel(globals){
for
(
var
i
=
0
;
i
<
_vertices
.
length
;
i
++
){
_nodes
.
push
(
new
Node
(
_vertices
[
i
].
clone
(),
_nodes
.
length
));
}
console
.
log
(
_faces
[
0
]);
_nodes
[
_faces
[
0
].
a
].
setFixed
(
true
);
_nodes
[
_faces
[
0
].
b
].
setFixed
(
true
);
_nodes
[
_faces
[
0
].
c
].
setFixed
(
true
);
...
...
js/threeView.js
View file @
58564e71
...
...
@@ -26,6 +26,7 @@ function initThreeView(globals) {
scene
.
background
=
new
THREE
.
Color
(
0xe6e6e6
);
scene
.
add
(
wrapper
);
scene
.
add
(
patternWrapper
);
patternWrapper
.
visible
=
false
;
scene
.
add
(
modelWrapper
);
var
directionalLight1
=
new
THREE
.
DirectionalLight
(
0xffffff
,
0.8
);
directionalLight1
.
position
.
set
(
0
,
100
,
0
);
...
...
@@ -42,7 +43,7 @@ function initThreeView(globals) {
//scene.fog = new THREE.FogExp2(0xf4f4f4, 1.7);
//renderer.setClearColor(scene.fog.color);
camera
.
zoom
=
1
5
;
camera
.
zoom
=
1
;
camera
.
updateProjectionMatrix
();
camera
.
position
.
x
=
40
;
camera
.
position
.
y
=
40
;
...
...
@@ -143,6 +144,10 @@ function initThreeView(globals) {
controls
.
enableRotate
=
state
;
}
function
centerModel
(
position
){
modelWrapper
.
position
.
set
(
position
.
x
,
0
,
position
.
z
);
}
return
{
sceneAddPattern
:
sceneAddPattern
,
...
...
@@ -150,6 +155,7 @@ function initThreeView(globals) {
sceneClearPattern
:
sceneClearPattern
,
sceneAddModel
:
sceneAddModel
,
sceneClearModel
:
sceneClearModel
,
centerModel
:
centerModel
,
sceneAdd
:
sceneAdd
,
sceneRemove
:
sceneRemove
,
render
:
render
,
...
...
Write
Preview
Supports
Markdown
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