@@ -12,12 +12,12 @@ export function convertStyleToShaders(style: FlatStyleLike | StyleShaders | Arra
12
12
export type Attributes = string ;
13
13
export namespace Attributes {
14
14
let POSITION : string ;
15
- let INDEX : string ;
15
+ let LOCAL_POSITION : string ;
16
16
let SEGMENT_START : string ;
17
17
let SEGMENT_END : string ;
18
18
let MEASURE_START : string ;
19
19
let MEASURE_END : string ;
20
- let PARAMETERS : string ;
20
+ let ANGLE_TANGENT_SUM : string ;
21
21
let JOIN_ANGLES : string ;
22
22
let DISTANCE : string ;
23
23
}
@@ -44,19 +44,23 @@ export type AttributeDefinitions = {
44
44
export type UniformDefinitions = {
45
45
[ x : string ] : import ( "../../webgl/Helper.js" ) . UniformValue ;
46
46
} ;
47
+ /**
48
+ * Buffers organized like so: [indicesBuffer, vertexAttributesBuffer, instanceAttributesBuffer]
49
+ */
50
+ export type WebGLArrayBufferSet = Array < WebGLArrayBuffer > ;
47
51
export type WebGLBuffers = {
48
52
/**
49
53
* Array containing indices and vertices buffers for polygons
50
54
*/
51
- polygonBuffers : Array < WebGLArrayBuffer > ;
55
+ polygonBuffers : WebGLArrayBufferSet ;
52
56
/**
53
57
* Array containing indices and vertices buffers for line strings
54
58
*/
55
- lineStringBuffers : Array < WebGLArrayBuffer > ;
59
+ lineStringBuffers : WebGLArrayBufferSet ;
56
60
/**
57
61
* Array containing indices and vertices buffers for points
58
62
*/
59
- pointBuffers : Array < WebGLArrayBuffer > ;
63
+ pointBuffers : WebGLArrayBufferSet ;
60
64
/**
61
65
* Inverse of the transform applied when generating buffers
62
66
*/
@@ -103,9 +107,17 @@ export type SubRenderPass = {
103
107
*/
104
108
fragmentShader : string ;
105
109
/**
106
- * Attributes description
110
+ * Attributes description, defined for each primitive vertex
107
111
*/
108
112
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 ;
109
121
/**
110
122
* Program; this has to be recreated if the helper is lost/changed
111
123
*/
@@ -137,11 +149,14 @@ export type RenderPass = {
137
149
* @typedef {Object<string, AttributeDefinition> } AttributeDefinitions
138
150
* @typedef {Object<string, import("../../webgl/Helper").UniformValue> } UniformDefinitions
139
151
*/
152
+ /**
153
+ * @typedef {Array<WebGLArrayBuffer> } WebGLArrayBufferSet Buffers organized like so: [indicesBuffer, vertexAttributesBuffer, instanceAttributesBuffer]
154
+ */
140
155
/**
141
156
* @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
145
160
* @property {import("../../transform.js").Transform } invertVerticesTransform Inverse of the transform applied when generating buffers
146
161
*/
147
162
/**
@@ -171,7 +186,9 @@ export type RenderPass = {
171
186
* @typedef {Object } SubRenderPass
172
187
* @property {string } vertexShader Vertex shader
173
188
* @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
175
192
* @property {WebGLProgram } [program] Program; this has to be recreated if the helper is lost/changed
176
193
*/
177
194
/**
@@ -248,7 +265,7 @@ declare class VectorStyleRenderer {
248
265
* @param {Float32Array|null } renderInstructions Render instructions
249
266
* @param {import("../../geom/Geometry.js").Type } geometryType Geometry type
250
267
* @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
252
269
* @private
253
270
*/
254
271
private generateBuffersForType_ ;
@@ -261,9 +278,9 @@ declare class VectorStyleRenderer {
261
278
render ( buffers : WebGLBuffers , frameState : import ( "../../Map.js" ) . FrameState , preRenderCallback : ( ) => void ) : void ;
262
279
/**
263
280
* @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
267
284
* @param {import("../../Map.js").FrameState } frameState Frame state.
268
285
* @param {function(): void } preRenderCallback This callback will be called right before drawing, and can be used to set uniforms
269
286
* @private
0 commit comments