Commit 24351ecc authored by amandaghassaei's avatar amandaghassaei
Browse files

change material

parent 8e2516b3
......@@ -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){
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment