Clean up WebGL provides

This commit is contained in:
Tim Schaub
2016-08-06 14:28:50 -06:00
parent 1b8310a6fe
commit 12e81e5487
18 changed files with 474 additions and 484 deletions

View File

@@ -233,8 +233,8 @@ ol.webgl.Context.prototype.getShader = function(shaderObject) {
* 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
* cache.
* @param {ol.webgl.shader.Fragment} fragmentShaderObject Fragment shader.
* @param {ol.webgl.shader.Vertex} vertexShaderObject Vertex shader.
* @param {ol.webgl.Fragment} fragmentShaderObject Fragment shader.
* @param {ol.webgl.Vertex} vertexShaderObject Vertex shader.
* @return {WebGLProgram} Program.
*/
ol.webgl.Context.prototype.getProgram = function(

25
src/ol/webgl/fragment.js Normal file
View File

@@ -0,0 +1,25 @@
goog.provide('ol.webgl.Fragment');
goog.require('ol');
goog.require('ol.webgl');
goog.require('ol.webgl.Shader');
/**
* @constructor
* @extends {ol.webgl.Shader}
* @param {string} source Source.
* @struct
*/
ol.webgl.Fragment = function(source) {
ol.webgl.Shader.call(this, source);
};
ol.inherits(ol.webgl.Fragment, ol.webgl.Shader);
/**
* @inheritDoc
*/
ol.webgl.Fragment.prototype.getType = function() {
return ol.webgl.FRAGMENT_SHADER;
};

View File

@@ -1,7 +1,4 @@
goog.provide('ol.webgl.Fragment');
goog.provide('ol.webgl.Shader');
goog.provide('ol.webgl.Vertex');
goog.provide('ol.webgl.shader');
goog.require('ol.functions');
goog.require('ol.webgl');
@@ -42,43 +39,3 @@ ol.webgl.Shader.prototype.getSource = function() {
* @return {boolean} Is animated?
*/
ol.webgl.Shader.prototype.isAnimated = ol.functions.FALSE;
/**
* @constructor
* @extends {ol.webgl.Shader}
* @param {string} source Source.
* @struct
*/
ol.webgl.shader.Fragment = function(source) {
ol.webgl.Shader.call(this, source);
};
ol.inherits(ol.webgl.shader.Fragment, ol.webgl.Shader);
/**
* @inheritDoc
*/
ol.webgl.shader.Fragment.prototype.getType = function() {
return ol.webgl.FRAGMENT_SHADER;
};
/**
* @constructor
* @extends {ol.webgl.Shader}
* @param {string} source Source.
* @struct
*/
ol.webgl.shader.Vertex = function(source) {
ol.webgl.Shader.call(this, source);
};
ol.inherits(ol.webgl.shader.Vertex, ol.webgl.Shader);
/**
* @inheritDoc
*/
ol.webgl.shader.Vertex.prototype.getType = function() {
return ol.webgl.VERTEX_SHADER;
};

View File

@@ -1,80 +1,78 @@
// This file is automatically generated, do not edit
goog.provide('{{namespace}}');
goog.provide('{{namespace}}.Locations');
goog.provide('{{className}}Fragment');
goog.provide('{{className}}Vertex');
goog.require('ol.webgl.shader');
goog.require('ol.webgl.Fragment');
goog.require('ol.webgl.Vertex');
/**
* @constructor
* @extends {ol.webgl.shader.Fragment}
* @extends {ol.webgl.Fragment}
* @struct
*/
{{className}}Fragment = function() {
ol.webgl.shader.Fragment.call(this, {{className}}Fragment.SOURCE);
{{className}}.Fragment = function() {
ol.webgl.Fragment.call(this, {{className}}.Fragment.SOURCE);
};
ol.inherits({{className}}Fragment, ol.webgl.shader.Fragment);
goog.addSingletonGetter({{className}}Fragment);
ol.inherits({{className}}.Fragment, ol.webgl.Fragment);
goog.addSingletonGetter({{className}}.Fragment);
/**
* @const
* @type {string}
*/
{{className}}Fragment.DEBUG_SOURCE = 'precision mediump float;\n{{{getOriginalFragmentSource}}}';
{{className}}.Fragment.DEBUG_SOURCE = 'precision mediump float;\n{{{getOriginalFragmentSource}}}';
/**
* @const
* @type {string}
*/
{{className}}Fragment.OPTIMIZED_SOURCE = 'precision mediump float;{{{getFragmentSource}}}';
{{className}}.Fragment.OPTIMIZED_SOURCE = 'precision mediump float;{{{getFragmentSource}}}';
/**
* @const
* @type {string}
*/
{{className}}Fragment.SOURCE = goog.DEBUG ?
{{className}}Fragment.DEBUG_SOURCE :
{{className}}Fragment.OPTIMIZED_SOURCE;
{{className}}.Fragment.SOURCE = goog.DEBUG ?
{{className}}.Fragment.DEBUG_SOURCE :
{{className}}.Fragment.OPTIMIZED_SOURCE;
/**
* @constructor
* @extends {ol.webgl.shader.Vertex}
* @extends {ol.webgl.Vertex}
* @struct
*/
{{className}}Vertex = function() {
ol.webgl.shader.Vertex.call(this, {{className}}Vertex.SOURCE);
{{className}}.Vertex = function() {
ol.webgl.Vertex.call(this, {{className}}.Vertex.SOURCE);
};
ol.inherits({{className}}Vertex, ol.webgl.shader.Vertex);
goog.addSingletonGetter({{className}}Vertex);
ol.inherits({{className}}.Vertex, ol.webgl.Vertex);
goog.addSingletonGetter({{className}}.Vertex);
/**
* @const
* @type {string}
*/
{{className}}Vertex.DEBUG_SOURCE = '{{{getOriginalVertexSource}}}';
{{className}}.Vertex.DEBUG_SOURCE = '{{{getOriginalVertexSource}}}';
/**
* @const
* @type {string}
*/
{{className}}Vertex.OPTIMIZED_SOURCE = '{{{getVertexSource}}}';
{{className}}.Vertex.OPTIMIZED_SOURCE = '{{{getVertexSource}}}';
/**
* @const
* @type {string}
*/
{{className}}Vertex.SOURCE = goog.DEBUG ?
{{className}}Vertex.DEBUG_SOURCE :
{{className}}Vertex.OPTIMIZED_SOURCE;
{{className}}.Vertex.SOURCE = goog.DEBUG ?
{{className}}.Vertex.DEBUG_SOURCE :
{{className}}.Vertex.OPTIMIZED_SOURCE;
/**

25
src/ol/webgl/vertex.js Normal file
View File

@@ -0,0 +1,25 @@
goog.provide('ol.webgl.Vertex');
goog.require('ol');
goog.require('ol.webgl');
goog.require('ol.webgl.Shader');
/**
* @constructor
* @extends {ol.webgl.Shader}
* @param {string} source Source.
* @struct
*/
ol.webgl.Vertex = function(source) {
ol.webgl.Shader.call(this, source);
};
ol.inherits(ol.webgl.Vertex, ol.webgl.Shader);
/**
* @inheritDoc
*/
ol.webgl.Vertex.prototype.getType = function() {
return ol.webgl.VERTEX_SHADER;
};