Starting from:

$25

ComputerGraphics - A10 – Indexed primitiecs - Solved

The goal of the application contained in index.html, is to create two meshes: the surface defined by equation y = sin(x) * cos(z) with -3 <= x <= 3 and -3 <= z <= 3, and a half-sphere. Models are created in file models.js. In particular, the application uses the procedure addMesh(), that receives as parameters the vertex buffer (an array of three elements vectors with the coordinates of the vertices), the index buffer (an array of indices in the vertex buffer), and an RGB color (a three-elements array, with the value of the red, green and blue components of the color, each one in the 0-1 range). Primitives are encoded as indexed triangle lists.

 

The two meshes should be generated by an algorithm (which requires at least two nested loops are required). Below you can see a picture of the expected result.

 

In the application, the mouse turns the view, and the slider at the bottom of the page can be used to change the objects being displayed. To help you in the creation of objects, it is possible to toggle a wireframe view pressing the space bar key.

 

  

More products