1 /** 2 * @class mesh 3 * @description 4 * 5 * 3D object defined by triangle primitives. 6 * 7 * A mesh contains 2 components: the Mesh itself and a series of faces (face list). 8 * The mesh itself provides the base data: vertex positions, normals, 9 * UVs, you name it. A face list actually 10 * Using the mesh - meshObject reloationship aptly can allow for flexible 11 * control over performance vs. memory cost. 12 * 13 */ 14 function mesh() { 15 16 /** 17 * Explicitly defines the vertices of the mesh. 18 * 19 * This overwrites any previous geometry data. The array of data 20 * must match numVertices in lenght or the request will be rejected. 21 * The numbe rof floats per vertex depends on the given {@link sandboxe.mesh.vertexAttribute} 22 * 23 * @param {Number} attribute The attribute . See {@link sandboxe.mesh.vertexAttribute} 24 * @param {Array} data The array of values to read from. 25 */ 26 this.defineVertices = function(){}; 27 28 /** 29 * Gets the data for the requested vertex. 30 * @param {Number} vertexIndex The index of the vertex to get info for. 31 * @param {Number} attribute The attribute to request. 32 * @returns {Array} The data for the vertex requested. 33 */ 34 this.getVertex = function(){}; 35 36 /** 37 * Sets the data for the requested vertex. 38 * @param {Number} vertexIndex The index of the vertex to get info for. 39 * @param {Number} attribute The attribute to request. 40 * @param {Array} newData The data for the vertex requested. 41 */ 42 this.setVertex = function(){}; 43 44 45 46 47 48 /** 49 * Adds a faceList to the mesh. When drawn, to the 50 * faceList will refer to vertices of this mesh. 51 * @param {Array} object The face list to add. If no argument is given, an empty mesh object is added. The array is an array of indices into the mesh's vertices 52 */ 53 this.addObject = function(){}; 54 55 /** 56 * Retrieves the i'th face list requested. 57 * @param {Number} i 58 * @returns {Array} 59 */ 60 this.getObject = function(){}; 61 62 /** 63 * Removes the meshObject requested. 64 * @param {Number} i 65 */ 66 this.removeObject = function(){}; 67 68 /** 69 * Returns the number of face lists that this mesh contains. 70 * @returns {Number} Count of face lists. 71 */ 72 this.numObjects = function(){}; 73 74 75 76 77 78 79 80 81 /** 82 * Number of vertices that belong to this mesh. vertex count must be set before 83 * starting to modify vertices. 84 * @type {Number} 85 */ 86 this.vertexCount = 0; 87 88 89 90 91 return this; 92 } 93