@luma.gl/engine 9.0.0-alpha.16 → 9.0.0-alpha.19
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/key-frames.d.ts +1 -1
- package/dist/animation/key-frames.d.ts.map +1 -1
- package/dist/animation/key-frames.js +55 -54
- package/dist/animation/key-frames.js.map +1 -0
- package/dist/animation/timeline.d.ts +4 -4
- package/dist/animation/timeline.d.ts.map +1 -1
- package/dist/animation/timeline.js +101 -94
- package/dist/animation/timeline.js.map +1 -0
- package/dist/animation-loop/animation-loop.d.ts +4 -2
- package/dist/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +358 -414
- package/dist/animation-loop/animation-loop.js.map +1 -0
- package/dist/animation-loop/animation-props.d.ts +3 -1
- package/dist/animation-loop/animation-props.d.ts.map +1 -1
- package/dist/animation-loop/animation-props.js +1 -0
- package/dist/animation-loop/animation-props.js.map +1 -0
- package/dist/animation-loop/make-animation-loop.d.ts +1 -1
- package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.js +25 -26
- package/dist/animation-loop/make-animation-loop.js.map +1 -0
- package/dist/animation-loop/render-loop.js +5 -17
- package/dist/animation-loop/render-loop.js.map +1 -0
- package/dist/dist.dev.js +12517 -0
- package/dist/geometries/cone-geometry.d.ts +1 -1
- package/dist/geometries/cone-geometry.d.ts.map +1 -1
- package/dist/geometries/cone-geometry.js +18 -12
- package/dist/geometries/cone-geometry.js.map +1 -0
- package/dist/geometries/cube-geometry.d.ts +1 -1
- package/dist/geometries/cube-geometry.d.ts.map +1 -1
- package/dist/geometries/cube-geometry.js +60 -187
- package/dist/geometries/cube-geometry.js.map +1 -0
- package/dist/geometries/cylinder-geometry.d.ts +1 -1
- package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
- package/dist/geometries/cylinder-geometry.js +15 -10
- package/dist/geometries/cylinder-geometry.js.map +1 -0
- package/dist/geometries/ico-sphere-geometry.d.ts +1 -1
- package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/ico-sphere-geometry.js +160 -141
- package/dist/geometries/ico-sphere-geometry.js.map +1 -0
- package/dist/geometries/plane-geometry.d.ts +1 -1
- package/dist/geometries/plane-geometry.d.ts.map +1 -1
- package/dist/geometries/plane-geometry.js +111 -93
- package/dist/geometries/plane-geometry.js.map +1 -0
- package/dist/geometries/sphere-geometry.d.ts +1 -1
- package/dist/geometries/sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/sphere-geometry.js +95 -76
- package/dist/geometries/sphere-geometry.js.map +1 -0
- package/dist/geometries/truncated-cone-geometry.d.ts +1 -1
- package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
- package/dist/geometries/truncated-cone-geometry.js +126 -105
- package/dist/geometries/truncated-cone-geometry.js.map +1 -0
- package/dist/geometry/geometry-table.d.ts +1 -1
- package/dist/geometry/geometry-table.d.ts.map +1 -1
- package/dist/geometry/geometry-table.js +1 -0
- package/dist/geometry/geometry-table.js.map +1 -0
- package/dist/geometry/geometry-utils.js +32 -22
- package/dist/geometry/geometry-utils.js.map +1 -0
- package/dist/geometry/geometry.d.ts +4 -4
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +109 -96
- package/dist/geometry/geometry.js.map +1 -0
- package/dist/geometry/primitive-utils.js +1 -30
- package/dist/geometry/primitive-utils.js.map +1 -0
- package/dist/index.cjs +2268 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -20
- package/dist/index.js.map +1 -0
- package/dist/lib/clip-space.d.ts +8 -0
- package/dist/lib/clip-space.d.ts.map +1 -1
- package/dist/lib/clip-space.js +32 -45
- package/dist/lib/clip-space.js.map +1 -0
- package/dist/lib/model-utils.js +28 -101
- package/dist/lib/model-utils.js.map +1 -0
- package/dist/lib/model.d.ts +1 -1
- package/dist/lib/model.d.ts.map +1 -1
- package/dist/lib/model.js +129 -121
- package/dist/lib/model.js.map +1 -0
- package/dist/lib/pipeline-factory.d.ts +3 -3
- package/dist/lib/pipeline-factory.d.ts.map +1 -1
- package/dist/lib/pipeline-factory.js +165 -136
- package/dist/lib/pipeline-factory.js.map +1 -0
- package/dist.min.js +295 -0
- package/package.json +22 -13
- package/src/animation/timeline.ts +1 -1
- package/src/animation-loop/animation-loop.ts +5 -5
- package/src/animation-loop/make-animation-loop.ts +2 -1
- package/src/geometry/geometry.ts +2 -2
- package/src/index.ts +1 -1
- package/src/lib/clip-space.ts +14 -11
- package/src/lib/pipeline-factory.ts +1 -1
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -5
- package/dist/dist.min.js +0 -31
- package/dist/es5/animation/key-frames.js +0 -84
- package/dist/es5/animation/key-frames.js.map +0 -1
- package/dist/es5/animation/timeline.js +0 -183
- package/dist/es5/animation/timeline.js.map +0 -1
- package/dist/es5/animation-loop/animation-loop.js +0 -534
- package/dist/es5/animation-loop/animation-loop.js.map +0 -1
- package/dist/es5/animation-loop/animation-props.js +0 -2
- package/dist/es5/animation-loop/animation-props.js.map +0 -1
- package/dist/es5/animation-loop/make-animation-loop.js +0 -53
- package/dist/es5/animation-loop/make-animation-loop.js.map +0 -1
- package/dist/es5/animation-loop/render-loop.js +0 -39
- package/dist/es5/animation-loop/render-loop.js.map +0 -1
- package/dist/es5/bundle.js +0 -6
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/geometries/cone-geometry.js +0 -43
- package/dist/es5/geometries/cone-geometry.js.map +0 -1
- package/dist/es5/geometries/cube-geometry.js +0 -84
- package/dist/es5/geometries/cube-geometry.js.map +0 -1
- package/dist/es5/geometries/cylinder-geometry.js +0 -39
- package/dist/es5/geometries/cylinder-geometry.js.map +0 -1
- package/dist/es5/geometries/ico-sphere-geometry.js +0 -185
- package/dist/es5/geometries/ico-sphere-geometry.js.map +0 -1
- package/dist/es5/geometries/plane-geometry.js +0 -137
- package/dist/es5/geometries/plane-geometry.js.map +0 -1
- package/dist/es5/geometries/sphere-geometry.js +0 -120
- package/dist/es5/geometries/sphere-geometry.js.map +0 -1
- package/dist/es5/geometries/truncated-cone-geometry.js +0 -160
- package/dist/es5/geometries/truncated-cone-geometry.js.map +0 -1
- package/dist/es5/geometry/geometry-table.js +0 -2
- package/dist/es5/geometry/geometry-table.js.map +0 -1
- package/dist/es5/geometry/geometry-utils.js +0 -39
- package/dist/es5/geometry/geometry-utils.js.map +0 -1
- package/dist/es5/geometry/geometry.js +0 -150
- package/dist/es5/geometry/geometry.js.map +0 -1
- package/dist/es5/geometry/primitive-utils.js +0 -2
- package/dist/es5/geometry/primitive-utils.js.map +0 -1
- package/dist/es5/index.js +0 -112
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/lib/clip-space.js +0 -2
- package/dist/es5/lib/clip-space.js.map +0 -1
- package/dist/es5/lib/model-utils.js +0 -52
- package/dist/es5/lib/model-utils.js.map +0 -1
- package/dist/es5/lib/model.js +0 -173
- package/dist/es5/lib/model.js.map +0 -1
- package/dist/es5/lib/pipeline-factory.js +0 -244
- package/dist/es5/lib/pipeline-factory.js.map +0 -1
- package/dist/esm/animation/key-frames.js +0 -57
- package/dist/esm/animation/key-frames.js.map +0 -1
- package/dist/esm/animation/timeline.js +0 -113
- package/dist/esm/animation/timeline.js.map +0 -1
- package/dist/esm/animation-loop/animation-loop.js +0 -367
- package/dist/esm/animation-loop/animation-loop.js.map +0 -1
- package/dist/esm/animation-loop/animation-props.js +0 -2
- package/dist/esm/animation-loop/animation-props.js.map +0 -1
- package/dist/esm/animation-loop/make-animation-loop.js +0 -28
- package/dist/esm/animation-loop/make-animation-loop.js.map +0 -1
- package/dist/esm/animation-loop/render-loop.js +0 -7
- package/dist/esm/animation-loop/render-loop.js.map +0 -1
- package/dist/esm/bundle.js +0 -4
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/geometries/cone-geometry.js +0 -21
- package/dist/esm/geometries/cone-geometry.js.map +0 -1
- package/dist/esm/geometries/cube-geometry.js +0 -67
- package/dist/esm/geometries/cube-geometry.js.map +0 -1
- package/dist/esm/geometries/cylinder-geometry.js +0 -18
- package/dist/esm/geometries/cylinder-geometry.js.map +0 -1
- package/dist/esm/geometries/ico-sphere-geometry.js +0 -170
- package/dist/esm/geometries/ico-sphere-geometry.js.map +0 -1
- package/dist/esm/geometries/plane-geometry.js +0 -119
- package/dist/esm/geometries/plane-geometry.js.map +0 -1
- package/dist/esm/geometries/sphere-geometry.js +0 -102
- package/dist/esm/geometries/sphere-geometry.js.map +0 -1
- package/dist/esm/geometries/truncated-cone-geometry.js +0 -136
- package/dist/esm/geometries/truncated-cone-geometry.js.map +0 -1
- package/dist/esm/geometry/geometry-table.js +0 -2
- package/dist/esm/geometry/geometry-table.js.map +0 -1
- package/dist/esm/geometry/geometry-utils.js +0 -37
- package/dist/esm/geometry/geometry-utils.js.map +0 -1
- package/dist/esm/geometry/geometry.js +0 -119
- package/dist/esm/geometry/geometry.js.map +0 -1
- package/dist/esm/geometry/primitive-utils.js +0 -2
- package/dist/esm/geometry/primitive-utils.js.map +0 -1
- package/dist/esm/index.js +0 -16
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lib/clip-space.js +0 -2
- package/dist/esm/lib/clip-space.js.map +0 -1
- package/dist/esm/lib/model-utils.js +0 -40
- package/dist/esm/lib/model-utils.js.map +0 -1
- package/dist/esm/lib/model.js +0 -146
- package/dist/esm/lib/model.js.map +0 -1
- package/dist/esm/lib/pipeline-factory.js +0 -180
- package/dist/esm/lib/pipeline-factory.js.map +0 -1
- package/src/bundle.ts +0 -4
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { makeAnimationLoop } from './animation-loop/make-animation-loop';
|
|
|
9
9
|
export type { ModelProps } from './lib/model';
|
|
10
10
|
export { Model } from './lib/model';
|
|
11
11
|
export { PipelineFactory } from './lib/pipeline-factory';
|
|
12
|
+
export { ClipSpace } from './lib/clip-space';
|
|
12
13
|
export { default as Geometry } from './geometry/geometry';
|
|
13
14
|
export type { ConeGeometryProps } from './geometries/cone-geometry';
|
|
14
15
|
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,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,YAAY,EAAC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAC;AAEnE,YAAY,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAC;AAE9D,YAAY,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAC,iBAAiB,EAAC,MAAM,sCAAsC,CAAC;AAEvE,YAAY,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAElC,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,YAAY,EAAC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAC;AAEnE,YAAY,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAC;AAE9D,YAAY,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAC,iBAAiB,EAAC,MAAM,sCAAsC,CAAC;AAEvE,YAAY,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAElC,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAGxD,YAAY,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,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
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
|
|
18
|
-
export { PlaneGeometry } from './geometries/plane-geometry.js';
|
|
19
|
-
export { SphereGeometry } from './geometries/sphere-geometry.js';
|
|
20
|
-
export { TruncatedConeGeometry } from './geometries/truncated-cone-geometry.js';
|
|
1
|
+
export { Timeline } from "./animation/timeline.js";
|
|
2
|
+
export { KeyFrames } from "./animation/key-frames.js";
|
|
3
|
+
export { AnimationLoopTemplate } from "./animation-loop/render-loop.js";
|
|
4
|
+
export { AnimationLoop } from "./animation-loop/animation-loop.js";
|
|
5
|
+
export { makeAnimationLoop } from "./animation-loop/make-animation-loop.js";
|
|
6
|
+
export { Model } from "./lib/model.js";
|
|
7
|
+
export { PipelineFactory } from "./lib/pipeline-factory.js";
|
|
8
|
+
export { ClipSpace } from "./lib/clip-space.js";
|
|
9
|
+
export { default as Geometry } from "./geometry/geometry.js";
|
|
10
|
+
export { ConeGeometry } from "./geometries/cone-geometry.js";
|
|
11
|
+
export { CubeGeometry } from "./geometries/cube-geometry.js";
|
|
12
|
+
export { CylinderGeometry } from "./geometries/cylinder-geometry.js";
|
|
13
|
+
export { IcoSphereGeometry } from "./geometries/ico-sphere-geometry.js";
|
|
14
|
+
export { PlaneGeometry } from "./geometries/plane-geometry.js";
|
|
15
|
+
export { SphereGeometry } from "./geometries/sphere-geometry.js";
|
|
16
|
+
export { TruncatedConeGeometry } from "./geometries/truncated-cone-geometry.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["Timeline","KeyFrames","AnimationLoopTemplate","AnimationLoop","makeAnimationLoop","Model","PipelineFactory","ClipSpace","default","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 './lib/model';\nexport {Model} from './lib/model';\n\nexport {PipelineFactory} from './lib/pipeline-factory';\n\n// Utils\nexport {ClipSpace} from './lib/clip-space';\n\n// Geometries\nexport {default as 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,eAAe;AAAA,SAGfC,SAAS;AAAA,SAGTC,OAAO,IAAIC,QAAQ;AAAA,SAInBC,YAAY;AAAA,SAEZC,YAAY;AAAA,SAEZC,gBAAgB;AAAA,SAEhBC,iBAAiB;AAAA,SAEjBC,aAAa;AAAA,SAEbC,cAAc;AAAA,SAEdC,qBAAqB"}
|
package/dist/lib/clip-space.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
+
import { Device } from '@luma.gl/api';
|
|
2
|
+
import { Model, ModelProps } from './model';
|
|
3
|
+
/**
|
|
4
|
+
* A flat geometry that covers the "visible area" that the GPU renders.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ClipSpace extends Model {
|
|
7
|
+
constructor(device: Device | WebGLRenderingContext, opts?: ModelProps);
|
|
8
|
+
}
|
|
1
9
|
//# sourceMappingURL=clip-space.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip-space.d.ts","sourceRoot":"","sources":["../../src/lib/clip-space.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"clip-space.d.ts","sourceRoot":"","sources":["../../src/lib/clip-space.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,MAAM,EAAO,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,SAAS,CAAC;AAwB1C;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBACtB,MAAM,EAAE,MAAM,GAAG,qBAAqB,EAAE,IAAI,CAAC,EAAE,UAAU;CAqBtE"}
|
package/dist/lib/clip-space.js
CHANGED
|
@@ -1,51 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/*
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
4
3
|
import GL from '@luma.gl/constants';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
attribute vec2 aClipSpacePosition;
|
|
10
|
-
attribute vec2 aTexCoord;
|
|
11
|
-
attribute vec2 aCoordinate;
|
|
12
|
-
|
|
13
|
-
varying vec2 position;
|
|
14
|
-
varying vec2 coordinate;
|
|
15
|
-
varying vec2 uv;
|
|
16
|
-
|
|
17
|
-
void main(void) {
|
|
18
|
-
gl_Position = vec4(aClipSpacePosition, 0., 1.);
|
|
19
|
-
position = aClipSpacePosition;
|
|
20
|
-
coordinate = aCoordinate;
|
|
21
|
-
uv = aTexCoord;
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
/* eslint-disable indent, no-multi-spaces *
|
|
4
|
+
import { glsl } from '@luma.gl/api';
|
|
5
|
+
import { Model } from "./model.js";
|
|
6
|
+
import Geometry from "../geometry/geometry.js";
|
|
7
|
+
import { WebGLDevice } from '@luma.gl/webgl/index';
|
|
8
|
+
const CLIPSPACE_VERTEX_SHADER = glsl(_templateObject || (_templateObject = _taggedTemplateLiteral(["attribute 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"], ["\\\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"])));
|
|
26
9
|
const POSITIONS = [-1, -1, 1, -1, -1, 1, 1, 1];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
10
|
+
export class ClipSpace extends Model {
|
|
11
|
+
constructor(device, opts) {
|
|
12
|
+
const TEX_COORDS = POSITIONS.map(coord => coord === -1 ? 0 : coord);
|
|
13
|
+
super(WebGLDevice.attach(device), {
|
|
14
|
+
...opts,
|
|
15
|
+
vs: CLIPSPACE_VERTEX_SHADER,
|
|
16
|
+
vertexCount: 4,
|
|
17
|
+
geometry: new Geometry({
|
|
18
|
+
drawMode: GL.TRIANGLE_STRIP,
|
|
19
|
+
vertexCount: 4,
|
|
20
|
+
attributes: {
|
|
21
|
+
aClipSpacePosition: {
|
|
22
|
+
size: 2,
|
|
23
|
+
value: new Float32Array(POSITIONS)
|
|
24
|
+
},
|
|
25
|
+
aTexCoord: {
|
|
26
|
+
size: 2,
|
|
27
|
+
value: new Float32Array(TEX_COORDS)
|
|
28
|
+
},
|
|
29
|
+
aCoordinate: {
|
|
30
|
+
size: 2,
|
|
31
|
+
value: new Float32Array(TEX_COORDS)
|
|
44
32
|
}
|
|
45
|
-
}
|
|
33
|
+
}
|
|
46
34
|
})
|
|
47
|
-
);
|
|
48
|
-
this.setVertexCount(4);
|
|
35
|
+
});
|
|
49
36
|
}
|
|
50
37
|
}
|
|
51
|
-
|
|
38
|
+
//# sourceMappingURL=clip-space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clip-space.js","names":["GL","glsl","Model","Geometry","WebGLDevice","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 {Model, ModelProps} from './model';\nimport Geometry from '../geometry/geometry';\nimport {WebGLDevice} from '@luma.gl/webgl/index';\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,OAAOA,EAAE,MAAM,oBAAoB;AACnC,SAAgBC,IAAI,QAAO,cAAc;AAAC,SAClCC,KAAK;AAAA,OACNC,QAAQ;AACf,SAAQC,WAAW,QAAO,sBAAsB;AAEhD,MAAMC,uBAAuB,GAAGJ,IAAI,CAAAK,eAAA,KAAAA,eAAA,GAAAC,sBAAA,gpBAenC;AAGD,MAAMC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAK9C,OAAO,MAAMC,SAAS,SAASP,KAAK,CAAC;EACnCQ,WAAWA,CAACC,MAAsC,EAAEC,IAAiB,EAAE;IACrE,MAAMC,UAAU,GAAGL,SAAS,CAACM,GAAG,CAAEC,KAAK,IAAMA,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,GAAGA,KAAM,CAAC;IAEvE,KAAK,CACHX,WAAW,CAACY,MAAM,CAACL,MAAM,CAAC,EAC1B;MACE,GAAGC,IAAI;MACPK,EAAE,EAAEZ,uBAAuB;MAC3Ba,WAAW,EAAE,CAAC;MACdC,QAAQ,EAAE,IAAIhB,QAAQ,CAAC;QACrBiB,QAAQ,EAAEpB,EAAE,CAACqB,cAAc;QAC3BH,WAAW,EAAE,CAAC;QACdI,UAAU,EAAE;UACVC,kBAAkB,EAAE;YAACC,IAAI,EAAE,CAAC;YAAEC,KAAK,EAAE,IAAIC,YAAY,CAAClB,SAAS;UAAC,CAAC;UACjEmB,SAAS,EAAE;YAACH,IAAI,EAAE,CAAC;YAAEC,KAAK,EAAE,IAAIC,YAAY,CAACb,UAAU;UAAC,CAAC;UACzDe,WAAW,EAAE;YAACJ,IAAI,EAAE,CAAC;YAAEC,KAAK,EAAE,IAAIC,YAAY,CAACb,UAAU;UAAC;QAC5D;MACF,CAAC;IACH,CAAC,CACF;EACH;AACF"}
|
package/dist/lib/model-utils.js
CHANGED
|
@@ -1,113 +1,40 @@
|
|
|
1
1
|
import { Buffer, assert } from '@luma.gl/api';
|
|
2
|
-
// Support for mapping new geometries with glTF attribute names to "classic" luma.gl shader names
|
|
3
2
|
const GLTF_TO_LUMA_ATTRIBUTE_MAP = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
POSITION: 'positions',
|
|
4
|
+
NORMAL: 'normals',
|
|
5
|
+
COLOR_0: 'colors',
|
|
6
|
+
TEXCOORD_0: 'texCoords',
|
|
7
|
+
TEXCOORD_1: 'texCoords1',
|
|
8
|
+
TEXCOORD_2: 'texCoords2'
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
export function getIndexBufferFromGeometry(device, geometry) {
|
|
11
|
+
if (!geometry.indices) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const data = geometry.indices.value || geometry.indices;
|
|
15
|
+
assert(data instanceof Uint16Array || data instanceof Uint32Array, 'attribute array for "indices" must be of integer type');
|
|
16
|
+
return device.createBuffer({
|
|
17
|
+
usage: Buffer.INDEX,
|
|
18
|
+
data
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function getAttributeBuffersFromGeometry(device, geometry) {
|
|
22
|
+
const buffers = {};
|
|
16
23
|
for (const [name, attribute] of Object.entries(geometry.attributes)) {
|
|
17
24
|
const remappedName = mapAttributeName(name);
|
|
18
|
-
|
|
19
|
-
if (attribute.constant) {
|
|
25
|
+
if (attribute !== null && attribute !== void 0 && attribute.constant) {
|
|
20
26
|
throw new Error('constant attributes not supported');
|
|
21
27
|
} else {
|
|
22
|
-
const typedArray = attribute.value;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
inferAttributeAccessor(name, accessor);
|
|
28
|
+
const typedArray = attribute === null || attribute === void 0 ? void 0 : attribute.value;
|
|
29
|
+
buffers[remappedName] = device.createBuffer({
|
|
30
|
+
data: typedArray,
|
|
31
|
+
id: "".concat(remappedName, "-buffer")
|
|
32
|
+
});
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export class Table {
|
|
34
|
-
length: number;
|
|
35
|
-
// columns: Record<string, TypedArray> = {};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export class GPUTable {
|
|
39
|
-
length: number;
|
|
40
|
-
columns: Record<string, Buffer> = {};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function convertTableToGPUTable(table: Table) {
|
|
44
|
-
// for (const ) {}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function renameTableColumns(table: Table, map: (name: string) => string) {
|
|
48
|
-
const newColumns = table.columns.reduce()
|
|
49
|
-
table.clone();
|
|
50
|
-
}
|
|
51
|
-
*/
|
|
52
|
-
export function getIndexBufferFromGeometry(device, geometry) {
|
|
53
|
-
if (!geometry.indices) {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
// @ts-expect-error
|
|
57
|
-
const data = geometry.indices.value || geometry.indices;
|
|
58
|
-
assert(data instanceof Uint16Array || data instanceof Uint32Array, 'attribute array for "indices" must be of integer type');
|
|
59
|
-
return device.createBuffer({ usage: Buffer.INDEX, data });
|
|
60
|
-
}
|
|
61
|
-
export function getAttributeBuffersFromGeometry(device, geometry) {
|
|
62
|
-
const buffers = {};
|
|
63
|
-
for (const [name, attribute] of Object.entries(geometry.attributes)) {
|
|
64
|
-
const remappedName = mapAttributeName(name);
|
|
65
|
-
if (attribute?.constant) {
|
|
66
|
-
throw new Error('constant attributes not supported');
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
const typedArray = attribute?.value;
|
|
70
|
-
buffers[remappedName] = device.createBuffer({ data: typedArray, id: `${remappedName}-buffer` });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return buffers;
|
|
35
|
+
return buffers;
|
|
74
36
|
}
|
|
75
37
|
function mapAttributeName(name) {
|
|
76
|
-
|
|
77
|
-
return GLTF_TO_LUMA_ATTRIBUTE_MAP[name] || name;
|
|
78
|
-
}
|
|
79
|
-
/*
|
|
80
|
-
// Check for well known attribute names
|
|
81
|
-
// eslint-disable-next-line complexity
|
|
82
|
-
export function inferAttributeAccessor(attributeName, attribute) {
|
|
83
|
-
let category;
|
|
84
|
-
switch (attributeName) {
|
|
85
|
-
case 'texCoords':
|
|
86
|
-
case 'texCoord1':
|
|
87
|
-
case 'texCoord2':
|
|
88
|
-
case 'texCoord3':
|
|
89
|
-
category = 'uvs';
|
|
90
|
-
break;
|
|
91
|
-
case 'vertices':
|
|
92
|
-
case 'positions':
|
|
93
|
-
case 'normals':
|
|
94
|
-
case 'pickingColors':
|
|
95
|
-
category = 'vectors';
|
|
96
|
-
break;
|
|
97
|
-
default:
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Check for categorys
|
|
101
|
-
switch (category) {
|
|
102
|
-
case 'vectors':
|
|
103
|
-
attribute.size = attribute.size || 3;
|
|
104
|
-
break;
|
|
105
|
-
case 'uvs':
|
|
106
|
-
attribute.size = attribute.size || 2;
|
|
107
|
-
break;
|
|
108
|
-
default:
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
assert(Number.isFinite(attribute.size), `attribute ${attributeName} needs size`);
|
|
38
|
+
return GLTF_TO_LUMA_ATTRIBUTE_MAP[name] || name;
|
|
112
39
|
}
|
|
113
|
-
|
|
40
|
+
//# sourceMappingURL=model-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-utils.js","names":["Buffer","assert","GLTF_TO_LUMA_ATTRIBUTE_MAP","POSITION","NORMAL","COLOR_0","TEXCOORD_0","TEXCOORD_1","TEXCOORD_2","getIndexBufferFromGeometry","device","geometry","indices","undefined","data","value","Uint16Array","Uint32Array","createBuffer","usage","INDEX","getAttributeBuffersFromGeometry","buffers","name","attribute","Object","entries","attributes","remappedName","mapAttributeName","constant","Error","typedArray","id","concat"],"sources":["../../src/lib/model-utils.ts"],"sourcesContent":["import {Device, Buffer, assert} from '@luma.gl/api';\nimport type Geometry from '../geometry/geometry';\n\n// Support for mapping new geometries with glTF attribute names to \"classic\" luma.gl shader names\nconst GLTF_TO_LUMA_ATTRIBUTE_MAP = {\n POSITION: 'positions',\n NORMAL: 'normals',\n COLOR_0: 'colors',\n TEXCOORD_0: 'texCoords',\n TEXCOORD_1: 'texCoords1',\n TEXCOORD_2: 'texCoords2'\n};\n\n/*\nexport function getAttributeLayoutsFromGeometry(geometry: Geometry) {\n const layouts: Record<string, {}> = {};\n let indices = geometry.indices;\n\n for (const [name, attribute] of Object.entries(geometry.attributes)) {\n const remappedName = mapAttributeName(name);\n\n if (attribute.constant) {\n throw new Error('constant attributes not supported');\n } else {\n const typedArray = attribute.value;\n // Create accessor by copying the attribute and removing `value``\n const accessor = {...attribute};\n delete accessor.value;\n buffers[remappedName] = [device.createBuffer(typedArray), accessor];\n\n inferAttributeAccessor(name, accessor);\n }\n }\n}\n\nexport class Table {\n length: number;\n // columns: Record<string, TypedArray> = {};\n}\n\nexport class GPUTable {\n length: number;\n columns: Record<string, Buffer> = {};\n}\n\nexport function convertTableToGPUTable(table: Table) {\n // for (const ) {}\n}\n\nexport function renameTableColumns(table: Table, map: (name: string) => string) {\n const newColumns = table.columns.reduce()\n table.clone();\n}\n*/\n\nexport function getIndexBufferFromGeometry(device: Device, geometry: Geometry): Buffer | undefined {\n if (!geometry.indices) {\n return undefined;\n }\n\n // @ts-expect-error\n const data = geometry.indices.value || geometry.indices;\n assert(\n data instanceof Uint16Array || data instanceof Uint32Array,\n 'attribute array for \"indices\" must be of integer type'\n );\n return device.createBuffer({usage: Buffer.INDEX, data});\n}\n\nexport function getAttributeBuffersFromGeometry(device: Device, geometry: Geometry): Record<string, Buffer> {\n const buffers: Record<string, Buffer> = {};\n\n for (const [name, attribute] of Object.entries(geometry.attributes)) {\n const remappedName = mapAttributeName(name);\n if (attribute?.constant) {\n throw new Error('constant attributes not supported');\n } else {\n const typedArray = attribute?.value;\n buffers[remappedName] = device.createBuffer({data: typedArray, id: `${remappedName}-buffer`});\n }\n }\n\n return buffers;\n}\n\nfunction mapAttributeName(name: string): string {\n // @ts-ignore-error\n return GLTF_TO_LUMA_ATTRIBUTE_MAP[name] || name;\n}\n\n/*\n// Check for well known attribute names\n// eslint-disable-next-line complexity\nexport function inferAttributeAccessor(attributeName, attribute) {\n let category;\n switch (attributeName) {\n case 'texCoords':\n case 'texCoord1':\n case 'texCoord2':\n case 'texCoord3':\n category = 'uvs';\n break;\n case 'vertices':\n case 'positions':\n case 'normals':\n case 'pickingColors':\n category = 'vectors';\n break;\n default:\n }\n\n // Check for categorys\n switch (category) {\n case 'vectors':\n attribute.size = attribute.size || 3;\n break;\n case 'uvs':\n attribute.size = attribute.size || 2;\n break;\n default:\n }\n\n assert(Number.isFinite(attribute.size), `attribute ${attributeName} needs size`);\n}\n*/\n"],"mappings":"AAAA,SAAgBA,MAAM,EAAEC,MAAM,QAAO,cAAc;AAInD,MAAMC,0BAA0B,GAAG;EACjCC,QAAQ,EAAE,WAAW;EACrBC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAE,QAAQ;EACjBC,UAAU,EAAE,WAAW;EACvBC,UAAU,EAAE,YAAY;EACxBC,UAAU,EAAE;AACd,CAAC;AA4CD,OAAO,SAASC,0BAA0BA,CAACC,MAAc,EAAEC,QAAkB,EAAsB;EACjG,IAAI,CAACA,QAAQ,CAACC,OAAO,EAAE;IACrB,OAAOC,SAAS;EAClB;EAGA,MAAMC,IAAI,GAAGH,QAAQ,CAACC,OAAO,CAACG,KAAK,IAAIJ,QAAQ,CAACC,OAAO;EACvDX,MAAM,CACJa,IAAI,YAAYE,WAAW,IAAIF,IAAI,YAAYG,WAAW,EAC1D,uDAAuD,CACxD;EACD,OAAOP,MAAM,CAACQ,YAAY,CAAC;IAACC,KAAK,EAAEnB,MAAM,CAACoB,KAAK;IAAEN;EAAI,CAAC,CAAC;AACzD;AAEA,OAAO,SAASO,+BAA+BA,CAACX,MAAc,EAAEC,QAAkB,EAA0B;EAC1G,MAAMW,OAA+B,GAAG,CAAC,CAAC;EAE1C,KAAK,MAAM,CAACC,IAAI,EAAEC,SAAS,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACf,QAAQ,CAACgB,UAAU,CAAC,EAAE;IACnE,MAAMC,YAAY,GAAGC,gBAAgB,CAACN,IAAI,CAAC;IAC3C,IAAIC,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEM,QAAQ,EAAE;MACvB,MAAM,IAAIC,KAAK,CAAC,mCAAmC,CAAC;IACtD,CAAC,MAAM;MACL,MAAMC,UAAU,GAAGR,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAET,KAAK;MACnCO,OAAO,CAACM,YAAY,CAAC,GAAGlB,MAAM,CAACQ,YAAY,CAAC;QAACJ,IAAI,EAAEkB,UAAU;QAAEC,EAAE,KAAAC,MAAA,CAAKN,YAAY;MAAS,CAAC,CAAC;IAC/F;EACF;EAEA,OAAON,OAAO;AAChB;AAEA,SAASO,gBAAgBA,CAACN,IAAY,EAAU;EAE9C,OAAOrB,0BAA0B,CAACqB,IAAI,CAAC,IAAIA,IAAI;AACjD"}
|
package/dist/lib/model.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Device, Buffer, RenderPipelineProps, RenderPass, Binding, Primitiv
|
|
|
2
2
|
import { RenderPipeline } from '@luma.gl/api';
|
|
3
3
|
import type { ShaderModule } from '@luma.gl/shadertools';
|
|
4
4
|
import type Geometry from '../geometry/geometry';
|
|
5
|
-
export type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {
|
|
5
|
+
export declare type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {
|
|
6
6
|
vs?: {
|
|
7
7
|
glsl?: string;
|
|
8
8
|
wgsl?: string;
|
package/dist/lib/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC9G,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAIjD,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC9G,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAIjD,oBAAY,UAAU,GAAG,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,IAAI,CAAC,GAAG;IAEhE,EAAE,CAAC,EAAE;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IACpD,EAAE,CAAC,EAAE;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IACpD,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC5B,CAAC;AAcF,aAAa;AACb,qBAAa,KAAK;IAChB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAQ;IAClC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,WAAW,SAAC;IACrB,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAE5B,OAAO,CAAC,kBAAkB,CAAuE;gBAErF,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU;IA2C7C,OAAO,IAAI,IAAI;IAIf,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI;IASnC,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAmBjC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAMtD,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMrC,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAMvD,uBAAuB;IACvB,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMpD,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAMhD,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAWvC"}
|
package/dist/lib/model.js
CHANGED
|
@@ -1,138 +1,146 @@
|
|
|
1
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { RenderPipeline } from '@luma.gl/api';
|
|
3
|
-
import { getAttributeBuffersFromGeometry, getIndexBufferFromGeometry } from
|
|
4
|
-
import { PipelineFactory } from
|
|
3
|
+
import { getAttributeBuffersFromGeometry, getIndexBufferFromGeometry } from "./model-utils.js";
|
|
4
|
+
import { PipelineFactory } from "./pipeline-factory.js";
|
|
5
5
|
const DEFAULT_MODEL_PROPS = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
...RenderPipeline._DEFAULT_PROPS,
|
|
7
|
+
vs: null,
|
|
8
|
+
fs: null,
|
|
9
|
+
id: 'unnamed',
|
|
10
|
+
handle: undefined,
|
|
11
|
+
userData: {},
|
|
12
|
+
modules: [],
|
|
13
|
+
moduleSettings: {},
|
|
14
|
+
geometry: null
|
|
15
15
|
};
|
|
16
|
-
/** v9 API */
|
|
17
16
|
export class Model {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
const pipelineFactory = PipelineFactory.getDefaultPipelineFactory(this.device);
|
|
39
|
-
const { pipeline, getUniforms } = pipelineFactory.createRenderPipeline({
|
|
40
|
-
...this.props,
|
|
41
|
-
vs: this.vs,
|
|
42
|
-
fs: this.fs,
|
|
43
|
-
topology: this.topology,
|
|
44
|
-
parameters: props.parameters,
|
|
45
|
-
layout: props.layout
|
|
46
|
-
});
|
|
47
|
-
this.pipeline = pipeline;
|
|
48
|
-
this._getModuleUniforms = getUniforms;
|
|
49
|
-
if (this.props.geometry) {
|
|
50
|
-
this._setGeometry(this.props.geometry);
|
|
51
|
-
}
|
|
52
|
-
this.setUniforms(this._getModuleUniforms()); // Get all default module uniforms
|
|
53
|
-
this.setProps(this.props);
|
|
17
|
+
constructor(device, props) {
|
|
18
|
+
_defineProperty(this, "device", void 0);
|
|
19
|
+
_defineProperty(this, "pipeline", void 0);
|
|
20
|
+
_defineProperty(this, "id", void 0);
|
|
21
|
+
_defineProperty(this, "vs", void 0);
|
|
22
|
+
_defineProperty(this, "fs", null);
|
|
23
|
+
_defineProperty(this, "topology", void 0);
|
|
24
|
+
_defineProperty(this, "vertexCount", void 0);
|
|
25
|
+
_defineProperty(this, "props", void 0);
|
|
26
|
+
_defineProperty(this, "_getModuleUniforms", void 0);
|
|
27
|
+
this.props = {
|
|
28
|
+
...DEFAULT_MODEL_PROPS,
|
|
29
|
+
...props
|
|
30
|
+
};
|
|
31
|
+
props = this.props;
|
|
32
|
+
this.id = this.props.id;
|
|
33
|
+
this.device = device;
|
|
34
|
+
if (!props.vs) {
|
|
35
|
+
throw new Error('no vertex shader');
|
|
54
36
|
}
|
|
55
|
-
|
|
56
|
-
|
|
37
|
+
this.vs = getShaderSource(this.device, props.vs);
|
|
38
|
+
if (props.fs) {
|
|
39
|
+
this.fs = getShaderSource(this.device, props.fs);
|
|
57
40
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
return this;
|
|
41
|
+
this.vertexCount = this.props.vertexCount;
|
|
42
|
+
this.topology = this.props.topology;
|
|
43
|
+
if (this.props.geometry) {
|
|
44
|
+
this.vertexCount = this.props.geometry.vertexCount;
|
|
45
|
+
this.topology = this.props.geometry.topology || 'triangle-list';
|
|
65
46
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return this;
|
|
47
|
+
const pipelineFactory = PipelineFactory.getDefaultPipelineFactory(this.device);
|
|
48
|
+
const {
|
|
49
|
+
pipeline,
|
|
50
|
+
getUniforms
|
|
51
|
+
} = pipelineFactory.createRenderPipeline({
|
|
52
|
+
...this.props,
|
|
53
|
+
vs: this.vs,
|
|
54
|
+
fs: this.fs,
|
|
55
|
+
topology: this.topology,
|
|
56
|
+
parameters: props.parameters,
|
|
57
|
+
layout: props.layout
|
|
58
|
+
});
|
|
59
|
+
this.pipeline = pipeline;
|
|
60
|
+
this._getModuleUniforms = getUniforms;
|
|
61
|
+
if (this.props.geometry) {
|
|
62
|
+
this._setGeometry(this.props.geometry);
|
|
83
63
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
64
|
+
this.setUniforms(this._getModuleUniforms());
|
|
65
|
+
this.setProps(this.props);
|
|
66
|
+
}
|
|
67
|
+
destroy() {
|
|
68
|
+
this.pipeline.destroy();
|
|
69
|
+
}
|
|
70
|
+
draw(renderPass) {
|
|
71
|
+
this.pipeline.draw({
|
|
72
|
+
renderPass,
|
|
73
|
+
vertexCount: this.vertexCount,
|
|
74
|
+
instanceCount: this.props.instanceCount
|
|
75
|
+
});
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
setProps(props) {
|
|
79
|
+
if (props.indices) {
|
|
80
|
+
this.setIndexBuffer(props.indices);
|
|
88
81
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
// this._indices = indices;
|
|
92
|
-
return this;
|
|
82
|
+
if (props.attributes) {
|
|
83
|
+
this.setAttributes(props.attributes);
|
|
93
84
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
Object.assign(this.props.attributes, attributes);
|
|
97
|
-
return this;
|
|
85
|
+
if (props.bindings) {
|
|
86
|
+
this.setBindings(props.bindings);
|
|
98
87
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.pipeline.setBindings(bindings);
|
|
102
|
-
Object.assign(this.props.bindings, bindings);
|
|
103
|
-
return this;
|
|
88
|
+
if (props.uniforms) {
|
|
89
|
+
this.setUniforms(props.uniforms);
|
|
104
90
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
Object.assign(this.props.uniforms, uniforms);
|
|
108
|
-
return this;
|
|
91
|
+
if (props.moduleSettings) {
|
|
92
|
+
this.updateModuleSettings(props.moduleSettings);
|
|
109
93
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
updateModuleSettings(props) {
|
|
97
|
+
const uniforms = this._getModuleUniforms(props);
|
|
98
|
+
this.setUniforms(uniforms);
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
setIndexBuffer(indices) {
|
|
102
|
+
this.pipeline.setIndexBuffer(indices);
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
setAttributes(attributes) {
|
|
106
|
+
this.pipeline.setAttributes(attributes);
|
|
107
|
+
Object.assign(this.props.attributes, attributes);
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
setBindings(bindings) {
|
|
111
|
+
this.pipeline.setBindings(bindings);
|
|
112
|
+
Object.assign(this.props.bindings, bindings);
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
115
|
+
setUniforms(uniforms) {
|
|
116
|
+
this.pipeline.setUniforms(uniforms);
|
|
117
|
+
Object.assign(this.props.uniforms, uniforms);
|
|
118
|
+
return this;
|
|
119
|
+
}
|
|
120
|
+
_setGeometry(geometry) {
|
|
121
|
+
const geometryBuffers = getAttributeBuffersFromGeometry(this.device, geometry);
|
|
122
|
+
this.setAttributes(geometryBuffers);
|
|
123
|
+
const indexBuffer = getIndexBufferFromGeometry(this.device, geometry);
|
|
124
|
+
if (indexBuffer) {
|
|
125
|
+
this.setIndexBuffer(indexBuffer);
|
|
118
126
|
}
|
|
127
|
+
}
|
|
119
128
|
}
|
|
120
|
-
/** Create a shader from the different overloads */
|
|
121
129
|
function getShaderSource(device, shader) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
130
|
+
if (typeof shader === 'string') {
|
|
131
|
+
return shader;
|
|
132
|
+
}
|
|
133
|
+
switch (device.info.type) {
|
|
134
|
+
case 'webgpu':
|
|
135
|
+
if (shader !== null && shader !== void 0 && shader.wgsl) {
|
|
136
|
+
return shader.wgsl;
|
|
137
|
+
}
|
|
138
|
+
throw new Error('WebGPU does not support GLSL shaders');
|
|
139
|
+
default:
|
|
140
|
+
if (shader !== null && shader !== void 0 && shader.glsl) {
|
|
141
|
+
return shader.glsl;
|
|
142
|
+
}
|
|
143
|
+
throw new Error('WebGL does not support WGSL shaders');
|
|
144
|
+
}
|
|
138
145
|
}
|
|
146
|
+
//# sourceMappingURL=model.js.map
|