diff options
| Commit | 35c022d440b0490fb6284fe19456ac16a695557a (patch) | |
|---|---|---|
| Author | 2022-11-15 12:06:58 +0200 | |
| Committer | 2022-11-15 12:06:58 +0200 | |
| Files | 026675195bc5be1722fec2c204b2dab6b132656a | |
| uni-projects-35c022d440b0490fb6284fe19456ac16a695557a.tar uni-projects-35c022d440b0490fb6284fe19456ac16a695557a.tar.gz uni-projects-35c022d440b0490fb6284fe19456ac16a695557a.zip | ||
| Parent | 1351a0c5a3880d1f6f015151d4deec017240787c (diff) | |
[OKG/HWK1] Minor tweeks, added a wall
1 files changed, 14 insertions, 32 deletions
| -rw-r--r-- | Year 2/Computer Graphics Fundamentals/Homework 1/moidom-6.html | 46 |
diff --git a/Year 2/Computer Graphics Fundamentals/Homework 1/moidom-6.html b/Year 2/Computer Graphics Fundamentals/Homework 1/moidom-6.html index 33ff729..e28ec2e 100644 --- a/Year 2/Computer Graphics Fundamentals/Homework 1/moidom-6.html +++ b/Year 2/Computer Graphics Fundamentals/Homework 1/moidom-6.html @@ -22,12 +22,12 @@ // мини телескоп и въртящ се стол
/*
- * Помощни
+ * Помощни функции
*/
var groups = [];
function hNewGroup(meshes, position) {
var group = new THREE.Group();
- meshes.forEach((mesh) => { group.add(mesh); enableShadows(mesh); });
+ meshes.forEach((mesh) => { enableShadows(mesh); group.add(mesh); });
group.position.set(...position);
groups.push(group);
return group;
@@ -39,12 +39,14 @@ mesh.children.forEach((child) => enableShadows(child));
}
+
+
/*
* Дупки
*/
function holePrimitive(size, position) {
var hole = new THREE.Mesh(new THREE.BoxGeometry(...size));
- position[1] -= (3.10 - size[1]) / 2; // на 3.10 трябва височината на стената, ама карай
+ position[1] -= (3.10 - size[1]) / 2;
hole.position.set(...position);
return hole;
}
@@ -65,6 +67,8 @@ return holePrimitive([1.40, 1.44, 1], [x, y+1.10, z]);
}
+
+
/*
* Обекти
*/
@@ -80,7 +84,7 @@ var wallCSG = new CSG();
wallCSG.subtract([wall]);
holes.forEach((hole) => wallCSG.subtract([hole]));
- var wall = wallCSG.toMesh();
+ wall = wallCSG.toMesh();
}
wall.rotation.y = rotation * Math.PI / 2;
@@ -261,10 +265,11 @@ swivelChair.rotation.y = rotation * Math.PI / 2;
if (position !== undefined)
swivelChair.position.set(...position);
- console.log(swivelChair);
return swivelChair;
}
+
+
/*
* Сцена
*/
@@ -287,7 +292,7 @@ ], [-6, 0, 1.5]);
var wall4 = hNewGroup([
- wall(8, 2, [doubleDoorHole(-0.5,0,0), doorHole(1,0,0)]),
+ wall(8, 2, [doubleDoorHole(-0.5,0,0)]),
], [-2, 0, -4]);
var wall5 = hNewGroup([
@@ -317,8 +322,8 @@ ], [2, 0, 1]);
var wall11 = hNewGroup([
- wall(5, -1, [doorHole([1,0,0])]),
- ], [5, 0, -0.5]);
+ wall(5, 1, [doorHole(-1,0,0)]),
+ ], [-3, 0, -1.5]);
/* Стаи */
@@ -328,33 +333,10 @@ -
-
-
-
-
-
-
-
-
-
-
-
/*
- * Помощен код
+ * Добавяне на групи в сцената
*/
groups.forEach((group) => scene.add(group));
-
- var geometry = new THREE.BoxGeometry( 2, 2, 2 ),
- material = new THREE.MeshPhongMaterial( {color:'crimson', shininess: 100} );
-
- var cube = new THREE.Mesh( geometry, material );
- cube.position.set( 0, 1, 0 );
- cube.receiveShadow = true;
- cube.castShadow = true;
-
- // scene.add( cube );
-
</script>
</body>
|
