From 3b9c0e6c505af3bad47b9152f5e8852987667a4d Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 18 Nov 2022 22:53:41 +0200 Subject: [OKG/HWK2] Added some outside walls --- .../Homework 2/mannequin.html | 48 ++++++++++++++++------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html index 3af4905..1a4becd 100644 --- a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html +++ b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html @@ -42,7 +42,7 @@ var aspect = window.innerWidth/window.innerHeight; var camera = new THREE.PerspectiveCamera( 30, aspect ); - camera.position.set( 0, 100, 100 ); + camera.position.set( 0, 1500, 00 ); camera.lookAt( new THREE.Vector3(0, 40, 0) ); function onWindowResize(event) @@ -90,7 +90,7 @@ return new THREE.Color(value); } - var cube = new THREE.Mesh(new THREE.BoxGeometry(1.0, 1.0, 1.0), new THREE.MeshPhongMaterial({color: 'red'})); + var cube = new THREE.Mesh(new THREE.BoxGeometry(1.0, 125, 1.0), new THREE.MeshPhongMaterial({color: 'red'})); cube.position.y = 0.5; scene.add(cube); @@ -254,21 +254,45 @@ return koichi; } - // scene.add(newJotaro()); + function newOutsideWall(width, color, rotation, x, z) { + const wallHeight = 200; + const wallWidth = 10; + + var wall = new THREE.Mesh(new THREE.BoxGeometry(width, wallHeight, wallWidth), + new THREE.MeshPhongMaterial({ color: color })); + wall.rotation.y = rotation * Math.PI / 2; + wall.position.set(x, wallHeight / 2 ,z); + return wall; + } + + var jotaro = newJotaro(); + jotaro.rotation.x = Math.PI / 2; + scene.add(jotaro); // scene.add(newKira()); - scene.add(newKoichi()); + // scene.add(newKoichi()); + + var patio = new THREE.Mesh(new THREE.BoxGeometry(300, 0.3, 300), + new THREE.MeshPhongMaterial({ color: 0x978661 })); + patio.position.y = 0.3; + patio.position.z = -125 -150; + scene.add(patio); + + var greenWall = new THREE.Group(); + greenWall.add(newOutsideWall(300, 0xa8bda7, -1, -220, -275)); + scene.add(greenWall); + + var brownWall = new THREE.Group(); + brownWall.add(newOutsideWall(300, 0xa38d6d, 1, 380, -275)) + scene.add(brownWall); + + var blueWall = new THREE.Group(); + blueWall.add(newOutsideWall(300, 0x718d9e, 1, 380, 275)); + scene.add(blueWall); - // тук си направете човечетата и статичните елементи по позите - // ... - // ... function animate(t) { - scene.rotation.y += 0.02; - // в тази функция направете движението на - // човечетата (параметърът t е времето) - // ... - // ... + scene.rotation.y += 0.001; } -- cgit v1.3.1-26-gb76a