Skip to content
Snippets Groups Projects
Commit 024e28ee authored by Suhyeon Han's avatar Suhyeon Han
Browse files

Added local sprites

parent abc8f425
Branches
No related tags found
No related merge requests found
......@@ -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);
......
sprites/cat.png

52.7 KiB

sprites/sun.png

40.8 KiB

......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment