@luma.gl/engine 9.0.0-alpha.32 → 9.0.0-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +107 -71
- package/dist/geometry/geometry.d.ts +19 -4
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +1 -2
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/geometry/gpu-geometry.d.ts +11 -8
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +39 -25
- package/dist/geometry/gpu-geometry.js.map +1 -1
- package/dist/index.cjs +55 -64
- package/dist/model/model.d.ts +2 -1
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +15 -10
- package/dist/model/model.js.map +1 -1
- package/dist.min.js +6 -6
- package/package.json +6 -6
- package/src/geometry/geometry.ts +19 -16
- package/src/geometry/gpu-geometry.ts +36 -37
- package/src/model/model.ts +20 -12
- package/dist/model/model-shaders.d.ts +0 -35
- package/dist/model/model-shaders.d.ts.map +0 -1
- package/dist/model/model-shaders.js +0 -38
- package/dist/model/model-shaders.js.map +0 -1
- package/dist/model/model-utils.d.ts +0 -5
- package/dist/model/model-utils.d.ts.map +0 -1
- package/dist/model/model-utils.js +0 -40
- package/dist/model/model-utils.js.map +0 -1
- package/src/model/model-shaders.ts +0 -76
- package/src/model/model-utils.ts +0 -125
package/dist/dist.dev.js
CHANGED
|
@@ -3888,6 +3888,40 @@ ${isVertex ? "" : FRAGMENT_SHADER_PROLOGUE}
|
|
|
3888
3888
|
return result;
|
|
3889
3889
|
}
|
|
3890
3890
|
|
|
3891
|
+
// ../shadertools/src/lib/shader-assembly/select-shaders.ts
|
|
3892
|
+
function selectShaders(platformInfo, props) {
|
|
3893
|
+
if (!props.vs) {
|
|
3894
|
+
throw new Error("no vertex shader");
|
|
3895
|
+
}
|
|
3896
|
+
const vs = getShaderSource(platformInfo, props.vs);
|
|
3897
|
+
let fs;
|
|
3898
|
+
if (props.fs) {
|
|
3899
|
+
fs = getShaderSource(platformInfo, props.fs);
|
|
3900
|
+
}
|
|
3901
|
+
return {
|
|
3902
|
+
...props,
|
|
3903
|
+
vs,
|
|
3904
|
+
fs
|
|
3905
|
+
};
|
|
3906
|
+
}
|
|
3907
|
+
function getShaderSource(platformInfo, shader) {
|
|
3908
|
+
if (typeof shader === "string") {
|
|
3909
|
+
return shader;
|
|
3910
|
+
}
|
|
3911
|
+
switch (platformInfo.type) {
|
|
3912
|
+
case "webgpu":
|
|
3913
|
+
if (shader?.wgsl) {
|
|
3914
|
+
return shader.wgsl;
|
|
3915
|
+
}
|
|
3916
|
+
throw new Error("WebGPU does not support GLSL shaders");
|
|
3917
|
+
default:
|
|
3918
|
+
if (shader?.glsl) {
|
|
3919
|
+
return shader.glsl;
|
|
3920
|
+
}
|
|
3921
|
+
throw new Error("WebGL does not support WGSL shaders");
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
|
|
3891
3925
|
// ../shadertools/src/lib/shader-assembler.ts
|
|
3892
3926
|
var ShaderAssembler = class {
|
|
3893
3927
|
/** Default ShaderAssembler instance */
|
|
@@ -3940,8 +3974,9 @@ ${isVertex ? "" : FRAGMENT_SHADER_PROLOGUE}
|
|
|
3940
3974
|
assembleShaders(platformInfo, props) {
|
|
3941
3975
|
const modules = this._getModuleList(props.modules);
|
|
3942
3976
|
const hookFunctions = this._hookFunctions;
|
|
3977
|
+
const options = selectShaders(platformInfo, props);
|
|
3943
3978
|
const assembled = assembleShaders(platformInfo, {
|
|
3944
|
-
...
|
|
3979
|
+
...options,
|
|
3945
3980
|
modules,
|
|
3946
3981
|
hookFunctions
|
|
3947
3982
|
});
|
|
@@ -5954,7 +5989,7 @@ void main() {
|
|
|
5954
5989
|
this.topology = props.topology;
|
|
5955
5990
|
this.indices = props.indices || null;
|
|
5956
5991
|
this.attributes = props.attributes;
|
|
5957
|
-
this.vertexCount = props.vertexCount
|
|
5992
|
+
this.vertexCount = props.vertexCount;
|
|
5958
5993
|
this.bufferLayout = props.bufferLayout || [];
|
|
5959
5994
|
if (!this.bufferLayout.find((layout) => layout.name === "positions")) {
|
|
5960
5995
|
this.bufferLayout.push({
|
|
@@ -5962,19 +5997,19 @@ void main() {
|
|
|
5962
5997
|
format: "float32x3"
|
|
5963
5998
|
});
|
|
5964
5999
|
}
|
|
5965
|
-
if (!this.bufferLayout.find((layout) => layout.name === "normals")) {
|
|
6000
|
+
if (this.attributes.normals && !this.bufferLayout.find((layout) => layout.name === "normals")) {
|
|
5966
6001
|
this.bufferLayout.push({
|
|
5967
6002
|
name: "normals",
|
|
5968
6003
|
format: "float32x3"
|
|
5969
6004
|
});
|
|
5970
6005
|
}
|
|
5971
|
-
if (!this.bufferLayout.find((layout) => layout.name === "texCoords")) {
|
|
6006
|
+
if (this.attributes.texCoords && !this.bufferLayout.find((layout) => layout.name === "texCoords")) {
|
|
5972
6007
|
this.bufferLayout.push({
|
|
5973
6008
|
name: "texCoords",
|
|
5974
6009
|
format: "float32x2"
|
|
5975
6010
|
});
|
|
5976
6011
|
}
|
|
5977
|
-
if (!this.bufferLayout.find((layout) => layout.name === "colors")) {
|
|
6012
|
+
if (this.attributes.colors && !this.bufferLayout.find((layout) => layout.name === "colors")) {
|
|
5978
6013
|
this.bufferLayout.push({
|
|
5979
6014
|
name: "colors",
|
|
5980
6015
|
format: "float32x3"
|
|
@@ -6010,9 +6045,13 @@ void main() {
|
|
|
6010
6045
|
return geometry;
|
|
6011
6046
|
}
|
|
6012
6047
|
const indices = getIndexBufferFromGeometry(device, geometry);
|
|
6013
|
-
const
|
|
6048
|
+
const {
|
|
6049
|
+
attributes,
|
|
6050
|
+
bufferLayout
|
|
6051
|
+
} = getAttributeBuffersFromGeometry(device, geometry);
|
|
6014
6052
|
return new GPUGeometry({
|
|
6015
|
-
topology: geometry.topology,
|
|
6053
|
+
topology: geometry.topology || "triangle-list",
|
|
6054
|
+
bufferLayout,
|
|
6016
6055
|
vertexCount: geometry.vertexCount,
|
|
6017
6056
|
indices,
|
|
6018
6057
|
attributes
|
|
@@ -6022,7 +6061,7 @@ void main() {
|
|
|
6022
6061
|
if (!geometry.indices) {
|
|
6023
6062
|
return void 0;
|
|
6024
6063
|
}
|
|
6025
|
-
const data = geometry.indices.value
|
|
6064
|
+
const data = geometry.indices.value;
|
|
6026
6065
|
assert2(data instanceof Uint16Array || data instanceof Uint32Array, 'attribute array for "indices" must be of integer type');
|
|
6027
6066
|
return device.createBuffer({
|
|
6028
6067
|
usage: Buffer2.INDEX,
|
|
@@ -6033,21 +6072,42 @@ void main() {
|
|
|
6033
6072
|
const positions = geometry.attributes.positions || geometry.attributes.POSITION;
|
|
6034
6073
|
const normals = geometry.attributes.normals || geometry.attributes.NORMAL;
|
|
6035
6074
|
const texCoords = geometry.attributes.texCoords || geometry.attributes.TEXCOORD_0;
|
|
6036
|
-
const
|
|
6075
|
+
const attributes = {
|
|
6037
6076
|
positions: device.createBuffer({
|
|
6038
6077
|
data: positions.value,
|
|
6039
6078
|
id: "positions-buffer"
|
|
6040
|
-
})
|
|
6041
|
-
|
|
6079
|
+
})
|
|
6080
|
+
};
|
|
6081
|
+
const bufferLayout = [{
|
|
6082
|
+
name: "positions",
|
|
6083
|
+
format: `float32x${positions.size}`
|
|
6084
|
+
}];
|
|
6085
|
+
if (normals) {
|
|
6086
|
+
attributes.normals = device.createBuffer({
|
|
6042
6087
|
data: normals.value,
|
|
6043
6088
|
id: "normals-buffer"
|
|
6044
|
-
})
|
|
6045
|
-
|
|
6089
|
+
});
|
|
6090
|
+
bufferLayout.push({
|
|
6091
|
+
name: "normals",
|
|
6092
|
+
format: `float32x${normals.size}`
|
|
6093
|
+
});
|
|
6094
|
+
}
|
|
6095
|
+
if (texCoords) {
|
|
6096
|
+
attributes.texCoords = device.createBuffer({
|
|
6046
6097
|
data: texCoords.value,
|
|
6047
6098
|
id: "texCoords-buffer"
|
|
6048
|
-
})
|
|
6099
|
+
});
|
|
6100
|
+
bufferLayout.push({
|
|
6101
|
+
name: "texCoords",
|
|
6102
|
+
format: `float32x${texCoords.size}`
|
|
6103
|
+
});
|
|
6104
|
+
}
|
|
6105
|
+
const vertexCount = geometry._calculateVertexCount(geometry.attributes, geometry.indices);
|
|
6106
|
+
return {
|
|
6107
|
+
attributes,
|
|
6108
|
+
bufferLayout,
|
|
6109
|
+
vertexCount
|
|
6049
6110
|
};
|
|
6050
|
-
return buffers;
|
|
6051
6111
|
}
|
|
6052
6112
|
|
|
6053
6113
|
// src/lib/pipeline-factory.ts
|
|
@@ -6140,45 +6200,6 @@ void main() {
|
|
|
6140
6200
|
fs: void 0
|
|
6141
6201
|
});
|
|
6142
6202
|
|
|
6143
|
-
// src/model/model-shaders.ts
|
|
6144
|
-
function buildShaders(device, props) {
|
|
6145
|
-
if (!props.vs) {
|
|
6146
|
-
throw new Error("no vertex shader");
|
|
6147
|
-
}
|
|
6148
|
-
const vs = getShaderSource(device, props.vs);
|
|
6149
|
-
let fs;
|
|
6150
|
-
if (props.fs) {
|
|
6151
|
-
fs = getShaderSource(device, props.fs);
|
|
6152
|
-
}
|
|
6153
|
-
const platformInfo = {
|
|
6154
|
-
type: device.info.type,
|
|
6155
|
-
gpu: device.info.gpu,
|
|
6156
|
-
features: device.features
|
|
6157
|
-
};
|
|
6158
|
-
return props.shaderAssembler.assembleShaders(platformInfo, {
|
|
6159
|
-
...props,
|
|
6160
|
-
fs,
|
|
6161
|
-
vs
|
|
6162
|
-
});
|
|
6163
|
-
}
|
|
6164
|
-
function getShaderSource(device, shader) {
|
|
6165
|
-
if (typeof shader === "string") {
|
|
6166
|
-
return shader;
|
|
6167
|
-
}
|
|
6168
|
-
switch (device.info.type) {
|
|
6169
|
-
case "webgpu":
|
|
6170
|
-
if (shader?.wgsl) {
|
|
6171
|
-
return shader.wgsl;
|
|
6172
|
-
}
|
|
6173
|
-
throw new Error("WebGPU does not support GLSL shaders");
|
|
6174
|
-
default:
|
|
6175
|
-
if (shader?.glsl) {
|
|
6176
|
-
return shader.glsl;
|
|
6177
|
-
}
|
|
6178
|
-
throw new Error("WebGL does not support WGSL shaders");
|
|
6179
|
-
}
|
|
6180
|
-
}
|
|
6181
|
-
|
|
6182
6203
|
// src/model/model.ts
|
|
6183
6204
|
var _Model = class {
|
|
6184
6205
|
userData = {};
|
|
@@ -6211,11 +6232,17 @@ void main() {
|
|
|
6211
6232
|
this.id = props.id || uid("model");
|
|
6212
6233
|
this.device = device;
|
|
6213
6234
|
Object.assign(this.userData, props.userData);
|
|
6235
|
+
const platformInfo = {
|
|
6236
|
+
type: device.info.type,
|
|
6237
|
+
shaderLanguage: device.info.shadingLanguages[0],
|
|
6238
|
+
gpu: device.info.gpu,
|
|
6239
|
+
features: device.features
|
|
6240
|
+
};
|
|
6214
6241
|
const {
|
|
6215
6242
|
vs,
|
|
6216
6243
|
fs,
|
|
6217
6244
|
getUniforms
|
|
6218
|
-
} =
|
|
6245
|
+
} = this.props.shaderAssembler.assembleShaders(platformInfo, this.props);
|
|
6219
6246
|
this.vs = vs;
|
|
6220
6247
|
this.fs = fs;
|
|
6221
6248
|
this._getModuleUniforms = getUniforms;
|
|
@@ -6224,9 +6251,8 @@ void main() {
|
|
|
6224
6251
|
this.topology = this.props.topology;
|
|
6225
6252
|
this.bufferLayout = this.props.bufferLayout;
|
|
6226
6253
|
this.parameters = this.props.parameters;
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
this.setGeometry(gpuGeometry);
|
|
6254
|
+
if (props.geometry) {
|
|
6255
|
+
this.setGeometry(props.geometry);
|
|
6230
6256
|
}
|
|
6231
6257
|
this.pipelineFactory = props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);
|
|
6232
6258
|
this.pipeline = this._updatePipeline();
|
|
@@ -6274,14 +6300,16 @@ void main() {
|
|
|
6274
6300
|
// Update fixed fields (can trigger pipeline rebuild)
|
|
6275
6301
|
/**
|
|
6276
6302
|
* Updates the optional geometry
|
|
6303
|
+
* Geometry, sets several attributes, indices, and also vertex count and topology
|
|
6277
6304
|
* @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU
|
|
6278
6305
|
*/
|
|
6279
6306
|
setGeometry(geometry) {
|
|
6280
|
-
this.
|
|
6281
|
-
this.
|
|
6282
|
-
this.
|
|
6283
|
-
this.
|
|
6284
|
-
this.
|
|
6307
|
+
const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);
|
|
6308
|
+
this.setTopology(gpuGeometry.topology || "triangle-list");
|
|
6309
|
+
this.bufferLayout = mergeBufferLayouts(this.bufferLayout, gpuGeometry.bufferLayout);
|
|
6310
|
+
this.vertexCount = gpuGeometry.vertexCount;
|
|
6311
|
+
this.setAttributes(gpuGeometry.attributes);
|
|
6312
|
+
this.setIndexBuffer(gpuGeometry.indices);
|
|
6285
6313
|
}
|
|
6286
6314
|
/**
|
|
6287
6315
|
* Updates the primitive topology ('triangle-list', 'triangle-strip' etc).
|
|
@@ -14079,7 +14107,10 @@ ${formattedLog}`)();
|
|
|
14079
14107
|
getVertexCount() {
|
|
14080
14108
|
return this.vertexCount;
|
|
14081
14109
|
}
|
|
14082
|
-
|
|
14110
|
+
/**
|
|
14111
|
+
* Return an object with all attributes plus indices added as a field.
|
|
14112
|
+
* TODO Geometry types are a mess
|
|
14113
|
+
*/
|
|
14083
14114
|
getAttributes() {
|
|
14084
14115
|
return this.indices ? {
|
|
14085
14116
|
indices: this.indices,
|
|
@@ -14090,11 +14121,17 @@ ${formattedLog}`)();
|
|
|
14090
14121
|
_print(attributeName) {
|
|
14091
14122
|
return `Geometry ${this.id} attribute ${attributeName}`;
|
|
14092
14123
|
}
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14124
|
+
/**
|
|
14125
|
+
* GeometryAttribute
|
|
14126
|
+
* value: typed array
|
|
14127
|
+
* type: indices, vertices, uvs
|
|
14128
|
+
* size: elements per vertex
|
|
14129
|
+
* target: WebGL buffer type (string or constant)
|
|
14130
|
+
*
|
|
14131
|
+
* @param attributes
|
|
14132
|
+
* @param indices
|
|
14133
|
+
* @returns
|
|
14134
|
+
*/
|
|
14098
14135
|
_setAttributes(attributes, indices) {
|
|
14099
14136
|
return this;
|
|
14100
14137
|
}
|
|
@@ -14103,8 +14140,7 @@ ${formattedLog}`)();
|
|
|
14103
14140
|
return indices.value.length;
|
|
14104
14141
|
}
|
|
14105
14142
|
let vertexCount = Infinity;
|
|
14106
|
-
for (const
|
|
14107
|
-
const attribute = attributes[attributeName];
|
|
14143
|
+
for (const attribute of Object.values(attributes)) {
|
|
14108
14144
|
const {
|
|
14109
14145
|
value,
|
|
14110
14146
|
size,
|
|
@@ -13,8 +13,8 @@ export type GeometryAttributes = {
|
|
|
13
13
|
NORMAL: GeometryAttribute;
|
|
14
14
|
TEXCOORD_0: GeometryAttribute;
|
|
15
15
|
COLOR_0?: GeometryAttribute;
|
|
16
|
-
indices?: {
|
|
17
|
-
size
|
|
16
|
+
indices?: GeometryAttribute & {
|
|
17
|
+
size: 1;
|
|
18
18
|
value: Uint32Array | Uint16Array;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
@@ -28,7 +28,7 @@ export declare class Geometry {
|
|
|
28
28
|
/** Determines how vertices are read from the 'vertex' attributes */
|
|
29
29
|
readonly topology?: PrimitiveTopology;
|
|
30
30
|
readonly vertexCount: number;
|
|
31
|
-
readonly indices?:
|
|
31
|
+
readonly indices?: GeometryAttribute;
|
|
32
32
|
readonly attributes: {
|
|
33
33
|
POSITION: GeometryAttribute;
|
|
34
34
|
NORMAL: GeometryAttribute;
|
|
@@ -39,9 +39,24 @@ export declare class Geometry {
|
|
|
39
39
|
userData: Record<string, unknown>;
|
|
40
40
|
constructor(props: GeometryProps);
|
|
41
41
|
getVertexCount(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Return an object with all attributes plus indices added as a field.
|
|
44
|
+
* TODO Geometry types are a mess
|
|
45
|
+
*/
|
|
42
46
|
getAttributes(): GeometryAttributes;
|
|
43
47
|
_print(attributeName: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* GeometryAttribute
|
|
50
|
+
* value: typed array
|
|
51
|
+
* type: indices, vertices, uvs
|
|
52
|
+
* size: elements per vertex
|
|
53
|
+
* target: WebGL buffer type (string or constant)
|
|
54
|
+
*
|
|
55
|
+
* @param attributes
|
|
56
|
+
* @param indices
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
44
59
|
_setAttributes(attributes: Record<string, GeometryAttribute>, indices: any): this;
|
|
45
|
-
_calculateVertexCount(attributes:
|
|
60
|
+
_calculateVertexCount(attributes: GeometryAttributes, indices: GeometryAttribute): number;
|
|
46
61
|
}
|
|
47
62
|
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,iBAAiB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAGjE,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,QAAQ,EACJ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,eAAe,GACf,gBAAgB,GAChB,oBAAoB,CAAC;IACzB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU,CAAC,CAAC;IAC5D,OAAO,CAAC,EAAE,iBAAiB,GAAG,UAAU,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,OAAO,CAAC,EAAE;QAAC,IAAI,
|
|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IACrC,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,EAAE,iBAAiB,CAAC;QAC5B,MAAM,EAAE,iBAAiB,CAAC;QAC1B,UAAU,EAAE,iBAAiB,CAAC;QAC9B,OAAO,CAAC,EAAE,iBAAiB,CAAC;QAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;KAC9C,CAAC;IAEF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;gBAE3B,KAAK,EAAE,aAAa;IA6ChC,cAAc,IAAI,MAAM;IAIxB;;;OAGG;IACH,aAAa,IAAI,kBAAkB;IAMnC,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM;IAIrC;;;;;;;;;;OAUG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI;IAIjF,qBAAqB,CAAC,UAAU,EAAE,kBAAkB,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM;CAe1F"}
|
|
@@ -63,8 +63,7 @@ export class Geometry {
|
|
|
63
63
|
return indices.value.length;
|
|
64
64
|
}
|
|
65
65
|
let vertexCount = Infinity;
|
|
66
|
-
for (const
|
|
67
|
-
const attribute = attributes[attributeName];
|
|
66
|
+
for (const attribute of Object.values(attributes)) {
|
|
68
67
|
const {
|
|
69
68
|
value,
|
|
70
69
|
size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.js","names":["uid","assert","Geometry","constructor","props","_defineProperty","attributes","indices","vertexCount","id","topology","ArrayBuffer","isView","value","size","attributeName","attributeValue","Object","entries","attribute","concat","_print","isIndexed","undefined","assign","_calculateVertexCount","getVertexCount","getAttributes","_setAttributes","length","Infinity","constant","Math","min","Number","isFinite"],"sources":["../../src/geometry/geometry.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {PrimitiveTopology, TypedArray} from '@luma.gl/core';\nimport {uid, assert} from '@luma.gl/core';\n\nexport type GeometryProps = {\n id?: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n topology:\n | 'point-list'\n | 'line-list'\n | 'line-strip'\n | 'line-loop-webgl'\n | 'triangle-list'\n | 'triangle-strip'\n | 'triangle-fan-webgl';\n /** Auto calculated from attributes if not provided */\n vertexCount?: number;\n attributes?: Record<string, GeometryAttribute | TypedArray>;\n indices?: GeometryAttribute | TypedArray;\n};\n\nexport type GeometryAttributes = {\n POSITION: GeometryAttribute;\n NORMAL: GeometryAttribute;\n TEXCOORD_0: GeometryAttribute;\n COLOR_0?: GeometryAttribute;\n indices?: {size
|
|
1
|
+
{"version":3,"file":"geometry.js","names":["uid","assert","Geometry","constructor","props","_defineProperty","attributes","indices","vertexCount","id","topology","ArrayBuffer","isView","value","size","attributeName","attributeValue","Object","entries","attribute","concat","_print","isIndexed","undefined","assign","_calculateVertexCount","getVertexCount","getAttributes","_setAttributes","length","Infinity","values","constant","Math","min","Number","isFinite"],"sources":["../../src/geometry/geometry.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {PrimitiveTopology, TypedArray} from '@luma.gl/core';\nimport {uid, assert} from '@luma.gl/core';\n\nexport type GeometryProps = {\n id?: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n topology:\n | 'point-list'\n | 'line-list'\n | 'line-strip'\n | 'line-loop-webgl'\n | 'triangle-list'\n | 'triangle-strip'\n | 'triangle-fan-webgl';\n /** Auto calculated from attributes if not provided */\n vertexCount?: number;\n attributes?: Record<string, GeometryAttribute | TypedArray>;\n indices?: GeometryAttribute | TypedArray;\n};\n\nexport type GeometryAttributes = {\n POSITION: GeometryAttribute;\n NORMAL: GeometryAttribute;\n TEXCOORD_0: GeometryAttribute;\n COLOR_0?: GeometryAttribute;\n indices?: GeometryAttribute & {size: 1; value: Uint32Array | Uint16Array};\n};\n\nexport type GeometryAttribute = {\n size?: number;\n value: TypedArray;\n [key: string]: any;\n};\n\nexport class Geometry {\n readonly id: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n readonly topology?: PrimitiveTopology;\n readonly vertexCount: number;\n readonly indices?: GeometryAttribute;\n readonly attributes: {\n POSITION: GeometryAttribute;\n NORMAL: GeometryAttribute;\n TEXCOORD_0: GeometryAttribute;\n COLOR_0?: GeometryAttribute;\n [key: string]: GeometryAttribute | undefined;\n };\n\n userData: Record<string, unknown> = {};\n\n constructor(props: GeometryProps) {\n const {attributes = {}, indices = null, vertexCount = null} = props;\n\n this.id = props.id || uid('geometry');\n this.topology = props.topology;\n\n if (indices) {\n this.indices = ArrayBuffer.isView(indices) ? {value: indices, size: 1} : indices;\n }\n\n // @ts-expect-error\n this.attributes = {};\n\n for (const [attributeName, attributeValue] of Object.entries(attributes)) {\n // Wrap \"unwrapped\" arrays and try to autodetect their type\n const attribute: GeometryAttribute = ArrayBuffer.isView(attributeValue)\n ? {value: attributeValue}\n : attributeValue;\n\n assert(\n ArrayBuffer.isView(attribute.value),\n `${this._print(attributeName)}: must be typed array or object with value as typed array`\n );\n\n if ((attributeName === 'POSITION' || attributeName === 'positions') && !attribute.size) {\n attribute.size = 3;\n }\n\n // Move indices to separate field\n if (attributeName === 'indices') {\n assert(!this.indices);\n this.indices = attribute;\n } else {\n this.attributes[attributeName] = attribute;\n }\n }\n\n if (this.indices && this.indices.isIndexed !== undefined) {\n this.indices = Object.assign({}, this.indices);\n delete this.indices.isIndexed;\n }\n\n this.vertexCount = vertexCount || this._calculateVertexCount(this.attributes, this.indices);\n }\n\n getVertexCount(): number {\n return this.vertexCount;\n }\n\n /** \n * Return an object with all attributes plus indices added as a field.\n * TODO Geometry types are a mess\n */\n getAttributes(): GeometryAttributes {\n return this.indices ? {indices: this.indices, ...this.attributes} : this.attributes;\n }\n\n // PRIVATE\n\n _print(attributeName: string): string {\n return `Geometry ${this.id} attribute ${attributeName}`;\n }\n\n /**\n * GeometryAttribute\n * value: typed array\n * type: indices, vertices, uvs\n * size: elements per vertex\n * target: WebGL buffer type (string or constant)\n * \n * @param attributes \n * @param indices \n * @returns \n */\n _setAttributes(attributes: Record<string, GeometryAttribute>, indices: any): this {\n return this;\n }\n\n _calculateVertexCount(attributes: GeometryAttributes, indices: GeometryAttribute): number {\n if (indices) {\n return indices.value.length;\n }\n let vertexCount = Infinity;\n for (const attribute of Object.values(attributes)) {\n const {value, size, constant} = attribute;\n if (!constant && value && size >= 1) {\n vertexCount = Math.min(vertexCount, value.length / size);\n }\n }\n\n assert(Number.isFinite(vertexCount));\n return vertexCount;\n }\n}\n"],"mappings":";AAEA,SAAQA,GAAG,EAAEC,MAAM,QAAO,eAAe;AAiCzC,OAAO,MAAMC,QAAQ,CAAC;EAgBpBC,WAAWA,CAACC,KAAoB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAFE,CAAC,CAAC;IAGpC,MAAM;MAACC,UAAU,GAAG,CAAC,CAAC;MAAEC,OAAO,GAAG,IAAI;MAAEC,WAAW,GAAG;IAAI,CAAC,GAAGJ,KAAK;IAEnE,IAAI,CAACK,EAAE,GAAGL,KAAK,CAACK,EAAE,IAAIT,GAAG,CAAC,UAAU,CAAC;IACrC,IAAI,CAACU,QAAQ,GAAGN,KAAK,CAACM,QAAQ;IAE9B,IAAIH,OAAO,EAAE;MACX,IAAI,CAACA,OAAO,GAAGI,WAAW,CAACC,MAAM,CAACL,OAAO,CAAC,GAAG;QAACM,KAAK,EAAEN,OAAO;QAAEO,IAAI,EAAE;MAAC,CAAC,GAAGP,OAAO;IAClF;IAGA,IAAI,CAACD,UAAU,GAAG,CAAC,CAAC;IAEpB,KAAK,MAAM,CAACS,aAAa,EAAEC,cAAc,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACZ,UAAU,CAAC,EAAE;MAExE,MAAMa,SAA4B,GAAGR,WAAW,CAACC,MAAM,CAACI,cAAc,CAAC,GACnE;QAACH,KAAK,EAAEG;MAAc,CAAC,GACvBA,cAAc;MAElBf,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Y,EAAQ;IAChF,OAAO,IAAI;EACb;EAEAkB,qBAAqBA,CAACnB,UAA8B,EAAEC,OAA0B,EAAU;IACxF,IAAIA,OAAO,EAAE;MACX,OAAOA,OAAO,CAACM,KAAK,CAACgB,MAAM;IAC7B;IACA,IAAIrB,WAAW,GAAGsB,QAAQ;IAC1B,KAAK,MAAMX,SAAS,IAAIF,MAAM,CAACc,MAAM,CAACzB,UAAU,CAAC,EAAE;MACjD,MAAM;QAACO,KAAK;QAAEC,IAAI;QAAEkB;MAAQ,CAAC,GAAGb,SAAS;MACzC,IAAI,CAACa,QAAQ,IAAInB,KAAK,IAAIC,IAAI,IAAI,CAAC,EAAE;QACnCN,WAAW,GAAGyB,IAAI,CAACC,GAAG,CAAC1B,WAAW,EAAEK,KAAK,CAACgB,MAAM,GAAGf,IAAI,CAAC;MAC1D;IACF;IAEAb,MAAM,CAACkC,MAAM,CAACC,QAAQ,CAAC5B,WAAW,CAAC,CAAC;IACpC,OAAOA,WAAW;EACpB;AACF"}
|
|
@@ -6,15 +6,15 @@ export type GPUGeometryProps = {
|
|
|
6
6
|
/** Determines how vertices are read from the 'vertex' attributes */
|
|
7
7
|
topology: 'point-list' | 'line-list' | 'line-strip' | 'line-loop-webgl' | 'triangle-list' | 'triangle-strip' | 'triangle-fan-webgl';
|
|
8
8
|
/** Auto calculated from attributes if not provided */
|
|
9
|
-
vertexCount
|
|
10
|
-
bufferLayout
|
|
9
|
+
vertexCount: number;
|
|
10
|
+
bufferLayout: BufferLayout[];
|
|
11
11
|
indices?: Buffer | null;
|
|
12
12
|
attributes: GPUGeometryAttributes;
|
|
13
13
|
};
|
|
14
14
|
export type GPUGeometryAttributes = {
|
|
15
15
|
positions: Buffer;
|
|
16
|
-
normals
|
|
17
|
-
texCoords
|
|
16
|
+
normals?: Buffer;
|
|
17
|
+
texCoords?: Buffer;
|
|
18
18
|
colors?: Buffer;
|
|
19
19
|
};
|
|
20
20
|
export declare class GPUGeometry {
|
|
@@ -27,8 +27,8 @@ export declare class GPUGeometry {
|
|
|
27
27
|
readonly indices?: Buffer | null;
|
|
28
28
|
readonly attributes: {
|
|
29
29
|
positions: Buffer;
|
|
30
|
-
normals
|
|
31
|
-
texCoords
|
|
30
|
+
normals?: Buffer;
|
|
31
|
+
texCoords?: Buffer;
|
|
32
32
|
colors?: Buffer;
|
|
33
33
|
};
|
|
34
34
|
constructor(props: GPUGeometryProps);
|
|
@@ -40,6 +40,9 @@ export declare class GPUGeometry {
|
|
|
40
40
|
}
|
|
41
41
|
export declare function makeGPUGeometry(device: Device, geometry: Geometry | GPUGeometry): GPUGeometry;
|
|
42
42
|
export declare function getIndexBufferFromGeometry(device: Device, geometry: Geometry): Buffer | undefined;
|
|
43
|
-
export declare function getAttributeBuffersFromGeometry(device: Device, geometry: Geometry):
|
|
44
|
-
|
|
43
|
+
export declare function getAttributeBuffersFromGeometry(device: Device, geometry: Geometry): {
|
|
44
|
+
attributes: GPUGeometryAttributes;
|
|
45
|
+
bufferLayout: BufferLayout[];
|
|
46
|
+
vertexCount: number;
|
|
47
|
+
};
|
|
45
48
|
//# sourceMappingURL=gpu-geometry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpu-geometry.d.ts","sourceRoot":"","sources":["../../src/geometry/gpu-geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACnE,OAAO,EAAC,MAAM,EAAE,MAAM,EAAc,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAEnD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,QAAQ,EACJ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,eAAe,GACf,gBAAgB,GAChB,oBAAoB,CAAC;IACzB,sDAAsD;IACtD,WAAW,
|
|
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AAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;gBAEU,KAAK,EAAE,gBAAgB;IA6BnC,OAAO,IAAI,IAAI;IAQf,cAAc,IAAI,MAAM;IAIxB,aAAa,IAAI,qBAAqB;IAItC,UAAU,IAAI,MAAM,GAAG,IAAI;IAI3B,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;CAKjD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,WAAW,GAAG,WAAW,CAc7F;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAWjG;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,GACjB;IAAC,UAAU,EAAE,qBAAqB,CAAC;IAAC,YAAY,EAAE,YAAY,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,CAuBxF"}
|
|
@@ -13,7 +13,7 @@ export class GPUGeometry {
|
|
|
13
13
|
this.topology = props.topology;
|
|
14
14
|
this.indices = props.indices || null;
|
|
15
15
|
this.attributes = props.attributes;
|
|
16
|
-
this.vertexCount = props.vertexCount
|
|
16
|
+
this.vertexCount = props.vertexCount;
|
|
17
17
|
this.bufferLayout = props.bufferLayout || [];
|
|
18
18
|
if (!this.bufferLayout.find(layout => layout.name === 'positions')) {
|
|
19
19
|
this.bufferLayout.push({
|
|
@@ -21,19 +21,19 @@ export class GPUGeometry {
|
|
|
21
21
|
format: 'float32x3'
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
if (!this.bufferLayout.find(layout => layout.name === 'normals')) {
|
|
24
|
+
if (this.attributes.normals && !this.bufferLayout.find(layout => layout.name === 'normals')) {
|
|
25
25
|
this.bufferLayout.push({
|
|
26
26
|
name: 'normals',
|
|
27
27
|
format: 'float32x3'
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
if (!this.bufferLayout.find(layout => layout.name === 'texCoords')) {
|
|
30
|
+
if (this.attributes.texCoords && !this.bufferLayout.find(layout => layout.name === 'texCoords')) {
|
|
31
31
|
this.bufferLayout.push({
|
|
32
32
|
name: 'texCoords',
|
|
33
33
|
format: 'float32x2'
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
if (!this.bufferLayout.find(layout => layout.name === 'colors')) {
|
|
36
|
+
if (this.attributes.colors && !this.bufferLayout.find(layout => layout.name === 'colors')) {
|
|
37
37
|
this.bufferLayout.push({
|
|
38
38
|
name: 'colors',
|
|
39
39
|
format: 'float32x3'
|
|
@@ -70,9 +70,13 @@ export function makeGPUGeometry(device, geometry) {
|
|
|
70
70
|
return geometry;
|
|
71
71
|
}
|
|
72
72
|
const indices = getIndexBufferFromGeometry(device, geometry);
|
|
73
|
-
const
|
|
73
|
+
const {
|
|
74
|
+
attributes,
|
|
75
|
+
bufferLayout
|
|
76
|
+
} = getAttributeBuffersFromGeometry(device, geometry);
|
|
74
77
|
return new GPUGeometry({
|
|
75
|
-
topology: geometry.topology,
|
|
78
|
+
topology: geometry.topology || 'triangle-list',
|
|
79
|
+
bufferLayout,
|
|
76
80
|
vertexCount: geometry.vertexCount,
|
|
77
81
|
indices,
|
|
78
82
|
attributes
|
|
@@ -82,7 +86,7 @@ export function getIndexBufferFromGeometry(device, geometry) {
|
|
|
82
86
|
if (!geometry.indices) {
|
|
83
87
|
return undefined;
|
|
84
88
|
}
|
|
85
|
-
const data = geometry.indices.value
|
|
89
|
+
const data = geometry.indices.value;
|
|
86
90
|
assert(data instanceof Uint16Array || data instanceof Uint32Array, 'attribute array for "indices" must be of integer type');
|
|
87
91
|
return device.createBuffer({
|
|
88
92
|
usage: Buffer.INDEX,
|
|
@@ -93,31 +97,41 @@ export function getAttributeBuffersFromGeometry(device, geometry) {
|
|
|
93
97
|
const positions = geometry.attributes.positions || geometry.attributes.POSITION;
|
|
94
98
|
const normals = geometry.attributes.normals || geometry.attributes.NORMAL;
|
|
95
99
|
const texCoords = geometry.attributes.texCoords || geometry.attributes.TEXCOORD_0;
|
|
96
|
-
const
|
|
100
|
+
const attributes = {
|
|
97
101
|
positions: device.createBuffer({
|
|
98
102
|
data: positions.value,
|
|
99
103
|
id: 'positions-buffer'
|
|
100
|
-
})
|
|
101
|
-
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
const bufferLayout = [{
|
|
107
|
+
name: 'positions',
|
|
108
|
+
format: "float32x".concat(positions.size)
|
|
109
|
+
}];
|
|
110
|
+
if (normals) {
|
|
111
|
+
attributes.normals = device.createBuffer({
|
|
102
112
|
data: normals.value,
|
|
103
113
|
id: 'normals-buffer'
|
|
104
|
-
})
|
|
105
|
-
|
|
114
|
+
});
|
|
115
|
+
bufferLayout.push({
|
|
116
|
+
name: 'normals',
|
|
117
|
+
format: "float32x".concat(normals.size)
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (texCoords) {
|
|
121
|
+
attributes.texCoords = device.createBuffer({
|
|
106
122
|
data: texCoords.value,
|
|
107
123
|
id: 'texCoords-buffer'
|
|
108
|
-
})
|
|
124
|
+
});
|
|
125
|
+
bufferLayout.push({
|
|
126
|
+
name: 'texCoords',
|
|
127
|
+
format: "float32x".concat(texCoords.size)
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const vertexCount = geometry._calculateVertexCount(geometry.attributes, geometry.indices);
|
|
131
|
+
return {
|
|
132
|
+
attributes,
|
|
133
|
+
bufferLayout,
|
|
134
|
+
vertexCount
|
|
109
135
|
};
|
|
110
|
-
return buffers;
|
|
111
|
-
}
|
|
112
|
-
const GLTF_TO_LUMA_ATTRIBUTE_MAP = {
|
|
113
|
-
POSITION: 'positions',
|
|
114
|
-
NORMAL: 'normals',
|
|
115
|
-
COLOR_0: 'colors',
|
|
116
|
-
TEXCOORD_0: 'texCoords',
|
|
117
|
-
TEXCOORD_1: 'texCoords1',
|
|
118
|
-
TEXCOORD_2: 'texCoords2'
|
|
119
|
-
};
|
|
120
|
-
export function mapAttributeName(name) {
|
|
121
|
-
return GLTF_TO_LUMA_ATTRIBUTE_MAP[name] || name;
|
|
122
136
|
}
|
|
123
137
|
//# sourceMappingURL=gpu-geometry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpu-geometry.js","names":["Buffer","uid","assert","GPUGeometry","constructor","props","_defineProperty","id","topology","indices","attributes","vertexCount","_calculateVertexCount","positions","bufferLayout","find","layout","name","push","format","usage","INDEX","destroy","_this$attributes$colo","normals","texCoords","colors","getVertexCount","getAttributes","getIndexes","byteLength","makeGPUGeometry","device","geometry","getIndexBufferFromGeometry","getAttributeBuffersFromGeometry","undefined","data","value","Uint16Array","Uint32Array","createBuffer","POSITION","NORMAL","TEXCOORD_0","buffers","GLTF_TO_LUMA_ATTRIBUTE_MAP","COLOR_0","TEXCOORD_1","TEXCOORD_2","mapAttributeName"],"sources":["../../src/geometry/gpu-geometry.ts"],"sourcesContent":["import type {PrimitiveTopology, BufferLayout} from '@luma.gl/core';\nimport {Device, Buffer, uid, assert} from '@luma.gl/core';\nimport type {Geometry} from '../geometry/geometry';\n\nexport type GPUGeometryProps = {\n id?: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n topology:\n | 'point-list'\n | 'line-list'\n | 'line-strip'\n | 'line-loop-webgl'\n | 'triangle-list'\n | 'triangle-strip'\n | 'triangle-fan-webgl';\n /** Auto calculated from attributes if not provided */\n vertexCount?: number;\n bufferLayout?: BufferLayout[];\n indices?: Buffer | null;\n attributes: GPUGeometryAttributes;\n};\n\nexport type GPUGeometryAttributes = {\n positions: Buffer;\n normals: Buffer;\n texCoords: Buffer;\n colors?: Buffer;\n};\n\nexport class GPUGeometry {\n readonly id: string;\n userData: Record<string, unknown> = {};\n\n /** Determines how vertices are read from the 'vertex' attributes */\n readonly topology?: PrimitiveTopology;\n readonly bufferLayout: BufferLayout[] = [];\n\n readonly vertexCount: number;\n readonly indices?: Buffer | null;\n readonly attributes: {\n positions: Buffer;\n normals: Buffer;\n texCoords: Buffer;\n colors?: Buffer;\n };\n\n constructor(props: GPUGeometryProps) {\n this.id = props.id || uid('geometry');\n this.topology = props.topology;\n this.indices = props.indices || null;\n this.attributes = props.attributes;\n\n // \n this.vertexCount = props.vertexCount || this._calculateVertexCount(this.attributes.positions);\n\n // Populate default bufferLayout\n this.bufferLayout = props.bufferLayout || [];\n if (!this.bufferLayout.find(layout => layout.name === 'positions')) {\n this.bufferLayout.push({name: 'positions', format: 'float32x3'});\n }\n if (!this.bufferLayout.find(layout => layout.name === 'normals')) {\n this.bufferLayout.push({name: 'normals', format: 'float32x3'});\n }\n if (!this.bufferLayout.find(layout => layout.name === 'texCoords')) {\n this.bufferLayout.push({name: 'texCoords', format: 'float32x2'});\n }\n if (!this.bufferLayout.find(layout => layout.name === 'colors')) {\n this.bufferLayout.push({name: 'colors', format: 'float32x3'});\n }\n\n if (this.indices) {\n assert(this.indices.usage === Buffer.INDEX);\n }\n }\n\n destroy(): void {\n this.indices.destroy();\n this.attributes.positions.destroy();\n this.attributes.normals.destroy();\n this.attributes.texCoords.destroy();\n this.attributes.colors?.destroy();\n }\n\n getVertexCount(): number {\n return this.vertexCount;\n }\n\n getAttributes(): GPUGeometryAttributes {\n return this.attributes;\n }\n\n getIndexes(): Buffer | null {\n return this.indices;\n }\n\n _calculateVertexCount(positions: Buffer): number {\n // Assume that positions is a fully packed float32x3 buffer\n const vertexCount = positions.byteLength / 12;\n return vertexCount;\n }\n}\n\nexport function makeGPUGeometry(device: Device, geometry: Geometry | GPUGeometry): GPUGeometry {\n if (geometry instanceof GPUGeometry) {\n return geometry;\n }\n\n const indices = getIndexBufferFromGeometry(device, geometry);\n const attributes = getAttributeBuffersFromGeometry(device, geometry);\n return new GPUGeometry({\n topology: geometry.topology, \n vertexCount: geometry.vertexCount, \n indices, \n attributes\n });\n}\n\nexport function getIndexBufferFromGeometry(device: Device, geometry: Geometry): Buffer | undefined {\n if (!geometry.indices) {\n return undefined;\n }\n\n // @ts-expect-error\n const data = geometry.indices.value || geometry.indices;\n assert(\n data instanceof Uint16Array || data instanceof Uint32Array,\n 'attribute array for \"indices\" must be of integer type'\n );\n return device.createBuffer({usage: Buffer.INDEX, data});\n}\n\nexport function getAttributeBuffersFromGeometry(device: Device, geometry: Geometry): GPUGeometryAttributes {\n const positions = geometry.attributes.positions || geometry.attributes.POSITION;\n const normals = geometry.attributes.normals || geometry.attributes.NORMAL;\n const texCoords = geometry.attributes.texCoords || geometry.attributes.TEXCOORD_0;\n\n const buffers: GPUGeometryAttributes = {\n positions: device.createBuffer({data: positions.value, id: 'positions-buffer'}),\n normals: device.createBuffer({data: normals.value, id: 'normals-buffer'}),\n texCoords: device.createBuffer({data: texCoords.value, id: 'texCoords-buffer'})\n };\n\n return buffers;\n}\n\n// Support for mapping new geometries with glTF attribute names to \"classic\" luma.gl shader names\nconst GLTF_TO_LUMA_ATTRIBUTE_MAP = {\n POSITION: 'positions',\n NORMAL: 'normals',\n COLOR_0: 'colors',\n TEXCOORD_0: 'texCoords',\n TEXCOORD_1: 'texCoords1',\n TEXCOORD_2: 'texCoords2'\n};\n\nexport function mapAttributeName(name: string): string {\n // @ts-ignore-error\n return GLTF_TO_LUMA_ATTRIBUTE_MAP[name] || name;\n}\n"],"mappings":";AACA,SAAgBA,MAAM,EAAEC,GAAG,EAAEC,MAAM,QAAO,eAAe;AA4BzD,OAAO,MAAMC,WAAW,CAAC;EAiBvBC,WAAWA,CAACC,KAAuB,EAAE;IAAAC,eAAA;IAAAA,eAAA,mBAfD,CAAC,CAAC;IAAAA,eAAA;IAAAA,eAAA,uBAIE,EAAE;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAYxC,IAAI,CAACC,EAAE,GAAGF,KAAK,CAACE,EAAE,IAAIN,GAAG,CAAC,UAAU,CAAC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EAChF,CAAC;EAED,OAAOsC,OAAO;AAChB;AAGA,MAAMC,0BAA0B,GAAG;EACjCJ,QAAQ,EAAE,WAAW;EACrBC,MAAM,EAAE,SAAS;EACjBI,OAAO,EAAE,QAAQ;EACjBH,UAAU,EAAE,WAAW;EACvBI,UAAU,EAAE,YAAY;EACxBC,UAAU,EAAE;AACd,CAAC;AAED,OAAO,SAASC,gBAAgBA,CAACjC,IAAY,EAAU;EAErD,OAAO6B,0BAA0B,CAAC7B,IAAI,CAAC,IAAIA,IAAI;AACjD"}
|
|
1
|
+
{"version":3,"file":"gpu-geometry.js","names":["Buffer","uid","assert","GPUGeometry","constructor","props","_defineProperty","id","topology","indices","attributes","vertexCount","bufferLayout","find","layout","name","push","format","normals","texCoords","colors","usage","INDEX","destroy","_this$attributes$colo","positions","getVertexCount","getAttributes","getIndexes","_calculateVertexCount","byteLength","makeGPUGeometry","device","geometry","getIndexBufferFromGeometry","getAttributeBuffersFromGeometry","undefined","data","value","Uint16Array","Uint32Array","createBuffer","POSITION","NORMAL","TEXCOORD_0","concat","size"],"sources":["../../src/geometry/gpu-geometry.ts"],"sourcesContent":["import type {PrimitiveTopology, BufferLayout} from '@luma.gl/core';\nimport {Device, Buffer, uid, assert} from '@luma.gl/core';\nimport type {Geometry} from '../geometry/geometry';\n\nexport type GPUGeometryProps = {\n id?: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n topology:\n | 'point-list'\n | 'line-list'\n | 'line-strip'\n | 'line-loop-webgl'\n | 'triangle-list'\n | 'triangle-strip'\n | 'triangle-fan-webgl';\n /** Auto calculated from attributes if not provided */\n vertexCount: number;\n bufferLayout: BufferLayout[];\n indices?: Buffer | null;\n attributes: GPUGeometryAttributes;\n};\n\nexport type GPUGeometryAttributes = {\n positions: Buffer;\n normals?: Buffer;\n texCoords?: Buffer;\n colors?: Buffer;\n};\n\nexport class GPUGeometry {\n readonly id: string;\n userData: Record<string, unknown> = {};\n\n /** Determines how vertices are read from the 'vertex' attributes */\n readonly topology?: PrimitiveTopology;\n readonly bufferLayout: BufferLayout[] = [];\n\n readonly vertexCount: number;\n readonly indices?: Buffer | null;\n readonly attributes: {\n positions: Buffer;\n normals?: Buffer;\n texCoords?: Buffer;\n colors?: Buffer;\n };\n\n constructor(props: GPUGeometryProps) {\n this.id = props.id || uid('geometry');\n this.topology = props.topology;\n this.indices = props.indices || null;\n this.attributes = props.attributes;\n\n //\n this.vertexCount = props.vertexCount;\n\n // Populate default bufferLayout\n this.bufferLayout = props.bufferLayout || [];\n if (!this.bufferLayout.find(layout => layout.name === 'positions')) {\n this.bufferLayout.push({name: 'positions', format: 'float32x3'});\n }\n if (this.attributes.normals && !this.bufferLayout.find(layout => layout.name === 'normals')) {\n this.bufferLayout.push({name: 'normals', format: 'float32x3'});\n }\n if (this.attributes.texCoords && !this.bufferLayout.find(layout => layout.name === 'texCoords')) {\n this.bufferLayout.push({name: 'texCoords', format: 'float32x2'});\n }\n if (this.attributes.colors && !this.bufferLayout.find(layout => layout.name === 'colors')) {\n this.bufferLayout.push({name: 'colors', format: 'float32x3'});\n }\n\n if (this.indices) {\n assert(this.indices.usage === Buffer.INDEX);\n }\n }\n\n destroy(): void {\n this.indices.destroy();\n this.attributes.positions.destroy();\n this.attributes.normals.destroy();\n this.attributes.texCoords.destroy();\n this.attributes.colors?.destroy();\n }\n\n getVertexCount(): number {\n return this.vertexCount;\n }\n\n getAttributes(): GPUGeometryAttributes {\n return this.attributes;\n }\n\n getIndexes(): Buffer | null {\n return this.indices;\n }\n\n _calculateVertexCount(positions: Buffer): number {\n // Assume that positions is a fully packed float32x3 buffer\n const vertexCount = positions.byteLength / 12;\n return vertexCount;\n }\n}\n\nexport function makeGPUGeometry(device: Device, geometry: Geometry | GPUGeometry): GPUGeometry {\n if (geometry instanceof GPUGeometry) {\n return geometry;\n }\n\n const indices = getIndexBufferFromGeometry(device, geometry);\n const {attributes, bufferLayout} = getAttributeBuffersFromGeometry(device, geometry);\n return new GPUGeometry({\n topology: geometry.topology || 'triangle-list',\n bufferLayout,\n vertexCount: geometry.vertexCount,\n indices,\n attributes\n });\n}\n\nexport function getIndexBufferFromGeometry(device: Device, geometry: Geometry): Buffer | undefined {\n if (!geometry.indices) {\n return undefined;\n }\n\n const data = geometry.indices.value;\n assert(\n data instanceof Uint16Array || data instanceof Uint32Array,\n 'attribute array for \"indices\" must be of integer type'\n );\n return device.createBuffer({usage: Buffer.INDEX, data});\n}\n\nexport function getAttributeBuffersFromGeometry(\n device: Device,\n geometry: Geometry\n): {attributes: GPUGeometryAttributes, bufferLayout: BufferLayout[], vertexCount: number} {\n const positions = geometry.attributes.positions || geometry.attributes.POSITION;\n const normals = geometry.attributes.normals || geometry.attributes.NORMAL;\n const texCoords = geometry.attributes.texCoords || geometry.attributes.TEXCOORD_0;\n\n const attributes: GPUGeometryAttributes = {\n positions: device.createBuffer({data: positions.value, id: 'positions-buffer'})\n };\n const bufferLayout: BufferLayout[] = [\n {name: 'positions', format: `float32x${positions.size as 2 | 3 | 4}`}\n ];\n if (normals) {\n attributes.normals = device.createBuffer({data: normals.value, id: 'normals-buffer'});\n bufferLayout.push({name: 'normals', format: `float32x${normals.size as 2 | 3 | 4}`});\n }\n if (texCoords) {\n attributes.texCoords = device.createBuffer({data: texCoords.value, id: 'texCoords-buffer'});\n bufferLayout.push({name: 'texCoords', format: `float32x${texCoords.size as 2 | 3 | 4}`});\n }\n\n const vertexCount = geometry._calculateVertexCount(geometry.attributes, geometry.indices)\n\n return {attributes, bufferLayout, vertexCount};\n}\n"],"mappings":";AACA,SAAgBA,MAAM,EAAEC,GAAG,EAAEC,MAAM,QAAO,eAAe;AA4BzD,OAAO,MAAMC,WAAW,CAAC;EAiBvBC,WAAWA,CAACC,KAAuB,EAAE;IAAAC,eAAA;IAAAA,eAAA,mBAfD,CAAC,CAAC;IAAAA,eAAA;IAAAA,eAAA,uBAIE,EAAE;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAYxC,IAAI,CAACC,EAAE,GAAGF,K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