diff options
| Commit | 1236758d54f7582427095d18a66c53f51c328a7d (patch) | |
|---|---|---|
| Author | 2022-10-12 21:03:22 +0300 | |
| Committer | 2022-10-12 21:03:22 +0300 | |
| Files | bb75adff9f1dc279528d435a74180c10e479c256 | |
| uni-projects-1236758d54f7582427095d18a66c53f51c328a7d.tar uni-projects-1236758d54f7582427095d18a66c53f51c328a7d.tar.gz uni-projects-1236758d54f7582427095d18a66c53f51c328a7d.zip | ||
| Parent | 9a04263e46be383439084ea8a92be139ab364116 (diff) | |
[OKG] Solved practicum homework 01
2 files changed, 73 insertions, 0 deletions
| -rw-r--r-- | Year 2/Computer Graphics Fundamentals/Practicum Homework/a01.html | 72 | ||||
| l--------- | Year 2/Computer Graphics Fundamentals/Practicum Homework/three.min.js | 1 |
diff --git a/Year 2/Computer Graphics Fundamentals/Practicum Homework/a01.html b/Year 2/Computer Graphics Fundamentals/Practicum Homework/a01.html new file mode 100644 index 0000000..1b9b8b0 --- /dev/null +++ b/Year 2/Computer Graphics Fundamentals/Practicum Homework/a01.html @@ -0,0 +1,72 @@ +<html>
+ <head>
+ <style>
+ body { margin: 0; }
+ canvas { width: 100%; height: 100% }
+ </style>
+ </head>
+ <body>
+ <script src="three.min.js"></script>
+ <script>
+ // От тука до "КРАЙ" е откраднато от задача 1 на практикум 2
+ var renderer = new THREE.WebGLRenderer();
+ renderer.setSize( window.innerWidth, window.innerHeight );
+ renderer.setAnimationLoop( drawFrame );
+ document.body.appendChild( renderer.domElement );
+
+ var scene = new THREE.Scene();
+
+ var aspect = window.innerWidth/window.innerHeight;
+ var camera = new THREE.PerspectiveCamera( 30, aspect );
+ camera.position.set( 3, 3, 8 );
+ camera.lookAt( new THREE.Vector3() );
+ // КРАЙ
+
+
+
+ var material = new THREE.MeshPhongMaterial();
+ function createBox(x, y, w, h, d) {
+ var geometry = new THREE.BoxGeometry( w, h, d );
+ var box = new THREE.Mesh( geometry, material );
+ box.position.set( x, y, 0 );
+ scene.add( box );
+ }
+
+ // Всички размери са в същите съотношения както на диаграмата от условието
+
+ const obw = 0.225; // outside border width
+ // Горен и долен паралелепипед от външна част
+ createBox(0, 1.05 - obw / 2, 3.55, obw, obw);
+ createBox(0, -1.05 + obw / 2, 3.55, obw, obw);
+
+ // Странични паралелепипеди от външна част
+ createBox( 1.775 - obw / 2, 0, obw, 2.1 - 2 * obw, obw);
+ createBox(-1.775 + obw / 2, 0, obw, 2.1 - 2 * obw, obw);
+
+ const ibw = 0.125; // inner border width
+ // Тънки вътрешни паралелепипеди
+ createBox( 0.475 + ibw / 2, 0, ibw, 2.1 - 2 * obw, ibw);
+ createBox(-0.475 - ibw / 2, 0, ibw, 2.1 - 2 * obw, ibw);
+
+
+
+
+ // От тука до "КРАЙ" е откраднато от задача 1 на практикум 2
+ var light = new THREE.PointLight( );
+ light.position.set( 3, 4, 5 );
+ scene.add( light );
+
+ light = new THREE.PointLight( );
+ light.position.set( -3, 4, -5 );
+ scene.add( light );
+
+ // въртене на сцената като в микровълнова фурна
+ function drawFrame()
+ {
+ scene.rotation.y += 0.005;
+ renderer.render( scene, camera );
+ }
+ // КРАЙ
+ </script>
+ </body>
+</html>
diff --git a/Year 2/Computer Graphics Fundamentals/Practicum Homework/three.min.js b/Year 2/Computer Graphics Fundamentals/Practicum Homework/three.min.js new file mode 120000 index 0000000..becc3e1 --- /dev/null +++ b/Year 2/Computer Graphics Fundamentals/Practicum Homework/three.min.js @@ -0,0 +1 @@ +../three.min.js
\ No newline at end of file |
