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 Ryan Dang #237

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9907581
Add files via upload
ryanhdang Sep 9, 2019
db7738b
Merge branch 'master' of https://github.com/bostongfx/cs460student
ryanhdang Sep 11, 2019
95af92c
Create index.html
ryanhdang Sep 11, 2019
73fdc90
Update index.html
ryanhdang Sep 11, 2019
8eee1ee
Test
ryanhdang Sep 11, 2019
270d7a6
Deleted Test.txt
ryanhdang Sep 11, 2019
685e51d
Changes to assignment 2
ryanhdang Sep 13, 2019
81706b6
Main assignment 2 complete
ryanhdang Sep 14, 2019
3bd0091
Finished bonus Assignment 2
ryanhdang Sep 16, 2019
f7bd022
Merge branch 'master' of https://github.com/bostongfx/cs460student
ryanhdang Sep 16, 2019
1094b28
Lecture 03 code
ryanhdang Sep 16, 2019
72d84a7
Modified index.html Assignment 3
ryanhdang Sep 18, 2019
1fe3195
Assignment 3 base
ryanhdang Sep 22, 2019
4c65570
Assignment 3 Completed
ryanhdang Sep 23, 2019
dfc1669
Added Assignment 3 PDF
ryanhdang Sep 23, 2019
881a44a
Merge branch 'master' of https://github.com/bostongfx/cs460student
ryanhdang Sep 23, 2019
0587339
Assignment 4
ryanhdang Oct 2, 2019
0a7e39e
Airplane
ryanhdang Oct 2, 2019
04db612
Assignment 4 Complte
ryanhdang Oct 2, 2019
3bc592e
Merge branch 'master' of https://github.com/bostongfx/cs460student
ryanhdang Oct 2, 2019
311813c
Assignment 05
ryanhdang Oct 11, 2019
551610b
Assignment 5 Completed
ryanhdang Oct 11, 2019
88ac6c4
Assignment 5 Bonus Complete
ryanhdang Oct 11, 2019
51d02d8
Merge branch 'master' of https://github.com/bostongfx/cs460student
ryanhdang Oct 11, 2019
320859b
Merge branch 'master' of https://github.com/bostongfx/cs460student
ryanhdang Oct 21, 2019
d46926a
Assignment 06
ryanhdang Oct 28, 2019
3791b51
Most of Assignment 6 Complete
ryanhdang Oct 28, 2019
a4ed3c4
06 Complete
ryanhdang Oct 28, 2019
74f4c88
Update PDF
ryanhdang Oct 28, 2019
220c177
Merge branch 'master' of https://github.com/bostongfx/cs460student
ryanhdang Nov 4, 2019
ca5173e
Assignment 7
ryanhdang Nov 12, 2019
9de6398
Assignment 8 progress
ryanhdang Nov 15, 2019
b3206f8
Assignment 8 complete
ryanhdang Nov 15, 2019
e55c453
Assignment 9
ryanhdang Nov 28, 2019
b7d4bbe
Merge branch 'master' of github.com:ryanhdang/cs460student
ryanhdang Nov 28, 2019
7104df4
Assignment 10
ryanhdang Dec 2, 2019
b4ec5bd
Final Progress
ryanhdang Dec 13, 2019
4fa3e9a
Final Progress
ryanhdang Dec 13, 2019
0b47de1
Final Progress
ryanhdang Dec 13, 2019
fab702a
Final Updated
ryanhdang Dec 20, 2019
43511a2
Final
ryanhdang Dec 20, 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.pdf
Binary file not shown.
Binary file added 02/CS460_Assignment_02__Copy_.pdf
Binary file not shown.
142 changes: 142 additions & 0 deletions 02/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<html>
<head>
<meta content = "text/html;charset=utf-8" http-equiv="Content-Type">
<meta content = "utf-8" http-equiv="enconding">
<title>CS460 Assignment 2</title>
<style>
body{
background-color: black;
color: white;
font-family: sans-serif;
padding: 0;
height: 100%;
overflow: hidden;
}

#logo{
position: absolute;
right: 10px;
top: 10px;
}
</style>
<script type="text/javascript" src="http://get.goXTK.com/xtk_edge.js"></script>
<script type = "text/javascript">

window.onload = function(){
r = new X.renderer3D(); //Creates new XTK renderer
r.init(); //Initialize
r.camera.position = [0, 0, 500];
//2D array of pixels for image
//Colors
var col1 = [0.76, 0.8, 0.88];
var col2 = [1, 1, 0.3];
var col3 = [0, 0.14, 0.42];

var pixels = [
[0, 2, 0, 0, 0, 0, 0, 2, 0],
[0, 2, 2, 0, 0, 0, 2, 2, 0],
[0, 1, 1, 0, 0, 0, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 2, 2, 1, 2, 2, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 1, 1, 3, 1, 1, 0, 0],
[0, 0, 0, 1, 1, 1, 0, 0, 0],
]

var eyePosX = new Array();
var eyePosY = new Array();
//Center pixel
var centerPixelX = parseInt(pixels.length / 2);
var centerPixelY = parseInt(pixels[0].length / 2);

//Cube parameters
var cubeLength = 20;
var cubeGap = 2.5;


for(var y = 0; y < pixels.length; y++){
for(var x = 0; x < pixels[y].length; x++){
if(pixels[y][x] != 0){

//Determines the cube color
var color;
switch(pixels[y][x]){
//Base Color
case 1:
color = col1;
break;
//Eye and Glowy bits
case 2:
eyePosX.push(x);
eyePosY.push(y);
color = col2;
break;
//Nose
case 3:
color = col3;
break;
default:
color = col1;
break;

}



//Creates cube and sets it's properties
pixels[y][x] = new X.cube();
pixels[y][x].lengthX = cubeLength;
pixels[y][x].lengthY = cubeLength;
pixels[y][x].lengthZ = cubeLength;
pixels[y][x].color = color;



//Position based on index from center pixel
var xPos = ((cubeLength / 2) + cubeGap + (cubeLength / 2)) * (x - centerPixelX);
var yPos = ((cubeLength / 2) + cubeGap + (cubeLength / 2)) * -(y - centerPixelY); //Invert y value because we're starting top left
pixels[y][x].center = [xPos, yPos, 0];



//Add pixel to scene
r.add(pixels[y][x]);

}
}

}

r.render(); //Start rendering


//Kinda looked like a robot so I made the eyes fade out
var rise = true;
//Eye pixels
setInterval(function() {
for(var i = 0; i < eyePosX.length; i++){
if(pixels[eyePosY[i]][eyePosX[i]].color[0] < .3 || pixels[eyePosY[i]][eyePosX[i]].color[1] < .3)
rise = true;
else if(pixels[eyePosY[i]][eyePosX[i]].color[0] > 1 || pixels[eyePosY[i]][eyePosX[i]].color[1] > 1)
rise = false
if(rise){
pixels[eyePosY[i]][eyePosX[i]].color[0] = pixels[eyePosY[i]][eyePosX[i]].color[0] + .001;
pixels[eyePosY[i]][eyePosX[i]].color[1] = pixels[eyePosY[i]][eyePosX[i]].color[1] + .001;
}
else{
pixels[eyePosY[i]][eyePosX[i]].color[0] = pixels[eyePosY[i]][eyePosX[i]].color[0] - .001;
pixels[eyePosY[i]][eyePosX[i]].color[1] = pixels[eyePosY[i]][eyePosX[i]].color[1] - .001;
}
}
}, 10);

};

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

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

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


triCount = new THREE.BoxGeometry(10, 10, 10);
console.log("Box: " + triCount.faces.length);
triCount = new THREE.TorusKnotGeometry(5, 2, 64, 8);
console.log("Torus Knot: " + triCount.faces.length);
triCount = new THREE.SphereGeometry(10, 16, 16);
console.log("Sphere: " + triCount.faces.length);
triCount = new THREE.OctahedronGeometry(10);
console.log("Octahedron: " + triCount.faces.length);
triCount = new THREE.ConeGeometry(10, 20);
console.log("Cone: " + triCount.faces.length);
triCount = new THREE.RingGeometry(5, 10, 32);
console.log("Ring: " + triCount.faces.length);
triCount = new THREE.BoxGeometry(10, 10, 10);


objCount = 0;
renderer.domElement.onmousemove = function(e){


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


pixCord = new THREE.Vector2(e.clientX, e.clientY);
viewCord = new THREE.Vector2((pixCord.x / window.innerWidth) * 2 - 1, -(pixCord.y / window.innerHeight) * 2 + 1);


viewCordNear = new THREE.Vector3(viewCord.x, viewCord.y, 0);


raycaster = new THREE.Raycaster();
raycaster.setFromCamera(viewCordNear, camera);
intersects = raycaster.intersectObject(invisiblePlane);

newShapePos = intersects[0].point;
//console.log('Clicked at', intersects[0].point);

newShapeVal = Math.floor(Math.random() * 6); //Int vals from 0 - 4 for 6 shapes
newColor = new THREE.Color(Math.random(), Math.random(), Math.random()); //Colors from 0 - 1

switch(newShapeVal){
case 0:
newShapeGeo = new THREE.BoxBufferGeometry(10, 10, 10);
break;
case 1:
newShapeGeo = new THREE.TorusKnotBufferGeometry(5, 2, 64, 8);
break;
case 2:
newShapeGeo = new THREE.SphereBufferGeometry(10, 16, 16);
break;
case 3:
newShapeGeo = new THREE.OctahedronBufferGeometry(10);
break;
case 4:
newShapeGeo = new THREE.ConeBufferGeometry(10, 20);
break;
case 5:
newShapeGeo = new THREE.RingBufferGeometry(5, 10, 32);
break;
default:
newShapeGeo = new THREE.BoxBufferGeometry(10, 10, 10);
break


}


newShapeMat = new THREE.MeshStandardMaterial({
color : newColor,
wireframe : false
});
newShape = new THREE.Mesh(newShapeGeo, newShapeMat);
newShape.position.set(newShapePos.x, newShapePos.y, newShapePos.z);
//console.log(newShape.position);
scene.add(newShape);
objCount++;
console.log(objCount);
}


//Light setup
ambientLight = new THREE.AmbientLight();
scene.add(ambientLight);
light = new THREE.DirectionalLight(0xffffff, 5.0);
light.position.set(10, 100, 10);
scene.add(light);

//Geometry
geometry = new THREE.PlaneBufferGeometry(10000, 10000);
material = new THREE.MeshStandardMaterial({
visible : false
});
invisiblePlane = new THREE.Mesh(geometry, material);
scene.add(invisiblePlane);
//Controls
controls = new THREE.TrackballControls(camera);

animate();

};

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