I have encountered an issue with Three.js. I successfully created a scene with a 3D model that could rotate, but when I attempted to implement Object Oriented Programming (OOP) in JavaScript for the scene, I ended up with a black screen and the scene not rendering as expected.
Below is the code snippet causing the problem:
function deg2radians(degs)
{
return Math.PI * degs / 180.0;
}
var OBJLoaded = function()
{
this.createRender();
this.createScenes();
this.createCamera();
this.createLights();
this.loadModel();
this.render();
};
// Code continues here...
If anyone can provide insight into why this OOP implementation is not functioning correctly, it would be greatly appreciated. Thank you!
EDIT : Here is my working code without "OOP":
var scene, camera, renderer, controls;
var object;
var OBJLoaded;
init();
animate();
// More code follows...