diff --git a/src/renderer/webgl/typedefs/WebGLPipelineAttributesConfig.js b/src/renderer/webgl/typedefs/WebGLPipelineAttributesConfig.js new file mode 100644 index 000000000..7ba215298 --- /dev/null +++ b/src/renderer/webgl/typedefs/WebGLPipelineAttributesConfig.js @@ -0,0 +1,12 @@ +/** + * @typedef {object} Phaser.Types.Renderer.WebGL.WebGLPipelineAttributesConfig + * @since 3.50.0 + * + * @property {string} name - The name of the attribute as defined in the vertex shader. + * @property {number} size - The number of components in the attribute, i.e. 1 for a float, 2 for a vec2, 3 for a vec3, etc. + * @property {GLenum} type - The data type of the attribute. Either `gl.BYTE`, `gl.SHORT`, `gl.UNSIGNED_BYTE`, `gl.UNSIGNED_SHORT` or `gl.FLOAT`. + * @property {number} offset - The offset, in bytes, of this attribute data in the vertex array. Equivalent to `offsetof(vertex, attrib)` in C. + * @property {boolean} normalized - Should the attribute data be normalized? + * @property {boolean} enabled - You should set this to `false` by default. The pipeline will enable it on boot. + * @property {number} location - You should set this to `-1` by default. The pipeline will set it on boot. + */ diff --git a/src/renderer/webgl/typedefs/WebGLPipelineConfig.js b/src/renderer/webgl/typedefs/WebGLPipelineConfig.js new file mode 100644 index 000000000..e4cd7a117 --- /dev/null +++ b/src/renderer/webgl/typedefs/WebGLPipelineConfig.js @@ -0,0 +1,14 @@ +/** + * @typedef {object} Phaser.Types.Renderer.WebGL.WebGLPipelineConfig + * @since 3.50.0 + * + * @property {Phaser.Game} game - The Phaser.Game instance that owns this pipeline. + * @property {string} [name] - The name of the pipeline. + * @property {GLenum} [topology=gl.TRIANGLES] - How the primitives are rendered. The default value is GL_TRIANGLES. Here is the full list of rendering primitives: (https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants). + * @property {string} [vertShader] - The source code, as a string, for the vertex shader. + * @property {string} [fragShader] - The source code, as a string, for the fragment shader. Can include `%count%` and `%forloop%` declarations for multi-texture support. + * @property {number} [vertexCapacity] - The number of vertices to hold in the batch. Defaults to `RenderConfig.batchSize` * 6. + * @property {number} [vertexSize] - The size, in bytes, of a single entry in the vertex buffer. Defaults to Float32Array.BYTES_PER_ELEMENT * 6 + Uint8Array.BYTES_PER_ELEMENT * 4. + * @property {ArrayBuffer} [vertices] - An optional Array Buffer full of pre-calculated vertices data. + * @property {Phaser.Types.Renderer.WebGL.WebGLPipelineAttributesConfig} [attributes] - An array of shader attribute data. + */ diff --git a/src/renderer/webgl/typedefs/index.js b/src/renderer/webgl/typedefs/index.js new file mode 100644 index 000000000..edb75f907 --- /dev/null +++ b/src/renderer/webgl/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Types.Renderer.WebGL + */