Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions chapter-02/01-basic-scene.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,17 @@
this.addCube = function() {

var cubeSize = Math.ceil((Math.random() * 3));
var cubeGeometry = new THREE.CubeGeometry(cubeSize,cubeSize,cubeSize);
var cubeGeometry = new THREE.BoxGeometry(cubeSize,cubeSize,cubeSize);
var cubeMaterial = new THREE.MeshLambertMaterial({color: Math.random() * 0xffffff });
var cube = new THREE.Mesh(cubeGeometry, cubeMaterial);
cube.castShadow = true;
cube.name = "cube-" + scene.children.length;


// position the cube randomly in the scene
cube.position.x=-30 + Math.round((Math.random() * planeGeometry.width));
cube.position.x=-30 + Math.round((Math.random() * planeGeometry.parameters.width));
cube.position.y= Math.round((Math.random() * 5));
cube.position.z=-20 + Math.round((Math.random() * planeGeometry.height));
cube.position.z=-20 + Math.round((Math.random() * planeGeometry.parameters.height));

// add the cube to the scene
scene.add(cube);
Expand Down
6 changes: 3 additions & 3 deletions chapter-02/02-foggy-scene.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@
this.addCube = function() {

var cubeSize = Math.ceil((Math.random() * 3));
var cubeGeometry = new THREE.CubeGeometry(cubeSize,cubeSize,cubeSize);
var cubeGeometry = new THREE.BoxGeometry(cubeSize,cubeSize,cubeSize);
var cubeMaterial = new THREE.MeshLambertMaterial({color: Math.random() * 0xffffff });
var cube = new THREE.Mesh(cubeGeometry, cubeMaterial);
cube.castShadow = true;

// position the cube randomly in the scene
cube.position.x=-30 + Math.round((Math.random() * planeGeometry.width));
cube.position.x=-30 + Math.round((Math.random() * planeGeometry.parameters.width));
cube.position.y= Math.round((Math.random() * 5));
cube.position.z=-20 + Math.round((Math.random() * planeGeometry.height));
cube.position.z=-20 + Math.round((Math.random() * planeGeometry.parameters.height));

// add the cube to the scene
scene.add(cube);
Expand Down
6 changes: 3 additions & 3 deletions chapter-02/03-forced-materials.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@
this.addCube = function() {

var cubeSize = Math.ceil((Math.random() * 3));
var cubeGeometry = new THREE.CubeGeometry(cubeSize,cubeSize,cubeSize);
var cubeGeometry = new THREE.BoxGeometry(cubeSize,cubeSize,cubeSize);
var cubeMaterial = new THREE.MeshLambertMaterial({color: Math.random() * 0xffffff });
var cube = new THREE.Mesh(cubeGeometry, cubeMaterial);
cube.castShadow = true;

// position the cube randomly in the scene
cube.position.x=-30 + Math.round((Math.random() * planeGeometry.width));
cube.position.x=-30 + Math.round((Math.random() * planeGeometry.parameters.width));
cube.position.y= Math.round((Math.random() * 5));
cube.position.z=-20 + Math.round((Math.random() * planeGeometry.height));
cube.position.z=-20 + Math.round((Math.random() * planeGeometry.parameters.height));

// add the cube to the scene
scene.add(cube);
Expand Down
3 changes: 2 additions & 1 deletion chapter-02/05-custom-geometry.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@



geom.computeCentroids();
// geom.computeCentroids();

geom.mergeVertices();

var materials = [
Expand Down
10 changes: 5 additions & 5 deletions chapter-02/07-both-cameras.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@
// add the plane to the scene
scene.add(plane);

var cubeGeometry = new THREE.CubeGeometry(4,4,4);
var cubeGeometry = new THREE.BoxGeometry(4,4,4);
var cubeMaterial = new THREE.MeshLambertMaterial({color: 0x00ee22});
for (var j = 0 ; j < (planeGeometry.height/5) ; j++) {
for (var i = 0 ; i < planeGeometry.width/5 ; i++) {
for (var j = 0 ; j < (planeGeometry.parameters.height/5) ; j++) {
for (var i = 0 ; i < planeGeometry.parameters.width/5 ; i++) {
var cube = new THREE.Mesh(cubeGeometry, cubeMaterial);

cube.position.z=-((planeGeometry.height)/2)+2+(j*5);
cube.position.x=-((planeGeometry.width)/2)+2+(i*5);
cube.position.z=-((planeGeometry.parameters.height)/2)+2+(j*5);
cube.position.x=-((planeGeometry.parameters.width)/2)+2+(i*5);
cube.position.y=2;

scene.add(cube);
Expand Down
2 changes: 1 addition & 1 deletion libs/ConvexGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ THREE.ConvexGeometry = function( vertices ) {
}


this.computeCentroids();
// this.computeCentroids();
this.computeFaceNormals();
this.computeVertexNormals();

Expand Down