Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
properly expose struct arrays as factories rather than classes
- Loading branch information
Showing
17 changed files
with
71 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
'use strict'; | ||
|
||
const StructArrayType = require('../util/struct_array'); | ||
const createStructArrayType = require('../util/struct_array'); | ||
|
||
module.exports = createElementArrayType; | ||
|
||
/** | ||
* An element array stores Uint16 indicies of vertexes in a corresponding vertex array. With no | ||
* arguments, it defaults to three components per element, forming triangles. | ||
* @private | ||
*/ | ||
module.exports = function ElementArrayType(components) { | ||
return new StructArrayType({ | ||
function createElementArrayType(components) { | ||
return createStructArrayType({ | ||
members: [{ | ||
type: 'Uint16', | ||
name: 'vertices', | ||
components: components || 3 | ||
}] | ||
}); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
'use strict'; | ||
|
||
const StructArrayType = require('../util/struct_array'); | ||
const createStructArrayType = require('../util/struct_array'); | ||
|
||
module.exports = createVertexArrayType; | ||
|
||
/** | ||
* A vertex array stores data for each vertex in a geometry. Elements are aligned to 4 byte | ||
* boundaries for best performance in WebGL. | ||
* @private | ||
*/ | ||
module.exports = function VertexArrayType(members) { | ||
return new StructArrayType({ | ||
function createVertexArrayType(members) { | ||
return createStructArrayType({ | ||
members: members, | ||
alignment: 4 | ||
}); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.