[SOLVED] CS代考计算机代写 CS580

30 $

CS580

HW3 Overview

Transformations

HW3 API function overview
NameList and ValueList are used to send parameters to the renderer
camera params, transforms, etc…
Push/Pop matrix stack functions are needed for HW3
Stack accumulates xforms (on right side) as they are pushed
Render sequence is:
Application creates FB and Rend
renderer builds and pushes Xsponce FB size is known
Application sets camera parameters (position, lookat, up, FOV)
renderer builds Xpi and Xiw and pushes them on stack
a complete Xsw transformation is built on stack for every frame
Application will push/pop Xwm for each object model and pass model triangles to renderer
renderer transforms passed triangles with the current TOS transformation and rasterizes resulting screen-space triangles
Make sure to compute and interpolate screen-z, not model-Z !
Check for z<0 (before divide by w) and skip any triangle with a negative screen-z vertexApp3 Fragments/*initialize the display and the renderer */newGzRender(xres, yres);/* set up app-defined camera if desired, else rely on camera defaults */ camera.position[X] = 13.2; camera.position[Y] = -8.7;camera.position[Z] = -14.8; camera.lookat[X] = 0.8; camera.lookat[Y] = 0.7; camera.lookat[Z] = 4.5; camera.worldup[X] = -0.2; camera.worldup[Y] = 1.0; camera.worldup[Z] = 0.0; camera.FOV = 53.7;/* degrees */ GzPutCamera(camera); /* overwrite default camera (optional) */GzBeginRender();/* Once camera is set Renderer gets ready for drawing tris*//* set up model matrices as desired */ GzPushMatrix(scale); GzPushMatrix(rotateY);GzPushMatrix(rotateX);/*Walk through the list of triangles, set color and render each triangle*//* write image file */ GzFlushDisplay2File(outfile); /* write image to screen*/ GzFlushDisplay2FrameBuffer(); /* Clean up and exit*/ HW3Add the transformation process to your HW2 rastorizer.The files in hw3.zip include:Gz.hA few new definitions for hw3 Application3.cppNew application that calls your rend.cpp functions rend.cppNew skeleton file with API definition and comments tri.ascA one-triangle data file tri.ppmThe result of running app3on tri.asc with default camerapot4.ascThe Utah teapot triangle data file(in its own model-space coords)pot4.ppmThe result of running app3 on pot4.asc with default camera pot4.cam.ppmThe result of running app3 on pot4.asc with app3 camera/* Camera defaults are set so the app can omit camera setup if desired */ #defineDEFAULT_FOV35.0/* use a default look-at point = 0,0,0 and world-up = 0,1,0 */ #defineDEFAULT_IM_Z(-10.0)/* world coords for image plane origin (camera origin) */ #defineDEFAULT_IM_Y(5.0)#defineDEFAULT_IM_X(-10.0)You can now change the resolution of your FB image to magnify or shrink the entire image. Your background color may be different than mine. “Stress-test” your renderer by changing the camera andlook at point with the PutCamera call. Don’t forget to interpolate screen-z, and cull (ignore) triangles that are behind the view plane (negative z vertex coord) after the transformation – test the z-sign before you do the divide by w.Renderer API (1)GzRender::GzRender(int xRes, int yRes){ /*- create a renderer structure and allocate pixel and frame buffers- setup Xsp and anything that is only done once – init default camera*/ } GzRender::~GzRender(){ /* clean up, free memory */} Renderer API (2)int GzRender::GzBeginRender(){ /*- setup for start of each frame – init frame buffer color, alpha, Z- compute Xiw and projection transform Xpi from camera definition – init Ximage – put Xsp at base of stack, then push Xpi and Xiw – now stack contains Xsw and app can push model Xforms when needed */}int GzRender::GzPutCamera(GzCamera camera){ /*- overwrite renderer camera structure with new camera definition*/}Renderer API (3)int GzRender::GzPushMatrix(GzMatrix matrix){ /*- push a matrix onto the Ximage stack- check for stack overflow*/}int GzRender::GzPopMatrix(){ /*- pop a matrix off the Ximage stack- check for stack underflow*/} Renderer API (4)int GzRender::GzPutAttribute(int numAttributes, GzToken *nameList,GzPointer *valueList) {/*– Set renderer attribute states (e.g.: GZ_RGB_COLOR flat shading color)– In later homeworks set shaders, interpolaters, texture maps, and lights*/}int GzRender::GzPutTriangle(int numParts, GzToken *nameList,GzPointer *valueList){/*– Pass in a triangle description with tokens and values corresponding toGZ_NULL_TOKEN:do nothing – no valuesGZ_POSITION:3 vert positions in model space– Transform vertex coordinates using current TOS matrix in stack– Cull – discard any triangle with verts behind view plane (z < 0)– Pass transformed verts to HW2 triangle rasterizer*/}HW3 ResultsPot4cam.ppm pot4.ppmtri.ppm (app sets camera)(default camera)(default camera)HW3 DetailsThe lid and pot are separate parts and not airtightThere is no bottom to the teapotExam 1 Thurs Feb 25No programming,No calculators,No cell phonesQuestions on all slides or HW material to this pointIncluding, but not limited to:HW1, HW2, HW3FBs, rasterizers, transformations, …Linear algebra, rendering transformations, …Multiple choice, fill-in, draw, describe, how to, …Emphasis is on reasoning about problemsAllow 1 full class session (most will finish sooner)Be on time – don’t be late – BB access is limited

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS代考计算机代写 CS580
30 $