Skip to content

Commit

Permalink
fix(graphic3d): fix graphic clear & destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
lslzl3000 committed Nov 21, 2024
1 parent 8b685b9 commit eff6082
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/graphic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orillusion/graphic",
"version": "0.2.3",
"version": "0.2.4",
"author": "Orillusion",
"description": "Orillusion Graphic Plugin",
"main": "./dist/graphic.umd.js",
Expand Down
11 changes: 11 additions & 0 deletions packages/graphic/renderer/Graphic3DBatchRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ export class Graphic3DBatchRenderer extends RenderNode {
}
}

public clear(){
this.shapes.clear();
this.mDirtyData = true;
}

public nodeUpdate(view: View3D, passType: PassType, renderPassState: RendererPassState, clusterLightingBuffer?: ClusterLightingBuffer) {
if(this.isDestroyed)
return
if (this.mDirtyData) {
let offset = 0;
let posAttrData = this.geometry.getAttribute(VertexAttributeName.position);
Expand Down Expand Up @@ -139,4 +146,8 @@ export class Graphic3DBatchRenderer extends RenderNode {
this.mDirtyData = true;
return shape;
}

public destroy(force?: boolean): void {
super.destroy(force);
}
}
4 changes: 2 additions & 2 deletions packages/graphic/renderer/Graphic3DRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ export class Graphic3D extends Object3D {
* Erase all drawn graphics
*/
public ClearAll() {
this.mLineRender.shapes.clear();
this.mFillRender.shapes.clear();
this.mLineRender.clear();
this.mFillRender.clear();
}

/**
Expand Down

0 comments on commit eff6082

Please sign in to comment.