Wrap ol.webgl code in define condition
This commit is contained in:
+16
-12
@@ -4,13 +4,15 @@ goog.require('ol');
|
|||||||
goog.require('ol.webgl');
|
goog.require('ol.webgl');
|
||||||
|
|
||||||
|
|
||||||
/**
|
if (ol.ENABLE_WEBGL) {
|
||||||
|
|
||||||
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Array.<number>=} opt_arr Array.
|
* @param {Array.<number>=} opt_arr Array.
|
||||||
* @param {number=} opt_usage Usage.
|
* @param {number=} opt_usage Usage.
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
ol.webgl.Buffer = function(opt_arr, opt_usage) {
|
ol.webgl.Buffer = function(opt_arr, opt_usage) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -25,31 +27,33 @@ ol.webgl.Buffer = function(opt_arr, opt_usage) {
|
|||||||
this.usage_ = opt_usage !== undefined ?
|
this.usage_ = opt_usage !== undefined ?
|
||||||
opt_usage : ol.webgl.Buffer.Usage_.STATIC_DRAW;
|
opt_usage : ol.webgl.Buffer.Usage_.STATIC_DRAW;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Array.<number>} Array.
|
* @return {Array.<number>} Array.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Buffer.prototype.getArray = function() {
|
ol.webgl.Buffer.prototype.getArray = function() {
|
||||||
return this.arr_;
|
return this.arr_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {number} Usage.
|
* @return {number} Usage.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Buffer.prototype.getUsage = function() {
|
ol.webgl.Buffer.prototype.getUsage = function() {
|
||||||
return this.usage_;
|
return this.usage_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.webgl.Buffer.Usage_ = {
|
ol.webgl.Buffer.Usage_ = {
|
||||||
STATIC_DRAW: ol.webgl.STATIC_DRAW,
|
STATIC_DRAW: ol.webgl.STATIC_DRAW,
|
||||||
STREAM_DRAW: ol.webgl.STREAM_DRAW,
|
STREAM_DRAW: ol.webgl.STREAM_DRAW,
|
||||||
DYNAMIC_DRAW: ol.webgl.DYNAMIC_DRAW
|
DYNAMIC_DRAW: ol.webgl.DYNAMIC_DRAW
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
+53
-49
@@ -9,7 +9,9 @@ goog.require('ol.webgl');
|
|||||||
goog.require('ol.webgl.ContextEventType');
|
goog.require('ol.webgl.ContextEventType');
|
||||||
|
|
||||||
|
|
||||||
/**
|
if (ol.ENABLE_WEBGL) {
|
||||||
|
|
||||||
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* A WebGL context for accessing low-level WebGL capabilities.
|
* A WebGL context for accessing low-level WebGL capabilities.
|
||||||
*
|
*
|
||||||
@@ -18,7 +20,7 @@ goog.require('ol.webgl.ContextEventType');
|
|||||||
* @param {HTMLCanvasElement} canvas Canvas.
|
* @param {HTMLCanvasElement} canvas Canvas.
|
||||||
* @param {WebGLRenderingContext} gl GL.
|
* @param {WebGLRenderingContext} gl GL.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context = function(canvas, gl) {
|
ol.webgl.Context = function(canvas, gl) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -90,18 +92,18 @@ ol.webgl.Context = function(canvas, gl) {
|
|||||||
ol.events.listen(this.canvas_, ol.webgl.ContextEventType.RESTORED,
|
ol.events.listen(this.canvas_, ol.webgl.ContextEventType.RESTORED,
|
||||||
this.handleWebGLContextRestored, this);
|
this.handleWebGLContextRestored, this);
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.webgl.Context, ol.Disposable);
|
ol.inherits(ol.webgl.Context, ol.Disposable);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just bind the buffer if it's in the cache. Otherwise create
|
* Just bind the buffer if it's in the cache. Otherwise create
|
||||||
* the WebGL buffer, bind it, populate it, and add an entry to
|
* the WebGL buffer, bind it, populate it, and add an entry to
|
||||||
* the cache.
|
* the cache.
|
||||||
* @param {number} target Target.
|
* @param {number} target Target.
|
||||||
* @param {ol.webgl.Buffer} buf Buffer.
|
* @param {ol.webgl.Buffer} buf Buffer.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.bindBuffer = function(target, buf) {
|
ol.webgl.Context.prototype.bindBuffer = function(target, buf) {
|
||||||
var gl = this.getGL();
|
var gl = this.getGL();
|
||||||
var arr = buf.getArray();
|
var arr = buf.getArray();
|
||||||
var bufferKey = String(ol.getUid(buf));
|
var bufferKey = String(ol.getUid(buf));
|
||||||
@@ -124,13 +126,13 @@ ol.webgl.Context.prototype.bindBuffer = function(target, buf) {
|
|||||||
buffer: buffer
|
buffer: buffer
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.webgl.Buffer} buf Buffer.
|
* @param {ol.webgl.Buffer} buf Buffer.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.deleteBuffer = function(buf) {
|
ol.webgl.Context.prototype.deleteBuffer = function(buf) {
|
||||||
var gl = this.getGL();
|
var gl = this.getGL();
|
||||||
var bufferKey = String(ol.getUid(buf));
|
var bufferKey = String(ol.getUid(buf));
|
||||||
var bufferCacheEntry = this.bufferCache_[bufferKey];
|
var bufferCacheEntry = this.bufferCache_[bufferKey];
|
||||||
@@ -138,13 +140,13 @@ ol.webgl.Context.prototype.deleteBuffer = function(buf) {
|
|||||||
gl.deleteBuffer(bufferCacheEntry.buffer);
|
gl.deleteBuffer(bufferCacheEntry.buffer);
|
||||||
}
|
}
|
||||||
delete this.bufferCache_[bufferKey];
|
delete this.bufferCache_[bufferKey];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.disposeInternal = function() {
|
ol.webgl.Context.prototype.disposeInternal = function() {
|
||||||
ol.events.unlistenAll(this.canvas_);
|
ol.events.unlistenAll(this.canvas_);
|
||||||
var gl = this.getGL();
|
var gl = this.getGL();
|
||||||
if (!gl.isContextLost()) {
|
if (!gl.isContextLost()) {
|
||||||
@@ -163,46 +165,46 @@ ol.webgl.Context.prototype.disposeInternal = function() {
|
|||||||
gl.deleteRenderbuffer(this.hitDetectionRenderbuffer_);
|
gl.deleteRenderbuffer(this.hitDetectionRenderbuffer_);
|
||||||
gl.deleteTexture(this.hitDetectionTexture_);
|
gl.deleteTexture(this.hitDetectionTexture_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {HTMLCanvasElement} Canvas.
|
* @return {HTMLCanvasElement} Canvas.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.getCanvas = function() {
|
ol.webgl.Context.prototype.getCanvas = function() {
|
||||||
return this.canvas_;
|
return this.canvas_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the WebGL rendering context
|
* Get the WebGL rendering context
|
||||||
* @return {WebGLRenderingContext} The rendering context.
|
* @return {WebGLRenderingContext} The rendering context.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.getGL = function() {
|
ol.webgl.Context.prototype.getGL = function() {
|
||||||
return this.gl_;
|
return this.gl_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the frame buffer for hit detection.
|
* Get the frame buffer for hit detection.
|
||||||
* @return {WebGLFramebuffer} The hit detection frame buffer.
|
* @return {WebGLFramebuffer} The hit detection frame buffer.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.getHitDetectionFramebuffer = function() {
|
ol.webgl.Context.prototype.getHitDetectionFramebuffer = function() {
|
||||||
if (!this.hitDetectionFramebuffer_) {
|
if (!this.hitDetectionFramebuffer_) {
|
||||||
this.initHitDetectionFramebuffer_();
|
this.initHitDetectionFramebuffer_();
|
||||||
}
|
}
|
||||||
return this.hitDetectionFramebuffer_;
|
return this.hitDetectionFramebuffer_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get shader from the cache if it's in the cache. Otherwise, create
|
* Get shader from the cache if it's in the cache. Otherwise, create
|
||||||
* the WebGL shader, compile it, and add entry to cache.
|
* the WebGL shader, compile it, and add entry to cache.
|
||||||
* @param {ol.webgl.Shader} shaderObject Shader object.
|
* @param {ol.webgl.Shader} shaderObject Shader object.
|
||||||
* @return {WebGLShader} Shader.
|
* @return {WebGLShader} Shader.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.getShader = function(shaderObject) {
|
ol.webgl.Context.prototype.getShader = function(shaderObject) {
|
||||||
var shaderKey = String(ol.getUid(shaderObject));
|
var shaderKey = String(ol.getUid(shaderObject));
|
||||||
if (shaderKey in this.shaderCache_) {
|
if (shaderKey in this.shaderCache_) {
|
||||||
return this.shaderCache_[shaderKey];
|
return this.shaderCache_[shaderKey];
|
||||||
@@ -214,10 +216,10 @@ ol.webgl.Context.prototype.getShader = function(shaderObject) {
|
|||||||
this.shaderCache_[shaderKey] = shader;
|
this.shaderCache_[shaderKey] = shader;
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the program from the cache if it's in the cache. Otherwise create
|
* Get the program from the cache if it's in the cache. Otherwise create
|
||||||
* the WebGL program, attach the shaders to it, and add an entry to the
|
* the WebGL program, attach the shaders to it, and add an entry to the
|
||||||
* cache.
|
* cache.
|
||||||
@@ -225,7 +227,7 @@ ol.webgl.Context.prototype.getShader = function(shaderObject) {
|
|||||||
* @param {ol.webgl.Vertex} vertexShaderObject Vertex shader.
|
* @param {ol.webgl.Vertex} vertexShaderObject Vertex shader.
|
||||||
* @return {WebGLProgram} Program.
|
* @return {WebGLProgram} Program.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.getProgram = function(
|
ol.webgl.Context.prototype.getProgram = function(
|
||||||
fragmentShaderObject, vertexShaderObject) {
|
fragmentShaderObject, vertexShaderObject) {
|
||||||
var programKey =
|
var programKey =
|
||||||
ol.getUid(fragmentShaderObject) + '/' + ol.getUid(vertexShaderObject);
|
ol.getUid(fragmentShaderObject) + '/' + ol.getUid(vertexShaderObject);
|
||||||
@@ -240,13 +242,13 @@ ol.webgl.Context.prototype.getProgram = function(
|
|||||||
this.programCache_[programKey] = program;
|
this.programCache_[programKey] = program;
|
||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME empy description for jsdoc
|
* FIXME empy description for jsdoc
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.handleWebGLContextLost = function() {
|
ol.webgl.Context.prototype.handleWebGLContextLost = function() {
|
||||||
ol.obj.clear(this.bufferCache_);
|
ol.obj.clear(this.bufferCache_);
|
||||||
ol.obj.clear(this.shaderCache_);
|
ol.obj.clear(this.shaderCache_);
|
||||||
ol.obj.clear(this.programCache_);
|
ol.obj.clear(this.programCache_);
|
||||||
@@ -254,21 +256,21 @@ ol.webgl.Context.prototype.handleWebGLContextLost = function() {
|
|||||||
this.hitDetectionFramebuffer_ = null;
|
this.hitDetectionFramebuffer_ = null;
|
||||||
this.hitDetectionTexture_ = null;
|
this.hitDetectionTexture_ = null;
|
||||||
this.hitDetectionRenderbuffer_ = null;
|
this.hitDetectionRenderbuffer_ = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME empy description for jsdoc
|
* FIXME empy description for jsdoc
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.handleWebGLContextRestored = function() {
|
ol.webgl.Context.prototype.handleWebGLContextRestored = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a 1x1 pixel framebuffer for the hit-detection.
|
* Creates a 1x1 pixel framebuffer for the hit-detection.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.initHitDetectionFramebuffer_ = function() {
|
ol.webgl.Context.prototype.initHitDetectionFramebuffer_ = function() {
|
||||||
var gl = this.gl_;
|
var gl = this.gl_;
|
||||||
var framebuffer = gl.createFramebuffer();
|
var framebuffer = gl.createFramebuffer();
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
||||||
@@ -289,16 +291,16 @@ ol.webgl.Context.prototype.initHitDetectionFramebuffer_ = function() {
|
|||||||
this.hitDetectionFramebuffer_ = framebuffer;
|
this.hitDetectionFramebuffer_ = framebuffer;
|
||||||
this.hitDetectionTexture_ = texture;
|
this.hitDetectionTexture_ = texture;
|
||||||
this.hitDetectionRenderbuffer_ = renderbuffer;
|
this.hitDetectionRenderbuffer_ = renderbuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use a program. If the program is already in use, this will return `false`.
|
* Use a program. If the program is already in use, this will return `false`.
|
||||||
* @param {WebGLProgram} program Program.
|
* @param {WebGLProgram} program Program.
|
||||||
* @return {boolean} Changed.
|
* @return {boolean} Changed.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.prototype.useProgram = function(program) {
|
ol.webgl.Context.prototype.useProgram = function(program) {
|
||||||
if (program == this.currentProgram_) {
|
if (program == this.currentProgram_) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -307,17 +309,17 @@ ol.webgl.Context.prototype.useProgram = function(program) {
|
|||||||
this.currentProgram_ = program;
|
this.currentProgram_ = program;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {WebGLRenderingContext} gl WebGL rendering context.
|
* @param {WebGLRenderingContext} gl WebGL rendering context.
|
||||||
* @param {number=} opt_wrapS wrapS.
|
* @param {number=} opt_wrapS wrapS.
|
||||||
* @param {number=} opt_wrapT wrapT.
|
* @param {number=} opt_wrapT wrapT.
|
||||||
* @return {WebGLTexture} The texture.
|
* @return {WebGLTexture} The texture.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
|
ol.webgl.Context.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
|
||||||
var texture = gl.createTexture();
|
var texture = gl.createTexture();
|
||||||
gl.bindTexture(gl.TEXTURE_2D, texture);
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
||||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||||
@@ -333,10 +335,10 @@ ol.webgl.Context.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {WebGLRenderingContext} gl WebGL rendering context.
|
* @param {WebGLRenderingContext} gl WebGL rendering context.
|
||||||
* @param {number} width Width.
|
* @param {number} width Width.
|
||||||
* @param {number} height Height.
|
* @param {number} height Height.
|
||||||
@@ -344,7 +346,7 @@ ol.webgl.Context.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
|
|||||||
* @param {number=} opt_wrapT wrapT.
|
* @param {number=} opt_wrapT wrapT.
|
||||||
* @return {WebGLTexture} The texture.
|
* @return {WebGLTexture} The texture.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.createEmptyTexture = function(
|
ol.webgl.Context.createEmptyTexture = function(
|
||||||
gl, width, height, opt_wrapS, opt_wrapT) {
|
gl, width, height, opt_wrapS, opt_wrapT) {
|
||||||
var texture = ol.webgl.Context.createTexture_(gl, opt_wrapS, opt_wrapT);
|
var texture = ol.webgl.Context.createTexture_(gl, opt_wrapS, opt_wrapT);
|
||||||
gl.texImage2D(
|
gl.texImage2D(
|
||||||
@@ -352,20 +354,22 @@ ol.webgl.Context.createEmptyTexture = function(
|
|||||||
null);
|
null);
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {WebGLRenderingContext} gl WebGL rendering context.
|
* @param {WebGLRenderingContext} gl WebGL rendering context.
|
||||||
* @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image.
|
* @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image.
|
||||||
* @param {number=} opt_wrapS wrapS.
|
* @param {number=} opt_wrapS wrapS.
|
||||||
* @param {number=} opt_wrapT wrapT.
|
* @param {number=} opt_wrapT wrapT.
|
||||||
* @return {WebGLTexture} The texture.
|
* @return {WebGLTexture} The texture.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Context.createTexture = function(gl, image, opt_wrapS, opt_wrapT) {
|
ol.webgl.Context.createTexture = function(gl, image, opt_wrapS, opt_wrapT) {
|
||||||
var texture = ol.webgl.Context.createTexture_(gl, opt_wrapS, opt_wrapT);
|
var texture = ol.webgl.Context.createTexture_(gl, opt_wrapS, opt_wrapT);
|
||||||
gl.texImage2D(
|
gl.texImage2D(
|
||||||
gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,21 +5,25 @@ goog.require('ol.webgl');
|
|||||||
goog.require('ol.webgl.Shader');
|
goog.require('ol.webgl.Shader');
|
||||||
|
|
||||||
|
|
||||||
/**
|
if (ol.ENABLE_WEBGL) {
|
||||||
|
|
||||||
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.webgl.Shader}
|
* @extends {ol.webgl.Shader}
|
||||||
* @param {string} source Source.
|
* @param {string} source Source.
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
ol.webgl.Fragment = function(source) {
|
ol.webgl.Fragment = function(source) {
|
||||||
ol.webgl.Shader.call(this, source);
|
ol.webgl.Shader.call(this, source);
|
||||||
};
|
};
|
||||||
ol.inherits(ol.webgl.Fragment, ol.webgl.Shader);
|
ol.inherits(ol.webgl.Fragment, ol.webgl.Shader);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.webgl.Fragment.prototype.getType = function() {
|
ol.webgl.Fragment.prototype.getType = function() {
|
||||||
return ol.webgl.FRAGMENT_SHADER;
|
return ol.webgl.FRAGMENT_SHADER;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
+14
-10
@@ -4,12 +4,14 @@ goog.require('ol.functions');
|
|||||||
goog.require('ol.webgl');
|
goog.require('ol.webgl');
|
||||||
|
|
||||||
|
|
||||||
/**
|
if (ol.ENABLE_WEBGL) {
|
||||||
|
|
||||||
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {string} source Source.
|
* @param {string} source Source.
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
ol.webgl.Shader = function(source) {
|
ol.webgl.Shader = function(source) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -17,25 +19,27 @@ ol.webgl.Shader = function(source) {
|
|||||||
*/
|
*/
|
||||||
this.source_ = source;
|
this.source_ = source;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract
|
* @abstract
|
||||||
* @return {number} Type.
|
* @return {number} Type.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Shader.prototype.getType = function() {};
|
ol.webgl.Shader.prototype.getType = function() {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string} Source.
|
* @return {string} Source.
|
||||||
*/
|
*/
|
||||||
ol.webgl.Shader.prototype.getSource = function() {
|
ol.webgl.Shader.prototype.getSource = function() {
|
||||||
return this.source_;
|
return this.source_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean} Is animated?
|
* @return {boolean} Is animated?
|
||||||
*/
|
*/
|
||||||
ol.webgl.Shader.prototype.isAnimated = ol.functions.FALSE;
|
ol.webgl.Shader.prototype.isAnimated = ol.functions.FALSE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
+11
-7
@@ -5,21 +5,25 @@ goog.require('ol.webgl');
|
|||||||
goog.require('ol.webgl.Shader');
|
goog.require('ol.webgl.Shader');
|
||||||
|
|
||||||
|
|
||||||
/**
|
if (ol.ENABLE_WEBGL) {
|
||||||
|
|
||||||
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.webgl.Shader}
|
* @extends {ol.webgl.Shader}
|
||||||
* @param {string} source Source.
|
* @param {string} source Source.
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
ol.webgl.Vertex = function(source) {
|
ol.webgl.Vertex = function(source) {
|
||||||
ol.webgl.Shader.call(this, source);
|
ol.webgl.Shader.call(this, source);
|
||||||
};
|
};
|
||||||
ol.inherits(ol.webgl.Vertex, ol.webgl.Shader);
|
ol.inherits(ol.webgl.Vertex, ol.webgl.Shader);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.webgl.Vertex.prototype.getType = function() {
|
ol.webgl.Vertex.prototype.getType = function() {
|
||||||
return ol.webgl.VERTEX_SHADER;
|
return ol.webgl.VERTEX_SHADER;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user