Class: V1_0

WebGLModule.DataLoader.V1_0

new V1_0()

Data loader for WebGL 1.0. Must load the data based on dataIndexMapping: for (first) texture at index 0, obtain its global index at dataIndexMapping[0] use the global index to localize the texture chunk in the data use the local index to get the texture name the chunk must be loaded to. Note that loading with single texture and computing indices is not possible since some access surrounding pixels -> requirement of MIRRORED_REPEAT not implementable For details, please, see the implementation.
Source:

Members

loadersByType

Loader strategy based on toString result, extend with your type if necessary. If your type cannot use the given version strategy (TEXTURE UNITS), you have to re-define the whole API.
Source:

Methods

declare(indicesOfImages) → {string}

Declare elements in shader
Parameters:
Name Type Description
indicesOfImages Array.<number> mapping of shader to data index, i.e. if shader requests texture i, the texture is located in the data at indicesOfImages[i] index
Source:
Returns:
GLSL declaration (terminated with semicolon) of necessary elements for textures
Type
string

measure(index) → {string}

Measure texture size
Parameters:
Name Type Description
index number index of the texture
Source:
Returns:
GLSL expression (unterminated) to obtain texture size - vec2
Type
string

sample(index, vec2coords) → {string}

Sample texture
Parameters:
Name Type Description
index number | string texture index, must respect index re-mapping (see declare())
vec2coords string GLSL expression that evaluates to vec2
Source:
Returns:
GLSL expression (unterminated) that evaluates to vec4
Type
string

toBuffers(context, gl, program, wrap, filter, visualization)

Called when the program is being loaded (set as active)
Parameters:
Name Type Description
context WebGLModule
gl WebGLRenderingContext WebGL context
program WebGLProgram
wrap GLint required texture GL wrap value
filter GLint required texture GL filter value
visualization object reference to the visualization object
Source:

toCanvas(context, dataIndexMapping, visualization, data, tileBounds, program, gl)

Called when tile is processed
Parameters:
Name Type Description
context WebGLModule
dataIndexMapping array mapping of array indices to data indices, e.g. texture 0 for this shader corresponds to index dataIndexMapping[0] in the data array, -1 value used for textures not loaded
visualization object reference to the current active visualization object
data * data object, must contain all the data listed in WebGLModule.prototype.getSources() in the respective order, dataIndexMapping then points with index to this data; by default an Image object
tileBounds object tile size in pixels
Properties
Name Type Description
width number tile width
height number tile height
program WebGLProgram current WebGLProgram
gl WebGLRenderingContext
Source:

toCanvasFinish(context, dataIndexMapping, visualization, data, tileBounds, program, gl)

Todo docs Texture not necessary to re-initialize since we can reuse it straight away
Parameters:
Name Type Description
context
dataIndexMapping
visualization
data
tileBounds
program
gl
Source: