@luma.gl/engine 8.6.0-alpha.1 → 8.6.0-alpha.5
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 +8 -1
- package/dist/index.d.ts +17 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/animation-loop.d.ts +57 -28
- package/dist/lib/animation-loop.d.ts.map +1 -1
- package/dist/lib/animation-loop.js +71 -62
- package/dist/lib/animation-loop.js.map +1 -1
- package/dist/lib/model.d.ts +18 -4
- package/dist/lib/model.d.ts.map +1 -1
- package/dist/lib/model.js +15 -9
- package/dist/lib/model.js.map +1 -1
- package/dist/lib/program-manager.d.ts +6 -5
- package/dist/lib/program-manager.d.ts.map +1 -1
- package/dist/lib/program-manager.js +8 -9
- package/dist/lib/program-manager.js.map +1 -1
- package/dist/lib/render-loop.d.ts +27 -0
- package/dist/lib/render-loop.d.ts.map +1 -0
- package/dist/lib/render-loop.js +56 -0
- package/dist/lib/render-loop.js.map +1 -0
- package/dist/transform/buffer-transform.d.ts.map +1 -1
- package/dist/transform/buffer-transform.js +2 -3
- package/dist/transform/buffer-transform.js.map +1 -1
- package/dist/transform/texture-transform.d.ts.map +1 -1
- package/dist/transform/texture-transform.js.map +1 -1
- package/dist/transform/transform-types.d.ts +1 -0
- package/dist/transform/transform-types.d.ts.map +1 -1
- package/dist/transform/transform.d.ts +21 -2
- package/dist/transform/transform.d.ts.map +1 -1
- package/dist/transform/transform.js +26 -11
- package/dist/transform/transform.js.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +18 -13
- package/src/lib/animation-loop.ts +141 -125
- package/src/lib/model.ts +44 -15
- package/src/lib/program-manager.ts +12 -13
- package/src/lib/render-loop.ts +56 -0
- package/src/transform/buffer-transform.ts +2 -3
- package/src/transform/texture-transform.ts +2 -3
- package/src/transform/transform-types.ts +1 -0
- package/src/transform/transform.ts +38 -22
package/src/lib/model.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// luma.gl, MIT license
|
|
2
|
+
import {Device} from '@luma.gl/api';
|
|
2
3
|
import GL from '@luma.gl/constants';
|
|
3
|
-
import {
|
|
4
|
-
import {ProgramProps} from '@luma.gl/webgl';
|
|
4
|
+
import type {ProgramProps} from '@luma.gl/webgl';
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
WebGLDevice,
|
|
7
7
|
Program,
|
|
8
8
|
VertexArray,
|
|
9
9
|
clear,
|
|
@@ -31,9 +31,22 @@ const NOOP = () => {};
|
|
|
31
31
|
const DRAW_PARAMS = {};
|
|
32
32
|
|
|
33
33
|
export type ModelProps = ProgramProps & {
|
|
34
|
-
id?: string
|
|
34
|
+
id?: string;
|
|
35
|
+
|
|
36
|
+
// program props
|
|
37
|
+
// vs,
|
|
38
|
+
// fs,
|
|
39
|
+
varyings?: string[];
|
|
40
|
+
bufferMode?;
|
|
41
|
+
|
|
42
|
+
program?: Program;
|
|
43
|
+
modules?: any[];
|
|
44
|
+
defines?: Record<string, number | boolean>;
|
|
45
|
+
inject?: Record<string, any>;
|
|
46
|
+
transpileToGLSL100?: boolean;
|
|
47
|
+
|
|
35
48
|
moduleSettings?: object; // UniformsOptions
|
|
36
|
-
attributes?: object
|
|
49
|
+
attributes?: object;
|
|
37
50
|
uniforms?: object; // Uniforms
|
|
38
51
|
geometry?: object; // Geometry
|
|
39
52
|
vertexCount?: number
|
|
@@ -50,8 +63,12 @@ export type ModelProps = ProgramProps & {
|
|
|
50
63
|
indexType?;
|
|
51
64
|
indexOffset?: number;
|
|
52
65
|
vertexArrayInstanced?: boolean;
|
|
66
|
+
|
|
67
|
+
/** @deprecated Use isInstanced */
|
|
68
|
+
instanced?: boolean
|
|
53
69
|
};
|
|
54
70
|
|
|
71
|
+
|
|
55
72
|
export type ModelDrawOptions = {
|
|
56
73
|
moduleSettings?;
|
|
57
74
|
framebuffer?;
|
|
@@ -102,8 +119,10 @@ interface TransformOpts extends DrawOpts {
|
|
|
102
119
|
*/
|
|
103
120
|
|
|
104
121
|
export default class Model {
|
|
105
|
-
readonly
|
|
122
|
+
readonly device: Device;
|
|
106
123
|
readonly gl: WebGLRenderingContext;
|
|
124
|
+
|
|
125
|
+
readonly id: string;
|
|
107
126
|
readonly animated: boolean = false;
|
|
108
127
|
programManager: ProgramManager;
|
|
109
128
|
vertexCount: number;
|
|
@@ -136,20 +155,24 @@ export default class Model {
|
|
|
136
155
|
// TODO - just to unbreak deck.gl 7.0-beta, remove as soon as updated
|
|
137
156
|
geometry = {};
|
|
138
157
|
|
|
139
|
-
constructor(
|
|
158
|
+
constructor(device: Device, props?: ModelProps);
|
|
159
|
+
/* @deprecated */
|
|
160
|
+
constructor(gl: WebGLRenderingContext, props?: ModelProps);
|
|
161
|
+
constructor(device, props: ModelProps = {}) {
|
|
140
162
|
// Deduce a helpful id
|
|
141
163
|
const {id = uid('model')} = props;
|
|
142
|
-
assert(isWebGL(gl));
|
|
143
164
|
this.id = id;
|
|
144
|
-
|
|
165
|
+
const webglDevice = WebGLDevice.attach(device);
|
|
166
|
+
this.device = webglDevice;
|
|
167
|
+
this.gl = webglDevice.gl;
|
|
145
168
|
this.id = props.id || uid('Model');
|
|
146
169
|
this.initialize(props);
|
|
147
170
|
}
|
|
148
171
|
|
|
149
|
-
initialize(props) {
|
|
172
|
+
initialize(props: ModelProps) {
|
|
150
173
|
this.props = {};
|
|
151
174
|
|
|
152
|
-
this.programManager = props.programManager || ProgramManager.getDefaultProgramManager(this.
|
|
175
|
+
this.programManager = props.programManager || ProgramManager.getDefaultProgramManager(this.device);
|
|
153
176
|
this._programManagerState = -1;
|
|
154
177
|
this._managedProgram = false;
|
|
155
178
|
|
|
@@ -226,7 +249,7 @@ export default class Model {
|
|
|
226
249
|
this._setModelProps(props);
|
|
227
250
|
}
|
|
228
251
|
|
|
229
|
-
|
|
252
|
+
destroy(): void {
|
|
230
253
|
// delete all attributes created by this model
|
|
231
254
|
// TODO - should buffer deletes be handled by vertex array?
|
|
232
255
|
for (const key in this._attributes) {
|
|
@@ -245,6 +268,11 @@ export default class Model {
|
|
|
245
268
|
this._deleteGeometryBuffers();
|
|
246
269
|
}
|
|
247
270
|
|
|
271
|
+
/** @deprecated Use .destroy() */
|
|
272
|
+
delete(): void {
|
|
273
|
+
this.destroy();
|
|
274
|
+
}
|
|
275
|
+
|
|
248
276
|
// GETTERS
|
|
249
277
|
|
|
250
278
|
getDrawMode() {
|
|
@@ -515,7 +543,9 @@ export default class Model {
|
|
|
515
543
|
const {vs, fs, modules, inject, defines, varyings, bufferMode, transpileToGLSL100} =
|
|
516
544
|
this.programProps;
|
|
517
545
|
program = this.programManager.get({
|
|
546
|
+
// @ts-expect-error
|
|
518
547
|
vs,
|
|
548
|
+
// @ts-expect-error
|
|
519
549
|
fs,
|
|
520
550
|
modules,
|
|
521
551
|
inject,
|
|
@@ -542,7 +572,6 @@ export default class Model {
|
|
|
542
572
|
this.program = program;
|
|
543
573
|
|
|
544
574
|
if (this.vertexArray) {
|
|
545
|
-
// @ts-ignore TODO
|
|
546
575
|
this.vertexArray.setProps({program: this.program, attributes: this.vertexArray.attributes});
|
|
547
576
|
} else {
|
|
548
577
|
this.vertexArray = new VertexArray(this.gl, {program: this.program});
|
|
@@ -618,7 +647,7 @@ export default class Model {
|
|
|
618
647
|
const attributeTable = getDebugTableForVertexArray({
|
|
619
648
|
vertexArray,
|
|
620
649
|
header: `${this.id} attributes`,
|
|
621
|
-
// @ts-
|
|
650
|
+
// @ts-expect-error
|
|
622
651
|
attributes: this._attributes
|
|
623
652
|
});
|
|
624
653
|
|
|
@@ -661,6 +690,6 @@ export default class Model {
|
|
|
661
690
|
framebuffer.log({logLevel: LOG_DRAW_PRIORITY, message: `Rendered to ${framebuffer.id}`});
|
|
662
691
|
}
|
|
663
692
|
|
|
664
|
-
log.groupEnd(LOG_DRAW_PRIORITY
|
|
693
|
+
log.groupEnd(LOG_DRAW_PRIORITY)();
|
|
665
694
|
}
|
|
666
695
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {Device} from '@luma.gl/api/';
|
|
1
2
|
import {assembleShaders} from '@luma.gl/shadertools';
|
|
2
3
|
import {Program} from '@luma.gl/webgl';
|
|
3
4
|
|
|
@@ -15,7 +16,7 @@ type GetProgramOptions = {
|
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export default class ProgramManager {
|
|
18
|
-
readonly
|
|
19
|
+
readonly device: Device;
|
|
19
20
|
|
|
20
21
|
stateHash = 0; // Used change hashing if hooks are modified
|
|
21
22
|
private _hashCounter = 0;
|
|
@@ -28,17 +29,15 @@ export default class ProgramManager {
|
|
|
28
29
|
private readonly _hookFunctions = [];
|
|
29
30
|
private _defaultModules = [];
|
|
30
31
|
|
|
31
|
-
static getDefaultProgramManager(
|
|
32
|
+
static getDefaultProgramManager(device: Device): ProgramManager {
|
|
32
33
|
// @ts-expect-error
|
|
33
|
-
|
|
34
|
+
device.defaultProgramManager = device.defaultProgramManager || new ProgramManager(device);
|
|
34
35
|
// @ts-expect-error
|
|
35
|
-
|
|
36
|
-
// @ts-expect-error
|
|
37
|
-
return gl.luma.defaultProgramManager;
|
|
36
|
+
return device.defaultProgramManager;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
constructor(
|
|
41
|
-
this.
|
|
39
|
+
constructor(device: Device) {
|
|
40
|
+
this.device = device;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
addDefaultModule(module: Module): void {
|
|
@@ -56,17 +55,16 @@ export default class ProgramManager {
|
|
|
56
55
|
this.stateHash++;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
addShaderHook(hook, opts) {
|
|
58
|
+
addShaderHook(hook, opts?): void {
|
|
60
59
|
if (opts) {
|
|
61
60
|
hook = Object.assign(opts, {hook});
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
this._hookFunctions.push(hook);
|
|
65
|
-
|
|
66
64
|
this.stateHash++;
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
get(props: GetProgramOptions = {}) {
|
|
67
|
+
get(props: GetProgramOptions = {}): Program {
|
|
70
68
|
const {
|
|
71
69
|
vs = '',
|
|
72
70
|
fs = '',
|
|
@@ -107,7 +105,7 @@ export default class ProgramManager {
|
|
|
107
105
|
}`;
|
|
108
106
|
|
|
109
107
|
if (!this._programCache[hash]) {
|
|
110
|
-
const assembled = assembleShaders(this.
|
|
108
|
+
const assembled = assembleShaders(this.device, {
|
|
111
109
|
vs,
|
|
112
110
|
fs,
|
|
113
111
|
modules,
|
|
@@ -117,7 +115,8 @@ export default class ProgramManager {
|
|
|
117
115
|
transpileToGLSL100
|
|
118
116
|
});
|
|
119
117
|
|
|
120
|
-
|
|
118
|
+
// @ts-expect-error TODO - program should be created from device
|
|
119
|
+
this._programCache[hash] = new Program(this.device.gl, {
|
|
121
120
|
hash,
|
|
122
121
|
vs: assembled.vs,
|
|
123
122
|
fs: assembled.fs,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {Stats} from '@probe.gl/stats';
|
|
2
|
+
import type {AnimationProps} from './animation-loop';
|
|
3
|
+
import AnimationLoop from './animation-loop';
|
|
4
|
+
import {Timeline} from '../animation/timeline'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Minimal animation loop that initializes models in constructor
|
|
8
|
+
* Simplifying type management
|
|
9
|
+
*/
|
|
10
|
+
export abstract class RenderLoop {
|
|
11
|
+
constructor(animationProps?: AnimationProps) {}
|
|
12
|
+
onRender(animationProps: AnimationProps) {}
|
|
13
|
+
onFinalize(animationProps: AnimationProps) {}
|
|
14
|
+
|
|
15
|
+
static getAnimationLoop(RenderLoopConstructor: typeof RenderLoop) {
|
|
16
|
+
return new WrappedAnimationLoop(RenderLoopConstructor);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Instantiates and runs the render loop */
|
|
20
|
+
static run(RenderLoopConstructor: typeof RenderLoop, options?: {start?: boolean}): WrappedAnimationLoop {
|
|
21
|
+
const animationLoop = RenderLoop.getAnimationLoop(RenderLoopConstructor);
|
|
22
|
+
if (options?.start !== false) {
|
|
23
|
+
animationLoop.start();
|
|
24
|
+
}
|
|
25
|
+
return animationLoop;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class WrappedAnimationLoop extends AnimationLoop {
|
|
30
|
+
RenderLoopConstructor: typeof RenderLoop;
|
|
31
|
+
renderLoop: RenderLoop;
|
|
32
|
+
|
|
33
|
+
getInfo() {
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
return this.RenderLoopConstructor.info;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
constructor(RenderLoopConstructor: typeof RenderLoop) {
|
|
39
|
+
super();
|
|
40
|
+
this.RenderLoopConstructor = RenderLoopConstructor;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onInitialize(animationProps: AnimationProps) {
|
|
44
|
+
// @ts-expect-error
|
|
45
|
+
this.renderLoop = new this.RenderLoopConstructor(animationProps);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
onRender(animationProps: AnimationProps) {
|
|
49
|
+
this.renderLoop.onRender(animationProps);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
onFinalize(animationProps: AnimationProps) {
|
|
53
|
+
this.renderLoop?.onFinalize?.(animationProps);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {Buffer, TransformFeedback} from '@luma.gl/webgl';
|
|
3
|
-
import {assert} from '@luma.gl/webgl';
|
|
1
|
+
import {assert} from '@luma.gl/api';
|
|
2
|
+
import {Buffer, TransformFeedback, isWebGL2} from '@luma.gl/webgl';
|
|
4
3
|
import type {TransformProps, TransformDrawOptions, TransformRunOptions, TransformBinding} from './transform-types';
|
|
5
4
|
|
|
6
5
|
// import {TransformDrawOptions, TransformModelProps} from './resource-transform';
|
|
@@ -125,7 +125,7 @@ export default class TextureTransform {
|
|
|
125
125
|
// readPixels returns 4 elements for each pixel, pack the elements when requested
|
|
126
126
|
const ArrayType = pixels.constructor;
|
|
127
127
|
const channelCount = typeToChannelCount(this.targetTextureType);
|
|
128
|
-
// @ts-
|
|
128
|
+
// @ts-expect-error
|
|
129
129
|
const packedPixels = new ArrayType((pixels.length * channelCount) / 4);
|
|
130
130
|
let packCount = 0;
|
|
131
131
|
for (let i = 0; i < pixels.length; i += 4) {
|
|
@@ -148,7 +148,6 @@ export default class TextureTransform {
|
|
|
148
148
|
this.ownTexture.delete();
|
|
149
149
|
}
|
|
150
150
|
if (this.elementIDBuffer) {
|
|
151
|
-
// @ts-ignore
|
|
152
151
|
this.elementIDBuffer.delete();
|
|
153
152
|
}
|
|
154
153
|
}
|
|
@@ -317,7 +316,7 @@ export default class TextureTransform {
|
|
|
317
316
|
// build and return shader releated parameters
|
|
318
317
|
_processVertexShader(props: TransformProps = {}) {
|
|
319
318
|
const {sourceTextures, targetTexture} = this.bindings[this.currentIndex];
|
|
320
|
-
// @ts-
|
|
319
|
+
// @ts-expect-error TODO - uniforms is not present
|
|
321
320
|
const {vs, uniforms, targetTextureType, inject, samplerTextureMap} = updateForTextures({
|
|
322
321
|
vs: props.vs,
|
|
323
322
|
sourceTextureMap: sourceTextures,
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
+
import {Device, assert} from '@luma.gl/api';
|
|
1
2
|
import GL from '@luma.gl/constants';
|
|
2
3
|
import {getShaderInfo, getPassthroughFS} from '@luma.gl/shadertools';
|
|
3
|
-
import {isWebGL2} from '@luma.gl/gltools';
|
|
4
4
|
import type {Framebuffer, Buffer} from '@luma.gl/webgl';
|
|
5
|
-
import {
|
|
5
|
+
import {WebGLDevice, isObjectEmpty} from '@luma.gl/webgl';
|
|
6
6
|
|
|
7
7
|
import Model from '../lib/model';
|
|
8
8
|
import BufferTransform from './buffer-transform';
|
|
9
9
|
import TextureTransform from './texture-transform';
|
|
10
10
|
import {TransformProps, TransformRunOptions, TransformDrawOptions} from './transform-types';
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Takes source and target buffers/textures and sets up the pipeline
|
|
14
|
+
*/
|
|
13
15
|
export default class Transform {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Check if Transforms are supported (they are not under WebGL1)
|
|
18
|
+
* @todo differentiate writing to buffer vs not
|
|
19
|
+
*/
|
|
20
|
+
static isSupported(device: Device | WebGL2RenderingContext): boolean {
|
|
21
|
+
try {
|
|
22
|
+
const webglDevice = WebGLDevice.attach(device);
|
|
23
|
+
return webglDevice.isWebGL2;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
17
27
|
}
|
|
18
28
|
|
|
29
|
+
readonly device: WebGLDevice;
|
|
19
30
|
readonly gl: WebGL2RenderingContext;
|
|
20
31
|
model: Model | null = null;
|
|
21
32
|
elementCount = 0;
|
|
@@ -23,14 +34,16 @@ export default class Transform {
|
|
|
23
34
|
textureTransform = null;
|
|
24
35
|
elementIDBuffer = null;
|
|
25
36
|
|
|
26
|
-
constructor(
|
|
27
|
-
this.
|
|
37
|
+
constructor(device: Device | WebGL2RenderingContext, props: TransformProps = {}) {
|
|
38
|
+
this.device = WebGLDevice.attach(device);
|
|
39
|
+
// TODO assert webgl2?
|
|
40
|
+
this.gl = this.device.gl2;
|
|
28
41
|
this._initialize(props);
|
|
29
42
|
Object.seal(this);
|
|
30
43
|
}
|
|
31
44
|
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
/** Delete owned resources. */
|
|
46
|
+
destroy(): void {
|
|
34
47
|
const {model, bufferTransform, textureTransform} = this;
|
|
35
48
|
if (model) {
|
|
36
49
|
model.delete();
|
|
@@ -43,7 +56,12 @@ export default class Transform {
|
|
|
43
56
|
}
|
|
44
57
|
}
|
|
45
58
|
|
|
46
|
-
|
|
59
|
+
/** @deprecated Use destroy*() */
|
|
60
|
+
delete(): void {
|
|
61
|
+
this.destroy();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Run one transform loop. */
|
|
47
65
|
run(options?: TransformRunOptions): void {
|
|
48
66
|
const {clearRenderTarget = true} = options || {};
|
|
49
67
|
|
|
@@ -56,7 +74,7 @@ export default class Transform {
|
|
|
56
74
|
this.model.transform(updatedOpts);
|
|
57
75
|
}
|
|
58
76
|
|
|
59
|
-
|
|
77
|
+
/** swap resources if a map is provided */
|
|
60
78
|
swap(): void {
|
|
61
79
|
let swapped = false;
|
|
62
80
|
const resourceTransforms = [this.bufferTransform, this.textureTransform].filter(Boolean);
|
|
@@ -66,16 +84,15 @@ export default class Transform {
|
|
|
66
84
|
assert(swapped, 'Nothing to swap');
|
|
67
85
|
}
|
|
68
86
|
|
|
69
|
-
|
|
87
|
+
/** Return Buffer object for given varying name. */
|
|
70
88
|
getBuffer(varyingName: string = null): Buffer {
|
|
71
89
|
return this.bufferTransform && this.bufferTransform.getBuffer(varyingName);
|
|
72
90
|
}
|
|
73
91
|
|
|
74
|
-
|
|
92
|
+
/** Return data either from Buffer or from Texture */
|
|
75
93
|
getData(options: {packed?: boolean; varyingName?: string} = {}) {
|
|
76
94
|
const resourceTransforms = [this.bufferTransform, this.textureTransform].filter(Boolean);
|
|
77
95
|
for (const resourceTransform of resourceTransforms) {
|
|
78
|
-
// @ts-ignore
|
|
79
96
|
const data = resourceTransform.getData(options);
|
|
80
97
|
if (data) {
|
|
81
98
|
return data;
|
|
@@ -84,15 +101,14 @@ export default class Transform {
|
|
|
84
101
|
return null;
|
|
85
102
|
}
|
|
86
103
|
|
|
87
|
-
|
|
104
|
+
/** Return framebuffer object if rendering to textures */
|
|
88
105
|
getFramebuffer(): Framebuffer | null {
|
|
89
106
|
return this.textureTransform && this.textureTransform.getFramebuffer();
|
|
90
107
|
}
|
|
91
108
|
|
|
92
|
-
|
|
109
|
+
/** Update some or all buffer/texture bindings. */
|
|
93
110
|
update(props: TransformProps): void {
|
|
94
111
|
if ('elementCount' in props) {
|
|
95
|
-
// @ts-ignore TODO
|
|
96
112
|
this.model.setVertexCount(props.elementCount);
|
|
97
113
|
}
|
|
98
114
|
const resourceTransforms = [this.bufferTransform, this.textureTransform].filter(Boolean);
|
|
@@ -109,7 +125,7 @@ export default class Transform {
|
|
|
109
125
|
|
|
110
126
|
props = this._updateModelProps(props);
|
|
111
127
|
this.model = new Model(
|
|
112
|
-
|
|
128
|
+
this.device,
|
|
113
129
|
Object.assign({}, props, {
|
|
114
130
|
fs: props.fs || getPassthroughFS({version: getShaderInfo(props.vs).version}),
|
|
115
131
|
id: props.id || 'transform-model',
|
|
@@ -118,9 +134,9 @@ export default class Transform {
|
|
|
118
134
|
})
|
|
119
135
|
);
|
|
120
136
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
137
|
+
if (this.bufferTransform) {
|
|
138
|
+
this.bufferTransform.setupResources({model: this.model});
|
|
139
|
+
}
|
|
124
140
|
}
|
|
125
141
|
|
|
126
142
|
_updateModelProps(props: TransformProps): TransformProps {
|