My code is:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demoThreeJs</title>
<style>
body { margin: 0; }
canvas { display: block; }
</style>
</head>
<body>
<script type="module">
import * as THREE from './js/three.module.js';
import { OrbitControls } from './js/OrbitControls.js';
import { OBJLoader2 } from './loader/OBJLoader2.js';
const renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
window.addEventListener( 'resize', function() {
const width = window.innerWidth;
const heigth = window.innerHeight;
renderer.setSize( width, heigth );
camera.aspect = width / heigth;
camera.updateProjectionMatrix();
});
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 ); //( fov, aspect, near, far )
controls = new THREE.OrbitControls( camera, renderer.domElement );
camera.position.z = 3;
const objloader = new OBJLoader2();
objloader.load( 'models/obj/cerberus/Cerberus.obj', ( root ) => {
scene.add(root);
});
var animate = function () {
requestAnimationFrame( animate );
renderer.render( scene, camera );
};
animate();
</script>
</body>
</html>
What am i missing?