webgl-framework
Advanced tools
Comparing version 2.0.1-beta to 2.0.2-beta
@@ -9,4 +9,4 @@ "use strict"; | ||
this.gl = gl; | ||
this.vertexShaderCode = ""; | ||
this.fragmentShaderCode = ""; | ||
this.vertexShaderCode = ''; | ||
this.fragmentShaderCode = ''; | ||
this.fillCode(); | ||
@@ -25,3 +25,3 @@ this.initShader(); | ||
if (!shader) { | ||
console.warn("Error creating shader."); | ||
console.warn('Error creating shader.'); | ||
return undefined; | ||
@@ -38,12 +38,18 @@ } | ||
/** | ||
* Get shader unform location | ||
* Get shader unform location. | ||
* | ||
* @param uniform Uniform name | ||
* @return Uniform location | ||
* @param uniform Uniform name. | ||
* @return Uniform location. | ||
*/ | ||
getUniform(uniform) { | ||
if (this.program === undefined) { | ||
throw new Error("No program for shader."); | ||
throw new Error('No program for shader.'); | ||
} | ||
return this.gl.getUniformLocation(this.program, uniform); | ||
const result = this.gl.getUniformLocation(this.program, uniform); | ||
if (result !== null) { | ||
return result; | ||
} | ||
else { | ||
throw new Error(`Cannot get uniform "${uniform}".`); | ||
} | ||
} | ||
@@ -58,3 +64,3 @@ /** | ||
if (this.program === undefined) { | ||
throw new Error("No program for shader."); | ||
throw new Error('No program for shader.'); | ||
} | ||
@@ -104,3 +110,2 @@ return this.gl.getAttribLocation(this.program, attrib); | ||
exports.BaseShader = BaseShader; | ||
; | ||
//# sourceMappingURL=BaseShader.js.map |
@@ -27,8 +27,8 @@ export declare abstract class BaseShader { | ||
/** | ||
* Get shader unform location | ||
* Get shader unform location. | ||
* | ||
* @param uniform Uniform name | ||
* @return Uniform location | ||
* @param uniform Uniform name. | ||
* @return Uniform location. | ||
*/ | ||
getUniform(uniform: string): WebGLUniformLocation | null; | ||
getUniform(uniform: string): WebGLUniformLocation; | ||
/** | ||
@@ -35,0 +35,0 @@ * Get shader attribute location |
@@ -154,4 +154,4 @@ class FullScreenUtils { | ||
this.gl = gl; | ||
this.vertexShaderCode = ""; | ||
this.fragmentShaderCode = ""; | ||
this.vertexShaderCode = ''; | ||
this.fragmentShaderCode = ''; | ||
this.fillCode(); | ||
@@ -170,3 +170,3 @@ this.initShader(); | ||
if (!shader) { | ||
console.warn("Error creating shader."); | ||
console.warn('Error creating shader.'); | ||
return undefined; | ||
@@ -183,12 +183,18 @@ } | ||
/** | ||
* Get shader unform location | ||
* Get shader unform location. | ||
* | ||
* @param uniform Uniform name | ||
* @return Uniform location | ||
* @param uniform Uniform name. | ||
* @return Uniform location. | ||
*/ | ||
getUniform(uniform) { | ||
if (this.program === undefined) { | ||
throw new Error("No program for shader."); | ||
throw new Error('No program for shader.'); | ||
} | ||
return this.gl.getUniformLocation(this.program, uniform); | ||
const result = this.gl.getUniformLocation(this.program, uniform); | ||
if (result !== null) { | ||
return result; | ||
} | ||
else { | ||
throw new Error(`Cannot get uniform "${uniform}".`); | ||
} | ||
} | ||
@@ -203,3 +209,3 @@ /** | ||
if (this.program === undefined) { | ||
throw new Error("No program for shader."); | ||
throw new Error('No program for shader.'); | ||
} | ||
@@ -206,0 +212,0 @@ return this.gl.getAttribLocation(this.program, attrib); |
@@ -160,4 +160,4 @@ (function (global, factory) { | ||
this.gl = gl; | ||
this.vertexShaderCode = ""; | ||
this.fragmentShaderCode = ""; | ||
this.vertexShaderCode = ''; | ||
this.fragmentShaderCode = ''; | ||
this.fillCode(); | ||
@@ -176,3 +176,3 @@ this.initShader(); | ||
if (!shader) { | ||
console.warn("Error creating shader."); | ||
console.warn('Error creating shader.'); | ||
return undefined; | ||
@@ -189,12 +189,18 @@ } | ||
/** | ||
* Get shader unform location | ||
* Get shader unform location. | ||
* | ||
* @param uniform Uniform name | ||
* @return Uniform location | ||
* @param uniform Uniform name. | ||
* @return Uniform location. | ||
*/ | ||
getUniform(uniform) { | ||
if (this.program === undefined) { | ||
throw new Error("No program for shader."); | ||
throw new Error('No program for shader.'); | ||
} | ||
return this.gl.getUniformLocation(this.program, uniform); | ||
const result = this.gl.getUniformLocation(this.program, uniform); | ||
if (result !== null) { | ||
return result; | ||
} | ||
else { | ||
throw new Error(`Cannot get uniform "${uniform}".`); | ||
} | ||
} | ||
@@ -209,3 +215,3 @@ /** | ||
if (this.program === undefined) { | ||
throw new Error("No program for shader."); | ||
throw new Error('No program for shader.'); | ||
} | ||
@@ -212,0 +218,0 @@ return this.gl.getAttribLocation(this.program, attrib); |
{ | ||
"name": "webgl-framework", | ||
"version": "2.0.1-beta", | ||
"version": "2.0.2-beta", | ||
"description": "Basic low-level WebGL framework", | ||
@@ -5,0 +5,0 @@ "author": "Oleksandr Popov (github.com/keaukraine/)", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2574
211557