Skip to content

Commit

Permalink
fix: add execute process timing
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuki Shimada committed May 22, 2024
1 parent 91f5d42 commit 6944e2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/foundation/geometry/Primitive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ export class Primitive extends RnObject {
return this.__primitives[primitiveUid];
}

static getPrimitiveCount() {
return this.__primitiveCount;
}

onAccessorUpdated(accessorVersion: number) {
this.__positionAccessorVersion = accessorVersion;
if (this.__mesh != null) {
Expand Down
7 changes: 5 additions & 2 deletions src/foundation/system/System.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { AnimationComponent } from '../components/Animation/AnimationComponent';
import { CameraControllerComponent } from '../components/CameraController/CameraControllerComponent';
import { MeshRendererComponent } from '../components/MeshRenderer/MeshRendererComponent';
import { TransformComponent } from '../components/Transform/TransformComponent';
import { Primitive } from '../geometry/Primitive';
declare const spector: any;

/**
Expand Down Expand Up @@ -85,6 +86,7 @@ export class System {

private static __lastCameraControllerComponentsUpdateCount = -1;
private static __lastTransformComponentsUpdateCount = -1;
private static __lastPrimitiveCount = -1;

private constructor() {}

Expand Down Expand Up @@ -355,7 +357,8 @@ export class System {
AnimationComponent.isAnimating ||
TransformComponent.updateCount !== this.__lastTransformComponentsUpdateCount ||
CameraControllerComponent.updateCount !==
this.__lastCameraControllerComponentsUpdateCount
this.__lastCameraControllerComponentsUpdateCount ||
Primitive.getPrimitiveCount() !== this.__lastPrimitiveCount
) {
for (const componentTid of componentTids) {
const componentClass: typeof Component =
Expand All @@ -373,12 +376,12 @@ export class System {

componentClass.process(componentClass, stage);
}

}
}
}
this.__lastCameraControllerComponentsUpdateCount = CameraControllerComponent.updateCount;
this.__lastTransformComponentsUpdateCount = TransformComponent.updateCount;
this.__lastPrimitiveCount = Primitive.getPrimitiveCount();
}

Time._processEnd();
Expand Down

0 comments on commit 6944e2f

Please sign in to comment.