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
24351ecc
Commit
24351ecc
authored
May 02, 2017
by
amandaghassaei
Browse files
change material
parent
8e2516b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
js/controls.js
View file @
24351ecc
...
...
@@ -72,13 +72,9 @@ function initControls(globals){
else
$
(
"
#coloredMaterialOptions
"
).
hide
();
setRadio
(
"
colorMode
"
,
globals
.
colorMode
,
function
(
val
){
globals
.
colorMode
=
val
;
if
(
val
==
"
color
"
)
{
$
(
"
#coloredMaterialOptions
"
).
show
();
globals
.
model
.
setMeshMaterial
();
}
if
(
val
==
"
color
"
)
$
(
"
#coloredMaterialOptions
"
).
show
();
else
$
(
"
#coloredMaterialOptions
"
).
hide
();
globals
.
model
.
setMeshMaterial
();
});
function
setButtonGroup
(
id
,
callback
){
...
...
js/model.js
View file @
24351ecc
...
...
@@ -5,16 +5,20 @@
//wireframe model and folding structure
function
initModel
(
globals
){
var
material
=
new
THREE
.
MeshNormalMaterial
({
shading
:
THREE
.
FlatShading
,
side
:
THREE
.
DoubleSide
});
var
material
;
setMeshMaterial
();
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
.
FrontSide
})
]);
object3D
.
material
=
material
;
if
(
globals
.
colorMode
==
"
normal
"
){
material
=
new
THREE
.
MeshNormalMaterial
({
shading
:
THREE
.
FlatShading
,
side
:
THREE
.
DoubleSide
});
}
else
{
material
=
THREE
.
MeshFaceMaterial
([
new
THREE
.
MeshLambertMaterial
({
shading
:
THREE
.
FlatShading
,
color
:
0xff0000
,
side
:
THREE
.
FrontSide
}),
new
THREE
.
MeshLambertMaterial
({
shading
:
THREE
.
FlatShading
,
color
:
0x0000ff
,
side
:
THREE
.
FrontSide
})
]);
}
if
(
object3D
)
object3D
.
material
=
material
;
}
var
geometry
=
new
THREE
.
Geometry
();
geometry
.
dynamic
=
true
;
var
object3D
=
new
THREE
.
Mesh
(
geometry
,
material
);
...
...
@@ -166,7 +170,6 @@ function initModel(globals){
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
=
geofaces
;
...
...
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