Essentially, I am generating a static scene using the three.js module with node.js.
Unfortunately, as the scene is being rendered without a browser, I can not use THREE.ImageUtils.loadTexture
.
I am given an error when using this - I understand that document
does not exist as I am rendering it server side.
var materials = [
new THREE.MeshLambertMaterial({map: THREE.ImageUtils.loadTexture('url here'')}),
new THREE.MeshLambertMaterial({map: THREE.ImageUtils.loadTexture('url here'')}),
new THREE.MeshLambertMaterial({map: THREE.ImageUtils.loadTexture('url here'')}),
new THREE.MeshLambertMaterial({map: THREE.ImageUtils.loadTexture('url here'')}),
new THREE.MeshLambertMaterial({map: THREE.ImageUtils.loadTexture('url here'')}),
new THREE.MeshLambertMaterial({map: THREE.ImageUtils.loadTexture('url here')})
];
returns
/usr/src/node-v0.10.40/node_modules/three/three.js:13028
var image = document.createElement( 'img' );
^
ReferenceError: document is not defined
So in a sum - I need to load a texture onto a cube using SoftwareRenderer in three.js, however the catch is I am rendering it with node, not loading it in a browser. How would I go about doing this?