Skip to content

Commit

Permalink
chore(engine): Restore tests for Model class (#1973)
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Feb 27, 2024
1 parent 380d1a0 commit 1bd3342
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 303 deletions.
6 changes: 5 additions & 1 deletion modules/engine/src/model/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ export class Model {
private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;
private props: Required<ModelProps>;

private _destroyed = false;

constructor(device: Device, props: ModelProps) {
this.props = {...Model.defaultProps, ...props};
props = this.props;
Expand Down Expand Up @@ -285,10 +287,12 @@ export class Model {
}

destroy(): void {
if (this._destroyed) return;
this.pipelineFactory.release(this.pipeline);
this.shaderFactory.release(this.pipeline.vs);
this.shaderFactory.release(this.pipeline.fs);
this._uniformStore.destroy();
this._destroyed = true;
}

// Draw call
Expand Down Expand Up @@ -386,7 +390,7 @@ export class Model {

/**
* Updates the buffer layout.
* @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU
* @note Triggers a pipeline rebuild / pipeline cache fetch
*/
setBufferLayout(bufferLayout: BufferLayout[]): void {
this.bufferLayout = this._gpuGeometry
Expand Down
2 changes: 1 addition & 1 deletion modules/engine/test/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// import './lib/model.spec';
import './lib/model.spec';
import './lib/animation-loop.spec';
import './lib/pipeline-factory.spec';
import './lib/shader-factory.spec';
Expand Down
Loading

0 comments on commit 1bd3342

Please sign in to comment.