55 */
66
77var Class = require ( '../../utils/Class' ) ;
8- var Utils = require ( './Utils' ) ;
9- var WEBGL_CONST = require ( './const' ) ;
108
119/**
1210 * @classdesc
@@ -80,7 +78,7 @@ var WebGLShader = new Class({
8078 /**
8179 * Array of objects that describe the vertex attributes.
8280 *
83- * @name Phaser.Renderer.WebGL.WebGLPipeline #attributes
81+ * @name Phaser.Renderer.WebGL.WebGLShader #attributes
8482 * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineAttribute[] }
8583 * @since 3.50.0
8684 */
@@ -108,7 +106,7 @@ var WebGLShader = new Class({
108106 * inTintEffect - (size 1 x gl.FLOAT) = 4
109107 * inTint - (size 4 x gl.UNSIGNED_BYTE) = 4
110108 *
111- * The total is 8 + 8 + 4 + 4 + 4 = 28, which is the default for this property .
109+ * The total, in this case, is 8 + 8 + 4 + 4 + 4 = 28.
112110 *
113111 * This is calculated automatically during the `createAttributes` method.
114112 *
@@ -141,10 +139,15 @@ var WebGLShader = new Class({
141139 } ,
142140
143141 /**
144- * Takes the vertex attributes array and parses it, creating the resulting array that is stored
142+ * Takes the vertex attributes config and parses it, creating the resulting array that is stored
145143 * in this shaders `attributes` property, calculating the offset, normalization and location
146144 * in the process.
147145 *
146+ * Calling this method resets `WebGLShader.attributes`, `WebGLShader.vertexSize` and
147+ * `WebGLShader.vertexComponentCount`.
148+ *
149+ * It is called automatically when this class is created, but can be called manually if required.
150+ *
148151 * @method Phaser.Renderer.WebGL.WebGLShader#createAttributes
149152 * @since 3.50.0
150153 *
@@ -206,6 +209,8 @@ var WebGLShader = new Class({
206209 * @method Phaser.Renderer.WebGL.WebGLShader#bind
207210 * @since 3.50.0
208211 *
212+ * @param {boolean } [reset=false] - Should the vertex attribute pointers be fully reset?
213+ *
209214 * @return {this } This WebGLShader instance.
210215 */
211216 bind : function ( reset )
@@ -223,7 +228,7 @@ var WebGLShader = new Class({
223228 pipeline . mvpDirty = false ;
224229 }
225230
226- // this.setAttribPointers(reset);
231+ this . setAttribPointers ( reset ) ;
227232
228233 return this ;
229234 } ,
@@ -233,7 +238,9 @@ var WebGLShader = new Class({
233238 *
234239 * This should only be called after the vertex buffer has been bound.
235240 *
236- * @method Phaser.Renderer.WebGL.WebGLPipeline#setAttribPointers
241+ * It is called automatically during the `bind` method.
242+ *
243+ * @method Phaser.Renderer.WebGL.WebGLShader#setAttribPointers
237244 * @since 3.50.0
238245 *
239246 * @param {boolean } [reset=false] - Reset the vertex attribute locations?
@@ -755,6 +762,8 @@ var WebGLShader = new Class({
755762 this . program = null ;
756763 this . pipeline = null ;
757764 this . renderer = null ;
765+ this . attributes = null ;
766+ this . uniforms = null ;
758767 }
759768
760769} ) ;
0 commit comments