@luma.gl/engine 9.0.11 → 9.1.0-alpha.2
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/LICENSE +34 -0
- package/dist/animation/key-frames.d.ts.map +1 -1
- package/dist/animation/key-frames.js +3 -0
- package/dist/animation-loop/animation-loop-template.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop-template.js +3 -0
- package/dist/animation-loop/animation-loop.d.ts +1 -1
- package/dist/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +5 -4
- package/dist/animation-loop/animation-props.d.ts.map +1 -1
- package/dist/animation-loop/animation-props.js +3 -0
- package/dist/animation-loop/request-animation-frame.d.ts +3 -0
- package/dist/animation-loop/request-animation-frame.d.ts.map +1 -0
- package/dist/animation-loop/request-animation-frame.js +16 -0
- package/dist/application-utils/load-file.d.ts +22 -0
- package/dist/application-utils/load-file.d.ts.map +1 -0
- package/dist/application-utils/load-file.js +43 -0
- package/dist/application-utils/random.d.ts +3 -0
- package/dist/application-utils/random.d.ts.map +1 -0
- package/dist/application-utils/random.js +16 -0
- package/dist/async-texture/async-texture.d.ts +50 -0
- package/dist/async-texture/async-texture.d.ts.map +1 -0
- package/dist/async-texture/async-texture.js +77 -0
- package/dist/computation.d.ts +4 -3
- package/dist/computation.d.ts.map +1 -1
- package/dist/computation.js +14 -6
- package/dist/debug/copy-texture-to-image.d.ts.map +1 -1
- package/dist/debug/copy-texture-to-image.js +4 -1
- package/dist/debug/debug-framebuffer.d.ts.map +1 -1
- package/dist/debug/debug-framebuffer.js +17 -12
- package/dist/debug/pixel-data-utils.d.ts +1 -1
- package/dist/dist.dev.js +1291 -648
- package/dist/dist.min.js +30 -28
- package/dist/geometries/cone-geometry.d.ts.map +1 -1
- package/dist/geometries/cone-geometry.js +4 -1
- package/dist/geometries/cube-geometry.d.ts.map +1 -1
- package/dist/geometries/cube-geometry.js +4 -1
- package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
- package/dist/geometries/cylinder-geometry.js +4 -1
- package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/ico-sphere-geometry.js +4 -1
- package/dist/geometries/plane-geometry.d.ts.map +1 -1
- package/dist/geometries/plane-geometry.js +4 -1
- package/dist/geometries/sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/sphere-geometry.js +4 -1
- package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
- package/dist/geometries/truncated-cone-geometry.js +4 -1
- package/dist/geometry/geometry-table.d.ts +2 -1
- package/dist/geometry/geometry-table.d.ts.map +1 -1
- package/dist/geometry/geometry-utils.d.ts.map +1 -1
- package/dist/geometry/geometry-utils.js +3 -1
- package/dist/geometry/geometry.d.ts +5 -4
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +9 -5
- package/dist/geometry/gpu-geometry.d.ts +1 -1
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +18 -6
- package/dist/geometry/gpu-table.js +3 -0
- package/dist/index.cjs +491 -244
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/lib/clip-space.d.ts.map +1 -1
- package/dist/lib/clip-space.js +3 -0
- package/dist/lib/pipeline-factory.d.ts +3 -2
- package/dist/lib/pipeline-factory.d.ts.map +1 -1
- package/dist/lib/pipeline-factory.js +12 -8
- package/dist/lib/shader-factory.d.ts +3 -2
- package/dist/lib/shader-factory.d.ts.map +1 -1
- package/dist/lib/shader-factory.js +11 -4
- package/dist/model/model.d.ts +10 -6
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +65 -8
- package/dist/model/split-uniforms-and-bindings.d.ts +9 -0
- package/dist/model/split-uniforms-and-bindings.d.ts.map +1 -0
- package/dist/model/split-uniforms-and-bindings.js +20 -0
- package/dist/scenegraph/group-node.d.ts +1 -1
- package/dist/scenegraph/group-node.d.ts.map +1 -1
- package/dist/scenegraph/group-node.js +3 -0
- package/dist/scenegraph/model-node.d.ts +2 -2
- package/dist/scenegraph/model-node.d.ts.map +1 -1
- package/dist/scenegraph/model-node.js +6 -3
- package/dist/scenegraph/scenegraph-node.d.ts +5 -6
- package/dist/scenegraph/scenegraph-node.d.ts.map +1 -1
- package/dist/scenegraph/scenegraph-node.js +11 -8
- package/dist/shader-inputs.d.ts +2 -3
- package/dist/shader-inputs.d.ts.map +1 -1
- package/dist/shader-inputs.js +7 -5
- package/dist/transform/buffer-transform.d.ts.map +1 -1
- package/dist/transform/buffer-transform.js +8 -2
- package/dist/transform/texture-transform.d.ts +2 -2
- package/dist/transform/texture-transform.d.ts.map +1 -1
- package/dist/transform/texture-transform.js +1 -0
- package/dist/utils/deep-equal.d.ts +9 -0
- package/dist/utils/deep-equal.d.ts.map +1 -0
- package/dist/utils/deep-equal.js +50 -0
- package/dist/utils/uid.d.ts +7 -0
- package/dist/utils/uid.d.ts.map +1 -0
- package/dist/utils/uid.js +14 -0
- package/package.json +7 -6
- package/src/animation/key-frames.ts +4 -0
- package/src/animation-loop/animation-loop-template.ts +4 -0
- package/src/animation-loop/animation-loop.ts +6 -4
- package/src/animation-loop/animation-props.ts +4 -0
- package/src/animation-loop/request-animation-frame.ts +19 -0
- package/src/application-utils/load-file.ts +53 -0
- package/src/application-utils/random.ts +18 -0
- package/src/async-texture/async-texture.ts +140 -0
- package/src/computation.ts +17 -9
- package/src/debug/copy-texture-to-image.ts +4 -1
- package/src/debug/debug-framebuffer.ts +18 -12
- package/src/debug/pixel-data-utils.ts +1 -1
- package/src/geometries/cone-geometry.ts +5 -1
- package/src/geometries/cube-geometry.ts +5 -1
- package/src/geometries/cylinder-geometry.ts +5 -1
- package/src/geometries/ico-sphere-geometry.ts +5 -1
- package/src/geometries/plane-geometry.ts +5 -1
- package/src/geometries/sphere-geometry.ts +5 -1
- package/src/geometries/truncated-cone-geometry.ts +5 -1
- package/src/geometry/geometry-table.ts +2 -1
- package/src/geometry/geometry-utils.ts +3 -1
- package/src/geometry/geometry.ts +16 -19
- package/src/geometry/gpu-geometry.ts +20 -14
- package/src/geometry/gpu-table.ts +4 -0
- package/src/index.ts +15 -0
- package/src/lib/clip-space.ts +4 -0
- package/src/lib/pipeline-factory.ts +17 -16
- package/src/lib/shader-factory.ts +13 -6
- package/src/model/model.ts +71 -17
- package/src/model/split-uniforms-and-bindings.ts +31 -0
- package/src/scenegraph/group-node.ts +4 -0
- package/src/scenegraph/model-node.ts +9 -5
- package/src/scenegraph/scenegraph-node.ts +17 -13
- package/src/shader-inputs.ts +8 -6
- package/src/transform/buffer-transform.ts +8 -9
- package/src/transform/texture-transform.ts +2 -1
- package/src/utils/deep-equal.ts +51 -0
- package/src/utils/uid.ts +16 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cone-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/cone-geometry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cone-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/cone-geometry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,qBAAqB,EAAC,qCAAkC;AAGhE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,qBAAa,YAAa,SAAQ,qBAAqB;gBACzC,KAAK,GAAE,iBAAsB;CAW1C"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
2
4
|
import { TruncatedConeGeometry } from "./truncated-cone-geometry.js";
|
|
5
|
+
import { uid } from "../utils/uid.js";
|
|
3
6
|
export class ConeGeometry extends TruncatedConeGeometry {
|
|
4
7
|
constructor(props = {}) {
|
|
5
8
|
const { id = uid('cone-geometry'), radius = 1, cap = true } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cube-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/cube-geometry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cube-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/cube-geometry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAC,gCAA6B;AAI9C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF,qBAAa,YAAa,SAAQ,QAAQ;gBAC5B,KAAK,GAAE,iBAAsB;CAoB1C;AAqDD,eAAO,MAAM,0BAA0B,cA0CrC,CAAC;AAIH,eAAO,MAAM,2BAA2B,cA0CtC,CAAC;AAIH,eAAO,MAAM,uBAAuB,cA0ClC,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
2
4
|
import { Geometry } from "../geometry/geometry.js";
|
|
5
|
+
import { uid } from "../utils/uid.js";
|
|
3
6
|
export class CubeGeometry extends Geometry {
|
|
4
7
|
constructor(props = {}) {
|
|
5
8
|
const { id = uid('cube-geometry'), indices = true } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cylinder-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/cylinder-geometry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cylinder-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/cylinder-geometry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,qBAAqB,EAAC,qCAAkC;AAGhE,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF,qBAAa,gBAAiB,SAAQ,qBAAqB;gBAC7C,KAAK,GAAE,qBAA0B;CAS9C"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
2
4
|
import { TruncatedConeGeometry } from "./truncated-cone-geometry.js";
|
|
5
|
+
import { uid } from "../utils/uid.js";
|
|
3
6
|
export class CylinderGeometry extends TruncatedConeGeometry {
|
|
4
7
|
constructor(props = {}) {
|
|
5
8
|
const { id = uid('cylinder-geometry'), radius = 1 } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ico-sphere-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/ico-sphere-geometry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ico-sphere-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/ico-sphere-geometry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,QAAQ,EAAC,gCAA6B;AAQ9C,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,QAAQ;gBACjC,KAAK,GAAE,sBAA2B;CAW/C"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
2
4
|
import { Vector3 } from '@math.gl/core';
|
|
3
5
|
import { Geometry } from "../geometry/geometry.js";
|
|
6
|
+
import { uid } from "../utils/uid.js";
|
|
4
7
|
/* eslint-disable comma-spacing, max-statements, complexity */
|
|
5
8
|
const ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0];
|
|
6
9
|
const 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];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plane-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/plane-geometry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plane-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/plane-geometry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAC,gCAA6B;AAI9C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,GAAG,CAAC;CAClB,CAAC;AAKF,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,KAAK,GAAE,kBAAuB;CAY3C"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
2
4
|
import { Geometry } from "../geometry/geometry.js";
|
|
3
5
|
import { unpackIndexedGeometry } from "../geometry/geometry-utils.js";
|
|
6
|
+
import { uid } from "../utils/uid.js";
|
|
4
7
|
// Primitives inspired by TDL http://code.google.com/p/webglsamples/,
|
|
5
8
|
// copyright 2011 Google Inc. new BSD License
|
|
6
9
|
// (http://www.opensource.org/licenses/bsd-license.php).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sphere-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/sphere-geometry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sphere-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/sphere-geometry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAC,gCAA6B;AAG9C,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,GAAG,CAAC;CAClB,CAAC;AAKF,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,KAAK,GAAE,mBAAwB;CAW5C"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
2
4
|
import { Geometry } from "../geometry/geometry.js";
|
|
5
|
+
import { uid } from "../utils/uid.js";
|
|
3
6
|
// Primitives inspired by TDL http://code.google.com/p/webglsamples/,
|
|
4
7
|
// copyright 2011 Google Inc. new BSD License
|
|
5
8
|
// (http://www.opensource.org/licenses/bsd-license.php).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"truncated-cone-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/truncated-cone-geometry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"truncated-cone-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/truncated-cone-geometry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAC,gCAA6B;AAS9C,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAChC,CAAC;AAEF;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,QAAQ;gBACrC,KAAK,GAAE,0BAA0B,GAAG;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,GAAG,CAAA;KAAM;CAgBrF"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
2
4
|
import { Geometry } from "../geometry/geometry.js";
|
|
5
|
+
import { uid } from "../utils/uid.js";
|
|
3
6
|
const INDEX_OFFSETS = {
|
|
4
7
|
x: [2, 0, 1],
|
|
5
8
|
y: [0, 1, 2],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-table.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry-table.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"geometry-table.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry-table.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAEhD,yBAAyB;AACzB,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,UAAU,EAAE;QACV,QAAQ,EAAE,UAAU,CAAC;QACrB,MAAM,EAAE,UAAU,CAAC;QACnB,UAAU,EAAE,UAAU,CAAC;QACvB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC;IACpC,QAAQ,CAAC,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;CAC3F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-utils.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geometry-utils.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry-utils.ts"],"names":[],"mappings":"AAIA,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,GAAG,OA4BlD"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TypedArray } from '@math.gl/core';
|
|
2
|
+
import type { PrimitiveTopology } from '@luma.gl/core';
|
|
2
3
|
export type GeometryProps = {
|
|
3
4
|
id?: string;
|
|
4
5
|
/** Determines how vertices are read from the 'vertex' attributes */
|
|
5
|
-
topology: 'point-list' | 'line-list' | 'line-strip' | '
|
|
6
|
+
topology: 'point-list' | 'line-list' | 'line-strip' | 'triangle-list' | 'triangle-strip';
|
|
6
7
|
/** Auto calculated from attributes if not provided */
|
|
7
8
|
vertexCount?: number;
|
|
8
|
-
attributes
|
|
9
|
+
attributes: Record<string, GeometryAttribute | TypedArray>;
|
|
9
10
|
indices?: GeometryAttribute | TypedArray;
|
|
10
11
|
};
|
|
11
12
|
export type GeometryAttributes = {
|
|
@@ -57,6 +58,6 @@ export declare class Geometry {
|
|
|
57
58
|
* @returns
|
|
58
59
|
*/
|
|
59
60
|
_setAttributes(attributes: Record<string, GeometryAttribute>, indices: any): this;
|
|
60
|
-
_calculateVertexCount(attributes: GeometryAttributes, indices
|
|
61
|
+
_calculateVertexCount(attributes: GeometryAttributes, indices?: GeometryAttribute): number;
|
|
61
62
|
}
|
|
62
63
|
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAGrD,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,QAAQ,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;IACzF,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU,CAAC,CAAC;IAC3D,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,iBAAiB,GAAG;QAAC,IAAI,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAAA;KAAC,CAAC;CAC3E,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,UAAU,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF,qBAAa,QAAQ;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;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;IAgDhC,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,CAAC,EAAE,iBAAiB,GAAG,MAAM;CAe3F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { uid
|
|
4
|
+
import { uid } from "../utils/uid.js";
|
|
5
5
|
export class Geometry {
|
|
6
6
|
id;
|
|
7
7
|
/** Determines how vertices are read from the 'vertex' attributes */
|
|
@@ -24,13 +24,17 @@ export class Geometry {
|
|
|
24
24
|
const attribute = ArrayBuffer.isView(attributeValue)
|
|
25
25
|
? { value: attributeValue }
|
|
26
26
|
: attributeValue;
|
|
27
|
-
|
|
27
|
+
if (!ArrayBuffer.isView(attribute.value)) {
|
|
28
|
+
throw new Error(`${this._print(attributeName)}: must be typed array or object with value as typed array`);
|
|
29
|
+
}
|
|
28
30
|
if ((attributeName === 'POSITION' || attributeName === 'positions') && !attribute.size) {
|
|
29
31
|
attribute.size = 3;
|
|
30
32
|
}
|
|
31
33
|
// Move indices to separate field
|
|
32
34
|
if (attributeName === 'indices') {
|
|
33
|
-
|
|
35
|
+
if (this.indices) {
|
|
36
|
+
throw new Error('Multiple indices detected');
|
|
37
|
+
}
|
|
34
38
|
this.indices = attribute;
|
|
35
39
|
}
|
|
36
40
|
else {
|
|
@@ -78,11 +82,11 @@ export class Geometry {
|
|
|
78
82
|
let vertexCount = Infinity;
|
|
79
83
|
for (const attribute of Object.values(attributes)) {
|
|
80
84
|
const { value, size, constant } = attribute;
|
|
81
|
-
if (!constant && value && size >= 1) {
|
|
85
|
+
if (!constant && value && size !== undefined && size >= 1) {
|
|
82
86
|
vertexCount = Math.min(vertexCount, value.length / size);
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
|
-
assert(Number.isFinite(vertexCount));
|
|
89
|
+
// assert(Number.isFinite(vertexCount));
|
|
86
90
|
return vertexCount;
|
|
87
91
|
}
|
|
88
92
|
}
|
|
@@ -4,7 +4,7 @@ import type { Geometry } from "../geometry/geometry.js";
|
|
|
4
4
|
export type GPUGeometryProps = {
|
|
5
5
|
id?: string;
|
|
6
6
|
/** Determines how vertices are read from the 'vertex' attributes */
|
|
7
|
-
topology: 'point-list' | 'line-list' | 'line-strip' | '
|
|
7
|
+
topology: 'point-list' | 'line-list' | 'line-strip' | 'triangle-list' | 'triangle-strip';
|
|
8
8
|
/** Auto calculated from attributes if not provided */
|
|
9
9
|
vertexCount: number;
|
|
10
10
|
bufferLayout: BufferLayout[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpu-geometry.d.ts","sourceRoot":"","sources":["../../src/geometry/gpu-geometry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gpu-geometry.d.ts","sourceRoot":"","sources":["../../src/geometry/gpu-geometry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACnE,OAAO,EAAC,MAAM,EAAE,MAAM,EAA+B,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,EAAC,QAAQ,EAAC,gCAA6B;AAGnD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,QAAQ,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;IACzF,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,CAAC;AAEF,qBAAa,WAAW;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IAEvC,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,YAAY,EAAE,CAAM;IAE3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAEhC,KAAK,EAAE,gBAAgB;IAiBnC,OAAO,IAAI,IAAI;IAOf,cAAc,IAAI,MAAM;IAIxB,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIvC,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,CAMjG;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,GACjB;IAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,YAAY,EAAE,YAAY,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,CAmCzF"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { Buffer, getVertexFormatFromAttribute } from '@luma.gl/core';
|
|
5
|
+
import { uid } from "../utils/uid.js";
|
|
2
6
|
export class GPUGeometry {
|
|
3
7
|
id;
|
|
4
8
|
userData = {};
|
|
@@ -16,7 +20,9 @@ export class GPUGeometry {
|
|
|
16
20
|
this.vertexCount = props.vertexCount;
|
|
17
21
|
this.bufferLayout = props.bufferLayout || [];
|
|
18
22
|
if (this.indices) {
|
|
19
|
-
|
|
23
|
+
if (!(this.indices.usage & Buffer.INDEX)) {
|
|
24
|
+
throw new Error('Index buffer must have INDEX usage');
|
|
25
|
+
}
|
|
20
26
|
}
|
|
21
27
|
}
|
|
22
28
|
destroy() {
|
|
@@ -32,7 +38,7 @@ export class GPUGeometry {
|
|
|
32
38
|
return this.attributes;
|
|
33
39
|
}
|
|
34
40
|
getIndexes() {
|
|
35
|
-
return this.indices;
|
|
41
|
+
return this.indices || null;
|
|
36
42
|
}
|
|
37
43
|
_calculateVertexCount(positions) {
|
|
38
44
|
// Assume that positions is a fully packed float32x3 buffer
|
|
@@ -81,9 +87,15 @@ export function getAttributeBuffersFromGeometry(device, geometry) {
|
|
|
81
87
|
name = 'colors';
|
|
82
88
|
break;
|
|
83
89
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
if (attribute) {
|
|
91
|
+
attributes[name] = device.createBuffer({
|
|
92
|
+
data: attribute.value,
|
|
93
|
+
id: `${attributeName}-buffer`
|
|
94
|
+
});
|
|
95
|
+
const { value, size, normalized } = attribute;
|
|
96
|
+
// @ts-expect-error
|
|
97
|
+
bufferLayout.push({ name, format: getVertexFormatFromAttribute(value, size, normalized) });
|
|
98
|
+
}
|
|
87
99
|
}
|
|
88
100
|
const vertexCount = geometry._calculateVertexCount(geometry.attributes, geometry.indices);
|
|
89
101
|
return { attributes, bufferLayout, vertexCount };
|