chore: comments and small opt
This commit is contained in:
parent
218a1c3d3d
commit
a3189bbef2
|
@ -34,18 +34,19 @@ export class Informed extends decorate(Trait) {
|
|||
// Reduce entity list to visible.
|
||||
const room = this.entity.room;
|
||||
const camera = this.entity.camera;
|
||||
// Blow up camera rectangle to compensate for camera desync.
|
||||
const position = Rectangle.position(camera.rectangle);
|
||||
const size = Rectangle.size(camera.rectangle);
|
||||
const visibleArea = Rectangle.compose(
|
||||
Vector.sub(
|
||||
position,
|
||||
Vector.scale(size, 0.25),
|
||||
),
|
||||
Vector.scale(size, 1.5),
|
||||
);
|
||||
// Write over entity list for every layer.
|
||||
for (const {index, layer} of room.layers) {
|
||||
const position = Rectangle.position(camera.rectangle);
|
||||
const size = Rectangle.size(camera.rectangle);
|
||||
const visibleEntities = layer.visibleEntities(
|
||||
Rectangle.compose(
|
||||
Vector.sub(
|
||||
position,
|
||||
Vector.scale(size, 0.25),
|
||||
),
|
||||
Vector.scale(size, 1.5),
|
||||
)
|
||||
);
|
||||
const visibleEntities = layer.visibleEntities(visibleArea);
|
||||
let reducedEntityList = I.Map();
|
||||
for (const entity of visibleEntities) {
|
||||
reducedEntityList = reducedEntityList.set(
|
||||
|
|
Loading…
Reference in New Issue
Block a user