diff --git a/src/core/renderers/webgl/managers/StateManager.js b/src/core/renderers/webgl/managers/StateManager.js index 8d7419f..57f5969 100755 --- a/src/core/renderers/webgl/managers/StateManager.js +++ b/src/core/renderers/webgl/managers/StateManager.js @@ -107,6 +107,11 @@ this.gl[value ? 'enable' : 'disable'](this.gl.BLEND); } + /** + * Enables or disable polygon offset fill + * + * @param {boolean} value - Turn on or off webgl polygon offset testing. + */ setOffset(value) { this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL); @@ -212,6 +217,15 @@ // this.setState(this.defaultState); } + /** + * checks to see which updates should be checked based on which settings have been activated + * for example if blend is enabled then we shold check the blend modes each time the state is changed + * or if poygon fill is activated then we need to check if the polygone offset changes. + * The idea is that we only check what we have too. + * + * @param {Function} func the checking function to add or remove + * @param {boolean} value should the check function be added or removed. + */ updateCheck(func, value) { const index = this.checks.indexOf(func); @@ -226,11 +240,18 @@ } } - // static function maintains scope! + /** + * A private little wrapper function that we call to check the blend mode. + * + * @static + * @private + * @param {PIXI.StateManager} manager the manager to perform the state check on + * @param {PIXI.State} state the state that the blendMode will pulled from + */ static checkBlendMode(manager, state) { manager.setBlendMode(state.blendMode); } - // TODO - polygon offset? + // TODO - add polygon offset? } diff --git a/src/core/renderers/webgl/managers/StateManager.js b/src/core/renderers/webgl/managers/StateManager.js index 8d7419f..57f5969 100755 --- a/src/core/renderers/webgl/managers/StateManager.js +++ b/src/core/renderers/webgl/managers/StateManager.js @@ -107,6 +107,11 @@ this.gl[value ? 'enable' : 'disable'](this.gl.BLEND); } + /** + * Enables or disable polygon offset fill + * + * @param {boolean} value - Turn on or off webgl polygon offset testing. + */ setOffset(value) { this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL); @@ -212,6 +217,15 @@ // this.setState(this.defaultState); } + /** + * checks to see which updates should be checked based on which settings have been activated + * for example if blend is enabled then we shold check the blend modes each time the state is changed + * or if poygon fill is activated then we need to check if the polygone offset changes. + * The idea is that we only check what we have too. + * + * @param {Function} func the checking function to add or remove + * @param {boolean} value should the check function be added or removed. + */ updateCheck(func, value) { const index = this.checks.indexOf(func); @@ -226,11 +240,18 @@ } } - // static function maintains scope! + /** + * A private little wrapper function that we call to check the blend mode. + * + * @static + * @private + * @param {PIXI.StateManager} manager the manager to perform the state check on + * @param {PIXI.State} state the state that the blendMode will pulled from + */ static checkBlendMode(manager, state) { manager.setBlendMode(state.blendMode); } - // TODO - polygon offset? + // TODO - add polygon offset? } diff --git a/src/mesh/geometry/Attribute.js b/src/mesh/geometry/Attribute.js index d07085f..71c153b 100644 --- a/src/mesh/geometry/Attribute.js +++ b/src/mesh/geometry/Attribute.js @@ -1,5 +1,22 @@ +/* eslint-disable max-len */ + +/** + * holds the information for a single attribute structure required to render geometry. + * this does not conatina the actul data, but instead has a buffer id that maps to a {PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc.. + * + * @class + * @memberof PIXI.Attribute + */ class Attribute { + /** + * @param {string} buffer the id of the buffer that this attribute will look for + * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) + * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) + * @param {Boolean} [normalised=false] should the data be normalised. + */ constructor(buffer, size = 2, stride = 0, start = 0, normalised = false) { this.buffer = buffer; @@ -10,14 +27,29 @@ this.type = null; } + /** + * Destroys the Attribute. + */ destroy() { this.buffer = null; } - static from(buffer, stride, start, normalised) + /** + * Helper function that creates an Attribute based on the information provided + * + * @static + * @param {string} buffer the id of the buffer that this attribute will look for + * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) + * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) + * @param {Boolean} [normalised=false] should the data be normalised. + * + * @returns {PIXI.Attribute} A new {PIXI.Attribute} based on the information provided + */ + static from(buffer, size, stride, start, normalised) { - return new Attribute(buffer, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalised); } } diff --git a/src/core/renderers/webgl/managers/StateManager.js b/src/core/renderers/webgl/managers/StateManager.js index 8d7419f..57f5969 100755 --- a/src/core/renderers/webgl/managers/StateManager.js +++ b/src/core/renderers/webgl/managers/StateManager.js @@ -107,6 +107,11 @@ this.gl[value ? 'enable' : 'disable'](this.gl.BLEND); } + /** + * Enables or disable polygon offset fill + * + * @param {boolean} value - Turn on or off webgl polygon offset testing. + */ setOffset(value) { this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL); @@ -212,6 +217,15 @@ // this.setState(this.defaultState); } + /** + * checks to see which updates should be checked based on which settings have been activated + * for example if blend is enabled then we shold check the blend modes each time the state is changed + * or if poygon fill is activated then we need to check if the polygone offset changes. + * The idea is that we only check what we have too. + * + * @param {Function} func the checking function to add or remove + * @param {boolean} value should the check function be added or removed. + */ updateCheck(func, value) { const index = this.checks.indexOf(func); @@ -226,11 +240,18 @@ } } - // static function maintains scope! + /** + * A private little wrapper function that we call to check the blend mode. + * + * @static + * @private + * @param {PIXI.StateManager} manager the manager to perform the state check on + * @param {PIXI.State} state the state that the blendMode will pulled from + */ static checkBlendMode(manager, state) { manager.setBlendMode(state.blendMode); } - // TODO - polygon offset? + // TODO - add polygon offset? } diff --git a/src/mesh/geometry/Attribute.js b/src/mesh/geometry/Attribute.js index d07085f..71c153b 100644 --- a/src/mesh/geometry/Attribute.js +++ b/src/mesh/geometry/Attribute.js @@ -1,5 +1,22 @@ +/* eslint-disable max-len */ + +/** + * holds the information for a single attribute structure required to render geometry. + * this does not conatina the actul data, but instead has a buffer id that maps to a {PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc.. + * + * @class + * @memberof PIXI.Attribute + */ class Attribute { + /** + * @param {string} buffer the id of the buffer that this attribute will look for + * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) + * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) + * @param {Boolean} [normalised=false] should the data be normalised. + */ constructor(buffer, size = 2, stride = 0, start = 0, normalised = false) { this.buffer = buffer; @@ -10,14 +27,29 @@ this.type = null; } + /** + * Destroys the Attribute. + */ destroy() { this.buffer = null; } - static from(buffer, stride, start, normalised) + /** + * Helper function that creates an Attribute based on the information provided + * + * @static + * @param {string} buffer the id of the buffer that this attribute will look for + * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) + * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) + * @param {Boolean} [normalised=false] should the data be normalised. + * + * @returns {PIXI.Attribute} A new {PIXI.Attribute} based on the information provided + */ + static from(buffer, size, stride, start, normalised) { - return new Attribute(buffer, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalised); } } diff --git a/src/mesh/geometry/GeometryData.js b/src/mesh/geometry/GeometryData.js index 290d7aa..487cc19 100644 --- a/src/mesh/geometry/GeometryData.js +++ b/src/mesh/geometry/GeometryData.js @@ -1,4 +1,5 @@ /* eslint-disable max-len */ +import Buffer from './Buffer'; /** * GeometryData - the data of the geometry - this consits of attribute buffers and one index buffer.