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 #509

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
66e3e44
Add files via upload
Anirudh909 Sep 13, 2022
4635965
Delete CS460_Assignment_01_.pdf
Anirudh909 Sep 13, 2022
568c873
Add files via upload
Anirudh909 Sep 13, 2022
cd2d658
Add files via upload
Anirudh909 Sep 20, 2022
e6bc6d6
Add files via upload
Anirudh909 Oct 11, 2022
051b25e
assignment05
Anirudh909 Oct 18, 2022
ce89049
Create 05
Anirudh909 Oct 18, 2022
099a23e
Add files via upload
Anirudh909 Oct 18, 2022
f6d2256
Create 06
Anirudh909 Oct 27, 2022
00c22ce
Add files via upload
Anirudh909 Oct 27, 2022
f5abf8d
Delete robot06.js
Anirudh909 Oct 27, 2022
211da31
Add files via upload
Anirudh909 Oct 27, 2022
e12f177
Add files via upload
Anirudh909 Oct 27, 2022
e303bb3
Add files via upload
Anirudh909 Nov 8, 2022
5bd6596
Add files via upload
Anirudh909 Nov 8, 2022
5af08d4
Create sample
Anirudh909 Nov 22, 2022
6229a1f
Add files via upload
Anirudh909 Nov 22, 2022
47665c8
Add files via upload
Anirudh909 Nov 22, 2022
4b990df
Create hw09
Anirudh909 Nov 29, 2022
6c2fa8a
Delete 09 directory
Anirudh909 Nov 29, 2022
94dad67
Create 09
Anirudh909 Nov 29, 2022
4519402
Delete 09
Anirudh909 Nov 29, 2022
165f23a
hw09
Anirudh909 Nov 29, 2022
06f1d58
Add files via upload
Anirudh909 Nov 29, 2022
749ce9f
Add files via upload
Anirudh909 Nov 29, 2022
07eed4f
Add files via upload
Anirudh909 Dec 9, 2022
1befeb8
Add files via upload
Anirudh909 Dec 9, 2022
7db5295
Add files via upload
Anirudh909 Dec 22, 2022
f8292c9
Add files via upload
Anirudh909 Dec 22, 2022
f0b087c
Add files via upload
Anirudh909 Dec 22, 2022
538ec9b
Add files via upload
Anirudh909 Dec 22, 2022
afe4e74
Add files via upload
Anirudh909 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/CS460_Assignment_02__Copy_.pdf
Binary file not shown.
173 changes: 173 additions & 0 deletions 02/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<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="http://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();


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

for (var j=0; j<7 ; j++)
{
var c = new X.cube();
c.color = [225,225,0];
c.center =[25*i,25*j,0,];
r.add(c);

}

}
//left eye
for (var i=1; i<2 ; i++)
{

for (var j=5; j<6 ; j++)
{
var c = new X.cube();
c.color = [0,0,0];
c.center =[25*i,25*j,0,];
r.add(c);

}

}
//right eye
for (var i=5; i<6 ; i++)
{

for (var j=5; j<6 ; j++)
{
var c = new X.cube();
c.color = [0,0,0];
c.center =[25*i,25*j,0,];
r.add(c);

}

}
//nose
for (var i=3; i<4 ; i++)
{

for (var j=3; j<4 ; j++)
{
var c = new X.cube();
c.color = [0,0,0];
c.center =[25*i,25*j,0,];
r.add(c);

}

}
//mouth
for (var i=2; i<5 ; i++)
{

for (var j=0; j<1 ; j++)
{
var c = new X.cube();
c.color = [1,0,0];
c.center =[25*i,25*j,0,];
r.add(c);

}

}

for (var i=1; i<6 ; i++)
{

for (var j=1; j<2 ; j++)
{
var c = new X.cube();
c.color = [0,0,0];
c.center =[25*i,25*j,0,];
r.add(c);

}

}

/*for (var i=1; i<2 ; i++)
{

for (var j=0; j<1 ; j++)
{
var c = new X.cube();
c.color = [0,0,0];
c.center =[25*i,25*j,0,];
r.add(c);

}

}

for (var i=5; i<6 ; i++)
{

for (var j=0; j<1 ; j++)
{
var c = new X.cube();
c.color = [0,0,0];
c.center =[25*i,25*j,0,];
r.add(c);

}

}*/











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

// render everything!
r.render();

};

</script>
</head>
<body>
<h1>CS460 Assignment 2</h1>
<div id="logo"><img style="height:60px" src="gfx/cs460.png"></div>
</body>
</html>
1 change: 1 addition & 0 deletions 05
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions 06
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file added 08/CS460_Assignment_08__Copy_.pdf
Binary file not shown.
Binary file added 08/board.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 83 additions & 0 deletions 08/helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
HELPER = {};

/**
* This method returns [geometry, material, bones] to create a skeleton mesh
* based on a cylinder.
*
* @param howmany: Number of bones.
* @param howwide: Radius of the cylinder.
* @param color: Color of the cylinder.
*/
HELPER.cylinderSkeletonMesh = function(howmany, howwide, color) {

var segmentheight = 10; // just a temporary value but it needs to match for geometry and bones
var height = segmentheight * howmany;

//
// inspired by https://threejs.org/docs/scenes/bones-browser.html
//

// step1: geometry
var geometry = new THREE.CylinderBufferGeometry(
howwide, // radiusTop
howwide, // radiusBottom
height, // height
8, // radiusSegments
howmany * 3, // heightSegments
true // openEnded
);

var position = geometry.attributes.position;

var vertex = new THREE.Vector3();

var skinIndices = [];
var skinWeights = [];

for ( var i = 0; i < position.count; i ++ ) {

vertex.fromBufferAttribute( position, i );

var y = ( vertex.y + height / 2 );

var skinIndex = Math.floor( y / segmentheight );
var skinWeight = ( y % segmentheight ) / segmentheight;

skinIndices.push( skinIndex, skinIndex + 1, 0, 0 );
skinWeights.push( 1 - skinWeight, skinWeight, 0, 0 );

}

geometry.setAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( skinIndices, 4 ) );
geometry.setAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeights, 4 ) );

// step 2: setup material
var material = new THREE.MeshStandardMaterial( {
skinning: true, // IMPORTANT!
color: color,
side: THREE.DoubleSide,
flatShading: true
} );

// step 3: setup bones
var bones = [];

// we always need a dummy parent bone as the anchor point
var parentbone = new THREE.Bone();
// parentbone.position.y = -height / 2; // weeeeird
bones.push(parentbone);

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

var currentbone = new THREE.Bone();
currentbone.position.y = segmentheight;

parentbone.add(currentbone);
bones.push(currentbone); // add the bone
parentbone = currentbone;

}

return [geometry, material, bones];

};
Loading