|
@@ -110,7 +110,7 @@ function makeScene(elem) {
|
|
|
|
|
|
function setupScene1() {
|
|
|
const sceneInfo = makeScene(document.querySelector('#box'));
|
|
|
- const geometry = new THREE.BoxBufferGeometry(1, 1, 1);
|
|
|
+ const geometry = new THREE.BoxGeometry(1, 1, 1);
|
|
|
const material = new THREE.MeshPhongMaterial({color: 'red'});
|
|
|
const mesh = new THREE.Mesh(geometry, material);
|
|
|
sceneInfo.scene.add(mesh);
|
|
@@ -123,7 +123,7 @@ function setupScene2() {
|
|
|
const radius = .8;
|
|
|
const widthSegments = 4;
|
|
|
const heightSegments = 2;
|
|
|
- const geometry = new THREE.SphereBufferGeometry(radius, widthSegments, heightSegments);
|
|
|
+ const geometry = new THREE.SphereGeometry(radius, widthSegments, heightSegments);
|
|
|
const material = new THREE.MeshPhongMaterial({
|
|
|
color: 'blue',
|
|
|
flatShading: true,
|
|
@@ -317,7 +317,7 @@ Now the setup code for each scene just adds itself to the list of scenes
|
|
|
{
|
|
|
const elem = document.querySelector('#box');
|
|
|
const {scene, camera} = makeScene();
|
|
|
- const geometry = new THREE.BoxBufferGeometry(1, 1, 1);
|
|
|
+ const geometry = new THREE.BoxGeometry(1, 1, 1);
|
|
|
const material = new THREE.MeshPhongMaterial({color: 'red'});
|
|
|
const mesh = new THREE.Mesh(geometry, material);
|
|
|
scene.add(mesh);
|
|
@@ -335,7 +335,7 @@ Now the setup code for each scene just adds itself to the list of scenes
|
|
|
const radius = .8;
|
|
|
const widthSegments = 4;
|
|
|
const heightSegments = 2;
|
|
|
- const geometry = new THREE.SphereBufferGeometry(radius, widthSegments, heightSegments);
|
|
|
+ const geometry = new THREE.SphereGeometry(radius, widthSegments, heightSegments);
|
|
|
const material = new THREE.MeshPhongMaterial({
|
|
|
color: 'blue',
|
|
|
flatShading: true,
|
|
@@ -392,7 +392,7 @@ We'll change the scene setup code to just be a map of names to *scene initializa
|
|
|
const sceneInitFunctionsByName = {
|
|
|
'box': () => {
|
|
|
const {scene, camera} = makeScene();
|
|
|
- const geometry = new THREE.BoxBufferGeometry(1, 1, 1);
|
|
|
+ const geometry = new THREE.BoxGeometry(1, 1, 1);
|
|
|
const material = new THREE.MeshPhongMaterial({color: 'red'});
|
|
|
const mesh = new THREE.Mesh(geometry, material);
|
|
|
scene.add(mesh);
|
|
@@ -408,7 +408,7 @@ const sceneInitFunctionsByName = {
|
|
|
const radius = .8;
|
|
|
const widthSegments = 4;
|
|
|
const heightSegments = 2;
|
|
|
- const geometry = new THREE.SphereBufferGeometry(radius, widthSegments, heightSegments);
|
|
|
+ const geometry = new THREE.SphereGeometry(radius, widthSegments, heightSegments);
|
|
|
const material = new THREE.MeshPhongMaterial({
|
|
|
color: 'blue',
|
|
|
flatShading: true,
|
|
@@ -492,7 +492,7 @@ const sceneInitFunctionsByName = {
|
|
|
- const {scene, camera} = makeScene();
|
|
|
+ 'box': (elem) => {
|
|
|
+ const {scene, camera, controls} = makeScene(elem);
|
|
|
- const geometry = new THREE.BoxBufferGeometry(1, 1, 1);
|
|
|
+ const geometry = new THREE.BoxGeometry(1, 1, 1);
|
|
|
const material = new THREE.MeshPhongMaterial({color: 'red'});
|
|
|
const mesh = new THREE.Mesh(geometry, material);
|
|
|
scene.add(mesh);
|
|
@@ -512,7 +512,7 @@ const sceneInitFunctionsByName = {
|
|
|
const radius = .8;
|
|
|
const widthSegments = 4;
|
|
|
const heightSegments = 2;
|
|
|
- const geometry = new THREE.SphereBufferGeometry(radius, widthSegments, heightSegments);
|
|
|
+ const geometry = new THREE.SphereGeometry(radius, widthSegments, heightSegments);
|
|
|
const material = new THREE.MeshPhongMaterial({
|
|
|
color: 'blue',
|
|
|
flatShading: true,
|