@hscmap/gl-wrapper
Advanced tools
Comparing version 0.6.1 to 0.6.2
export declare type ImageLike = HTMLImageElement | HTMLCanvasElement | ImageData; | ||
export declare class Texture { | ||
private gl; | ||
private name; | ||
constructor(gl: WebGLRenderingContext); | ||
readonly name: WebGLTexture; | ||
constructor(gl: WebGLRenderingContext, parameterSetter?: (gl: WebGLRenderingContext) => void); | ||
release(): void; | ||
@@ -7,0 +7,0 @@ bind(cb: () => void): void; |
@@ -5,12 +5,7 @@ "use strict"; | ||
var Texture = (function () { | ||
function Texture(gl) { | ||
function Texture(gl, parameterSetter) { | ||
var _this = this; | ||
this.gl = gl; | ||
this.name = glUtils.nonNull(gl.createTexture()); | ||
this.bind(function () { | ||
gl.texParameteri(_this.gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); | ||
gl.texParameteri(_this.gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); | ||
gl.texParameteri(_this.gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); | ||
gl.texParameteri(_this.gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); | ||
}); | ||
this.bind(function () { return (parameterSetter || defaultParameterSetter)(_this.gl); }); | ||
} | ||
@@ -34,1 +29,7 @@ Texture.prototype.release = function () { | ||
exports.Texture = Texture; | ||
function defaultParameterSetter(gl) { | ||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); | ||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); | ||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); | ||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); | ||
} |
{ | ||
"name": "@hscmap/gl-wrapper", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./lib/index.d.ts", |
20629
464