Skip to content

Commit

Permalink
Remove dependency on ANGLE_instanced_arrays extension
Browse files Browse the repository at this point in the history
  • Loading branch information
erksch committed Oct 25, 2021
1 parent cf5e769 commit be1a6cb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/setupRenderer.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import * as THREE from 'three';
const OrbitControls = require('three-orbitcontrols');
import * as THREE from "three";
const OrbitControls = require("three-orbitcontrols");

function setupRenderer() {
const canvas = document.querySelector<HTMLCanvasElement>("#canvas");
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, canvas.clientWidth / canvas.clientHeight, 0.1, 1000);
const camera = new THREE.PerspectiveCamera(
75,
canvas.clientWidth / canvas.clientHeight,
0.1,
1000
);
camera.position.set(0, 1, -3);
camera.lookAt(new THREE.Vector3());
const renderer = new THREE.WebGLRenderer({ alpha: true, canvas });
renderer.setSize(canvas.clientWidth, canvas.clientHeight);

if (renderer.extensions.get('ANGLE_instanced_arrays') === null) {
return;
}

camera.position.z = 5;

const controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.25;
controls.enableZoom = true;


const clearScene = () => {
while (scene.children.length) {
scene.remove(scene.children[0]);
Expand All @@ -31,4 +31,4 @@ function setupRenderer() {
return { renderer, scene, camera, clearScene };
}

export default setupRenderer;
export default setupRenderer;

0 comments on commit be1a6cb

Please sign in to comment.