Skip to content

Commit

Permalink
small
Browse files Browse the repository at this point in the history
  • Loading branch information
slimbuck committed Aug 15, 2024
1 parent e86f604 commit 7560e6d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/splat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,25 +331,27 @@ class Splat extends Element {
const material = this.entity.gsplat.instance.material;
material.setParameter('ringSize', (selected && cameraMode === 'rings' && splatSize > 0) ? 0.04 : 0);

if (this.visible && selected && events.invoke('camera.bound')) {
if (this.visible && selected) {
// render splat centers
if (cameraMode === 'centers' && splatSize > 0) {
this.splatDebug.splatSize = splatSize;
this.scene.app.drawMeshInstance(this.splatDebug.meshInstance);
}

// render bounding box
const bound = this.localBound;
const scale = new Mat4().setTRS(bound.center, Quat.IDENTITY, bound.halfExtents);
scale.mul2(this.entity.getWorldTransform(), scale);

for (let i = 0; i < boundingPoints.length / 2; i++) {
const a = boundingPoints[i * 2];
const b = boundingPoints[i * 2 + 1];
scale.transformPoint(a, veca);
scale.transformPoint(b, vecb);

this.scene.app.drawLine(veca, vecb, Color.WHITE, true, this.scene.debugLayer);
if (events.invoke('camera.bound')) {
const bound = this.localBound;
const scale = new Mat4().setTRS(bound.center, Quat.IDENTITY, bound.halfExtents);
scale.mul2(this.entity.getWorldTransform(), scale);

for (let i = 0; i < boundingPoints.length / 2; i++) {
const a = boundingPoints[i * 2];
const b = boundingPoints[i * 2 + 1];
scale.transformPoint(a, veca);
scale.transformPoint(b, vecb);

this.scene.app.drawLine(veca, vecb, Color.WHITE, true, this.scene.debugLayer);
}
}
}

Expand Down

0 comments on commit 7560e6d

Please sign in to comment.