diff --git a/js/threeViews/pushPullMeshView.js b/js/threeViews/pushPullMeshView.js index e27ecaaf73c17dd6c57be94c9ced4bfc35b8f707..06d1b4da8403831a3210ca9e89f9829a787b221d 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 3c1977da7afac66818fda07e14ab8b2a394daee1..53ce9bfae85ddcc8ea992935fd7d882042a87d17 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();