From 9625531bad2be64a123133bb566055f89ecaf4e4 Mon Sep 17 00:00:00 2001 From: Chris Kelley Date: Mon, 13 May 2013 15:46:46 +0200 Subject: [PATCH 1/2] bump 3.js to 0.58.9 and voxel-view to repository --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7473b3d..0ba2e77 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "dependencies": { "voxel": "0.3.1", "voxel-mesh": "0.2.1", - "voxel-view": "0.0.6", + "voxel-view": "git://github.com/snagy/voxel-view.git", "voxel-chunks": "0.0.2", "voxel-raycast": "0.2.1", "voxel-control": "0.0.7", @@ -17,7 +17,7 @@ "voxel-physical": "0.0.8", "voxel-region-change": "0.1.0", "raf": "0.0.1", - "three": "0.56.0", + "three": "0.58.9", "pin-it": "0.0.1", "aabb-3d": "0.0.0", "inherits": "1.0.0", From 3e7058da5eaf8c9db4d1e428b6fd6b4bd8dfd3cf Mon Sep 17 00:00:00 2001 From: Chris Kelley Date: Mon, 13 May 2013 16:27:13 +0200 Subject: [PATCH 2/2] Checking for browser when loading materials Blows up in server otherwise. --- index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 918756e..1437cc5 100644 --- a/index.js +++ b/index.js @@ -86,13 +86,15 @@ function Game(opts) { this.chunksNeedsUpdate = {} // contains new chunks yet to be generated. Handled by game.loadPendingChunks this.pendingChunks = [] - - this.materials = texture({ - game: this, - texturePath: opts.texturePath || './textures/', - materialType: opts.materialType || THREE.MeshLambertMaterial, - materialParams: opts.materialParams || {} - }) + + if (process.browser) { + this.materials = texture({ + game: this, + texturePath: opts.texturePath || './textures/', + materialType: opts.materialType || THREE.MeshLambertMaterial, + materialParams: opts.materialParams || {} + }) + } this.materialNames = opts.materials || [['grass', 'dirt', 'grass_dirt'], 'brick', 'dirt']