when I try to use JSONLoader to load the output from this code:
<script src="js/ThreeCSG.js"></script>
var mesh = intersect(
new THREE.SphereGeometry(50, 20, 20),
new THREE.SphereGeometry(50, 20, 20),
new THREE.Vector3(0, -66, 0),
new THREE.MeshBasicMaterial({color: 'white'}));
console.log(JSON.stringify(mesh.toJSON()));
function intersect(geo1, geo2, offsetVector3, material) {
var mesh1, mesh2, bsp1, bsp2;
mesh1 = new THREE.Mesh(geo1);
mesh1.position.add(offsetVector3);
bsp1 = new ThreeBSP(mesh1);
mesh2 = new THREE.Mesh(geo2);
bsp2 = new ThreeBSP(mesh2);
var resultBsp = bsp1.intersect(bsp2);
var resultMesh = resultBsp.toMesh(material);
resultMesh.geometry.computeVertexNormals();
return resultMesh;
}
Mesh thus created renders just fine in the browser and in AltspaceVR, but when I tried to store the pre-computed mesh to speed things up I got the above error.
Loading is like this (It dies before I get to "do stuff"):
var GOBAN = {
objLoader: new THREE.JSONLoader(),
}
then later
GOBAN.objLoader.load("js/stone.json", function (geom, mat) {/*do stuff*/});
I notice that the JSON produced has verticies in a deeper level, and that the THREE code is looking for them on the top level...
If this is not a bug, consider it a feature request :)
when I try to use JSONLoader to load the output from this code:
Mesh thus created renders just fine in the browser and in AltspaceVR, but when I tried to store the pre-computed mesh to speed things up I got the above error.
Loading is like this (It dies before I get to "do stuff"):
then later
I notice that the JSON produced has verticies in a deeper level, and that the THREE code is looking for them on the top level...
produced in r73 from here: