I encountered this error and I'm having trouble pinpointing its origin. It seems to be related to importing and creating 3D objects within my scene, but I can't figure out what exactly is causing the issue.
Below is the code snippet where I call a function before initializing:
function loadObjects()
{
loader = new THREE.JSONLoader();
var floorDiskmaterial = new THREE.MeshPhongMaterial({
map: THREE.ImageUtils.loadTexture('img/floor_test.jpg'),
transparent: true,
color: 0xeaeaea,
ambient: 0xeaeaea,
overdraw: 0.5,
//specular: 0x6a3e6d,
shading: THREE.FlatShading,
fog: false,
//shininess: 50,
});
loader.load( "models/floorScene.js", function( geometry ) {
FloorDiskFire = new THREE.Mesh( geometry, floorDiskmaterial);
FloorDiskFire.position.set(0,0.2,0);
FloorDiskFire.castShadow = true;
FloorDiskFire.receiveShadow = true;
FloorDiskFire.scale.set(1.5,1.5,1.5);
//FloorDiskFire.rotation.y = -0.78;
} );
//-----Pillar Loader------//
var pillarMaterial = new THREE.MeshPhongMaterial({
//map: THREE.ImageUtils.loadTexture('img/pillarMap.png'),
//transparent: true,
color: 0xeaeaea,
ambient: 0xeaeaea,
overdraw: 0.5,
//specular: 0x6a3e6d,
shading: THREE.FlatShading,
fog: false,
//shininess: 50,
});
loader.load( "models/pillar.js", function( pillar ) {
firePillar = new THREE.Mesh(pillar, pillarMaterial);
firePillar.position.set(135,0,135);
firePillar.castShadow = true;
firePillar.receiveShadow = true;
firePillar.scale.set(1.7,1.7,1.7);
} );
loader.load( "models/pillar.js", function( pillar ) {
earthPillar = new THREE.Mesh(pillar, pillarMaterial);
earthPillar.position.set(135,0,-135);
earthPillar.castShadow = true;
earthPillar.receiveShadow = true;
earthPillar.scale.set(1.7,1.7,1.7);
} );
loader.load( "models/pillar.js", function( pillar ) {
airPillar = new THREE.Mesh(pillar, pillarMaterial);
airPillar.position.set(-135,0,135);
airPillar.castShadow = true;
airPillar.receiveShadow = true;
airPillar.scale.set(1.7,1.7,1.7);
} );
loader.load( "models/pillar.js", function( pillar ) {
waterPillar = new THREE.Mesh(pillar, pillarMaterial);
waterPillar.position.set(-135,0,-135);
waterPillar.castShadow = true;
waterPillar.receiveShadow = true;
waterPillar.scale.set(1.7,1.7,1.7);
} );
}
Then in the initialization process, I add these objects into the scene:
loader.onLoadComplete=function(){
scene.add(FloorDiskFire);
scene.add(firePillar);
scene.add(earthPillar);
scene.add(waterPillar);
scene.add(airPillar);
};