chore: rename visibleBoundingBoxes to visibleAabbs
This commit is contained in:
parent
07869e2be9
commit
548e206bc9
|
@ -139,7 +139,7 @@ export class EntityList extends decorate(class {}) {
|
|||
const node = nodes[i];
|
||||
const entity = node.data[2];
|
||||
// Make sure they're actually in the query due to expanded AABB.
|
||||
if (!Rectangle.intersects(query, entity.visibleBoundingBox)) {
|
||||
if (!Rectangle.intersects(query, entity.visibleAabb)) {
|
||||
continue;
|
||||
}
|
||||
entities.push(entity);
|
||||
|
|
|
@ -34,7 +34,7 @@ export class Listed extends Trait {
|
|||
if (!this.entity.is('visible')) {
|
||||
return;
|
||||
}
|
||||
const aabb = this.entity.visibleBoundingBox;
|
||||
const aabb = this.entity.visibleAabb;
|
||||
if (Rectangle.isNull(aabb)) {
|
||||
return;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ export class Listed extends Trait {
|
|||
if (!this.quadTreeAabb) {
|
||||
return true;
|
||||
}
|
||||
const aabb = this.entity.visibleBoundingBox;
|
||||
const aabb = this.entity.visibleAabb;
|
||||
return !Rectangle.isInside(this.quadTreeAabb, aabb);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ export class Listed extends Trait {
|
|||
listeners() {
|
||||
return {
|
||||
|
||||
visibleBoundingBoxChanged: () => {
|
||||
visibleAabbChanged: () => {
|
||||
this.resetQuadTreeNodes();
|
||||
},
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ export class Pictured extends decorate(Trait) {
|
|||
hooks() {
|
||||
return {
|
||||
|
||||
visibleBoundingBoxes: () => {
|
||||
visibleAabbs: () => {
|
||||
const key = this.entity.currentImage;
|
||||
const image = this._images[key];
|
||||
if (!image) {
|
||||
|
|
|
@ -13,7 +13,7 @@ const decorate = compose(
|
|||
StateProperty('isVisible', {
|
||||
track: true,
|
||||
}),
|
||||
Property('visibleBoundingBox', {
|
||||
Property('visibleAabb', {
|
||||
default: [0, 0, 0, 0],
|
||||
emit: function (...args) {
|
||||
this.entity.emit(...args);
|
||||
|
@ -190,22 +190,22 @@ export class Visible extends decorate(Trait) {
|
|||
if (AVOCADO_SERVER) {
|
||||
if (this.scheduledBoundingBoxUpdate) {
|
||||
// Collect all bounding boxes.
|
||||
const visibleBoundingBoxes = this.entity.invokeHookFlat(
|
||||
'visibleBoundingBoxes'
|
||||
const visibleAabbs = this.entity.invokeHookFlat(
|
||||
'visibleAabbs'
|
||||
);
|
||||
if (0 === visibleBoundingBoxes.length) {
|
||||
this.visibleBoundingBox = [0, 0, 0, 0];
|
||||
if (0 === visibleAabbs.length) {
|
||||
this.visibleAabb = [0, 0, 0, 0];
|
||||
}
|
||||
else {
|
||||
let unifiedBoundingBox = [0, 0, 0, 0];
|
||||
for (let i = 0; i < visibleBoundingBoxes.length; ++i) {
|
||||
const visibleBoundingBox = visibleBoundingBoxes[i];
|
||||
for (let i = 0; i < visibleAabbs.length; ++i) {
|
||||
const visibleAabb = visibleAabbs[i];
|
||||
unifiedBoundingBox = Rectangle.united(
|
||||
unifiedBoundingBox,
|
||||
visibleBoundingBox,
|
||||
visibleAabb,
|
||||
);
|
||||
}
|
||||
this.visibleBoundingBox = unifiedBoundingBox;
|
||||
this.visibleAabb = unifiedBoundingBox;
|
||||
this.scheduledBoundingBoxUpdate = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ class AnimatedBase extends Trait {
|
|||
hooks() {
|
||||
return {
|
||||
|
||||
visibleBoundingBoxes: () => {
|
||||
visibleAabbs: () => {
|
||||
const key = this._currentAnimation;
|
||||
const animation = this.animations[key];
|
||||
if (!animation) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user