max-mapper / voxel-mesh

generate a three.js mesh from voxel data
https://npmjs.org/package/voxel-mesh
109 stars 28 forks source link

Add an option to supply a THREE.js instance to the Mesh constructor #5

Closed leolannenmaki closed 11 years ago

leolannenmaki commented 11 years ago

Because transitive dependencies get inserted in to the browserify bundle multiple times (see https://github.com/substack/node-browserify/issues/186) THREE.js can get loaded and instantiated multiple times in a single voxel-engine app.

This causes problems because for example instanceof checks fail for objects created in one Three instance and passed to another.

In my case

var mesh = new Mesh(voxelData);
game.scene.add(mesh.createSurfaceMesh());

Fails because the

mesh instanceof Object3d

fails inside Three.js

max-mapper commented 11 years ago

Thanks! Any idea how we could fix three.js?

leolannenmaki commented 11 years ago

Sorry, no idea. It seems riddled with instanceof checks.