@luma.gl/engine 9.0.0-alpha.24 → 9.0.0-alpha.26
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/animation/timeline.js.map +1 -1
- package/dist/animation-loop/animation-loop.js +7 -7
- package/dist/animation-loop/animation-loop.js.map +1 -1
- package/dist/animation-loop/make-animation-loop.js.map +1 -1
- package/dist/dist.dev.js +1557 -108
- package/dist/geometries/ico-sphere-geometry.js.map +1 -1
- package/dist/geometries/plane-geometry.js.map +1 -1
- package/dist/geometry/geometry.d.ts +1 -1
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +1 -1
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/index.cjs +313 -47
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/clip-space.js +1 -1
- package/dist/lib/clip-space.js.map +1 -1
- package/dist/lib/pipeline-factory.js.map +1 -1
- package/dist/model/model-utils.js.map +1 -1
- package/dist/model/model.d.ts +3 -0
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +10 -0
- package/dist/model/model.js.map +1 -1
- package/dist/scenegraph/group-node.d.ts +21 -0
- package/dist/scenegraph/group-node.d.ts.map +1 -0
- package/dist/scenegraph/group-node.js +95 -0
- package/dist/scenegraph/group-node.js.map +1 -0
- package/dist/scenegraph/model-node.d.ts +18 -0
- package/dist/scenegraph/model-node.d.ts.map +1 -0
- package/dist/scenegraph/model-node.js +29 -0
- package/dist/scenegraph/model-node.js.map +1 -0
- package/dist/scenegraph/scenegraph-node.d.ts +56 -0
- package/dist/scenegraph/scenegraph-node.d.ts.map +1 -0
- package/dist/scenegraph/scenegraph-node.js +142 -0
- package/dist/scenegraph/scenegraph-node.js.map +1 -0
- package/dist/transform/transform.js +1 -1
- package/dist/transform/transform.js.map +1 -1
- package/dist.min.js +77 -76
- package/package.json +6 -6
- package/src/geometry/geometry.ts +1 -1
- package/src/index.ts +5 -0
- package/src/lib/clip-space.ts +1 -1
- package/src/model/model.ts +10 -0
- package/src/scenegraph/group-node.ts +103 -0
- package/src/scenegraph/model-node.ts +50 -0
- package/src/scenegraph/scenegraph-node.ts +204 -0
- package/src/transform/transform.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
9
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
10
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -34,14 +32,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
34
32
|
}
|
|
35
33
|
return to;
|
|
36
34
|
};
|
|
37
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
39
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
40
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
41
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
42
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
43
|
-
mod
|
|
44
|
-
));
|
|
45
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
36
|
var __async = (__this, __arguments, generator) => {
|
|
47
37
|
return new Promise((resolve, reject) => {
|
|
@@ -74,11 +64,14 @@ __export(src_exports, {
|
|
|
74
64
|
CubeGeometry: () => CubeGeometry,
|
|
75
65
|
CylinderGeometry: () => CylinderGeometry,
|
|
76
66
|
Geometry: () => Geometry,
|
|
67
|
+
GroupNode: () => GroupNode,
|
|
77
68
|
IcoSphereGeometry: () => IcoSphereGeometry,
|
|
78
69
|
KeyFrames: () => KeyFrames,
|
|
79
70
|
Model: () => Model,
|
|
71
|
+
ModelNode: () => ModelNode,
|
|
80
72
|
PipelineFactory: () => PipelineFactory,
|
|
81
73
|
PlaneGeometry: () => PlaneGeometry,
|
|
74
|
+
ScenegraphNode: () => ScenegraphNode,
|
|
82
75
|
SphereGeometry: () => SphereGeometry,
|
|
83
76
|
Timeline: () => Timeline,
|
|
84
77
|
Transform: () => Transform,
|
|
@@ -869,10 +862,12 @@ var DEFAULT_MODEL_PROPS = __spreadProps(__spreadValues({}, import_api5.RenderPip
|
|
|
869
862
|
var Model = class {
|
|
870
863
|
constructor(device, props) {
|
|
871
864
|
this.fs = null;
|
|
865
|
+
this.userData = {};
|
|
872
866
|
this.props = __spreadValues(__spreadValues({}, DEFAULT_MODEL_PROPS), props);
|
|
873
867
|
props = this.props;
|
|
874
868
|
this.id = this.props.id;
|
|
875
869
|
this.device = device;
|
|
870
|
+
Object.assign(this.userData, this.props.userData);
|
|
876
871
|
if (!props.vs) {
|
|
877
872
|
throw new Error("no vertex shader");
|
|
878
873
|
}
|
|
@@ -942,6 +937,12 @@ var Model = class {
|
|
|
942
937
|
return this;
|
|
943
938
|
}
|
|
944
939
|
setAttributes(attributes) {
|
|
940
|
+
if (attributes.indices) {
|
|
941
|
+
this.setIndexBuffer(attributes.indices);
|
|
942
|
+
attributes = __spreadValues({}, attributes);
|
|
943
|
+
delete attributes.indices;
|
|
944
|
+
console.warn("luma.gl: indices should not be part of attributes");
|
|
945
|
+
}
|
|
945
946
|
this.pipeline.setAttributes(attributes);
|
|
946
947
|
Object.assign(this.props.attributes, attributes);
|
|
947
948
|
return this;
|
|
@@ -986,7 +987,7 @@ function getShaderSource(device, shader) {
|
|
|
986
987
|
|
|
987
988
|
// src/transform/transform.ts
|
|
988
989
|
var import_shadertools2 = require("@luma.gl/shadertools");
|
|
989
|
-
var import_constants =
|
|
990
|
+
var import_constants = require("@luma.gl/constants");
|
|
990
991
|
var import_webgl = require("@luma.gl/webgl");
|
|
991
992
|
var Transform = class {
|
|
992
993
|
constructor(device, props = {}) {
|
|
@@ -1003,7 +1004,7 @@ var Transform = class {
|
|
|
1003
1004
|
fs: props.fs || (0, import_shadertools2.getPassthroughFS)({ version: (0, import_shadertools2.getShaderInfo)(props.vs).version }),
|
|
1004
1005
|
id: props.id || "transform-model",
|
|
1005
1006
|
// @ts-expect-error
|
|
1006
|
-
drawMode: props.drawMode || import_constants.
|
|
1007
|
+
drawMode: props.drawMode || import_constants.GL.POINTS,
|
|
1007
1008
|
vertexCount: props.elementCount
|
|
1008
1009
|
}));
|
|
1009
1010
|
Object.seal(this);
|
|
@@ -1060,21 +1061,21 @@ var Transform = class {
|
|
|
1060
1061
|
};
|
|
1061
1062
|
|
|
1062
1063
|
// src/lib/clip-space.ts
|
|
1063
|
-
var import_constants3 =
|
|
1064
|
+
var import_constants3 = require("@luma.gl/constants");
|
|
1064
1065
|
var import_api7 = require("@luma.gl/api");
|
|
1065
1066
|
var import_webgl2 = require("@luma.gl/webgl");
|
|
1066
1067
|
|
|
1067
1068
|
// src/geometry/geometry.ts
|
|
1068
1069
|
var import_api6 = require("@luma.gl/api");
|
|
1069
|
-
var import_constants2 =
|
|
1070
|
+
var import_constants2 = require("@luma.gl/constants");
|
|
1070
1071
|
var Geometry = class {
|
|
1071
1072
|
constructor(props = {}) {
|
|
1072
1073
|
this.userData = {};
|
|
1073
1074
|
/** @deprecated */
|
|
1074
|
-
this.drawMode = import_constants2.
|
|
1075
|
+
this.drawMode = import_constants2.GL.TRIANGLES;
|
|
1075
1076
|
const {
|
|
1076
1077
|
id = (0, import_api6.uid)("geometry"),
|
|
1077
|
-
drawMode = import_constants2.
|
|
1078
|
+
drawMode = import_constants2.GL.TRIANGLES,
|
|
1078
1079
|
attributes = {},
|
|
1079
1080
|
indices = null,
|
|
1080
1081
|
vertexCount = null
|
|
@@ -1149,36 +1150,36 @@ var Geometry = class {
|
|
|
1149
1150
|
};
|
|
1150
1151
|
/** @deprecated */
|
|
1151
1152
|
Geometry.DRAW_MODE = {
|
|
1152
|
-
POINTS: import_constants2.
|
|
1153
|
+
POINTS: import_constants2.GL.POINTS,
|
|
1153
1154
|
// draw single points.
|
|
1154
|
-
LINES: import_constants2.
|
|
1155
|
+
LINES: import_constants2.GL.LINES,
|
|
1155
1156
|
// draw lines. Each vertex connects to the one after it.
|
|
1156
|
-
LINE_LOOP: import_constants2.
|
|
1157
|
+
LINE_LOOP: import_constants2.GL.LINE_LOOP,
|
|
1157
1158
|
// draw lines. Each set of two vertices is treated as a separate line segment.
|
|
1158
|
-
LINE_STRIP: import_constants2.
|
|
1159
|
+
LINE_STRIP: import_constants2.GL.LINE_STRIP,
|
|
1159
1160
|
// draw a connected group of line segments from the first vertex to the last
|
|
1160
|
-
TRIANGLES: import_constants2.
|
|
1161
|
+
TRIANGLES: import_constants2.GL.TRIANGLES,
|
|
1161
1162
|
// draw triangles. Each set of three vertices creates a separate triangle.
|
|
1162
|
-
TRIANGLE_STRIP: import_constants2.
|
|
1163
|
+
TRIANGLE_STRIP: import_constants2.GL.TRIANGLE_STRIP,
|
|
1163
1164
|
// draw a connected group of triangles.
|
|
1164
|
-
TRIANGLE_FAN: import_constants2.
|
|
1165
|
+
TRIANGLE_FAN: import_constants2.GL.TRIANGLE_FAN
|
|
1165
1166
|
// draw a connected group of triangles.
|
|
1166
1167
|
};
|
|
1167
1168
|
function convertToTopology(drawMode) {
|
|
1168
1169
|
switch (drawMode) {
|
|
1169
|
-
case import_constants2.
|
|
1170
|
+
case import_constants2.GL.POINTS:
|
|
1170
1171
|
return "point-list";
|
|
1171
|
-
case import_constants2.
|
|
1172
|
+
case import_constants2.GL.LINES:
|
|
1172
1173
|
return "line-list";
|
|
1173
|
-
case import_constants2.
|
|
1174
|
+
case import_constants2.GL.LINE_STRIP:
|
|
1174
1175
|
return "line-strip";
|
|
1175
|
-
case import_constants2.
|
|
1176
|
+
case import_constants2.GL.TRIANGLES:
|
|
1176
1177
|
return "triangle-list";
|
|
1177
|
-
case import_constants2.
|
|
1178
|
+
case import_constants2.GL.TRIANGLE_STRIP:
|
|
1178
1179
|
return "triangle-strip";
|
|
1179
|
-
case import_constants2.
|
|
1180
|
+
case import_constants2.GL.TRIANGLE_FAN:
|
|
1180
1181
|
return "triangle-fan";
|
|
1181
|
-
case import_constants2.
|
|
1182
|
+
case import_constants2.GL.LINE_LOOP:
|
|
1182
1183
|
return "line-loop";
|
|
1183
1184
|
default:
|
|
1184
1185
|
throw new Error(String(drawMode));
|
|
@@ -1212,7 +1213,7 @@ var ClipSpace = class extends Model {
|
|
|
1212
1213
|
vs: CLIPSPACE_VERTEX_SHADER,
|
|
1213
1214
|
vertexCount: 4,
|
|
1214
1215
|
geometry: new Geometry({
|
|
1215
|
-
drawMode: import_constants3.
|
|
1216
|
+
drawMode: import_constants3.GL.TRIANGLE_STRIP,
|
|
1216
1217
|
vertexCount: 4,
|
|
1217
1218
|
attributes: {
|
|
1218
1219
|
aClipSpacePosition: { size: 2, value: new Float32Array(POSITIONS) },
|
|
@@ -1225,11 +1226,276 @@ var ClipSpace = class extends Model {
|
|
|
1225
1226
|
}
|
|
1226
1227
|
};
|
|
1227
1228
|
|
|
1228
|
-
// src/
|
|
1229
|
+
// src/scenegraph/scenegraph-node.ts
|
|
1230
|
+
var import_api8 = require("@luma.gl/api");
|
|
1231
|
+
var import_core = require("@math.gl/core");
|
|
1232
|
+
var ScenegraphNode = class {
|
|
1233
|
+
constructor(props = {}) {
|
|
1234
|
+
this.matrix = new import_core.Matrix4();
|
|
1235
|
+
this.display = true;
|
|
1236
|
+
this.position = new import_core.Vector3();
|
|
1237
|
+
this.rotation = new import_core.Vector3();
|
|
1238
|
+
this.scale = new import_core.Vector3(1, 1, 1);
|
|
1239
|
+
this.userData = {};
|
|
1240
|
+
this.props = {};
|
|
1241
|
+
const { id } = props;
|
|
1242
|
+
this.id = id || (0, import_api8.uid)(this.constructor.name);
|
|
1243
|
+
this._setScenegraphNodeProps(props);
|
|
1244
|
+
}
|
|
1245
|
+
getBounds() {
|
|
1246
|
+
return null;
|
|
1247
|
+
}
|
|
1248
|
+
destroy() {
|
|
1249
|
+
}
|
|
1250
|
+
/** @deprecated use .destroy() */
|
|
1251
|
+
delete() {
|
|
1252
|
+
this.destroy();
|
|
1253
|
+
}
|
|
1254
|
+
setProps(props) {
|
|
1255
|
+
this._setScenegraphNodeProps(props);
|
|
1256
|
+
return this;
|
|
1257
|
+
}
|
|
1258
|
+
toString() {
|
|
1259
|
+
return `{type: ScenegraphNode, id: ${this.id})}`;
|
|
1260
|
+
}
|
|
1261
|
+
setPosition(position) {
|
|
1262
|
+
(0, import_api8.assert)(position.length === 3, "setPosition requires vector argument");
|
|
1263
|
+
this.position = position;
|
|
1264
|
+
return this;
|
|
1265
|
+
}
|
|
1266
|
+
setRotation(rotation) {
|
|
1267
|
+
(0, import_api8.assert)(rotation.length === 3, "setRotation requires vector argument");
|
|
1268
|
+
this.rotation = rotation;
|
|
1269
|
+
return this;
|
|
1270
|
+
}
|
|
1271
|
+
setScale(scale) {
|
|
1272
|
+
(0, import_api8.assert)(scale.length === 3, "setScale requires vector argument");
|
|
1273
|
+
this.scale = scale;
|
|
1274
|
+
return this;
|
|
1275
|
+
}
|
|
1276
|
+
setMatrix(matrix, copyMatrix = true) {
|
|
1277
|
+
if (copyMatrix) {
|
|
1278
|
+
this.matrix.copy(matrix);
|
|
1279
|
+
} else {
|
|
1280
|
+
this.matrix = matrix;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
setMatrixComponents(components) {
|
|
1284
|
+
const { position, rotation, scale, update = true } = components;
|
|
1285
|
+
if (position) {
|
|
1286
|
+
this.setPosition(position);
|
|
1287
|
+
}
|
|
1288
|
+
if (rotation) {
|
|
1289
|
+
this.setRotation(rotation);
|
|
1290
|
+
}
|
|
1291
|
+
if (scale) {
|
|
1292
|
+
this.setScale(scale);
|
|
1293
|
+
}
|
|
1294
|
+
if (update) {
|
|
1295
|
+
this.updateMatrix();
|
|
1296
|
+
}
|
|
1297
|
+
return this;
|
|
1298
|
+
}
|
|
1299
|
+
updateMatrix() {
|
|
1300
|
+
const pos = this.position;
|
|
1301
|
+
const rot = this.rotation;
|
|
1302
|
+
const scale = this.scale;
|
|
1303
|
+
this.matrix.identity();
|
|
1304
|
+
this.matrix.translate(pos);
|
|
1305
|
+
this.matrix.rotateXYZ(rot);
|
|
1306
|
+
this.matrix.scale(scale);
|
|
1307
|
+
return this;
|
|
1308
|
+
}
|
|
1309
|
+
update(options = {}) {
|
|
1310
|
+
const { position, rotation, scale } = options;
|
|
1311
|
+
if (position) {
|
|
1312
|
+
this.setPosition(position);
|
|
1313
|
+
}
|
|
1314
|
+
if (rotation) {
|
|
1315
|
+
this.setRotation(rotation);
|
|
1316
|
+
}
|
|
1317
|
+
if (scale) {
|
|
1318
|
+
this.setScale(scale);
|
|
1319
|
+
}
|
|
1320
|
+
this.updateMatrix();
|
|
1321
|
+
return this;
|
|
1322
|
+
}
|
|
1323
|
+
getCoordinateUniforms(viewMatrix, modelMatrix) {
|
|
1324
|
+
(0, import_api8.assert)(viewMatrix);
|
|
1325
|
+
modelMatrix = modelMatrix || this.matrix;
|
|
1326
|
+
const worldMatrix = new import_core.Matrix4(viewMatrix).multiplyRight(modelMatrix);
|
|
1327
|
+
const worldInverse = worldMatrix.invert();
|
|
1328
|
+
const worldInverseTranspose = worldInverse.transpose();
|
|
1329
|
+
return {
|
|
1330
|
+
viewMatrix,
|
|
1331
|
+
modelMatrix,
|
|
1332
|
+
objectMatrix: modelMatrix,
|
|
1333
|
+
worldMatrix,
|
|
1334
|
+
worldInverseMatrix: worldInverse,
|
|
1335
|
+
worldInverseTransposeMatrix: worldInverseTranspose
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1338
|
+
// TODO - copied code, not yet vetted
|
|
1339
|
+
/*
|
|
1340
|
+
transform() {
|
|
1341
|
+
if (!this.parent) {
|
|
1342
|
+
this.endPosition.set(this.position);
|
|
1343
|
+
this.endRotation.set(this.rotation);
|
|
1344
|
+
this.endScale.set(this.scale);
|
|
1345
|
+
} else {
|
|
1346
|
+
const parent = this.parent;
|
|
1347
|
+
this.endPosition.set(this.position.add(parent.endPosition));
|
|
1348
|
+
this.endRotation.set(this.rotation.add(parent.endRotation));
|
|
1349
|
+
this.endScale.set(this.scale.add(parent.endScale));
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
const ch = this.children;
|
|
1353
|
+
for (let i = 0; i < ch.length; ++i) {
|
|
1354
|
+
ch[i].transform();
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
return this;
|
|
1358
|
+
}
|
|
1359
|
+
*/
|
|
1360
|
+
_setScenegraphNodeProps(props) {
|
|
1361
|
+
if ("display" in props) {
|
|
1362
|
+
this.display = props.display;
|
|
1363
|
+
}
|
|
1364
|
+
if ("position" in props) {
|
|
1365
|
+
this.setPosition(props.position);
|
|
1366
|
+
}
|
|
1367
|
+
if ("rotation" in props) {
|
|
1368
|
+
this.setRotation(props.rotation);
|
|
1369
|
+
}
|
|
1370
|
+
if ("scale" in props) {
|
|
1371
|
+
this.setScale(props.scale);
|
|
1372
|
+
}
|
|
1373
|
+
if ("matrix" in props) {
|
|
1374
|
+
this.setMatrix(props.matrix);
|
|
1375
|
+
}
|
|
1376
|
+
Object.assign(this.props, props);
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
|
|
1380
|
+
// src/scenegraph/group-node.ts
|
|
1381
|
+
var import_core2 = require("@math.gl/core");
|
|
1229
1382
|
var import_api9 = require("@luma.gl/api");
|
|
1383
|
+
var GroupNode = class extends ScenegraphNode {
|
|
1384
|
+
constructor(props = {}) {
|
|
1385
|
+
props = Array.isArray(props) ? { children: props } : props;
|
|
1386
|
+
const { children = [] } = props;
|
|
1387
|
+
import_api9.log.assert(
|
|
1388
|
+
children.every((child) => child instanceof ScenegraphNode),
|
|
1389
|
+
"every child must an instance of ScenegraphNode"
|
|
1390
|
+
);
|
|
1391
|
+
super(props);
|
|
1392
|
+
this.children = children;
|
|
1393
|
+
}
|
|
1394
|
+
getBounds() {
|
|
1395
|
+
const result = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];
|
|
1396
|
+
this.traverse((node, { worldMatrix }) => {
|
|
1397
|
+
const bounds = node.getBounds();
|
|
1398
|
+
if (!bounds) {
|
|
1399
|
+
return;
|
|
1400
|
+
}
|
|
1401
|
+
const [min, max] = bounds;
|
|
1402
|
+
const center = new import_core2.Vector3(min).add(max).divide([2, 2, 2]);
|
|
1403
|
+
worldMatrix.transformAsPoint(center, center);
|
|
1404
|
+
const halfSize = new import_core2.Vector3(max).subtract(min).divide([2, 2, 2]);
|
|
1405
|
+
worldMatrix.transformAsVector(halfSize, halfSize);
|
|
1406
|
+
for (let v = 0; v < 8; v++) {
|
|
1407
|
+
const position = new import_core2.Vector3(
|
|
1408
|
+
v & 1 ? -1 : 1,
|
|
1409
|
+
v & 2 ? -1 : 1,
|
|
1410
|
+
v & 4 ? -1 : 1
|
|
1411
|
+
).multiply(halfSize).add(center);
|
|
1412
|
+
for (let i = 0; i < 3; i++) {
|
|
1413
|
+
result[0][i] = Math.min(result[0][i], position[i]);
|
|
1414
|
+
result[1][i] = Math.max(result[1][i], position[i]);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
});
|
|
1418
|
+
if (!Number.isFinite(result[0][0])) {
|
|
1419
|
+
return null;
|
|
1420
|
+
}
|
|
1421
|
+
return result;
|
|
1422
|
+
}
|
|
1423
|
+
destroy() {
|
|
1424
|
+
this.children.forEach((child) => child.destroy());
|
|
1425
|
+
this.removeAll();
|
|
1426
|
+
super.destroy();
|
|
1427
|
+
}
|
|
1428
|
+
// Unpacks arrays and nested arrays of children
|
|
1429
|
+
add(...children) {
|
|
1430
|
+
for (const child of children) {
|
|
1431
|
+
if (Array.isArray(child)) {
|
|
1432
|
+
this.add(...child);
|
|
1433
|
+
} else {
|
|
1434
|
+
this.children.push(child);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
return this;
|
|
1438
|
+
}
|
|
1439
|
+
remove(child) {
|
|
1440
|
+
const children = this.children;
|
|
1441
|
+
const indexOf = children.indexOf(child);
|
|
1442
|
+
if (indexOf > -1) {
|
|
1443
|
+
children.splice(indexOf, 1);
|
|
1444
|
+
}
|
|
1445
|
+
return this;
|
|
1446
|
+
}
|
|
1447
|
+
removeAll() {
|
|
1448
|
+
this.children = [];
|
|
1449
|
+
return this;
|
|
1450
|
+
}
|
|
1451
|
+
traverse(visitor, { worldMatrix = new import_core2.Matrix4() } = {}) {
|
|
1452
|
+
const modelMatrix = new import_core2.Matrix4(worldMatrix).multiplyRight(this.matrix);
|
|
1453
|
+
for (const child of this.children) {
|
|
1454
|
+
if (child instanceof GroupNode) {
|
|
1455
|
+
child.traverse(visitor, { worldMatrix: modelMatrix });
|
|
1456
|
+
} else {
|
|
1457
|
+
visitor(child, { worldMatrix: modelMatrix });
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
|
|
1463
|
+
// src/scenegraph/model-node.ts
|
|
1464
|
+
var ModelNode = class extends ScenegraphNode {
|
|
1465
|
+
// TODO - is this used? override callbacks to make sure we call them with this
|
|
1466
|
+
// onBeforeRender = null;
|
|
1467
|
+
// onAfterRender = null;
|
|
1468
|
+
// AfterRender = null;
|
|
1469
|
+
constructor(props) {
|
|
1470
|
+
super(props);
|
|
1471
|
+
this.bounds = null;
|
|
1472
|
+
this.model = props.model;
|
|
1473
|
+
this.managedResources = props.managedResources || [];
|
|
1474
|
+
this.bounds = props.bounds || null;
|
|
1475
|
+
this.setProps(props);
|
|
1476
|
+
}
|
|
1477
|
+
getBounds() {
|
|
1478
|
+
return this.bounds;
|
|
1479
|
+
}
|
|
1480
|
+
destroy() {
|
|
1481
|
+
if (this.model) {
|
|
1482
|
+
this.model.destroy();
|
|
1483
|
+
this.model = null;
|
|
1484
|
+
}
|
|
1485
|
+
this.managedResources.forEach((resource) => resource.destroy());
|
|
1486
|
+
this.managedResources = [];
|
|
1487
|
+
}
|
|
1488
|
+
// Expose model methods
|
|
1489
|
+
draw(renderPass) {
|
|
1490
|
+
return this.model.draw(renderPass);
|
|
1491
|
+
}
|
|
1492
|
+
};
|
|
1493
|
+
|
|
1494
|
+
// src/geometries/cone-geometry.ts
|
|
1495
|
+
var import_api11 = require("@luma.gl/api");
|
|
1230
1496
|
|
|
1231
1497
|
// src/geometries/truncated-cone-geometry.ts
|
|
1232
|
-
var
|
|
1498
|
+
var import_api10 = require("@luma.gl/api");
|
|
1233
1499
|
var INDEX_OFFSETS = {
|
|
1234
1500
|
x: [2, 0, 1],
|
|
1235
1501
|
y: [0, 1, 2],
|
|
@@ -1237,7 +1503,7 @@ var INDEX_OFFSETS = {
|
|
|
1237
1503
|
};
|
|
1238
1504
|
var TruncatedConeGeometry = class extends Geometry {
|
|
1239
1505
|
constructor(props = {}) {
|
|
1240
|
-
const { id = (0,
|
|
1506
|
+
const { id = (0, import_api10.uid)("truncated-code-geometry") } = props;
|
|
1241
1507
|
const { indices, attributes } = tesselateTruncatedCone(props);
|
|
1242
1508
|
super(__spreadProps(__spreadValues({}, props), {
|
|
1243
1509
|
id,
|
|
@@ -1338,7 +1604,7 @@ function tesselateTruncatedCone(props = {}) {
|
|
|
1338
1604
|
// src/geometries/cone-geometry.ts
|
|
1339
1605
|
var ConeGeometry = class extends TruncatedConeGeometry {
|
|
1340
1606
|
constructor(props = {}) {
|
|
1341
|
-
const { id = (0,
|
|
1607
|
+
const { id = (0, import_api11.uid)("cone-geometry"), radius = 1, cap = true } = props;
|
|
1342
1608
|
super(__spreadProps(__spreadValues({}, props), {
|
|
1343
1609
|
id,
|
|
1344
1610
|
topRadius: 0,
|
|
@@ -1350,10 +1616,10 @@ var ConeGeometry = class extends TruncatedConeGeometry {
|
|
|
1350
1616
|
};
|
|
1351
1617
|
|
|
1352
1618
|
// src/geometries/cube-geometry.ts
|
|
1353
|
-
var
|
|
1619
|
+
var import_api12 = require("@luma.gl/api");
|
|
1354
1620
|
var CubeGeometry = class extends Geometry {
|
|
1355
1621
|
constructor(props = {}) {
|
|
1356
|
-
const { id = (0,
|
|
1622
|
+
const { id = (0, import_api12.uid)("cube-geometry"), indices = true } = props;
|
|
1357
1623
|
super(indices ? __spreadProps(__spreadValues({}, props), {
|
|
1358
1624
|
id,
|
|
1359
1625
|
indices: { size: 1, value: CUBE_INDICES },
|
|
@@ -1992,10 +2258,10 @@ var NON_INDEXED_ATTRIBUTES = {
|
|
|
1992
2258
|
};
|
|
1993
2259
|
|
|
1994
2260
|
// src/geometries/cylinder-geometry.ts
|
|
1995
|
-
var
|
|
2261
|
+
var import_api13 = require("@luma.gl/api");
|
|
1996
2262
|
var CylinderGeometry = class extends TruncatedConeGeometry {
|
|
1997
2263
|
constructor(props = {}) {
|
|
1998
|
-
const { id = (0,
|
|
2264
|
+
const { id = (0, import_api13.uid)("cylinder-geometry"), radius = 1 } = props;
|
|
1999
2265
|
super(__spreadProps(__spreadValues({}, props), {
|
|
2000
2266
|
id,
|
|
2001
2267
|
bottomRadius: radius,
|
|
@@ -2005,13 +2271,13 @@ var CylinderGeometry = class extends TruncatedConeGeometry {
|
|
|
2005
2271
|
};
|
|
2006
2272
|
|
|
2007
2273
|
// src/geometries/ico-sphere-geometry.ts
|
|
2008
|
-
var
|
|
2009
|
-
var
|
|
2274
|
+
var import_api14 = require("@luma.gl/api");
|
|
2275
|
+
var import_core3 = require("@math.gl/core");
|
|
2010
2276
|
var ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0];
|
|
2011
2277
|
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];
|
|
2012
2278
|
var IcoSphereGeometry = class extends Geometry {
|
|
2013
2279
|
constructor(props = {}) {
|
|
2014
|
-
const { id = (0,
|
|
2280
|
+
const { id = (0, import_api14.uid)("ico-sphere-geometry") } = props;
|
|
2015
2281
|
const { indices, attributes } = tesselateIcosaHedron(props);
|
|
2016
2282
|
super(__spreadProps(__spreadValues({}, props), {
|
|
2017
2283
|
id,
|
|
@@ -2102,7 +2368,7 @@ function tesselateIcosaHedron(props) {
|
|
|
2102
2368
|
const u3 = 1 - phi3 / PI2;
|
|
2103
2369
|
const vec1 = [x3 - x2, y3 - y2, z3 - z2];
|
|
2104
2370
|
const vec2 = [x1 - x2, y1 - y2, z1 - z2];
|
|
2105
|
-
const normal = new
|
|
2371
|
+
const normal = new import_core3.Vector3(vec1).cross(vec2).normalize();
|
|
2106
2372
|
let newIndex;
|
|
2107
2373
|
if ((u1 === 0 || u2 === 0 || u3 === 0) && (u1 === 0 || u1 > 0.5) && (u2 === 0 || u2 > 0.5) && (u3 === 0 || u3 > 0.5)) {
|
|
2108
2374
|
positions.push(positions[in1 + 0], positions[in1 + 1], positions[in1 + 2]);
|
|
@@ -2151,7 +2417,7 @@ function tesselateIcosaHedron(props) {
|
|
|
2151
2417
|
}
|
|
2152
2418
|
|
|
2153
2419
|
// src/geometries/plane-geometry.ts
|
|
2154
|
-
var
|
|
2420
|
+
var import_api15 = require("@luma.gl/api");
|
|
2155
2421
|
|
|
2156
2422
|
// src/geometry/geometry-utils.ts
|
|
2157
2423
|
function unpackIndexedGeometry(geometry) {
|
|
@@ -2184,7 +2450,7 @@ function unpackIndexedGeometry(geometry) {
|
|
|
2184
2450
|
// src/geometries/plane-geometry.ts
|
|
2185
2451
|
var PlaneGeometry = class extends Geometry {
|
|
2186
2452
|
constructor(props = {}) {
|
|
2187
|
-
const { id = (0,
|
|
2453
|
+
const { id = (0, import_api15.uid)("plane-geometry") } = props;
|
|
2188
2454
|
const { indices, attributes } = tesselatePlane(props);
|
|
2189
2455
|
super(__spreadProps(__spreadValues({}, props), {
|
|
2190
2456
|
id,
|
|
@@ -2272,10 +2538,10 @@ function tesselatePlane(props) {
|
|
|
2272
2538
|
}
|
|
2273
2539
|
|
|
2274
2540
|
// src/geometries/sphere-geometry.ts
|
|
2275
|
-
var
|
|
2541
|
+
var import_api16 = require("@luma.gl/api");
|
|
2276
2542
|
var SphereGeometry = class extends Geometry {
|
|
2277
2543
|
constructor(props = {}) {
|
|
2278
|
-
const { id = (0,
|
|
2544
|
+
const { id = (0, import_api16.uid)("sphere-geometry") } = props;
|
|
2279
2545
|
const { indices, attributes } = tesselateSphere(props);
|
|
2280
2546
|
super(__spreadProps(__spreadValues({}, props), {
|
|
2281
2547
|
id,
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export { Model } from './model/model';
|
|
|
11
11
|
export { Transform } from './transform/transform';
|
|
12
12
|
export { PipelineFactory } from './lib/pipeline-factory';
|
|
13
13
|
export { ClipSpace } from './lib/clip-space';
|
|
14
|
+
export { ScenegraphNode } from './scenegraph/scenegraph-node';
|
|
15
|
+
export { GroupNode } from './scenegraph/group-node';
|
|
16
|
+
export { ModelNode } from './scenegraph/model-node';
|
|
14
17
|
export { Geometry } from './geometry/geometry';
|
|
15
18
|
export type { ConeGeometryProps } from './geometries/cone-geometry';
|
|
16
19
|
export { ConeGeometry } from './geometries/cone-geometry';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB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BAA4B,CAAC;AACxD,YAAY,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AACxD,YAAY,EAAC,qBAAqB,EAAC,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAC,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAChE,YAAY,EAAC,sBAAsB,EAAC,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAC,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AACnE,YAAY,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC1D,YAAY,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAC5D,YAAY,EAAC,0BAA0B,EAAC,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAC,qBAAqB,EAAC,MAAM,sCAAsC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,9 @@ export { Model } from "./model/model.js";
|
|
|
7
7
|
export { Transform } from "./transform/transform.js";
|
|
8
8
|
export { PipelineFactory } from "./lib/pipeline-factory.js";
|
|
9
9
|
export { ClipSpace } from "./lib/clip-space.js";
|
|
10
|
+
export { ScenegraphNode } from "./scenegraph/scenegraph-node.js";
|
|
11
|
+
export { GroupNode } from "./scenegraph/group-node.js";
|
|
12
|
+
export { ModelNode } from "./scenegraph/model-node.js";
|
|
10
13
|
export { Geometry } from "./geometry/geometry.js";
|
|
11
14
|
export { ConeGeometry } from "./geometries/cone-geometry.js";
|
|
12
15
|
export { CubeGeometry } from "./geometries/cube-geometry.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Timeline","KeyFrames","AnimationLoopTemplate","AnimationLoop","makeAnimationLoop","Model","Transform","PipelineFactory","ClipSpace","Geometry","ConeGeometry","CubeGeometry","CylinderGeometry","IcoSphereGeometry","PlaneGeometry","SphereGeometry","TruncatedConeGeometry"],"sources":["../src/index.ts"],"sourcesContent":["// luma.gl Engine API\n\n// Animation\nexport {Timeline} from './animation/timeline';\nexport {KeyFrames} from './animation/key-frames';\nexport type {AnimationProps} from './animation-loop/animation-props';\n\nexport {AnimationLoopTemplate} from './animation-loop/render-loop';\n\nexport type {AnimationLoopProps} from './animation-loop/animation-loop';\nexport {AnimationLoop} from './animation-loop/animation-loop';\n\nexport type {MakeAnimationLoopProps} from './animation-loop/make-animation-loop';\nexport {makeAnimationLoop} from './animation-loop/make-animation-loop';\n\nexport type {ModelProps} from './model/model';\nexport {Model} from './model/model';\n\nexport {Transform} from './transform/transform';\n\nexport {PipelineFactory} from './lib/pipeline-factory';\n\n// Utils\nexport {ClipSpace} from './lib/clip-space';\n\n// Geometries\nexport {Geometry} from './geometry/geometry';\n\n// Primitives\nexport type {ConeGeometryProps} from './geometries/cone-geometry';\nexport {ConeGeometry} from './geometries/cone-geometry';\nexport type {CubeGeometryProps} from './geometries/cube-geometry';\nexport {CubeGeometry} from './geometries/cube-geometry';\nexport type {CylinderGeometryProps} from './geometries/cylinder-geometry';\nexport {CylinderGeometry} from './geometries/cylinder-geometry';\nexport type {IcoSphereGeometryProps} from './geometries/ico-sphere-geometry';\nexport {IcoSphereGeometry} from './geometries/ico-sphere-geometry';\nexport type {PlaneGeometryProps} from './geometries/plane-geometry';\nexport {PlaneGeometry} from './geometries/plane-geometry';\nexport type {SphereGeometryProps} from './geometries/sphere-geometry';\nexport {SphereGeometry} from './geometries/sphere-geometry';\nexport type {TruncatedConeGeometryProps} from './geometries/truncated-cone-geometry';\nexport {TruncatedConeGeometry} from './geometries/truncated-cone-geometry';\n\n"],"mappings":"SAGQA,QAAQ;AAAA,SACRC,SAAS;AAAA,SAGTC,qBAAqB;AAAA,SAGrBC,aAAa;AAAA,SAGbC,iBAAiB;AAAA,SAGjBC,KAAK;AAAA,SAELC,SAAS;AAAA,SAETC,eAAe;AAAA,SAGfC,SAAS;AAAA,SAGTC,QAAQ;AAAA,SAIRC,YAAY;AAAA,SAEZC,YAAY;AAAA,SAEZC,gBAAgB;AAAA,SAEhBC,iBAAiB;AAAA,SAEjBC,aAAa;AAAA,SAEbC,cAAc;AAAA,SAEdC,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Timeline","KeyFrames","AnimationLoopTemplate","AnimationLoop","makeAnimationLoop","Model","Transform","PipelineFactory","ClipSpace","ScenegraphNode","GroupNode","ModelNode","Geometry","ConeGeometry","CubeGeometry","CylinderGeometry","IcoSphereGeometry","PlaneGeometry","SphereGeometry","TruncatedConeGeometry"],"sources":["../src/index.ts"],"sourcesContent":["// luma.gl Engine API\n\n// Animation\nexport {Timeline} from './animation/timeline';\nexport {KeyFrames} from './animation/key-frames';\nexport type {AnimationProps} from './animation-loop/animation-props';\n\nexport {AnimationLoopTemplate} from './animation-loop/render-loop';\n\nexport type {AnimationLoopProps} from './animation-loop/animation-loop';\nexport {AnimationLoop} from './animation-loop/animation-loop';\n\nexport type {MakeAnimationLoopProps} from './animation-loop/make-animation-loop';\nexport {makeAnimationLoop} from './animation-loop/make-animation-loop';\n\nexport type {ModelProps} from './model/model';\nexport {Model} from './model/model';\n\nexport {Transform} from './transform/transform';\n\nexport {PipelineFactory} from './lib/pipeline-factory';\n\n// Utils\nexport {ClipSpace} from './lib/clip-space';\n\n// Scenegraph Core nodes\nexport {ScenegraphNode} from './scenegraph/scenegraph-node';\nexport {GroupNode} from './scenegraph/group-node';\nexport {ModelNode} from './scenegraph/model-node';\n\n// Geometries\nexport {Geometry} from './geometry/geometry';\n\n// Primitives\nexport type {ConeGeometryProps} from './geometries/cone-geometry';\nexport {ConeGeometry} from './geometries/cone-geometry';\nexport type {CubeGeometryProps} from './geometries/cube-geometry';\nexport {CubeGeometry} from './geometries/cube-geometry';\nexport type {CylinderGeometryProps} from './geometries/cylinder-geometry';\nexport {CylinderGeometry} from './geometries/cylinder-geometry';\nexport type {IcoSphereGeometryProps} from './geometries/ico-sphere-geometry';\nexport {IcoSphereGeometry} from './geometries/ico-sphere-geometry';\nexport type {PlaneGeometryProps} from './geometries/plane-geometry';\nexport {PlaneGeometry} from './geometries/plane-geometry';\nexport type {SphereGeometryProps} from './geometries/sphere-geometry';\nexport {SphereGeometry} from './geometries/sphere-geometry';\nexport type {TruncatedConeGeometryProps} from './geometries/truncated-cone-geometry';\nexport {TruncatedConeGeometry} from './geometries/truncated-cone-geometry';\n\n"],"mappings":"SAGQA,QAAQ;AAAA,SACRC,SAAS;AAAA,SAGTC,qBAAqB;AAAA,SAGrBC,aAAa;AAAA,SAGbC,iBAAiB;AAAA,SAGjBC,KAAK;AAAA,SAELC,SAAS;AAAA,SAETC,eAAe;AAAA,SAGfC,SAAS;AAAA,SAGTC,cAAc;AAAA,SACdC,SAAS;AAAA,SACTC,SAAS;AAAA,SAGTC,QAAQ;AAAA,SAIRC,YAAY;AAAA,SAEZC,YAAY;AAAA,SAEZC,gBAAgB;AAAA,SAEhBC,iBAAiB;AAAA,SAEjBC,aAAa;AAAA,SAEbC,cAAc;AAAA,SAEdC,qBAAqB"}
|
package/dist/lib/clip-space.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
|
-
import GL from '@luma.gl/constants';
|
|
3
|
+
import { GL } from '@luma.gl/constants';
|
|
4
4
|
import { glsl } from '@luma.gl/api';
|
|
5
5
|
import { WebGLDevice } from '@luma.gl/webgl';
|
|
6
6
|
import { Model } from "../model/model.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip-space.js","names":["GL","glsl","WebGLDevice","Model","Geometry","CLIPSPACE_VERTEX_SHADER","_templateObject","_taggedTemplateLiteral","POSITIONS","ClipSpace","constructor","device","opts","TEX_COORDS","map","coord","attach","vs","vertexCount","geometry","drawMode","TRIANGLE_STRIP","attributes","aClipSpacePosition","size","value","Float32Array","aTexCoord","aCoordinate"],"sources":["../../src/lib/clip-space.ts"],"sourcesContent":["\n// ClipSpace\nimport GL from '@luma.gl/constants';\nimport {Device, glsl} from '@luma.gl/api';\nimport {WebGLDevice} from '@luma.gl/webgl';\nimport {Model, ModelProps} from '../model/model';\nimport {Geometry} from '../geometry/geometry';\n\nconst CLIPSPACE_VERTEX_SHADER = glsl`\\\nattribute vec2 aClipSpacePosition;\nattribute vec2 aTexCoord;\nattribute vec2 aCoordinate;\n\nvarying vec2 position;\nvarying vec2 coordinate;\nvarying vec2 uv;\n\nvoid main(void) {\n gl_Position = vec4(aClipSpacePosition, 0., 1.);\n position = aClipSpacePosition;\n coordinate = aCoordinate;\n uv = aTexCoord;\n}\n`;\n\n/* eslint-disable indent, no-multi-spaces */\nconst POSITIONS = [-1, -1, 1, -1, -1, 1, 1, 1];\n\n/**\n * A flat geometry that covers the \"visible area\" that the GPU renders.\n */\nexport class ClipSpace extends Model {\n constructor(device: Device | WebGLRenderingContext, opts?: ModelProps) {\n const TEX_COORDS = POSITIONS.map((coord) => (coord === -1 ? 0 : coord));\n\n super(\n WebGLDevice.attach(device),\n {\n ...opts,\n vs: CLIPSPACE_VERTEX_SHADER,\n vertexCount: 4,\n geometry: new Geometry({\n drawMode: GL.TRIANGLE_STRIP,\n vertexCount: 4,\n attributes: {\n aClipSpacePosition: {size: 2, value: new Float32Array(POSITIONS)},\n aTexCoord: {size: 2, value: new Float32Array(TEX_COORDS)},\n aCoordinate: {size: 2, value: new Float32Array(TEX_COORDS)}\n }\n })\n }\n );\n }\n}\n"],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"clip-space.js","names":["GL","glsl","WebGLDevice","Model","Geometry","CLIPSPACE_VERTEX_SHADER","_templateObject","_taggedTemplateLiteral","POSITIONS","ClipSpace","constructor","device","opts","TEX_COORDS","map","coord","attach","vs","vertexCount","geometry","drawMode","TRIANGLE_STRIP","attributes","aClipSpacePosition","size","value","Float32Array","aTexCoord","aCoordinate"],"sources":["../../src/lib/clip-space.ts"],"sourcesContent":["\n// ClipSpace\nimport {GL} from '@luma.gl/constants';\nimport {Device, glsl} from '@luma.gl/api';\nimport {WebGLDevice} from '@luma.gl/webgl';\nimport {Model, ModelProps} from '../model/model';\nimport {Geometry} from '../geometry/geometry';\n\nconst CLIPSPACE_VERTEX_SHADER = glsl`\\\nattribute vec2 aClipSpacePosition;\nattribute vec2 aTexCoord;\nattribute vec2 aCoordinate;\n\nvarying vec2 position;\nvarying vec2 coordinate;\nvarying vec2 uv;\n\nvoid main(void) {\n gl_Position = vec4(aClipSpacePosition, 0., 1.);\n position = aClipSpacePosition;\n coordinate = aCoordinate;\n uv = aTexCoord;\n}\n`;\n\n/* eslint-disable indent, no-multi-spaces */\nconst POSITIONS = [-1, -1, 1, -1, -1, 1, 1, 1];\n\n/**\n * A flat geometry that covers the \"visible area\" that the GPU renders.\n */\nexport class ClipSpace extends Model {\n constructor(device: Device | WebGLRenderingContext, opts?: ModelProps) {\n const TEX_COORDS = POSITIONS.map((coord) => (coord === -1 ? 0 : coord));\n\n super(\n WebGLDevice.attach(device),\n {\n ...opts,\n vs: CLIPSPACE_VERTEX_SHADER,\n vertexCount: 4,\n geometry: new Geometry({\n drawMode: GL.TRIANGLE_STRIP,\n vertexCount: 4,\n attributes: {\n aClipSpacePosition: {size: 2, value: new Float32Array(POSITIONS)},\n aTexCoord: {size: 2, value: new Float32Array(TEX_COORDS)},\n aCoordinate: {size: 2, value: new Float32Array(TEX_COORDS)}\n }\n })\n }\n );\n }\n}\n"],"mappings":";;AAEA,SAAQA,EAAE,QAAO,oBAAoB;AACrC,SAAgBC,IAAI,QAAO,cAAc;AACzC,SAAQC,WAAW,QAAO,gBAAgB;AAAC,SACnCC,KAAK;AAAA,SACLC,QAAQ;AAEhB,MAAMC,uBAAuB,GAAGJ,IAAI,CAAAK,eAAA,KAAAA,eAAA,GAAAC,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