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
8e2516b3
Commit
8e2516b3
authored
May 02, 2017
by
amandaghassaei
Browse files
two sided material
parent
341019d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
js/controls.js
View file @
8e2516b3
...
...
@@ -17,7 +17,7 @@ function initControls(globals){
setLink
(
"
#about
"
,
function
(){
$
(
'
#aboutModal
'
).
modal
(
'
show
'
);
});
setCheckbox
(
"
#dynamic
"
,
globals
.
simType
==
"
dynamic
"
,
function
(
val
){
globals
.
simType
=
val
;
});
...
...
js/model.js
View file @
8e2516b3
...
...
@@ -9,7 +9,7 @@ function initModel(globals){
function
setMeshMaterial
(){
material
=
THREE
.
MeshFaceMaterial
([
new
THREE
.
MeshLambertMaterial
({
shading
:
THREE
.
FlatShading
,
color
:
0xff0000
,
side
:
THREE
.
FrontSide
}),
new
THREE
.
MeshLambertMaterial
({
shading
:
THREE
.
FlatShading
,
color
:
0x0000ff
,
side
:
THREE
.
Back
Side
})
new
THREE
.
MeshLambertMaterial
({
shading
:
THREE
.
FlatShading
,
color
:
0x0000ff
,
side
:
THREE
.
Front
Side
})
]);
object3D
.
material
=
material
;
}
...
...
@@ -161,22 +161,21 @@ function initModel(globals){
vertices
.
push
(
nodes
[
i
].
getPosition
());
}
var
geofaces
=
faces
.
slice
();
for
(
var
i
=
0
;
i
<
faces
.
length
;
i
++
){
geofaces
[
i
].
materialIndex
=
1
;
geofaces
.
push
(
new
THREE
.
Face3
(
faces
[
i
].
a
,
faces
[
i
].
c
,
faces
[
i
].
b
));
}
console
.
log
(
geofaces
);
geometry
.
vertices
=
vertices
;
geometry
.
faces
=
faces
;
geometry
.
faces
=
geo
faces
;
geometry
.
verticesNeedUpdate
=
true
;
geometry
.
elementsNeedUpdate
=
true
;
geometry
.
computeFaceNormals
();
geometry
.
computeBoundingBox
();
geometry
.
computeBoundingSphere
();
// for ( var face in geometry.faces ) {
// if (face<geometry.faces.length/2) {
// geometry.faces[ face ].materialIndex = 1;
// console.log(face);
// }
// else geometry.faces[ face ].materialIndex = 0;
// }
globals
.
shouldSyncWithModel
=
true
;
inited
=
true
;
// globals.staticSolver.syncNodesAndEdges();
...
...
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