I encountered an issue with my code while working with three.js. I am having trouble initializing certain components and objects such as the axis and cube, as they are not displaying on the screen. Can someone please help me identify where the error might be occurring?
function gameInit(axlesHelper) {
(axlesHelper) ? gameComponent.setAxlesHelper() : null;
gameComponent.setAambientLight();
gameComponent.setDirectionalLight();
gameComponent.setCameraPosition();
gameComponent.renderer();
}
var gameComponent = {
scene: new THREE.Scene(),
axesHelper: new THREE.AxesHelper(10),
ambientLight: new THREE.AmbientLight(0xffffff, 0,6),
directionalLight: new THREE.DirectionalLight(0xffffff, 1),
aspect: window.innerWidth / window.innerHeight,
width: 10,
height: this.width / this.aspect,
camera: new THREE.OrthographicCamera(
this.width * -2, // left
this.width * 2, // right
this.height * 2, // top
this.height * -2, // bottom
0, // near plane
10000 // far plane
),
render: new THREE.WebGLRenderer({ antialias: true }),
setAxlesHelper: function () {
console.log('Axles Helper called');
this.scene.add(this.axesHelper);
},
.
.
.
renderer: function () {
console.log('Renderer called');
this.render.setSize(window.innerWidth, window.innerHeight);
this.render.render(this.scene, this.camera);
document.body.appendChild(this.render.domElement);
},
rendererUpdate: function () {
console.log('Renderer Update called');
this.render.render(this.scene, this.camera);
}
}
gameInit(true);