Classes
Members
-
module:ol/webgl/Helper.AttributeType{number}
-
Attribute types, either
UNSIGNED_BYTE
,UNSIGNED_SHORT
,UNSIGNED_INT
orFLOAT
Note: an attribute stored in aFloat32Array
should be of typeFLOAT
. -
module:ol/webgl/Helper.DefaultUniform{string}
-
Uniform names used in the default shaders:
PROJECTION_MATRIX
,OFFSET_SCALE_MATRIX
. andOFFSET_ROTATION_MATRIX
. -
module:ol/webgl/Helper.ShaderType{number}
-
Shader types, either
FRAGMENT_SHADER
orVERTEX_SHADER
.
Methods
-
import {computeAttributesStride} from 'ol/webgl/Helper';
Compute a stride in bytes based on a list of attributes
Name Type Description attributes
Array.<module:ol/webgl/Helper~AttributeDescription> Ordered list of attributes
Returns:
Stride, ie amount of values for each vertex in the vertex buffer
Type Definitions
-
AttributeDescription{Object}
-
Description of an attribute in a buffer
Properties:
Name Type Argument Description name
string Attribute name to use in shaders
size
number Number of components per attributes
type
module:ol/webgl/Helper~AttributeType <optional>
Attribute type, i.e. number of bytes used to store the value. This is determined by the class of typed array which the buffer uses (eg.
Float32Array
for aFLOAT
attribute). Default isFLOAT
. -
BufferCacheEntry{Object}
-
Properties:
Name Type Description buffer
module:ol/webgl/Buffer~WebGLArrayBuffer Buffer.
webGlBuffer
WebGLBuffer WebGlBuffer.
-
Options{Object}
-
Properties:
Name Type Argument Description uniforms
Object.<string, module:ol/webgl/Helper~UniformValue> <optional>
Uniform definitions; property names must match the uniform names in the provided or default shaders.
postProcesses
Array.<module:ol/webgl/Helper~PostProcessesOptions> <optional>
Post-processes definitions
-
PostProcessesOptions{Object}
-
Properties:
Name Type Argument Description scaleRatio
number <optional>
Scale ratio; if < 1, the post process will render to a texture smaller than the main canvas which will then be sampled up (useful for saving resource on blur steps).
vertexShader
string <optional>
Vertex shader source
fragmentShader
string <optional>
Fragment shader source
uniforms
Object.<string, module:ol/webgl/Helper~UniformValue> <optional>
Uniform definitions for the post process step
-
UniformLiteralValue{number} {Array.<number>} {HTMLCanvasElement} {HTMLImageElement} {ImageData} {module:ol/transform~Transform}
-
-
Uniform value can be a number, array of numbers (2 to 4), canvas element or a callback returning one of the previous types.