Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this is how it looks when i run the code but i want to add three fingers and a thumb to the robot so it
this is how it looks when i run the code but i want to add three fingers and a thumb to the
robot so it will look like this
Show Transcribed Text
and here is the code that you need to modify so it will be just like i want i mean just like the final photo.
"use strict";
var gl;
var shapes
wireCube: points: colors: start: size: type:
solidCube: points: colors: start: size: type:
axes: points: colors: start: size: type:
;
var mv new mat;
var p new mat;
var mvLoc, projLoc;
var shoulder
elbow ;
var wireframeMode false; Variable to toggle wireframe mode
var perspectiveMode true; Variable to toggle perspective mode
var red vec;
var green vec;
var blue vec;
var lightred vec;
var lightgreen vec;
var lightblue vec;
var white vec;
shapes.axes.points
vec
vec
vec
vec
vec
vec
;
shapes.axes.colors green green, red, red, blue, blue;
var cubeVerts
vec
vec
vec
vec
vec
vec
vec
vec
;
var wireCubeLookups ;
var solidCubeLookups
;
for var i ; i wireCubeLookups.length; i
shapes.wireCube.points.pushcubeVertswireCubeLookupsi;
shapes.wireCube.colors.pushwhite;
var colorNum ;
var colorList lightblue lightgreen, lightred, blue, red, green;
for var i ; i solidCubeLookups.length; i
shapes.solidCube.points.pushcubeVertssolidCubeLookupsi;
shapes.solidCube.colors.pushcolorListcolorNum;
if i colorNum;
var points ;
var colors ;
function loadShapemyShape type
myShape.start points.length;
points points.concatmyShapepoints;
colors colors.concatmyShapecolors;
myShape.size points.length myShape.start;
myShape.type type;
window.onload function init
var canvas document.getElementByIdglcanvas";
gl canvas.getContextwebgl;
if gl
canvas.parentNode.innerHTMLCannot get WebGL Rendering Context";
glviewport gldrawingBufferWidth, gldrawingBufferHeight;
glenableglDEPTHTEST;
glclearColor;
glenableglCULLFACE;
var program initShadersgl "shader.vert", "shader.frag";
gluseProgramprogram;
loadShapeshapeswireCube, glLINESTRIP;
loadShapeshapessolidCube, glTRIANGLES;
loadShapeshapesaxes, glLINES;
var vertexBuffer glcreateBuffer;
glbindBufferglARRAYBUFFER, vertexBuffer;
glbufferDataglARRAYBUFFER, flattenpoints glSTATICDRAW;
program.vPosition glgetAttribLocationprogram "vPosition";
glvertexAttribPointerprogramvPosition, glFLOAT, glFALSE, ;
glenableVertexAttribArrayprogramvPosition;
var colorBuffer glcreateBuffer;
glbindBufferglARRAYBUFFER, colorBuffer;
glbufferDataglARRAYBUFFER, flattencolors glSTATICDRAW;
program.vColor glgetAttribLocationprogram "vColor";
glvertexAttribPointerprogramvColor, glFLOAT, glFALSE, ;
glenableVertexAttribArrayprogramvColor;
projLoc glgetUniformLocationprogramp;
mvLoc glgetUniformLocationprogrammv;
updateProjection; Set initial projection matrix
var eye vec;
var at vec;
var up vec;
mv lookAteye at up;
requestAnimationFrameanimate;
;
var prevTime ;
function animate
requestAnimationFrameanimate;
var curTime new DategetTime;
if prevTime
var timePassed curTime prevTime;
handleKeystimePassed;
prevTime curTime;
render;
function render
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started