From 53529de38ed2b618de2b61ad368a85fb77c5212d Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Mon, 19 Jan 2015 17:40:11 -0500
Subject: [PATCH] normal added

---
 js/threeViews/pushPullMeshView.js | 3 ++-
 js/threeViews/threeView.js        | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/js/threeViews/pushPullMeshView.js b/js/threeViews/pushPullMeshView.js
index e27ecaaf..06d1b4da 100644
--- a/js/threeViews/pushPullMeshView.js
+++ b/js/threeViews/pushPullMeshView.js
@@ -29,7 +29,8 @@ PushPullMeshView = Backbone.View.extend({
     },
 
     drawBounds: function(){
-        this.boundsBox = new THREE.Mesh(new THREE.BoxGeometry(100, 100, 100), new THREE.MeshLambertMaterial({color:0x0000ff, shading:THREE.FlatShading, transparent:true, opacity:0.0, vertexColors:THREE.FaceColors}));
+        this.boundsBox = new THREE.Mesh(new THREE.BoxGeometry(100, 100, 100),
+            new THREE.MeshLambertMaterial({color:0x0000ff, shading:THREE.FlatShading, transparent:true, opacity:0.0, vertexColors:THREE.FaceColors}));
         this.boxHelper = new THREE.BoxHelper(this.boundsBox);
 
         this.boxHelper.material.color.set(this.defaultColor);
diff --git a/js/threeViews/threeView.js b/js/threeViews/threeView.js
index 3c1977da..53ce9bfa 100644
--- a/js/threeViews/threeView.js
+++ b/js/threeViews/threeView.js
@@ -16,6 +16,7 @@ ThreeView = Backbone.View.extend({
     highlightTargets: null,
     meshHandle: null,
     cubeGeometry: new THREE.BoxGeometry(5,5,5),
+    cubeMaterial: new THREE.MeshLambertMaterial({color:0x0000ff, shading:THREE.FlatShading, vertexColors:THREE.FaceColors}),
 
     el: "#threeContainer",
 
@@ -58,6 +59,7 @@ ThreeView = Backbone.View.extend({
         if (intersections.length>1){
             var voxel = new THREE.Mesh(this.cubeGeometry);
             voxel.position.copy(intersections[1].point);
+            if (intersections[1].face) voxel.position.add(intersections[1].face.normal);
             voxel.position.divideScalar(5).floor().multiplyScalar(5).addScalar(2.5);
             this.model.sceneAdd(voxel);
             this.model.render();
-- 
GitLab