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
This commit is contained in:
Glen Whitney 2019-12-31 07:20:33 -08:00
parent 9c2038e3c9
commit fce8be5b56
2 changed files with 12 additions and 7 deletions

6
package-lock.json generated
View File

@ -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",

View File

@ -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