GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — old/Viewport.js at master · vfasteng/old

Expand file tree

/

Viewport.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
43 lines (30 loc) · 941 Bytes
/

Viewport.js

Copy path

File metadata and controls

43 lines (30 loc) · 941 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import * as THREE from 'three'
export default class Viewport {
constructor (canvas, scene) {
this.width = null
this.height = null
this.aspectRatio = null
this.canvas = canvas
this.renderer = new THREE.WebGLRenderer({ canvas })
this.renderer.setPixelRatio(window.devicePixelRatio);
this.scene = scene
this.camera = new THREE.PerspectiveCamera(50, 1, 1, 2000);
this.camera.position.set(4, 8, 10);
this.resize()
}
resize () {
this.canvas.style.width = ''
this.canvas.style.height = ''
this.width = this.canvas.offsetWidth
this.height = this.canvas.offsetHeight
this.renderer.setSize(this.width, this.height)
this.aspectRatio = this.width / this.height
this.camera.aspect = this.aspectRatio
this.camera.updateProjectionMatrix()
this.render()
}
render () {
this.renderer.render(this.scene, this.camera)
return this.renderer.info;
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.