Skip to content

Commit

Permalink
updated the box cube for assignment 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Sukrut2710 committed Jan 25, 2024
1 parent a7343ef commit 0bc685f
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions 06-Box/public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,20 @@ const vertexData = [
-.5, -.5, -.5,
];

// const colorData = [
// 1, 0, 0, // V1.color
// 0, 1, 0, // V2.color
// 0, 0, 1, // V3.color
// ];

function randomColor() {
return [Math.random(), Math.random(), Math.random()];
}
const faceColor = [
1, 0, 1, // V1.color
0, 1, 0, // V2.color
0, 0, 1, // V3.color
];

// function randomColor() {
// return [Math.random(), Math.random(), Math.random()];
// }

// let colorData = [
// ...randomColor(),
// ...randomColor(),
// ...randomColor(),
// ];

let colorData = [];
for (let face = 0; face < 6; face++) {
let faceColor = randomColor();
//let faceColor = randomColor();
for (let vertex = 0; vertex < 6; vertex++) {
colorData.push(...faceColor);
}
Expand Down Expand Up @@ -145,7 +140,7 @@ const matrix = mat4.create();

mat4.translate(matrix, matrix, [.2, .5, 0]);

mat4.scale(matrix, matrix, [0.25, 0.25, 0.25]);
mat4.scale(matrix, matrix, [0.5, 0.5, 0.5]); //modifications made

function animate() {
requestAnimationFrame(animate);
Expand Down

0 comments on commit 0bc685f

Please sign in to comment.