- Source:
Methods
generateVisualization(order, visualization, withHtml) → {object}
Create a visualization from the given JSON params
Parameters:
Name | Type | Description |
---|---|---|
order |
Array.<string> | keys of visualization.shader in which order to build the visualization the order: painter's algorithm: the last drawn is the most visible |
visualization |
object | |
withHtml |
boolean | whether html should be also created (false if no UI controls are desired) |
- Source:
Returns:
{string} object.vertex_shader vertex shader code
{string} object.fragment_shader fragment shader code
{string} object.html html for the UI
{number} object.usableShaders how many layers are going to be visualized
{(array|string[])} object.dataUrls ID's of data in use (keys of visualization.shaders object) in desired order
the data is guaranteed to arrive in this order (images stacked below each other in imageElement)
getTextureDimensionXY(order) → {string}
Get GLSL texture XY dimension
Parameters:
Name | Type | Description |
---|---|---|
order |
string | order number in the shader, available in vis.shaders[id].index |
- Source:
Returns:
vec2
getTextureSamplingCode(order, textureCoords) → {string}
Get GLSL texture sampling code
Parameters:
Name | Type | Description |
---|---|---|
order |
string | order number in the shader, available in vis.shaders[id].index |
textureCoords |
string | string representing GLSL code of valid texture coordinates e.g. 'tex_coords' or 'vec2(1.0, 0.0)' |
- Source:
Returns:
GLSL code that is correct in texture sampling wrt. WebGL version used
getVersion() → {string}
- Source:
Returns:
WebGL version used
globalCodeRequiredByShaderType(type) → {object}
Code to be included only once, required by given shader type (keys are considered global)
Parameters:
Name | Type | Description |
---|---|---|
type |
string | shader type |
- Source:
Returns:
global-scope code used by the shader in format
setBlendEquation(glslCode)
Blend equation sent from the outside, must be respected
Parameters:
Name | Type | Description |
---|---|---|
glslCode |
code for blending, using two variables: 'foreground', 'background' |
- Source:
Example
//The shader context must define the following:
vec4 some_blending_name_etc(in vec4 background, in vec4 foreground) {
// << glslCode >>
}
void blend_clip(vec4 input) {
//for details on clipping mask approach see show() below
// <
toBuffers(program, currentVisualization)
Called once program is switched to: initialize all necessary items
Parameters:
Name | Type | Description |
---|---|---|
program |
WebGLProgram | used program |
currentVisualization |
Visualization | JSON parameters used for this visualization |
- Source:
toCanvas(program, currentVisualization, imageElement, tileDimension, zoomLevel, pixelSize)
Draw on the canvas using given program
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
program |
WebGLProgram | used program | |||||||||
currentVisualization |
WebGLModule.VisualizationConfig | JSON parameters used for this visualization | |||||||||
imageElement |
object | image data | |||||||||
tileDimension |
object |
Properties
|
|||||||||
zoomLevel |
number | arbitrary number 1 (this is not very clean design, pass object load properties of?) used to pass OSD zoom level value | |||||||||
pixelSize |
number | arbitrary number 2 (this is not very clean design, pass object load properties of?) used to pass ratio of how many screen pixels a fragment spans on |
- Source: