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

CS460 Final Project Submisson: Basic Liquid in Vanilla WebGL #240

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d7be2ae
Assignment 1 Submission -YH
YahiyaHussain Sep 8, 2019
84092cb
Merge branch 'master' of https://github.com/bostongfx/cs460student
YahiyaHussain Sep 9, 2019
e96c901
put Assignment 1 in the correct folder
YahiyaHussain Sep 9, 2019
d79a713
Milestone 1
YahiyaHussain Sep 9, 2019
558028d
Milestone 2
YahiyaHussain Sep 9, 2019
269cd1f
Merge branch 'master' of https://github.com/bostongfx/cs460student
YahiyaHussain Sep 11, 2019
dc9ea9d
add index.html
YahiyaHussain Sep 11, 2019
e4fbe00
pasted code into index.html
YahiyaHussain Sep 11, 2019
607fa86
first draft of A2
YahiyaHussain Sep 16, 2019
fd24fe2
Update index.html
YahiyaHussain Sep 16, 2019
62e566b
Merge branch 'master' of https://github.com/bostongfx/cs460student
YahiyaHussain Sep 16, 2019
c8fdb2e
initialize index page in 03 folder
YahiyaHussain Sep 16, 2019
b2c6441
A3
YahiyaHussain Sep 22, 2019
927f80d
Merge branch 'master' of https://github.com/bostongfx/cs460student
YahiyaHussain Sep 23, 2019
b574480
Merge branch 'master' of https://github.com/bostongfx/cs460student
YahiyaHussain Oct 2, 2019
5127ca6
Assignment 4
YahiyaHussain Oct 2, 2019
bfbeebb
A5 test
YahiyaHussain Oct 10, 2019
5cc5070
A5 Submission
YahiyaHussain Oct 10, 2019
8299865
Merge branch 'master' of https://github.com/bostongfx/cs460student
YahiyaHussain Oct 11, 2019
c58fd3d
update pdf
YahiyaHussain Oct 11, 2019
bf221a6
Merge branch 'master' of https://github.com/bostongfx/cs460student
YahiyaHussain Oct 18, 2019
215245c
Assignment 6
YahiyaHussain Oct 27, 2019
1aa21d2
update1
YahiyaHussain Oct 27, 2019
c3b465e
pdf
YahiyaHussain Oct 29, 2019
c18e234
move
YahiyaHussain Oct 29, 2019
5ea87e6
Merge branch 'master' of https://github.com/bostongfx/cs460student
YahiyaHussain Nov 4, 2019
a50fc10
assignment 7 submission
YahiyaHussain Nov 12, 2019
0647fdc
assignment 7 submission
YahiyaHussain Nov 12, 2019
f40c6e2
assignment 7 submission
YahiyaHussain Nov 12, 2019
ca9a4f2
basic Assignment
YahiyaHussain Nov 16, 2019
3949481
pdf
YahiyaHussain Nov 16, 2019
c4044e2
Merge branch 'master' of https://github.com/bostongfx/cs460student
YahiyaHussain Nov 28, 2019
d35e4ce
assignment 9 basic
YahiyaHussain Nov 28, 2019
e79f27b
pdf
YahiyaHussain Nov 28, 2019
6383240
bare min assignment
YahiyaHussain Dec 2, 2019
c5d5cb1
r
YahiyaHussain Dec 2, 2019
6db513a
FinalProject
YahiyaHussain Dec 21, 2019
59992a4
Create README
YahiyaHussain Dec 21, 2019
8b6feee
Update TexturedQuad_blur_time_better.js
YahiyaHussain Dec 21, 2019
0ab418d
Update TexturedQuad_blur_time_better.js
YahiyaHussain Dec 21, 2019
cebace0
Update README
YahiyaHussain Dec 21, 2019
4e7f017
Delete CS460 Report.pdf
YahiyaHussain Dec 21, 2019
ac7e165
Add files via upload
YahiyaHussain Dec 21, 2019
16ad029
Delete CS460 Report, Final Project, Yahiya Hussain.pdf
YahiyaHussain Dec 21, 2019
f4e99d2
Add files via upload
YahiyaHussain Dec 21, 2019
c86ca17
Update README
YahiyaHussain Dec 21, 2019
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 01/CS460_Assignment_01_YahiyaHussain.pdf
Binary file not shown.
Binary file added 02/CS460_Assignment_02__Copy_.pdf
Binary file not shown.
131 changes: 131 additions & 0 deletions 02/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<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() {

toCube = new Array(8);

for (var i = 0; i < 8; i++){
toCube[i] = new Array(7);
for (var j = 0; j < 7; j++){
toCube[i][j] = true;
}
}

// ears
for (var j = 1; j < 6; j++){
toCube[0][j] = false;
}
for (var j = 2; j < 5; j++){
toCube[1][j] = false;
}

// cheeks
toCube[6][0] = false;
toCube[6][6] = false;

// chin
for(var j = 0; j < 7; j++){
toCube[7][j] = false;
}
for(var j = 2; j < 5; j++){
toCube[7][j] = true;
}

// this gets called when the site is ready

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

// add all relevant cubes
for (var i = 0; i < toCube.length; i++){
for (var j = 0; j < toCube[0].length; j++){
if (toCube[i][j] == true){
toCube[i][j] = new X.cube();
toCube[i][j].center = [25 * (j - 3.5), -25 * (i - 4), 0];
toCube[i][j].color = [1, 1, 1];

r.add(toCube[i][j]);
}
}
}

// color eyes
//his righty
toCube[3][1].color = [0, 1, 1];
toCube[3][2].color = [0, 1, 1];
//his lefty
toCube[3][4].color = [0, 1, 1];
toCube[3][5].color = [0, 1, 1];

// color nose
toCube[6][3].color = [1, 0, 0];


// set camera further away!
r.camera.position = [0, 0, 1000];

// render everything!
r.render();
on = true;
};

window.setInterval(function() {
on = !on;

if (on){
var c = [0, 1, 1];
// color eyes
//his righty
toCube[3][1].color = c;
toCube[3][2].color = c;
//his lefty
toCube[3][4].color = c;
toCube[3][5].color = c;
}
else{
var c = [0, 0, 1];
// color eyes
//his righty
toCube[3][1].color = c;
toCube[3][2].color = c;
//his lefty
toCube[3][4].color = c;
toCube[3][5].color = c;
}

}, 1000);


</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/CS460_Assignment_03__Copy_.pdf
Binary file not shown.
195 changes: 195 additions & 0 deletions 03/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<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() {

var r2 = document.getElementById('body');

scene = new THREE.Scene();

fov = 75;
var ratio = r2.innerWidth / r2.clientHeight;
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({antialias:true});
renderer.setSize( r2.clientWidth, r2.clientHeight );
r2.appendChild( renderer.domElement );

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

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

nObjects = 0;
triangleEstimate = 0;
// now we add the cube
// geometry = new THREE.BoxBufferGeometry( 20, 20, 20);
// material = new THREE.MeshStandardMaterial({ color: 0xffffff });
// cube = new THREE.Mesh( geometry, material);
// scene.add(cube);


//
// 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 );

animate();


//
// ACTION!
//

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);

randomNumber = Math.floor(Math.random()*6);
//console.log("yay random number:", randomNumber);

bigNumber = 60 + 40*Math.random();
mediumNumber = 30 + 20*Math.random();
smallNumber = 5 + 15*Math.random();
tinyNumber = 10*Math.random();

// cool shapes
switch(+randomNumber){
case 0:
geometry = new THREE.BoxBufferGeometry( smallNumber, smallNumber, smallNumber );
triangleEstimate += 12;
break;
case 1:
geometry = new THREE.TorusKnotBufferGeometry( smallNumber, tinyNumber, Math.floor(bigNumber), Math.floor(mediumNumber) );
triangleEstimate += 2 * Math.floor(bigNumber)*Math.floor(mediumNumber);
break;
case 2:
geometry = new THREE.SphereBufferGeometry( smallNumber, bigNumber, bigNumber );
triangleEstimate += 2 * Math.floor(bigNumber)^2
break;
case 3:
geometry = new THREE.OctahedronBufferGeometry( Math.floor(smallNumber) );
triangleEstimate += 16 * Math.floor(smallNumber);
break;
case 4:
geometry = new THREE.ConeBufferGeometry( smallNumber, tinyNumber );
triangleEstimate += 16;
break;
default:
geometry = new THREE.RingBufferGeometry( tinyNumber, smallNumber, Math.floor(bigNumber) );
triangleEstimate += 2*Math.floor(bigNumber);
break;

}

// cool colors
randomNumber = Math.floor(Math.random()*5);

switch(+randomNumber){
case 0:
c = 0xFFE1EE;
break;
case 1:
c = 0xC2ABED;
break;
case 2:
c = 0x90BEDE;
break;
case 3:
c = 0x68EDC6;
break;
default:
c = 0x90F3FF;
break;
}


material = new THREE.MeshStandardMaterial({ color: c });
shape = new THREE.Mesh( geometry, material);
shape.position.set(intersects[0].point.x, intersects[0].point.y, intersects[0].point.z);
scene.add(shape);
console.log("Number Of Objects:", ++nObjects, triangleEstimate);

// console.log(geometry);


// update cube position
// cube.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/CS460_Assignment_04__Copy_.pdf
Binary file not shown.
Loading