Webgl worker / add tests, some typing and documentation
The worker currently works by receiving GENERATE_BUFFERS messages and will send back the same kind of message, with the generated buffers attached. All properties of the original message are kept, so that when a GENERATE_BUFFERS message comes back to the main thread it is possible to know what and how the buffers where generated. This is typically used for the `projectionTransform` matrix, and will also be necessary when working with tiles.
This commit is contained in:
@@ -5,6 +5,26 @@ import LayerRenderer from '../Layer.js';
|
||||
import WebGLHelper from '../../webgl/Helper.js';
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
export const WebGLWorkerMessageType = {
|
||||
GENERATE_BUFFERS: 'GENERATE_BUFFERS'
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {Object} WebGLWorkerGenerateBuffersMessage
|
||||
* This message will trigger the generation of a vertex and an index buffer based on the given render instructions.
|
||||
* When the buffers are generated, the worked will send a message of the same type to the main thread, with
|
||||
* the generated buffers in it.
|
||||
* Note that any addition properties present in the message *will* be sent back to the main thread.
|
||||
* @property {WebGLWorkerMessageType} type Message type
|
||||
* @property {ArrayBuffer} renderInstructions Render instructions raw binary buffer.
|
||||
* @property {ArrayBuffer=} vertexBuffer Vertices array raw binary buffer (sent by the worker).
|
||||
* @property {ArrayBuffer=} indexBuffer Indices array raw binary buffer (sent by the worker).
|
||||
* @property {number=} customAttributesCount Amount of custom attributes count in the render instructions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} PostProcessesOptions
|
||||
* @property {number} [scaleRatio] Scale ratio; if < 1, the post process will render to a texture smaller than
|
||||
|
||||
Reference in New Issue
Block a user