Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitc012b272f5532386c7b887a526798454ed899062 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-11-21 19:23:10 +0200
Committer
 Syndamia <kamen@syndamia.com>
2022-11-21 19:23:10 +0200
Files7d1193ddd62c67f91d44e6729c9e5ee25a366402
uni-projects-c012b272f5532386c7b887a526798454ed899062.tar
uni-projects-c012b272f5532386c7b887a526798454ed899062.tar.gz
uni-projects-c012b272f5532386c7b887a526798454ed899062.zip
Parentdde098328c2b313150ae78d1ccf6e753a0da48ef (diff)
[OKG/HWK2] Added bushpots to tailor shop
1 files changed, 31 insertions, 3 deletions
-rw-r--r--Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html34
diff --git a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html
index 25e81e1..553dbe3 100644
--- a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html
+++ b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html
@@ -43,8 +43,8 @@
var aspect = window.innerWidth/window.innerHeight;
var camera = new THREE.PerspectiveCamera( 30, aspect );
- camera.position.set( 0, 100, -200 );
- camera.lookAt( new THREE.Vector3(60, 50, 225) );
+ camera.position.set( -200, 80, -100 );
+ camera.lookAt( new THREE.Vector3(300, 50, 200) );
function onWindowResize(event)
{
@@ -122,7 +122,10 @@
patio.position.set(0, 1, -125 -150);
scene.add(patio);
- var tailorShop = newTailorShop();
+ var tailorShop = new THREE.Group();
+ tailorShop.add(newTailorShop());
+ tailorShop.add(newBushPot(0xb29858, 30, 7, 10, 0, 55,-90-5));
+ tailorShop.add(newBushPot(0xb29858, 30, 7, 10, 0, -55,-90-5));
tailorShop.position.set(60, 0, 225);
scene.add(tailorShop);
@@ -176,6 +179,31 @@
* Функции, генериращи обекти
*/
+ function newBushPot(color, length, height, width, orientation, x, z) {
+ const density = 6;
+ const bushColor = 0x4d3573;
+
+ var bushes = new THREE.Group();
+ var bush = new THREE.Mesh(new THREE.SphereGeometry(width / 1.5),
+ new THREE.MeshPhongMaterial({ color: bushColor, flatShading: true }));
+ bush.position.y = height + width / 2 * 0.7;
+ for (var i = -length / 2 + width / 2; i <= length / 2 - width / 2; i += length / density) {
+ bush.position.x = i;
+ bushes.add(bush.clone());
+ }
+
+ var pot = new THREE.Mesh(new THREE.BoxGeometry(length, height, width),
+ new THREE.MeshPhongMaterial({ color: color }));
+ pot.position.y = height / 2;
+
+ var bushPot = new THREE.Group();
+ bushPot.add(bushes, pot);
+ bushPot.position.set(x, 0, z);
+ bushPot.rotation.y = orientation * Math.PI / 2;
+
+ return bushPot;
+ }
+
function newTailorShop() {
const size = 180;
const bottomHeight = 25;