Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Computer Graphics Fundamentals / 07-Practice-21.11.2022 / futuristicPillar.js
diff options
context:
space:
mode:
Commit904a52f952a8a5604c24ea8d525bf88a55bb8cee (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-11-26 15:16:06 +0200
Committer
 Syndamia <kamen@syndamia.com>
2022-11-26 15:16:06 +0200
Files083a069e2da9cf75dfc6122d494d5649b9b89f7d /Year 2/Computer Graphics Fundamentals/07-Practice-21.11.2022/futuristicPillar.js
uni-projects-904a52f952a8a5604c24ea8d525bf88a55bb8cee.tar
uni-projects-904a52f952a8a5604c24ea8d525bf88a55bb8cee.tar.gz
uni-projects-904a52f952a8a5604c24ea8d525bf88a55bb8cee.zip
Parent884a3cc6d873053b72855107f9f5d95d7ad1706d (diff)
[OKG/P07] Solved exercises from 7th practicum
1 files changed, 38 insertions, 0 deletions
-rw-r--r--Year 2/Computer Graphics Fundamentals/07-Practice-21.11.2022/futuristicPillar.js38
diff --git a/Year 2/Computer Graphics Fundamentals/07-Practice-21.11.2022/futuristicPillar.js b/Year 2/Computer Graphics Fundamentals/07-Practice-21.11.2022/futuristicPillar.js
new file mode 100644
index 0000000..ebd132a
--- /dev/null
+++ b/Year 2/Computer Graphics Fundamentals/07-Practice-21.11.2022/futuristicPillar.js
@@ -0,0 +1,38 @@
+// Примерен обект-пилон
+
+function futuristicPillar(x,z, height, material)
+{
+ var pillar = new THREE.Group();
+
+ var obj = new THREE.Mesh(
+ new THREE.SphereGeometry( 4, 32, 32 ),
+ material
+ );
+ obj.position.set( 0, height, 0 );
+ obj.receiveShadow = true;
+ obj.castShadow = true;
+ pillar.add( obj );
+
+ var spline = new THREE.QuadraticBezierCurve(
+ new THREE.Vector3( Math.max(1+height/2,10), 0, 0 ),
+ new THREE.Vector3( -3, 0, 0 ),
+ new THREE.Vector3( 2, height-1, 0 ) );
+ var points = [];
+ for ( var i = 0; i <= 30; i ++ )
+ {
+ var p = spline.getPoint(i/30);
+ points.push( new THREE.Vector2( p.x, p.y ) );
+ }
+
+ obj = new THREE.Mesh(
+ new THREE.LatheGeometry( points, 40 ),
+ material
+ );
+
+ obj.receiveShadow = true;
+ obj.castShadow = true;
+ pillar.add( obj );
+ pillar.position.set( x, 0, z );
+
+ return pillar;
+} \ No newline at end of file