Skip to content
Snippets Groups Projects
Commit 7b28f339 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

begin cubify

parent 733b3426
No related branches found
No related tags found
No related merge requests found
...@@ -52,12 +52,13 @@ $(function(){ ...@@ -52,12 +52,13 @@ $(function(){
var meshesToAdd = []; var meshesToAdd = [];
var cubeDim = localEnv.cubeDim; var cubeDim = localEnv.cubeDim;
var boundingBox = localEnv.boundingBox; var boundingBox = localEnv.boundingBox;
// for (var y=boundingBox.min.y;y<boundingBox.max.y;y+=cubeDim){ var modelClone = new THREE.Mesh(localEnv.modelMesh.geometry, localEnv.modelMesh.material);//had to do this for some reason
//// if () for (var y=boundingBox.min.y;y<boundingBox.max.y;y+=cubeDim){
// for (var z=boundingBox.min.z;z<boundingBox.max.z;z+=cubeDim){ for (var z=boundingBox.min.z;z<boundingBox.max.z;z+=cubeDim){
// var raycaster = new THREE.Raycaster(new THREE.Vector3(x+cubeDim/2, y+cubeDim/2, z+cubeDim/2), var raycaster = new THREE.Raycaster(new THREE.Vector3(x+cubeDim/2, y+cubeDim/2, z+cubeDim/2),
// new THREE.Vector3(0, 0, 1), 0, boundingBox.max.z-z+cubeDim/2); new THREE.Vector3(0, 0, 1), 0, boundingBox.max.z-z+cubeDim/2);
// var numIntersections = raycaster.intersectObject(localEnv.modelMesh).length; var numIntersections = raycaster.intersectObject(modelClone).length;
// console.log(numIntersections);
// if (numIntersections % 2 == 1) { // if (numIntersections % 2 == 1) {
// var mesh = createCubeGeometry(cubeDim); // var mesh = createCubeGeometry(cubeDim);
// mesh.position.set(x+cubeDim/2, y+cubeDim/2, z+cubeDim/2); // mesh.position.set(x+cubeDim/2, y+cubeDim/2, z+cubeDim/2);
...@@ -67,8 +68,8 @@ $(function(){ ...@@ -67,8 +68,8 @@ $(function(){
//// global.env.three.scene.add(mesh); //// global.env.three.scene.add(mesh);
// } else if (numIntersections == 0){ // } else if (numIntersections == 0){
// } // }
// } }
// } }
return x*x; return x*x;
} }
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment