Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitb9a7524716a2e9d4ab1d92fe7fb954265d3ce3a4 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-10-24 13:57:57 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-10-24 13:57:57 +0300
Files95169de0a6bb9f6beed846d80961284d58be9745
uni-projects-b9a7524716a2e9d4ab1d92fe7fb954265d3ce3a4.tar
uni-projects-b9a7524716a2e9d4ab1d92fe7fb954265d3ce3a4.tar.gz
uni-projects-b9a7524716a2e9d4ab1d92fe7fb954265d3ce3a4.zip
Parent0908d4afea7f45bfe3f78d47eeefc074b1c8b864 (diff)
[OKG/HW03] Added ring and two gem geometries
1 files changed, 74 insertions, 0 deletions
-rw-r--r--Year 2/Computer Graphics Fundamentals/Practicum Homework/a03.html74
diff --git a/Year 2/Computer Graphics Fundamentals/Practicum Homework/a03.html b/Year 2/Computer Graphics Fundamentals/Practicum Homework/a03.html
new file mode 100644
index 0000000..8b26132
--- /dev/null
+++ b/Year 2/Computer Graphics Fundamentals/Practicum Homework/a03.html
@@ -0,0 +1,74 @@
+<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( 1, 8, 3 );
+ camera.lookAt( new THREE.Vector3() );
+ // КРАЙ
+
+
+
+ var ring = new THREE.Group();
+ var loopMaterial = new THREE.MeshPhongMaterial();
+ var ornamentMaterial = new THREE.MeshPhongMaterial({ color: 'orange' })
+
+ // Loop
+ var ringRadius = 1.2;
+ var ringWidth = 0.15;
+ ring.add(new THREE.Mesh(new THREE.TorusGeometry(ringRadius, ringWidth, 16, 100), loopMaterial));
+
+ // Big gem
+ var big = new THREE.Mesh(new THREE.SphereGeometry(0.3, 32, 16), ornamentMaterial);
+ big.position.set(-0.2, ringRadius + ringWidth, 0);
+ ring.add(big);
+
+ // Small gems
+ var small1 = new THREE.Mesh(new THREE.SphereGeometry(0.1, 32, 16), ornamentMaterial);
+ small1.position.set(0.19, ringRadius + ringWidth, 0);
+ ring.add(small1);
+
+ var small2 = new THREE.Mesh(new THREE.SphereGeometry(0.1, 32, 16), ornamentMaterial);
+ small1.position.set(0.19, ringRadius + ringWidth, 0);
+ ring.add(small1);
+
+ var small2 = new THREE.Mesh(new THREE.SphereGeometry(0.1, 32, 16), ornamentMaterial);
+ small1.position.set(0.19, ringRadius + ringWidth, 0);
+ ring.add(small1);
+
+ scene.add(ring);
+
+ // От тука до "КРАЙ" е откраднато от задача 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>