@@ -12,12 +12,12 @@ export function convertStyleToShaders(style: FlatStyleLike | StyleShaders | Arra
1212export type Attributes = string ;
1313export namespace Attributes {
1414 let POSITION : string ;
15- let INDEX : string ;
15+ let LOCAL_POSITION : string ;
1616 let SEGMENT_START : string ;
1717 let SEGMENT_END : string ;
1818 let MEASURE_START : string ;
1919 let MEASURE_END : string ;
20- let PARAMETERS : string ;
20+ let ANGLE_TANGENT_SUM : string ;
2121 let JOIN_ANGLES : string ;
2222 let DISTANCE : string ;
2323}
@@ -44,19 +44,23 @@ export type AttributeDefinitions = {
4444export type UniformDefinitions = {
4545 [ x : string ] : import ( "../../webgl/Helper.js" ) . UniformValue ;
4646} ;
47+ /**
48+ * Buffers organized like so: [indicesBuffer, vertexAttributesBuffer, instanceAttributesBuffer]
49+ */
50+ export type WebGLArrayBufferSet = Array < WebGLArrayBuffer > ;
4751export type WebGLBuffers = {
4852 /**
4953 * Array containing indices and vertices buffers for polygons
5054 */
51- polygonBuffers : Array < WebGLArrayBuffer > ;
55+ polygonBuffers : WebGLArrayBufferSet ;
5256 /**
5357 * Array containing indices and vertices buffers for line strings
5458 */
55- lineStringBuffers : Array < WebGLArrayBuffer > ;
59+ lineStringBuffers : WebGLArrayBufferSet ;
5660 /**
5761 * Array containing indices and vertices buffers for points
5862 */
59- pointBuffers : Array < WebGLArrayBuffer > ;
63+ pointBuffers : WebGLArrayBufferSet ;
6064 /**
6165 * Inverse of the transform applied when generating buffers
6266 */
@@ -103,9 +107,17 @@ export type SubRenderPass = {
103107 */
104108 fragmentShader : string ;
105109 /**
106- * Attributes description
110+ * Attributes description, defined for each primitive vertex
107111 */
108112 attributesDesc : Array < import ( "../../webgl/Helper.js" ) . AttributeDescription > ;
113+ /**
114+ * Attributes description, defined once per primitive
115+ */
116+ instancedAttributesDesc : Array < import ( "../../webgl/Helper.js" ) . AttributeDescription > ;
117+ /**
118+ * Number of vertices per instance primitive in this render pass
119+ */
120+ instancePrimitiveVertexCount : number ;
109121 /**
110122 * Program; this has to be recreated if the helper is lost/changed
111123 */
@@ -137,11 +149,14 @@ export type RenderPass = {
137149 * @typedef {Object<string, AttributeDefinition> } AttributeDefinitions
138150 * @typedef {Object<string, import("../../webgl/Helper").UniformValue> } UniformDefinitions
139151 */
152+ /**
153+ * @typedef {Array<WebGLArrayBuffer> } WebGLArrayBufferSet Buffers organized like so: [indicesBuffer, vertexAttributesBuffer, instanceAttributesBuffer]
154+ */
140155/**
141156 * @typedef {Object } WebGLBuffers
142- * @property {Array<WebGLArrayBuffer> } polygonBuffers Array containing indices and vertices buffers for polygons
143- * @property {Array<WebGLArrayBuffer> } lineStringBuffers Array containing indices and vertices buffers for line strings
144- * @property {Array<WebGLArrayBuffer> } pointBuffers Array containing indices and vertices buffers for points
157+ * @property {WebGLArrayBufferSet } polygonBuffers Array containing indices and vertices buffers for polygons
158+ * @property {WebGLArrayBufferSet } lineStringBuffers Array containing indices and vertices buffers for line strings
159+ * @property {WebGLArrayBufferSet } pointBuffers Array containing indices and vertices buffers for points
145160 * @property {import("../../transform.js").Transform } invertVerticesTransform Inverse of the transform applied when generating buffers
146161 */
147162/**
@@ -171,7 +186,9 @@ export type RenderPass = {
171186 * @typedef {Object } SubRenderPass
172187 * @property {string } vertexShader Vertex shader
173188 * @property {string } fragmentShader Fragment shader
174- * @property {Array<import('../../webgl/Helper.js').AttributeDescription> } attributesDesc Attributes description
189+ * @property {Array<import('../../webgl/Helper.js').AttributeDescription> } attributesDesc Attributes description, defined for each primitive vertex
190+ * @property {Array<import('../../webgl/Helper.js').AttributeDescription> } instancedAttributesDesc Attributes description, defined once per primitive
191+ * @property {number } instancePrimitiveVertexCount Number of vertices per instance primitive in this render pass
175192 * @property {WebGLProgram } [program] Program; this has to be recreated if the helper is lost/changed
176193 */
177194/**
@@ -248,7 +265,7 @@ declare class VectorStyleRenderer {
248265 * @param {Float32Array|null } renderInstructions Render instructions
249266 * @param {import("../../geom/Geometry.js").Type } geometryType Geometry type
250267 * @param {import("../../transform.js").Transform } transform Transform to apply to coordinates
251- * @return {Promise<Array<WebGLArrayBuffer> >|null } Indices buffer and vertices buffer; null if nothing to render
268+ * @return {Promise<WebGLArrayBufferSet >|null } Indices buffer and vertices buffer; null if nothing to render
252269 * @private
253270 */
254271 private generateBuffersForType_ ;
@@ -261,9 +278,9 @@ declare class VectorStyleRenderer {
261278 render ( buffers : WebGLBuffers , frameState : import ( "../../Map.js" ) . FrameState , preRenderCallback : ( ) => void ) : void ;
262279 /**
263280 * @param {WebGLArrayBuffer } indicesBuffer Indices buffer
264- * @param {WebGLArrayBuffer } verticesBuffer Vertices buffer
265- * @param {WebGLProgram } program Program
266- * @param {Array<import('../../webgl/Helper.js').AttributeDescription> } attributes Attribute descriptions
281+ * @param {WebGLArrayBuffer } vertexAttributesBuffer Vertex attributes buffer
282+ * @param {WebGLArrayBuffer } instanceAttributesBuffer Instance attributes buffer
283+ * @param {SubRenderPass } subRenderPass Render pass (program, attributes, etc.) specific to one geometry type
267284 * @param {import("../../Map.js").FrameState } frameState Frame state.
268285 * @param {function(): void } preRenderCallback This callback will be called right before drawing, and can be used to set uniforms
269286 * @private
0 commit comments