Browse Source

Adjust lighting and camera for decent initial rendering of polyhedra

Note that the version of three.js also incidentally bumped, since it's set
  to take the latest
master
Glen Whitney 2 years ago
parent
commit
fce8be5b56
  1. 6
      package-lock.json
  2. 13
      src/dyna3.litcoffee

6
package-lock.json

@ -3535,9 +3535,9 @@
}
},
"three": {
"version": "0.111.0",
"resolved": "https://registry.npmjs.org/three/-/three-0.111.0.tgz",
"integrity": "sha512-AcTqyGJ3H75AIusOuADy0LsP958QKQwm/YhABHFMzd6RFXPNVay1rlSbbG6WYv7KM72G2THMMwqbjQd4dVHMkQ=="
"version": "0.112.1",
"resolved": "https://registry.npmjs.org/three/-/three-0.112.1.tgz",
"integrity": "sha512-8I0O74hiYtKl3LgDNcPJbBGOlpekbcJ6fJnImmW3mFdeUFJ2H9Y3/UuUSW2sBdjrIlCM0gvOkaTEFlofO900TQ=="
},
"time-zone": {
"version": "1.0.0",

13
src/dyna3.litcoffee

@ -37,18 +37,23 @@ When you load dyna3, you should initially see a three-dimensional coordinate sys
rwd = window.innerWidth
rht = window.innerHeight
renderer.setSize rwd, rht
renderer.setClearColor 0xeeeeee, 1.0
renderer.setClearColor 0xdddddd, 1.0
document.body.appendChild renderer.domElement
scene = new J3.Scene()
geometry = new J3.SphereBufferGeometry 1,5,5
material = new J3.MeshBasicMaterial {color: 0xff00ff}
geometry = new J3.IcosahedronBufferGeometry 1
material = new J3.MeshPhongMaterial {color: 0xff00ff}
ball = new J3.Mesh geometry, material
scene.add ball
scene.add axes 10
ambient = new J3.HemisphereLight 0xffffff, 0xaaaaaa, 1
ambient.position.set 0.1, 0.1, 1
scene.add ambient
camera = new J3.PerspectiveCamera 75, rwd/rht, 0.1, 1000
camera.position.z = 5
camera.up.set 0, 0, 1
camera.position.set 4, -1, 3
controls = new J3x.TrackballControls camera, renderer.domElement

Loading…
Cancel
Save