mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-23 08:00:51 +01:00
More plane updates
This commit is contained in:
parent
2ef9d01fa4
commit
fe20138abf
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user