Removed the read of constant values from the WebGLRenderingContext object. Now they are read from an instance of webgl context.

This commit is contained in:
Felipe Alfonso 2018-02-19 17:49:17 -03:00
parent 50c79c14af
commit abfe7536e9
3 changed files with 13 additions and 12 deletions

View file

@ -97,10 +97,11 @@ module.exports = {
* @since 3.0.0
*
* @param {number} attributes - [description]
* @param {WebGLRenderingContext} glContext - [description]
*
* @return {number} [description]
*/
getComponentCount: function (attributes)
getComponentCount: function (attributes, glContext)
{
var count = 0;
@ -108,7 +109,7 @@ module.exports = {
{
var element = attributes[index];
if (element.type === WebGLRenderingContext.FLOAT)
if (element.type === glContext.FLOAT)
{
count += element.size;
}

View file

@ -185,7 +185,7 @@ var WebGLPipeline = new Class({
* @type {integer}
* @since 3.0.0
*/
this.vertexComponentCount = Utils.getComponentCount(config.attributes);
this.vertexComponentCount = Utils.getComponentCount(config.attributes, this.gl);
/**
* Indicates if the current pipeline is flushing the contents to the GPU.

View file

@ -179,15 +179,6 @@ var WebGLRenderer = new Class({
encoder: null
};
for (var i = 0; i <= 16; i++)
{
this.blendModes.push({ func: [ WebGLRenderingContext.ONE, WebGLRenderingContext.ONE_MINUS_SRC_ALPHA ], equation: WebGLRenderingContext.FUNC_ADD });
}
this.blendModes[1].func = [ WebGLRenderingContext.ONE, WebGLRenderingContext.DST_ALPHA ];
this.blendModes[2].func = [ WebGLRenderingContext.DST_COLOR, WebGLRenderingContext.ONE_MINUS_SRC_ALPHA ];
this.blendModes[3].func = [ WebGLRenderingContext.ONE, WebGLRenderingContext.ONE_MINUS_SRC_COLOR ];
// Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc)
/**
@ -389,6 +380,15 @@ var WebGLRenderer = new Class({
this.gl = gl;
for (var i = 0; i <= 16; i++)
{
this.blendModes.push({ func: [ gl.ONE, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_ADD });
}
this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ];
this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ];
this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ];
// Load supported extensions
this.supportedExtensions = gl.getSupportedExtensions();