diff --git a/packages/room/src/object/visualization/room/RoomPlane.ts b/packages/room/src/object/visualization/room/RoomPlane.ts index 1b795daf..9aa1b573 100644 --- a/packages/room/src/object/visualization/room/RoomPlane.ts +++ b/packages/room/src/object/visualization/room/RoomPlane.ts @@ -13,6 +13,7 @@ export class RoomPlane implements IRoomPlane public static HORIZONTAL_ANGLE_DEFAULT: number = 45; public static VERTICAL_ANGLE_DEFAULT: number = 30; public static PLANE_GEOMETRY: IRoomGeometry = new RoomGeometry(64, new Vector3d(RoomPlane.HORIZONTAL_ANGLE_DEFAULT, RoomPlane.VERTICAL_ANGLE_DEFAULT), new Vector3d(-10, 0, 0)); + private static LANDSCAPE_COLOR: number = 0x0082F0; public static TYPE_UNDEFINED: number = 0; public static TYPE_WALL: number = 1; @@ -121,12 +122,10 @@ export class RoomPlane implements IRoomPlane this._disposed = true; } - public update(geometry: IRoomGeometry, timeSinceStartMs: number): boolean + public update(geometry: IRoomGeometry, timeSinceStartMs: number, needsUpdate: boolean = false): boolean { if(!geometry || this._disposed) return false; - let needsUpdate = false; - if(this._geometryUpdateId !== geometry.updateId) { this._geometryUpdateId = geometry.updateId; @@ -200,17 +199,6 @@ export class RoomPlane implements IRoomPlane let height = (this._rightSide.length * geometry.scale); const normal = geometry.getCoordinatePosition(this._normal); - const getRandomColor = () => - { - const letters = '0123456789ABCDEF'; - let color = '0x'; - for(let i = 0; i < 6; i++) - { - color += letters[Math.floor(Math.random() * 16)]; - } - return parseInt(color, 16); - }; - const getTextureAndColorForPlane = (planeId: string, planeType: number) => { const dataType: keyof IAssetRoomVisualizationData = (planeType === RoomPlane.TYPE_FLOOR) ? 'floorData' : (planeType === RoomPlane.TYPE_WALL) ? 'wallData' : 'landscapeData'; @@ -321,7 +309,7 @@ export class RoomPlane implements IRoomPlane x: renderOffsetX, y: renderOffsetY }, - tint: getRandomColor() + tint: RoomPlane.LANDSCAPE_COLOR }); break; } diff --git a/packages/room/src/object/visualization/room/RoomVisualization.ts b/packages/room/src/object/visualization/room/RoomVisualization.ts index 87f0780f..883fe5df 100644 --- a/packages/room/src/object/visualization/room/RoomVisualization.ts +++ b/packages/room/src/object/visualization/room/RoomVisualization.ts @@ -141,7 +141,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements if(this.updatePlaneTexturesAndVisibilities(objectModel)) needsUpdate = true; - if(this.updatePlanes(geometry, geometryUpdate, time)) needsUpdate = true; + if(this.updatePlanes(geometry, geometryUpdate, time, needsUpdate)) needsUpdate = true; if(needsUpdate) { @@ -576,7 +576,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements return true; } - protected updatePlanes(geometry: IRoomGeometry, geometryUpdate: boolean, timeSinceStartMs: number): boolean + protected updatePlanes(geometry: IRoomGeometry, geometryUpdate: boolean, timeSinceStartMs: number, needsUpdate: boolean = false): boolean { if(!geometry || !this.object) return false; @@ -614,7 +614,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements { sprite.id = plane.uniqueId; - if(plane.update(geometry, timeSinceStartMs)) + if(plane.update(geometry, timeSinceStartMs, needsUpdate)) { if(plane.visible) { diff --git a/packages/room/src/object/visualization/room/mask/PlaneMaskManager.ts b/packages/room/src/object/visualization/room/mask/PlaneMaskManager.ts index fefbfba2..53f3c71b 100644 --- a/packages/room/src/object/visualization/room/mask/PlaneMaskManager.ts +++ b/packages/room/src/object/visualization/room/mask/PlaneMaskManager.ts @@ -155,7 +155,7 @@ export class PlaneMaskManager if(!texture) return true; - const point = new Point(Math.round(posX) + asset.offsetX, Math.round(posY) + asset.offsetY); + const point = new Point((posX + asset.offsetX), (posY + asset.offsetY)); const matrix = new Matrix();