@luma.gl/engine 9.0.0-alpha.45 → 9.0.0-alpha.47
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 +245 -43
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +6 -2
- package/dist/geometry/gpu-geometry.js.map +1 -1
- package/dist/index.cjs +152 -82
- package/dist/model/model.d.ts +10 -1
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +12 -1
- package/dist/model/model.js.map +1 -1
- package/dist/transform/transform.d.ts +24 -57
- package/dist/transform/transform.d.ts.map +1 -1
- package/dist/transform/transform.js +66 -24
- package/dist/transform/transform.js.map +1 -1
- package/dist.min.js +62 -45
- package/package.json +5 -5
- package/src/geometry/gpu-geometry.ts +3 -2
- package/src/model/model.ts +51 -8
- package/src/transform/transform.ts +125 -113
package/dist/index.cjs
CHANGED
|
@@ -735,7 +735,8 @@ function getAttributeBuffersFromGeometry(device, geometry) {
|
|
|
735
735
|
break;
|
|
736
736
|
}
|
|
737
737
|
attributes[name] = device.createBuffer({ data: attribute.value, id: `${attributeName}-buffer` });
|
|
738
|
-
|
|
738
|
+
const { value, size } = attribute;
|
|
739
|
+
bufferLayout.push({ name, format: (0, import_core4.getVertexFormatFromAttribute)(value, size) });
|
|
739
740
|
}
|
|
740
741
|
const vertexCount = geometry._calculateVertexCount(geometry.attributes, geometry.indices);
|
|
741
742
|
return { attributes, bufferLayout, vertexCount };
|
|
@@ -833,6 +834,8 @@ var _Model = class {
|
|
|
833
834
|
this.bindings = {};
|
|
834
835
|
/** Sets uniforms @deprecated Use uniform buffers and setBindings() for portability*/
|
|
835
836
|
this.uniforms = {};
|
|
837
|
+
/** TransformFeedback, WebGL 2 only. */
|
|
838
|
+
this.transformFeedback = null;
|
|
836
839
|
this._pipelineNeedsUpdate = "newly created";
|
|
837
840
|
this._attributeInfos = {};
|
|
838
841
|
this._gpuGeometry = null;
|
|
@@ -897,6 +900,9 @@ var _Model = class {
|
|
|
897
900
|
if (props.moduleSettings) {
|
|
898
901
|
this.updateModuleSettings(props.moduleSettings);
|
|
899
902
|
}
|
|
903
|
+
if (props.transformFeedback) {
|
|
904
|
+
this.transformFeedback = props.transformFeedback;
|
|
905
|
+
}
|
|
900
906
|
this.setUniforms(this._getModuleUniforms());
|
|
901
907
|
Object.seal(this);
|
|
902
908
|
}
|
|
@@ -912,7 +918,8 @@ var _Model = class {
|
|
|
912
918
|
renderPass,
|
|
913
919
|
vertexArray: this.vertexArray,
|
|
914
920
|
vertexCount: this.vertexCount,
|
|
915
|
-
instanceCount: this.instanceCount
|
|
921
|
+
instanceCount: this.instanceCount,
|
|
922
|
+
transformFeedback: this.transformFeedback
|
|
916
923
|
});
|
|
917
924
|
}
|
|
918
925
|
// Update fixed fields (can trigger pipeline rebuild)
|
|
@@ -999,6 +1006,12 @@ var _Model = class {
|
|
|
999
1006
|
Object.assign(this.bindings, bindings);
|
|
1000
1007
|
Object.assign(this.uniforms, uniforms);
|
|
1001
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Updates optional transform feedback. WebGL 2 only.
|
|
1011
|
+
*/
|
|
1012
|
+
setTransformFeedback(transformFeedback) {
|
|
1013
|
+
this.transformFeedback = transformFeedback;
|
|
1014
|
+
}
|
|
1002
1015
|
/**
|
|
1003
1016
|
* @deprecated Updates shader module settings (which results in uniforms being set)
|
|
1004
1017
|
*/
|
|
@@ -1042,6 +1055,7 @@ var _Model = class {
|
|
|
1042
1055
|
for (const [bufferName, buffer] of Object.entries(buffers)) {
|
|
1043
1056
|
const bufferLayout = this.bufferLayout.find((layout) => layout.name === bufferName);
|
|
1044
1057
|
if (!bufferLayout) {
|
|
1058
|
+
import_core6.log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
|
|
1045
1059
|
continue;
|
|
1046
1060
|
}
|
|
1047
1061
|
const attributeNames = bufferLayout.attributes ? (_a = bufferLayout.attributes) == null ? void 0 : _a.map((layout) => layout.attribute) : [bufferLayout.name];
|
|
@@ -1074,7 +1088,9 @@ var _Model = class {
|
|
|
1074
1088
|
if (attributeInfo) {
|
|
1075
1089
|
this.vertexArray.setConstant(attributeInfo.location, value);
|
|
1076
1090
|
} else {
|
|
1077
|
-
import_core6.log.warn(
|
|
1091
|
+
import_core6.log.warn(
|
|
1092
|
+
`Model "${this.id}: Ignoring constant supplied for unknown attribute "${attributeName}"`
|
|
1093
|
+
)();
|
|
1078
1094
|
}
|
|
1079
1095
|
}
|
|
1080
1096
|
}
|
|
@@ -1084,7 +1100,10 @@ var _Model = class {
|
|
|
1084
1100
|
_updatePipeline() {
|
|
1085
1101
|
if (this._pipelineNeedsUpdate) {
|
|
1086
1102
|
if (this.pipeline) {
|
|
1087
|
-
import_core6.log.log(
|
|
1103
|
+
import_core6.log.log(
|
|
1104
|
+
1,
|
|
1105
|
+
`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`
|
|
1106
|
+
)();
|
|
1088
1107
|
}
|
|
1089
1108
|
this._pipelineNeedsUpdate = false;
|
|
1090
1109
|
this.pipeline = this.device.createRenderPipeline(__spreadProps(__spreadValues({}, this.props), {
|
|
@@ -1092,7 +1111,11 @@ var _Model = class {
|
|
|
1092
1111
|
topology: this.topology,
|
|
1093
1112
|
parameters: this.parameters,
|
|
1094
1113
|
vs: this.device.createShader({ id: "{$this.id}-vertex", stage: "vertex", source: this.vs }),
|
|
1095
|
-
fs: this.fs ? this.device.createShader({
|
|
1114
|
+
fs: this.fs ? this.device.createShader({
|
|
1115
|
+
id: "{$this.id}-fragment",
|
|
1116
|
+
stage: "fragment",
|
|
1117
|
+
source: this.fs
|
|
1118
|
+
}) : null
|
|
1096
1119
|
}));
|
|
1097
1120
|
this._attributeInfos = (0, import_core7.getAttributeInfosFromLayouts)(
|
|
1098
1121
|
this.pipeline.shaderLayout,
|
|
@@ -1116,7 +1139,9 @@ Model.defaultProps = __spreadProps(__spreadValues({}, import_core6.RenderPipelin
|
|
|
1116
1139
|
indexBuffer: null,
|
|
1117
1140
|
attributes: {},
|
|
1118
1141
|
constantAttributes: {},
|
|
1142
|
+
varyings: [],
|
|
1119
1143
|
pipelineFactory: void 0,
|
|
1144
|
+
transformFeedback: void 0,
|
|
1120
1145
|
shaderAssembler: import_shadertools.ShaderAssembler.getDefaultShaderAssembler()
|
|
1121
1146
|
});
|
|
1122
1147
|
function mergeBufferLayouts(layouts1, layouts2) {
|
|
@@ -1133,68 +1158,113 @@ function mergeBufferLayouts(layouts1, layouts2) {
|
|
|
1133
1158
|
}
|
|
1134
1159
|
|
|
1135
1160
|
// src/transform/transform.ts
|
|
1161
|
+
var import_core8 = require("@luma.gl/core");
|
|
1162
|
+
var import_shadertools2 = require("@luma.gl/shadertools");
|
|
1136
1163
|
var Transform = class {
|
|
1137
1164
|
constructor(device, props = {}) {
|
|
1138
|
-
// model: Model;
|
|
1139
|
-
this.elementCount = 0;
|
|
1140
1165
|
// bufferTransform: BufferTransform | null = null;
|
|
1141
1166
|
// textureTransform: TextureTransform | null = null;
|
|
1142
1167
|
this.elementIDBuffer = null;
|
|
1168
|
+
(0, import_core8.assert)(device.features.has("transform-feedback-webgl2"), "Device must support transform feedback");
|
|
1169
|
+
this.device = device;
|
|
1170
|
+
this.model = new Model(this.device, {
|
|
1171
|
+
vs: props.vs,
|
|
1172
|
+
fs: props.fs || (0, import_shadertools2.getPassthroughFS)({ version: (0, import_shadertools2.getShaderInfo)(props.vs).version }),
|
|
1173
|
+
id: props.id || "transform-model",
|
|
1174
|
+
varyings: props.varyings,
|
|
1175
|
+
attributes: props.attributes,
|
|
1176
|
+
bufferLayout: props.bufferLayout,
|
|
1177
|
+
topology: props.topology || "point-list",
|
|
1178
|
+
vertexCount: props.vertexCount,
|
|
1179
|
+
defines: props.defines,
|
|
1180
|
+
modules: props.modules
|
|
1181
|
+
});
|
|
1182
|
+
this.transformFeedback = this.device.createTransformFeedback({
|
|
1183
|
+
layout: this.model.pipeline.shaderLayout,
|
|
1184
|
+
buffers: props.feedbackBuffers
|
|
1185
|
+
});
|
|
1186
|
+
this.model.setTransformFeedback(this.transformFeedback);
|
|
1187
|
+
Object.seal(this);
|
|
1143
1188
|
}
|
|
1144
|
-
/**
|
|
1145
|
-
* Check if Transforms are supported (they are not under WebGL1)
|
|
1146
|
-
* @todo differentiate writing to buffer vs not
|
|
1147
|
-
*/
|
|
1189
|
+
/** @deprecated Use device feature test. */
|
|
1148
1190
|
static isSupported(device) {
|
|
1149
|
-
return
|
|
1191
|
+
return device.features.has("transform-feedback-webgl2");
|
|
1150
1192
|
}
|
|
1151
|
-
/**
|
|
1193
|
+
/** Destroy owned resources. */
|
|
1152
1194
|
destroy() {
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
this.destroy();
|
|
1195
|
+
if (this.model) {
|
|
1196
|
+
this.model.destroy();
|
|
1197
|
+
}
|
|
1157
1198
|
}
|
|
1158
1199
|
/** Run one transform loop. */
|
|
1159
1200
|
run(options) {
|
|
1160
|
-
const {
|
|
1161
|
-
const
|
|
1162
|
-
if (
|
|
1163
|
-
|
|
1201
|
+
const { framebuffer, parameters, discard, uniforms } = options || {};
|
|
1202
|
+
const renderPass = this.device.beginRenderPass({ framebuffer, parameters, discard });
|
|
1203
|
+
if (uniforms)
|
|
1204
|
+
this.model.setUniforms(uniforms);
|
|
1205
|
+
this.model.draw(renderPass);
|
|
1206
|
+
renderPass.end();
|
|
1164
1207
|
}
|
|
1165
1208
|
/** swap resources if a map is provided */
|
|
1166
1209
|
swap() {
|
|
1210
|
+
throw new Error("Not implemented");
|
|
1167
1211
|
}
|
|
1168
|
-
/**
|
|
1212
|
+
/** Returns the {@link Buffer} or {@link BufferRange} for given varying name. */
|
|
1169
1213
|
getBuffer(varyingName) {
|
|
1170
|
-
return
|
|
1214
|
+
return this.transformFeedback.getBuffer(varyingName);
|
|
1171
1215
|
}
|
|
1172
|
-
|
|
1216
|
+
readAsync(varyingName) {
|
|
1217
|
+
const result = this.getBuffer(varyingName);
|
|
1218
|
+
if (result instanceof import_core8.Buffer) {
|
|
1219
|
+
return result.readAsync();
|
|
1220
|
+
}
|
|
1221
|
+
const { buffer, byteOffset = 0, byteLength = buffer.byteLength } = result;
|
|
1222
|
+
return buffer.readAsync(byteOffset, byteLength);
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Return data either from Buffer or from Texture.
|
|
1226
|
+
* @deprecated Prefer {@link readAsync}.
|
|
1227
|
+
*/
|
|
1173
1228
|
getData(options = {}) {
|
|
1229
|
+
throw new Error("Not implemented");
|
|
1174
1230
|
}
|
|
1175
1231
|
/** Return framebuffer object if rendering to textures */
|
|
1176
1232
|
getFramebuffer() {
|
|
1177
|
-
|
|
1233
|
+
throw new Error("Not implemented");
|
|
1178
1234
|
}
|
|
1179
1235
|
/** Update some or all buffer/texture bindings. */
|
|
1180
1236
|
update(props) {
|
|
1237
|
+
throw new Error("Not implemented");
|
|
1181
1238
|
}
|
|
1182
1239
|
// Private
|
|
1183
1240
|
_updateModelProps(props) {
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
}
|
|
1241
|
+
throw new Error("Not implemented");
|
|
1242
|
+
}
|
|
1243
|
+
// _buildResourceTransforms(props: TransformProps) {
|
|
1244
|
+
// if (canCreateBufferTransform(props)) {
|
|
1245
|
+
// this.bufferTransform = new BufferTransform(this.device, props);
|
|
1246
|
+
// }
|
|
1247
|
+
// if (canCreateTextureTransform(props)) {
|
|
1248
|
+
// this.textureTransform = new TextureTransform(this.device, props);
|
|
1249
|
+
// }
|
|
1250
|
+
// assert(
|
|
1251
|
+
// this.bufferTransform || this.textureTransform,
|
|
1252
|
+
// 'must provide source/feedback buffers or source/target textures'
|
|
1253
|
+
// );
|
|
1254
|
+
// }
|
|
1255
|
+
// _updateDrawOptions(options: TransformRunOptions): TransformDrawOptions {
|
|
1256
|
+
// const updatedOpts = {...options};
|
|
1257
|
+
// const resourceTransforms = [this.bufferTransform, this.textureTransform].filter(Boolean) ;
|
|
1258
|
+
// for (const resourceTransform of resourceTransforms) {
|
|
1259
|
+
// updatedOpts = Object.assign(updatedOpts, resourceTransform.getDrawOptions(updatedOpts));
|
|
1260
|
+
// }
|
|
1261
|
+
// return updatedOpts;
|
|
1262
|
+
// }
|
|
1193
1263
|
};
|
|
1194
1264
|
|
|
1195
1265
|
// src/shadertools/shader-module-uniforms.ts
|
|
1196
|
-
var import_core8 = require("@luma.gl/core");
|
|
1197
1266
|
var import_core9 = require("@luma.gl/core");
|
|
1267
|
+
var import_core10 = require("@luma.gl/core");
|
|
1198
1268
|
var ShaderModuleUniforms = class {
|
|
1199
1269
|
constructor(props) {
|
|
1200
1270
|
this.uniformBuffer = null;
|
|
@@ -1209,10 +1279,10 @@ var ShaderModuleUniforms = class {
|
|
|
1209
1279
|
for (const [name, { format }] of Object.entries(props.shaderModule.uniformPropTypes || {})) {
|
|
1210
1280
|
uniformTypes[name] = format;
|
|
1211
1281
|
}
|
|
1212
|
-
this.uniformBufferLayout = new
|
|
1282
|
+
this.uniformBufferLayout = new import_core10.UniformBufferLayout(uniformTypes);
|
|
1213
1283
|
if (this.useUniformBuffers) {
|
|
1214
1284
|
this.uniformBuffer = this.device.createBuffer({
|
|
1215
|
-
usage:
|
|
1285
|
+
usage: import_core10.Buffer.UNIFORM,
|
|
1216
1286
|
byteLength: this.uniformBufferLayout.byteLength
|
|
1217
1287
|
});
|
|
1218
1288
|
}
|
|
@@ -1266,11 +1336,11 @@ function arrayEqual(a, b, limit = 16) {
|
|
|
1266
1336
|
if (a !== b) {
|
|
1267
1337
|
return false;
|
|
1268
1338
|
}
|
|
1269
|
-
const arrayA = (0,
|
|
1339
|
+
const arrayA = (0, import_core9.isNumberArray)(a);
|
|
1270
1340
|
if (!arrayA) {
|
|
1271
1341
|
return false;
|
|
1272
1342
|
}
|
|
1273
|
-
const arrayB = (0,
|
|
1343
|
+
const arrayB = (0, import_core9.isNumberArray)(b);
|
|
1274
1344
|
if (arrayB && arrayA.length === arrayB.length) {
|
|
1275
1345
|
for (let i = 0; i < arrayA.length; ++i) {
|
|
1276
1346
|
if (arrayB[i] !== arrayA[i]) {
|
|
@@ -1282,15 +1352,15 @@ function arrayEqual(a, b, limit = 16) {
|
|
|
1282
1352
|
}
|
|
1283
1353
|
|
|
1284
1354
|
// src/lib/clip-space.ts
|
|
1285
|
-
var
|
|
1355
|
+
var import_core12 = require("@luma.gl/core");
|
|
1286
1356
|
|
|
1287
1357
|
// src/geometry/geometry.ts
|
|
1288
|
-
var
|
|
1358
|
+
var import_core11 = require("@luma.gl/core");
|
|
1289
1359
|
var Geometry = class {
|
|
1290
1360
|
constructor(props) {
|
|
1291
1361
|
this.userData = {};
|
|
1292
1362
|
const { attributes = {}, indices = null, vertexCount = null } = props;
|
|
1293
|
-
this.id = props.id || (0,
|
|
1363
|
+
this.id = props.id || (0, import_core11.uid)("geometry");
|
|
1294
1364
|
this.topology = props.topology;
|
|
1295
1365
|
if (indices) {
|
|
1296
1366
|
this.indices = ArrayBuffer.isView(indices) ? { value: indices, size: 1 } : indices;
|
|
@@ -1298,7 +1368,7 @@ var Geometry = class {
|
|
|
1298
1368
|
this.attributes = {};
|
|
1299
1369
|
for (const [attributeName, attributeValue] of Object.entries(attributes)) {
|
|
1300
1370
|
const attribute = ArrayBuffer.isView(attributeValue) ? { value: attributeValue } : attributeValue;
|
|
1301
|
-
(0,
|
|
1371
|
+
(0, import_core11.assert)(
|
|
1302
1372
|
ArrayBuffer.isView(attribute.value),
|
|
1303
1373
|
`${this._print(attributeName)}: must be typed array or object with value as typed array`
|
|
1304
1374
|
);
|
|
@@ -1306,7 +1376,7 @@ var Geometry = class {
|
|
|
1306
1376
|
attribute.size = 3;
|
|
1307
1377
|
}
|
|
1308
1378
|
if (attributeName === "indices") {
|
|
1309
|
-
(0,
|
|
1379
|
+
(0, import_core11.assert)(!this.indices);
|
|
1310
1380
|
this.indices = attribute;
|
|
1311
1381
|
} else {
|
|
1312
1382
|
this.attributes[attributeName] = attribute;
|
|
@@ -1357,13 +1427,13 @@ var Geometry = class {
|
|
|
1357
1427
|
vertexCount = Math.min(vertexCount, value.length / size);
|
|
1358
1428
|
}
|
|
1359
1429
|
}
|
|
1360
|
-
(0,
|
|
1430
|
+
(0, import_core11.assert)(Number.isFinite(vertexCount));
|
|
1361
1431
|
return vertexCount;
|
|
1362
1432
|
}
|
|
1363
1433
|
};
|
|
1364
1434
|
|
|
1365
1435
|
// src/lib/clip-space.ts
|
|
1366
|
-
var CLIPSPACE_VERTEX_SHADER =
|
|
1436
|
+
var CLIPSPACE_VERTEX_SHADER = import_core12.glsl`\
|
|
1367
1437
|
attribute vec2 aClipSpacePosition;
|
|
1368
1438
|
attribute vec2 aTexCoord;
|
|
1369
1439
|
attribute vec2 aCoordinate;
|
|
@@ -1403,19 +1473,19 @@ var ClipSpace = class extends Model {
|
|
|
1403
1473
|
};
|
|
1404
1474
|
|
|
1405
1475
|
// src/scenegraph/scenegraph-node.ts
|
|
1406
|
-
var
|
|
1407
|
-
var
|
|
1476
|
+
var import_core13 = require("@luma.gl/core");
|
|
1477
|
+
var import_core14 = require("@math.gl/core");
|
|
1408
1478
|
var ScenegraphNode = class {
|
|
1409
1479
|
constructor(props = {}) {
|
|
1410
|
-
this.matrix = new
|
|
1480
|
+
this.matrix = new import_core14.Matrix4();
|
|
1411
1481
|
this.display = true;
|
|
1412
|
-
this.position = new
|
|
1413
|
-
this.rotation = new
|
|
1414
|
-
this.scale = new
|
|
1482
|
+
this.position = new import_core14.Vector3();
|
|
1483
|
+
this.rotation = new import_core14.Vector3();
|
|
1484
|
+
this.scale = new import_core14.Vector3(1, 1, 1);
|
|
1415
1485
|
this.userData = {};
|
|
1416
1486
|
this.props = {};
|
|
1417
1487
|
const { id } = props;
|
|
1418
|
-
this.id = id || (0,
|
|
1488
|
+
this.id = id || (0, import_core13.uid)(this.constructor.name);
|
|
1419
1489
|
this._setScenegraphNodeProps(props);
|
|
1420
1490
|
}
|
|
1421
1491
|
getBounds() {
|
|
@@ -1435,17 +1505,17 @@ var ScenegraphNode = class {
|
|
|
1435
1505
|
return `{type: ScenegraphNode, id: ${this.id})}`;
|
|
1436
1506
|
}
|
|
1437
1507
|
setPosition(position) {
|
|
1438
|
-
(0,
|
|
1508
|
+
(0, import_core13.assert)(position.length === 3, "setPosition requires vector argument");
|
|
1439
1509
|
this.position = position;
|
|
1440
1510
|
return this;
|
|
1441
1511
|
}
|
|
1442
1512
|
setRotation(rotation) {
|
|
1443
|
-
(0,
|
|
1513
|
+
(0, import_core13.assert)(rotation.length === 3, "setRotation requires vector argument");
|
|
1444
1514
|
this.rotation = rotation;
|
|
1445
1515
|
return this;
|
|
1446
1516
|
}
|
|
1447
1517
|
setScale(scale) {
|
|
1448
|
-
(0,
|
|
1518
|
+
(0, import_core13.assert)(scale.length === 3, "setScale requires vector argument");
|
|
1449
1519
|
this.scale = scale;
|
|
1450
1520
|
return this;
|
|
1451
1521
|
}
|
|
@@ -1497,9 +1567,9 @@ var ScenegraphNode = class {
|
|
|
1497
1567
|
return this;
|
|
1498
1568
|
}
|
|
1499
1569
|
getCoordinateUniforms(viewMatrix, modelMatrix) {
|
|
1500
|
-
(0,
|
|
1570
|
+
(0, import_core13.assert)(viewMatrix);
|
|
1501
1571
|
modelMatrix = modelMatrix || this.matrix;
|
|
1502
|
-
const worldMatrix = new
|
|
1572
|
+
const worldMatrix = new import_core14.Matrix4(viewMatrix).multiplyRight(modelMatrix);
|
|
1503
1573
|
const worldInverse = worldMatrix.invert();
|
|
1504
1574
|
const worldInverseTranspose = worldInverse.transpose();
|
|
1505
1575
|
return {
|
|
@@ -1554,13 +1624,13 @@ var ScenegraphNode = class {
|
|
|
1554
1624
|
};
|
|
1555
1625
|
|
|
1556
1626
|
// src/scenegraph/group-node.ts
|
|
1557
|
-
var
|
|
1558
|
-
var
|
|
1627
|
+
var import_core15 = require("@math.gl/core");
|
|
1628
|
+
var import_core16 = require("@luma.gl/core");
|
|
1559
1629
|
var GroupNode = class extends ScenegraphNode {
|
|
1560
1630
|
constructor(props = {}) {
|
|
1561
1631
|
props = Array.isArray(props) ? { children: props } : props;
|
|
1562
1632
|
const { children = [] } = props;
|
|
1563
|
-
|
|
1633
|
+
import_core16.log.assert(
|
|
1564
1634
|
children.every((child) => child instanceof ScenegraphNode),
|
|
1565
1635
|
"every child must an instance of ScenegraphNode"
|
|
1566
1636
|
);
|
|
@@ -1575,12 +1645,12 @@ var GroupNode = class extends ScenegraphNode {
|
|
|
1575
1645
|
return;
|
|
1576
1646
|
}
|
|
1577
1647
|
const [min, max] = bounds;
|
|
1578
|
-
const center = new
|
|
1648
|
+
const center = new import_core15.Vector3(min).add(max).divide([2, 2, 2]);
|
|
1579
1649
|
worldMatrix.transformAsPoint(center, center);
|
|
1580
|
-
const halfSize = new
|
|
1650
|
+
const halfSize = new import_core15.Vector3(max).subtract(min).divide([2, 2, 2]);
|
|
1581
1651
|
worldMatrix.transformAsVector(halfSize, halfSize);
|
|
1582
1652
|
for (let v = 0; v < 8; v++) {
|
|
1583
|
-
const position = new
|
|
1653
|
+
const position = new import_core15.Vector3(
|
|
1584
1654
|
v & 1 ? -1 : 1,
|
|
1585
1655
|
v & 2 ? -1 : 1,
|
|
1586
1656
|
v & 4 ? -1 : 1
|
|
@@ -1624,8 +1694,8 @@ var GroupNode = class extends ScenegraphNode {
|
|
|
1624
1694
|
this.children = [];
|
|
1625
1695
|
return this;
|
|
1626
1696
|
}
|
|
1627
|
-
traverse(visitor, { worldMatrix = new
|
|
1628
|
-
const modelMatrix = new
|
|
1697
|
+
traverse(visitor, { worldMatrix = new import_core15.Matrix4() } = {}) {
|
|
1698
|
+
const modelMatrix = new import_core15.Matrix4(worldMatrix).multiplyRight(this.matrix);
|
|
1629
1699
|
for (const child of this.children) {
|
|
1630
1700
|
if (child instanceof GroupNode) {
|
|
1631
1701
|
child.traverse(visitor, { worldMatrix: modelMatrix });
|
|
@@ -1668,10 +1738,10 @@ var ModelNode = class extends ScenegraphNode {
|
|
|
1668
1738
|
};
|
|
1669
1739
|
|
|
1670
1740
|
// src/geometries/cone-geometry.ts
|
|
1671
|
-
var
|
|
1741
|
+
var import_core18 = require("@luma.gl/core");
|
|
1672
1742
|
|
|
1673
1743
|
// src/geometries/truncated-cone-geometry.ts
|
|
1674
|
-
var
|
|
1744
|
+
var import_core17 = require("@luma.gl/core");
|
|
1675
1745
|
var INDEX_OFFSETS = {
|
|
1676
1746
|
x: [2, 0, 1],
|
|
1677
1747
|
y: [0, 1, 2],
|
|
@@ -1679,7 +1749,7 @@ var INDEX_OFFSETS = {
|
|
|
1679
1749
|
};
|
|
1680
1750
|
var TruncatedConeGeometry = class extends Geometry {
|
|
1681
1751
|
constructor(props = {}) {
|
|
1682
|
-
const { id = (0,
|
|
1752
|
+
const { id = (0, import_core17.uid)("truncated-code-geometry") } = props;
|
|
1683
1753
|
const { indices, attributes } = tesselateTruncatedCone(props);
|
|
1684
1754
|
super(__spreadProps(__spreadValues({}, props), {
|
|
1685
1755
|
id,
|
|
@@ -1781,7 +1851,7 @@ function tesselateTruncatedCone(props = {}) {
|
|
|
1781
1851
|
// src/geometries/cone-geometry.ts
|
|
1782
1852
|
var ConeGeometry = class extends TruncatedConeGeometry {
|
|
1783
1853
|
constructor(props = {}) {
|
|
1784
|
-
const { id = (0,
|
|
1854
|
+
const { id = (0, import_core18.uid)("cone-geometry"), radius = 1, cap = true } = props;
|
|
1785
1855
|
super(__spreadProps(__spreadValues({}, props), {
|
|
1786
1856
|
id,
|
|
1787
1857
|
topRadius: 0,
|
|
@@ -1793,10 +1863,10 @@ var ConeGeometry = class extends TruncatedConeGeometry {
|
|
|
1793
1863
|
};
|
|
1794
1864
|
|
|
1795
1865
|
// src/geometries/cube-geometry.ts
|
|
1796
|
-
var
|
|
1866
|
+
var import_core19 = require("@luma.gl/core");
|
|
1797
1867
|
var CubeGeometry = class extends Geometry {
|
|
1798
1868
|
constructor(props = {}) {
|
|
1799
|
-
const { id = (0,
|
|
1869
|
+
const { id = (0, import_core19.uid)("cube-geometry"), indices = true } = props;
|
|
1800
1870
|
super(indices ? __spreadProps(__spreadValues({}, props), {
|
|
1801
1871
|
id,
|
|
1802
1872
|
topology: "triangle-list",
|
|
@@ -2437,10 +2507,10 @@ var NON_INDEXED_ATTRIBUTES = {
|
|
|
2437
2507
|
};
|
|
2438
2508
|
|
|
2439
2509
|
// src/geometries/cylinder-geometry.ts
|
|
2440
|
-
var
|
|
2510
|
+
var import_core20 = require("@luma.gl/core");
|
|
2441
2511
|
var CylinderGeometry = class extends TruncatedConeGeometry {
|
|
2442
2512
|
constructor(props = {}) {
|
|
2443
|
-
const { id = (0,
|
|
2513
|
+
const { id = (0, import_core20.uid)("cylinder-geometry"), radius = 1 } = props;
|
|
2444
2514
|
super(__spreadProps(__spreadValues({}, props), {
|
|
2445
2515
|
id,
|
|
2446
2516
|
bottomRadius: radius,
|
|
@@ -2450,13 +2520,13 @@ var CylinderGeometry = class extends TruncatedConeGeometry {
|
|
|
2450
2520
|
};
|
|
2451
2521
|
|
|
2452
2522
|
// src/geometries/ico-sphere-geometry.ts
|
|
2453
|
-
var
|
|
2454
|
-
var
|
|
2523
|
+
var import_core21 = require("@luma.gl/core");
|
|
2524
|
+
var import_core22 = require("@math.gl/core");
|
|
2455
2525
|
var ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0];
|
|
2456
2526
|
var ICO_INDICES = [3, 4, 5, 3, 5, 1, 3, 1, 0, 3, 0, 4, 4, 0, 2, 4, 2, 5, 2, 0, 1, 5, 2, 1];
|
|
2457
2527
|
var IcoSphereGeometry = class extends Geometry {
|
|
2458
2528
|
constructor(props = {}) {
|
|
2459
|
-
const { id = (0,
|
|
2529
|
+
const { id = (0, import_core21.uid)("ico-sphere-geometry") } = props;
|
|
2460
2530
|
const { indices, attributes } = tesselateIcosaHedron(props);
|
|
2461
2531
|
super(__spreadProps(__spreadValues({}, props), {
|
|
2462
2532
|
id,
|
|
@@ -2548,7 +2618,7 @@ function tesselateIcosaHedron(props) {
|
|
|
2548
2618
|
const u3 = 1 - phi3 / PI2;
|
|
2549
2619
|
const vec1 = [x3 - x2, y3 - y2, z3 - z2];
|
|
2550
2620
|
const vec2 = [x1 - x2, y1 - y2, z1 - z2];
|
|
2551
|
-
const normal = new
|
|
2621
|
+
const normal = new import_core22.Vector3(vec1).cross(vec2).normalize();
|
|
2552
2622
|
let newIndex;
|
|
2553
2623
|
if ((u1 === 0 || u2 === 0 || u3 === 0) && (u1 === 0 || u1 > 0.5) && (u2 === 0 || u2 > 0.5) && (u3 === 0 || u3 > 0.5)) {
|
|
2554
2624
|
positions.push(positions[in1 + 0], positions[in1 + 1], positions[in1 + 2]);
|
|
@@ -2597,7 +2667,7 @@ function tesselateIcosaHedron(props) {
|
|
|
2597
2667
|
}
|
|
2598
2668
|
|
|
2599
2669
|
// src/geometries/plane-geometry.ts
|
|
2600
|
-
var
|
|
2670
|
+
var import_core23 = require("@luma.gl/core");
|
|
2601
2671
|
|
|
2602
2672
|
// src/geometry/geometry-utils.ts
|
|
2603
2673
|
function unpackIndexedGeometry(geometry) {
|
|
@@ -2630,7 +2700,7 @@ function unpackIndexedGeometry(geometry) {
|
|
|
2630
2700
|
// src/geometries/plane-geometry.ts
|
|
2631
2701
|
var PlaneGeometry = class extends Geometry {
|
|
2632
2702
|
constructor(props = {}) {
|
|
2633
|
-
const { id = (0,
|
|
2703
|
+
const { id = (0, import_core23.uid)("plane-geometry") } = props;
|
|
2634
2704
|
const { indices, attributes } = tesselatePlane(props);
|
|
2635
2705
|
super(__spreadProps(__spreadValues({}, props), {
|
|
2636
2706
|
id,
|
|
@@ -2719,10 +2789,10 @@ function tesselatePlane(props) {
|
|
|
2719
2789
|
}
|
|
2720
2790
|
|
|
2721
2791
|
// src/geometries/sphere-geometry.ts
|
|
2722
|
-
var
|
|
2792
|
+
var import_core24 = require("@luma.gl/core");
|
|
2723
2793
|
var SphereGeometry = class extends Geometry {
|
|
2724
2794
|
constructor(props = {}) {
|
|
2725
|
-
const { id = (0,
|
|
2795
|
+
const { id = (0, import_core24.uid)("sphere-geometry") } = props;
|
|
2726
2796
|
const { indices, attributes } = tesselateSphere(props);
|
|
2727
2797
|
super(__spreadProps(__spreadValues({}, props), {
|
|
2728
2798
|
id,
|
package/dist/model/model.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TypedArray, RenderPipelineProps, RenderPipelineParameters, BufferLayout, VertexArray, AttributeInfo } from '@luma.gl/core';
|
|
1
|
+
import type { TypedArray, RenderPipelineProps, RenderPipelineParameters, BufferLayout, VertexArray, AttributeInfo, TransformFeedback } from '@luma.gl/core';
|
|
2
2
|
import type { Binding, UniformValue, PrimitiveTopology } from '@luma.gl/core';
|
|
3
3
|
import { Device, Buffer, RenderPipeline, RenderPass } from '@luma.gl/core';
|
|
4
4
|
import type { ShaderModule } from '@luma.gl/shadertools';
|
|
@@ -36,6 +36,9 @@ export type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {
|
|
|
36
36
|
attributes?: Record<string, Buffer>;
|
|
37
37
|
/** */
|
|
38
38
|
constantAttributes?: Record<string, TypedArray>;
|
|
39
|
+
/** @internal For use with {@link TransformFeedback}, WebGL 2 only. */
|
|
40
|
+
varyings?: string[];
|
|
41
|
+
transformFeedback?: TransformFeedback;
|
|
39
42
|
/** Mapped uniforms for shadertool modules */
|
|
40
43
|
moduleSettings?: Record<string, Record<string, any>>;
|
|
41
44
|
};
|
|
@@ -85,6 +88,8 @@ export declare class Model {
|
|
|
85
88
|
* @todo - allow application to define multiple vertex arrays?
|
|
86
89
|
* */
|
|
87
90
|
vertexArray: VertexArray;
|
|
91
|
+
/** TransformFeedback, WebGL 2 only. */
|
|
92
|
+
transformFeedback: TransformFeedback | null;
|
|
88
93
|
_pipelineNeedsUpdate: string | false;
|
|
89
94
|
_attributeInfos: Record<string, AttributeInfo>;
|
|
90
95
|
_gpuGeometry: GPUGeometry | null;
|
|
@@ -135,6 +140,10 @@ export declare class Model {
|
|
|
135
140
|
* Updates shader module settings (which results in bindings & uniforms being set)
|
|
136
141
|
*/
|
|
137
142
|
setShaderModuleProps(props: Record<string, any>): void;
|
|
143
|
+
/**
|
|
144
|
+
* Updates optional transform feedback. WebGL 2 only.
|
|
145
|
+
*/
|
|
146
|
+
setTransformFeedback(transformFeedback: TransformFeedback | null): void;
|
|
138
147
|
/**
|
|
139
148
|
* @deprecated Updates shader module settings (which results in uniforms being set)
|
|
140
149
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,aAAa,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5E,OAAO,EACL,MAAM,EACN,MAAM,EACN,cAAc,EACd,UAAU,EAKX,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAC,YAAY,EAAe,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAC,WAAW,EAAkB,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAA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AKzD;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIhD;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAiCpD;;;;;;;OAOG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAanE,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI7C,eAAe,IAAI,cAAc;CA8BlC"}
|
package/dist/model/model.js
CHANGED
|
@@ -23,6 +23,7 @@ export class Model {
|
|
|
23
23
|
this.uniforms = {};
|
|
24
24
|
this.pipeline = void 0;
|
|
25
25
|
this.vertexArray = void 0;
|
|
26
|
+
this.transformFeedback = null;
|
|
26
27
|
this._pipelineNeedsUpdate = 'newly created';
|
|
27
28
|
this._attributeInfos = {};
|
|
28
29
|
this._gpuGeometry = null;
|
|
@@ -93,6 +94,9 @@ export class Model {
|
|
|
93
94
|
if (props.moduleSettings) {
|
|
94
95
|
this.updateModuleSettings(props.moduleSettings);
|
|
95
96
|
}
|
|
97
|
+
if (props.transformFeedback) {
|
|
98
|
+
this.transformFeedback = props.transformFeedback;
|
|
99
|
+
}
|
|
96
100
|
this.setUniforms(this._getModuleUniforms());
|
|
97
101
|
Object.seal(this);
|
|
98
102
|
}
|
|
@@ -107,7 +111,8 @@ export class Model {
|
|
|
107
111
|
renderPass,
|
|
108
112
|
vertexArray: this.vertexArray,
|
|
109
113
|
vertexCount: this.vertexCount,
|
|
110
|
-
instanceCount: this.instanceCount
|
|
114
|
+
instanceCount: this.instanceCount,
|
|
115
|
+
transformFeedback: this.transformFeedback
|
|
111
116
|
});
|
|
112
117
|
}
|
|
113
118
|
setGeometry(geometry) {
|
|
@@ -161,6 +166,9 @@ export class Model {
|
|
|
161
166
|
Object.assign(this.bindings, bindings);
|
|
162
167
|
Object.assign(this.uniforms, uniforms);
|
|
163
168
|
}
|
|
169
|
+
setTransformFeedback(transformFeedback) {
|
|
170
|
+
this.transformFeedback = transformFeedback;
|
|
171
|
+
}
|
|
164
172
|
updateModuleSettings(props) {
|
|
165
173
|
this.setShaderModuleProps(props);
|
|
166
174
|
}
|
|
@@ -182,6 +190,7 @@ export class Model {
|
|
|
182
190
|
var _bufferLayout$attribu;
|
|
183
191
|
const bufferLayout = this.bufferLayout.find(layout => layout.name === bufferName);
|
|
184
192
|
if (!bufferLayout) {
|
|
193
|
+
log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
|
|
185
194
|
continue;
|
|
186
195
|
}
|
|
187
196
|
const attributeNames = bufferLayout.attributes ? (_bufferLayout$attribu = bufferLayout.attributes) === null || _bufferLayout$attribu === void 0 ? void 0 : _bufferLayout$attribu.map(layout => layout.attribute) : [bufferLayout.name];
|
|
@@ -252,7 +261,9 @@ Model.defaultProps = {
|
|
|
252
261
|
indexBuffer: null,
|
|
253
262
|
attributes: {},
|
|
254
263
|
constantAttributes: {},
|
|
264
|
+
varyings: [],
|
|
255
265
|
pipelineFactory: undefined,
|
|
266
|
+
transformFeedback: undefined,
|
|
256
267
|
shaderAssembler: ShaderAssembler.getDefaultShaderAssembler()
|
|
257
268
|
};
|
|
258
269
|
function mergeBufferLayouts(layouts1, layouts2) {
|