Setting up a 3d asset viewer in Three.js can be quite challenging, especially for someone who is new to JavaScript like myself. After following the advice to wrap my code within an 'init();' function, I encountered a new issue - a black screen instead of the expected 3d model.
I spent a significant amount of time troubleshooting various problems, such as the absence of the 'canvas' inside the 'container' div and the issues with the 'onWindowResize' function. Despite resolving all these issues and ensuring there are no errors in the code, the problem persists.
Although I understand the importance of keeping the code concise, I'm unable to pinpoint the exact source of the problem. Hence, I've included most of the code on the page:
<div id="container" ></div>
<script>
...
...
// Code where the issue might be originating
...
...
</script>
Prior to encapsulating the code within the 'init();' function, everything was working perfectly fine. The expected outcome was to see a simple ship model floating in water, accompanied by a cloud skybox. The interactive controls were functioning, including auto-rotation.
However, the current state of the project is far from this ideal scenario. Despite successful obj loading, as indicated in the console log, the screen remains black with no visible content.
If anyone experienced with Three.js can assist me in resolving this issue, I would greatly appreciate it!