Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final Project #491

Open
wants to merge 68 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e717673
Add files via upload
SandeepSinghSardar Sep 12, 2022
f33e18a
Add files via upload
SandeepSinghSardar Sep 19, 2022
be3c7b3
Add files via upload
SandeepSinghSardar Sep 20, 2022
b97dc00
Create index.html
SandeepSinghSardar Sep 27, 2022
1832fd0
Add files via upload
SandeepSinghSardar Sep 27, 2022
8a8ce29
Delete My_CS460_Assignment_03_.pdf
SandeepSinghSardar Sep 27, 2022
1a789d1
Add files via upload
SandeepSinghSardar Sep 27, 2022
8675dca
Create index.html
SandeepSinghSardar Oct 10, 2022
33bceb0
Delete index.html
SandeepSinghSardar Oct 10, 2022
9c9a54f
Create index.html
SandeepSinghSardar Oct 10, 2022
c33cfdf
Add files via upload
SandeepSinghSardar Oct 10, 2022
c7f37a1
Delete 04 directory
SandeepSinghSardar Oct 11, 2022
8ce153a
Create index.html
SandeepSinghSardar Oct 11, 2022
e2603c8
Add files via upload
SandeepSinghSardar Oct 11, 2022
9689941
Create index.html
SandeepSinghSardar Oct 18, 2022
8100c09
Add files via upload
SandeepSinghSardar Oct 18, 2022
59b9997
Merge branch 'bostongfx:main' into main
SandeepSinghSardar Oct 27, 2022
a698e7a
Delete index.html
SandeepSinghSardar Oct 27, 2022
960ba21
Delete sky.jpg
SandeepSinghSardar Oct 27, 2022
518840d
Delete board.jpg
SandeepSinghSardar Oct 27, 2022
7ae110e
Add files via upload
SandeepSinghSardar Oct 27, 2022
d145d2a
Delete index.html
SandeepSinghSardar Oct 27, 2022
124cc90
Delete robot.js
SandeepSinghSardar Oct 27, 2022
5b5b8cd
Add files via upload
SandeepSinghSardar Oct 27, 2022
01eef69
Add files via upload
SandeepSinghSardar Oct 27, 2022
c502d44
Create index.html
SandeepSinghSardar Nov 8, 2022
0dfbe66
Delete 07 directory
SandeepSinghSardar Nov 8, 2022
8a2c26e
Merge branch 'bostongfx:main' into main
SandeepSinghSardar Nov 8, 2022
122b2e1
Add files via upload
SandeepSinghSardar Nov 8, 2022
28e9f97
Add files via upload
SandeepSinghSardar Nov 8, 2022
485de6d
Add files via upload
SandeepSinghSardar Nov 8, 2022
5a6ace8
Delete README.md
SandeepSinghSardar Nov 8, 2022
58afaa5
Delete 07 directory
SandeepSinghSardar Nov 8, 2022
9ef06c2
Create index.html
SandeepSinghSardar Nov 8, 2022
074d178
Update index.html
SandeepSinghSardar Nov 8, 2022
a36e8fe
Add files via upload
SandeepSinghSardar Nov 8, 2022
2291d17
Delete r1.png
SandeepSinghSardar Nov 8, 2022
265be01
Add files via upload
SandeepSinghSardar Nov 8, 2022
7f6a1db
Update index.html
SandeepSinghSardar Nov 8, 2022
94c8e36
Update index.html
SandeepSinghSardar Nov 8, 2022
c7705e4
Update index.html
SandeepSinghSardar Nov 8, 2022
a08d202
Update index.html
SandeepSinghSardar Nov 8, 2022
ed6199f
Update index.html
SandeepSinghSardar Nov 8, 2022
04161f0
Add files via upload
SandeepSinghSardar Nov 8, 2022
3aa7100
Create index.html
SandeepSinghSardar Nov 21, 2022
05d1a5a
Add files via upload
SandeepSinghSardar Nov 21, 2022
44d4238
Add files via upload
SandeepSinghSardar Nov 22, 2022
d2e980d
Create index.html
SandeepSinghSardar Nov 29, 2022
ed40e3a
Add files via upload
SandeepSinghSardar Nov 29, 2022
0475eb0
Add files via upload
SandeepSinghSardar Nov 29, 2022
41f7f50
Create 10
SandeepSinghSardar Dec 8, 2022
bf2ca66
Delete 10
SandeepSinghSardar Dec 8, 2022
6fa16ff
Create Index.html
SandeepSinghSardar Dec 8, 2022
c664347
Add files via upload
SandeepSinghSardar Dec 8, 2022
99d9573
Delete Index.html
SandeepSinghSardar Dec 8, 2022
4b4c8af
Add files via upload
SandeepSinghSardar Dec 8, 2022
5892fa5
Add files via upload
SandeepSinghSardar Dec 9, 2022
d2a0c62
Create index.html
SandeepSinghSardar Dec 20, 2022
3778e0f
Add files via upload
SandeepSinghSardar Dec 20, 2022
0493b26
Delete index.html
SandeepSinghSardar Dec 20, 2022
5504b3b
Add files via upload
SandeepSinghSardar Dec 20, 2022
0bc70bc
Delete script.js
SandeepSinghSardar Dec 20, 2022
c87acfe
Add files via upload
SandeepSinghSardar Dec 20, 2022
1426102
Delete index.html
SandeepSinghSardar Dec 21, 2022
7d85716
Add files via upload
SandeepSinghSardar Dec 21, 2022
cde7e85
Update script.js
SandeepSinghSardar Dec 22, 2022
b02311e
Update script.js
SandeepSinghSardar Dec 22, 2022
151b25d
Add files via upload
SandeepSinghSardar Dec 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added 02/My_CS460_Assignment_02_.pdf
Binary file not shown.
109 changes: 109 additions & 0 deletions 02/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>CS460 Assignment 2</title>
<style>
body {
background-color: black;
color: white; /* font color */
font-family: sans-serif;
margin: 0;
padding: 0;
height: 100%;
overflow: hidden !important;
}

#logo {
position: absolute;
right: 10px;
top: 10px;
}
</style>

<script type="text/javascript" src="https://get.goXTK.com/xtk_edge.js"></script>

<script type="text/javascript">

window.onload = function() {

// this gets called when the site is ready

// create a new scene and renderer
r = new X.renderer3D();
r.init();

draw_row([0,0,0],1, [1,1,0]); // start, howmany, color
draw_row([6*25,0,0],1, [1,1,0]);

draw_row([0,25,0],2, [1,1,0]);
draw_row([5*25,25,0],2, [1,1,0]);

draw_row([0,25*2,0], 7, [1,1,0]);

eyes = [];
draw_row([0,25*3,0], 1, [0,1,1]);
draw_row([25,25*3,0], 2, [1,0,0], true);
draw_row([75,25*3,0], 1, [0,1,1]);
draw_row([100,25*3,0], 2, [1,0,0], true);
draw_row([150,25*3,0], 1, [0,1,1]);

draw_row([0,25*4,0], 7, [0,1,0]);
draw_row([0,25*5,0], 7, [0,1,0]);

draw_row([25,25*6,0], 2, [0,1,0]);
draw_row([75,25*6,0], 1, [1,0,0]);
draw_row([100,25*6,0], 2, [0,1,0]);

draw_row([50,25*7,1], 3, [0,1,0]);

r.camera.position = [0,0,1000];

// render everything!
r.render();

eyesclosed = false;
setInterval(function() {
if (eyesclosed) {
// open the eyes
for (e in eyes) {
eyes[e].color = [1,0,0];
}
eyesclosed = false;
} else {
// close the eyes
for (e in eyes) {
eyes[e].color = [0,1,1];
}
eyesclosed = true;
}

},500);

};

function draw_row(start, howmany, color, keeptrack) {

var gap=2;

for (var i=0; i<howmany; i++) {

c = new X.cube();
c.color = color;
c.center = [start[0]+i*20+i*5, start[1], start[2]];
r.add(c);
if (keeptrack) {
eyes.push(c);
}

}

}

</script>
</head>
<body>
<h1>CS460 Assignment 2</h1>
<div id="logo"><img style="height:60px" src="gfx/cs460.png"></div>
</body>
</html>
Binary file added 03/My_CS460_Assignment_03_.pdf
Binary file not shown.
144 changes: 144 additions & 0 deletions 03/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<html>
<head>
<meta charset="UTF-8" />
<style>
html, body {
background-color:#000;
margin: 0;
padding: 0;
height: 100%;
overflow: hidden !important;
}
</style>
<script src="https://threejs.org/build/three.min.js" type="text/javascript"></script>
<script src="https://threejs.org/examples/js/controls/TrackballControls.js" type="text/javascript"></script>
<script>
window.onload = function() {

scene = new THREE.Scene();

fov = 75;
ratio = window.innerWidth / window.innerHeight;
zNear = 1;
zFar = 10000;
// console.log(ratio);
camera = new THREE.PerspectiveCamera(fov, ratio, zNear, zFar);
camera.position.set( 0, 0, 100);

renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );

ambientLight = new THREE.AmbientLight( 0xE5E5E5 );
scene.add( ambientLight );

light = new THREE.DirectionalLight( 0xffffff, 5.0 );
light.position.set( 10, 100, 10 );
scene.add( light );


//
// The invisible plane
//
geometry = new THREE.PlaneBufferGeometry( 10000, 10000 );
material = new THREE.MeshBasicMaterial( {
visible: false
});

invisible_plane = new THREE.Mesh( geometry, material );

scene.add( invisible_plane );
//
//
//



controls = new THREE.TrackballControls( camera, renderer.domElement );

animate();


//
// ACTION!
//

objNum = 0;

renderer.domElement.onmousemove = function(e) {

if (!e.shiftKey) {
e.preventDefault();
return false;
}

console.log('yes! you clicked!');

pixel_coords = new THREE.Vector2( e.clientX, e.clientY );

console.log('Pixel coordinates', pixel_coords);

vp_coords = new THREE.Vector2( ( pixel_coords.x / window.innerWidth ) * 2 - 1,
-( pixel_coords.y / window.innerHeight ) * 2 + 1);

console.log('Viewport coordinates', vp_coords);

vp_coords_near = new THREE.Vector3( vp_coords.x, vp_coords.y, 0);

raycaster = new THREE.Raycaster();
raycaster.setFromCamera(vp_coords_near, camera);
intersects = raycaster.intersectObject(invisible_plane);

console.log('Ray to Invisible Plane', intersects[0].point);



var r = Math.floor(Math.random() * 6);
var c;
if (r == 0){
geometry = new THREE.BoxBufferGeometry(10, 10, 10);
}
else if (r == 1) {
geometry = new THREE.TorusKnotBufferGeometry(5, 1.5, 100, 16);
}
else if (r == 2) {
geometry = new THREE.SphereBufferGeometry(8, 8, 8);
}
else if (r == 3) {
geometry = new THREE.OctahedronBufferGeometry(10);
}
else if (r == 4) {
geometry = new THREE.ConeBufferGeometry(8, 7);
}
else {
geometry = new THREE.RingBufferGeometry(5, 8, 64, 1, 0, Math.PI*2);
}

//Got it here https://stackoverflow.com/questions/5092808/how-do-i-randomly-generate-html-hex-color-codes-using-javascript
var r_color = '#'+(Math.random() * 0xFFFFFF << 0).toString(16).padStart(6, '0');
material = new THREE.MeshStandardMaterial({color: r_color});
c = new THREE.Mesh( geometry, material);
scene.add(c);
objNum++;
c.position.set(intersects[0].point.x, intersects[0].point.y, intersects[0].point.z);

};




};

function animate() {

requestAnimationFrame( animate );

controls.update();
renderer.render( scene, camera );

};

</script>
</head>
<body></body>
</html>
Binary file added 04/My_CS460_Assignment_04_ .pdf
Binary file not shown.
Loading