webgl代写/js代写: assignment webgl

webgl代写/js代写: 这是一个典型的webjs图形编程作业代写,工作难度和工作量都很大
Introduction
In this assignment, you’ll implement interactive 3D viewing and animation. You’ll use the keyboard and mouse events to control viewing, and you’ll define paths for objects to follow through a scene.

The assignment is divided into a viewing component and two animation components. There are a total of 100 points for the assignment.

Getting Started
You may use any code from your previous labs or the posted lab solutions. The file formats for this program will be the same as for Lab 5 with minor exceptions noted below. Start with the Lab 5 code for loading the scene and the models (remove the y-rotation animation from the Lab 5 code for this project). You may use any of your own Lab 5 code, or any code from the posted Lab5Solution.zip (available Wed. Feb. 21).

Part 1 – Viewing
Implement the ability to use the mouse to rotate the camera position, and to use the keyboard to change the “look at” point:

Keyboard: as in Lab 5, pressing a number key from 1 to 9 should replace the camera “lookAt” point specified in the scene file with the current location for the corresponding model, where 1 is the 1st instance (index 0) in the scene file, 2 the 2nd, etc. (ignore any values greater than the number of instances). Pressing the 0 key should restore the original “lookAt” value specified in the scene file.

The main difference here from Lab 5 is that as the model moves, the lookAt point should be updated to follow the model. In Lab 5, the models didn’t move.
Mouse: moving the mouse with the button held down should cause the entire scene to rotate up, down, right, or left around the current “look at” point. Take a look at Google Earth for an example of how this should work.

Use y-axis rotation for left-right mouse motion, and x-axis rotation for up-down mouse motion. Apply these rotations in viewing coordinates (after the viewing matrix generated by the lookAt function).
Part 2 – Path Animation
In this part of the assignment, you will animate the object found at index 0 in the scene file to move in a straight line between the objects at index 1 and index 2. Only a single object will be animated; all other objects in the scene are static. The scene file contains two new values, collisionDistance and animationStep.

Ignore the location specified in the scene file for object 0. Position the animated object 0 initially at a point halfway between the locations of objects 1 and 2. Objects 1 and 2 will be referred to as the first and second target objects.
Ignore the basis vectors in the scene file for object 0. Compute new basis vectors such that the +y axis of the object points toward the first target object, and use the vector <0,0,1> as the approximate up vector to compute the other two basis vectors.
Use the +y direction basis vector computed in the previous step as the initial animation direction. Every redraw, move the animated object towards the next target by the distance between targets divided by the animationStep value.
When the location of the animated object is <= the collisionDistance, reverse the current animation direction vector, compute a new basis for the animated object, and continue animation towards the other target.

发表评论

电子邮件地址不会被公开。 必填项已用*标注