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

Assignment 5 Submission #185

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
56 changes: 46 additions & 10 deletions 04/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
gl_Position = final_position;

// TODO Part 2
gl_PointSize = 8.;


}
Expand Down Expand Up @@ -173,7 +174,7 @@
animate();
};

function createRectangle(color, offset) {
function createPaddle(color, offset) {



Expand All @@ -185,12 +186,12 @@
//
// TODO Part 1
//
vertices = new Float32Array([
-0.5, 0.5, 0.0, // V0 // 0
-0.5, -0.5, 0.0, // V1, V4 // 1
0.5, 0.5, 0.0, // V2, V3 // 2
0.5, -0.5, 0.0 // V5 // 3
]);
vertices = new Float32Array( [
-0.1, 0.05, 0.0, // V0 // 0
-0.1, -0.05, 0.0, // V1, V4 // 1
0.1, 0.05, 0.0, // V2, V3 // 2
0.1, -0.05, 0.0 // V5 // 3
] );

indices = new Uint8Array([0, 1, 2, // Triangle 1
2, 1, 3]); // Triangle 2
Expand All @@ -208,7 +209,7 @@
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); // unbind

// TODO Part 2
return [v_buffer, i_buffer, color, offset, 6];
return [v_buffer, i_buffer, color, offset, 6, gl.TRIANGLES];

}

Expand All @@ -217,8 +218,29 @@
function createBall(color, offset) {
//
// TODO Part 2
vertex = new Float32Array
([
0.0, 0.0, 0.0 //origin
]);

index = new Uint8Array([0]); //origin pt

v_buffer = gl.createBuffer(); // create

gl.bindBuffer(gl.ARRAY_BUFFER, v_buffer); // bind
gl.bufferData(gl.ARRAY_BUFFER, vertex, gl.STATIC_DRAW); // put data in
gl__PointSize = 8.0;
gl.bindBuffer(gl.ARRAY_BUFFER, null); // unbind


i_buffer = gl.createBuffer(); // create
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, i_buffer); // bind
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, index, gl.STATIC_DRAW); // put data in
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); // unbind
//

return [v_buffer, i_buffer, color, offset, 1, gl.POINTS];

}

function createBrick(color, offset, score) {
Expand Down Expand Up @@ -262,7 +284,7 @@
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); // unbind

// TODO Part 2
return [v_buffer, i_buffer, color, offset, 6, score];
return [v_buffer, i_buffer, color, offset, 6, gl.TRIANGLES, score];
}

function createBricks() {
Expand Down Expand Up @@ -305,6 +327,7 @@
var COLOR = current[2];
var OFFSET = current[3];
var VERTEXCOUNT = current[4];
var TYPE = current[5];

//************************************************************//
//
Expand Down Expand Up @@ -345,7 +368,10 @@
// gl.drawArrays( gl.LINES, 0, 6 );

// TODO Part 2
gl.drawElements(gl.TRIANGLES, VERTEXCOUNT, gl.UNSIGNED_BYTE, 0);
//gl.drawArrays(gl.POINTS, 0, 1);
//gl.drawElements(gl.TRIANGLES, VERTEXCOUNT, gl.UNSIGNED_BYTE, 0);
gl.drawElements(TYPE, VERTEXCOUNT, gl.UNSIGNED_BYTE, 0);

}
}

Expand Down Expand Up @@ -437,6 +463,16 @@
window.location.reload();
}
// TODO Part 3
if (e.code == 'ArrowLeft')
{
OBJECTS.push(createPaddle([1, 1, 1, 1], [-1, -0.9, 0]));
animate();
}
if (e.code == 'ArrowRight')
{
OBJECTS.push(createPaddle([1, 1, 1, 1], [1, -0.9, 0]));
animate();
}
};
</script>
</head>
Expand Down
Binary file added 05/inkman/11_21_2024.glb
Binary file not shown.
17 changes: 17 additions & 0 deletions 05/inkman/ar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
<script src="https://raw.githack.com/AR-js-org/AR.js/dev/aframe/build/aframe-ar.js"></script>
<body style="margin : 0px; overflow: hidden;">
<a-scene embedded arjs>
<a-marker preset="hiro">
<a-entity
position="0 0 0"
rotation="0 0 0"
scale="0.05 0.05 0.05"
gltf-model="tinker_hobbes.glb"
></a-entity>
</a-marker>
<a-entity camera></a-entity>
</a-scene>
</body>
</html>
Binary file added 05/inkman/hobbes.blend
Binary file not shown.
Binary file added 05/inkman/hobbes.glb
Binary file not shown.
Binary file added 05/inkman/hobbes.stl
Binary file not shown.
Loading