Some Models
NOTE: These models are somewhat untested. Please report problems to me.
- N64.js normals x -1
- butterfly.js
- cheetah.js
- coasts.js
- cone.js normal x -1
- copter.js
- cube.js
- dino.js
- dolphin.js
- dragon.jsnormal x -1
- epcot.js
- enterprise.js
- fish.js
- ganster.js
- head.js
- lizard.js
- nightmare.js
- plane.js
- shuttle.js, This model has issues, but it seems to work.
- skeleton.js
- spider.js
- tank.js
- teapot.js
- womanInDress.js
- xwing.js
The file format is as follows:
- For a file named butterfly
-
butterflyModel_Vertexis a list of vertexes- There is a data point for each vertex
- Each data point is a 3 dimensional array
- A 3 vector containing the coordinates.
- A 4 vector containing the color blue, with alpha of 1.
- A 3 vector containing a calculated vertex normal.
- Note, the vertex normal calculation has not been tested as of 11/7/22. That will come later.
- Example:
-
butterflyModel_Vertex=[[[0.33, 0.46, 0.29],[0.0, 0.0, 1.0, 1.0],[3.2e-06, 0.82, -0.58]],[[0.48, 0.46, 0.29],[0.0, 0.0, 1.0, 1.0],[3.2e-06, 0.63, -0.78]],
-
-
butterflyModel_INDEXis a list of edges- These are sets of three (but not grouped as such) for the triangles in the model.
-
butterflyModel_INDEX = [3, 2, 1, 5, 4, 2,- The first triangle is vertex: 3, 2, 1
- The second triangle is vertex: 5, 4, 2
- It is unknown if these are clockwise or counter clockwise.
-
function DeepFlatten(struct) { let size = 0; for (let item of struct[0]) { size += item.length; } size *= struct.length let i = 0; let rv = new Float32Array(size); for(let data of struct) { for (let item of data) { for(let num of item) { rv[i] = num; ++i; } } } return rv; }An example application of this isvbuf = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, vbuf); gl.bufferData(gl.ARRAY_BUFFER,DeepFlatten(verts), gl.STATIC_DRAW);Typical use includes the following in your .html file:<script type="text/javascript" src="https://mirkwood.cs.edinboro.edu/~bennett/GraphicsCode/Common/webgl-utils.js"></script> <script type="text/javascript" src="https://mirkwood.cs.edinboro.edu/~bennett/GraphicsCode/Common/initShaders.js"></script> <script type="text/javascript" src="https://mirkwood.cs.edinboro.edu/~bennett/GraphicsCode/Common/MV.js"></script> <script type="text/javascript" src="https://mirkwood.cs.edinboro.edu/~bennett/GraphicsCode/NewShapes/teapot.js"></script> <script type="text/javascript" src="https://mirkwood.cs.edinboro.edu/~bennett/GraphicsCode/NewShapes/cheetah.js"></script> <script type="text/javascript" src="https://mirkwood.cs.edinboro.edu/~bennett/GraphicsCode/NewShapes/DeepFlatten.js"></script> - These are sets of three (but not grouped as such) for the triangles in the model.