diff --git a/script.js b/script.js index 09cfba2b81cc0ff367bf74b04a27a56048532220..47804c6aed44783ff61ee9d56d88626122f3e537 100644 --- a/script.js +++ b/script.js @@ -298,7 +298,7 @@ function run() { scene.add(sunObject); for (let i = 0; i < constants.treeCount; ++i) { - loader.load('models/obj/tree.obj', function (tree) { + loader.load('models/tree.obj', function (tree) { tree.material = whiteMaterial; tree.position.set( (i * constants.treeOffset) - (constants.treeOffset * (constants.treeCount / 2) - (constants.treeOffset / 2)), @@ -375,7 +375,7 @@ function run() { break; } }); - generalFolder.add(controls, 'sunObject', ['sphere', 'lisaSu', 'cat', 'none']).listen().onChange(function (value) { + generalFolder.add(controls, 'sunObject', ['sphere', 'sun_draw', 'cat_draw', 'none']).listen().onChange(function (value) { const textureLoader = new THREE.TextureLoader(); let planeGeometry; let planeMaterial; @@ -396,11 +396,12 @@ function run() { scene.add(sunObject); break; - case 'lisaSu': - planeTexture = textureLoader.load('https://miro.medium.com/proxy/0*pKN_ICbi7lzXWgcN.png'); - planeGeometry = new THREE.PlaneGeometry(175, 100); + case 'sun_draw': + planeTexture = textureLoader.load('sprites/sun.png'); + planeGeometry = new THREE.PlaneGeometry(90, 90); planeMaterial = new THREE.MeshBasicMaterial({ - map: planeTexture + map: planeTexture, + alphaTest: 0.05 }); sunObject = new THREE.Mesh(planeGeometry, planeMaterial); @@ -410,11 +411,12 @@ function run() { controls.sunPositionZ); scene.add(sunObject); break; - case 'cat': - planeTexture = textureLoader.load('https://upload.wikimedia.org/wikipedia/commons/thumb/b/bb/Kittyply_edit1.jpg/220px-Kittyply_edit1.jpg'); - planeGeometry = new THREE.PlaneGeometry(173, 115); + case 'cat_draw': + planeTexture = textureLoader.load('sprites/cat.png'); + planeGeometry = new THREE.PlaneGeometry(90, 90); planeMaterial = new THREE.MeshBasicMaterial({ - map: planeTexture + map: planeTexture, + alphaTest: 0.05 }); sunObject = new THREE.Mesh(planeGeometry, planeMaterial); diff --git a/sprites/cat.png b/sprites/cat.png new file mode 100644 index 0000000000000000000000000000000000000000..9a53ca2ca174d083bec27cb7be1c47fd3db2059b Binary files /dev/null and b/sprites/cat.png differ diff --git a/sprites/sun.png b/sprites/sun.png new file mode 100644 index 0000000000000000000000000000000000000000..f8eb031b5f45a135b877a237a9e11bb993032594 Binary files /dev/null and b/sprites/sun.png differ diff --git a/tutorial_data/scripts/script_7.js b/tutorial_data/scripts/script_7.js index 8eabe47213a9ca1147db09dad018f13c7050842c..87a7957b6e8b3cfae4ffdafbabcd2ea761a8f46a 100644 --- a/tutorial_data/scripts/script_7.js +++ b/tutorial_data/scripts/script_7.js @@ -375,7 +375,7 @@ function run() { break; } }); - generalFolder.add(controls, 'sunObject', ['sphere', 'lisaSu', 'cat', 'none']).listen().onChange(function (value) { + generalFolder.add(controls, 'sunObject', ['sphere', 'sun_draw', 'cat_draw', 'none']).listen().onChange(function (value) { const textureLoader = new THREE.TextureLoader(); let planeGeometry; let planeMaterial; @@ -396,11 +396,12 @@ function run() { scene.add(sunObject); break; - case 'lisaSu': - planeTexture = textureLoader.load('https://miro.medium.com/proxy/0*pKN_ICbi7lzXWgcN.png'); - planeGeometry = new THREE.PlaneGeometry(175, 100); + case 'sun_draw': + planeTexture = textureLoader.load('sprites/sun.png'); + planeGeometry = new THREE.PlaneGeometry(90, 90); planeMaterial = new THREE.MeshBasicMaterial({ - map: planeTexture + map: planeTexture, + alphaTest: 0.05 }); sunObject = new THREE.Mesh(planeGeometry, planeMaterial); @@ -410,11 +411,12 @@ function run() { controls.sunPositionZ); scene.add(sunObject); break; - case 'cat': - planeTexture = textureLoader.load('https://upload.wikimedia.org/wikipedia/commons/thumb/b/bb/Kittyply_edit1.jpg/220px-Kittyply_edit1.jpg'); - planeGeometry = new THREE.PlaneGeometry(173, 115); + case 'cat_draw': + planeTexture = textureLoader.load('sprites/cat.png'); + planeGeometry = new THREE.PlaneGeometry(90, 90); planeMaterial = new THREE.MeshBasicMaterial({ - map: planeTexture + map: planeTexture, + alphaTest: 0.05 }); sunObject = new THREE.Mesh(planeGeometry, planeMaterial);