mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-27 01:40:52 +01:00
Rename variables
This commit is contained in:
parent
a1eb711f6a
commit
296ecf4722
@ -1,6 +1,7 @@
|
||||
import { RenderTexture, Resource, Texture } from '@pixi/core';
|
||||
import { Graphics } from '@pixi/graphics';
|
||||
import { Matrix, Point, Rectangle } from '@pixi/math';
|
||||
import { NitroRenderTexture } from '../../../../../core';
|
||||
import { IRoomPlane } from '../../../../../room/object/visualization/IRoomPlane';
|
||||
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
|
||||
import { IVector3D } from '../../../../../room/utils/IVector3D';
|
||||
@ -36,6 +37,7 @@ export class RoomPlane implements IRoomPlane
|
||||
private _geometryUpdateId: number;
|
||||
private _type: number;
|
||||
private _isVisible: boolean;
|
||||
private _bitmapTexture: NitroRenderTexture;
|
||||
private _bitmapData: Graphics;
|
||||
private _hasTexture: boolean;
|
||||
private _offset: Point;
|
||||
|
@ -9,30 +9,30 @@ export class FloorPlane extends Plane
|
||||
public static HORIZONTAL_ANGLE_DEFAULT: number = 45;
|
||||
public static VERTICAL_ANGLE_DEFAULT: number = 30;
|
||||
|
||||
public render(k: Graphics, _arg_2: number, _arg_3: number, size: number, _arg_5: IVector3D, _arg_6: boolean, _arg_7: number, _arg_8: number): Graphics
|
||||
public render(canvas: Graphics, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number, offsetY: number): Graphics
|
||||
{
|
||||
const visualization = this.getPlaneVisualization(size);
|
||||
const visualization = this.getPlaneVisualization(scale);
|
||||
|
||||
if(!visualization || !visualization.geometry) return null;
|
||||
|
||||
const _local_10 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 0));
|
||||
const _local_11 = visualization.geometry.getScreenPoint(new Vector3d(0, (_arg_3 / visualization.geometry.scale), 0));
|
||||
const _local_12 = visualization.geometry.getScreenPoint(new Vector3d((_arg_2 / visualization.geometry.scale), 0, 0));
|
||||
const _local_11 = visualization.geometry.getScreenPoint(new Vector3d(0, (height / visualization.geometry.scale), 0));
|
||||
const _local_12 = visualization.geometry.getScreenPoint(new Vector3d((width / visualization.geometry.scale), 0, 0));
|
||||
|
||||
let _local_13 = 0;
|
||||
let _local_14 = 0;
|
||||
|
||||
if(_local_10 && _local_11 && _local_12)
|
||||
{
|
||||
_arg_2 = Math.round(Math.abs((_local_10.x - _local_12.x)));
|
||||
_arg_3 = Math.round(Math.abs((_local_10.x - _local_11.x)));
|
||||
width = Math.round(Math.abs((_local_10.x - _local_12.x)));
|
||||
height = Math.round(Math.abs((_local_10.x - _local_11.x)));
|
||||
|
||||
const _local_15 = (_local_10.x - visualization.geometry.getScreenPoint(new Vector3d(1, 0, 0)).x);
|
||||
|
||||
_local_13 = (_arg_7 * Math.trunc(Math.abs(_local_15)));
|
||||
_local_14 = (_arg_8 * Math.trunc(Math.abs(_local_15)));
|
||||
_local_13 = (offsetX * Math.trunc(Math.abs(_local_15)));
|
||||
_local_14 = (offsetY * Math.trunc(Math.abs(_local_15)));
|
||||
}
|
||||
|
||||
return visualization.render(k, _arg_2, _arg_3, _arg_5, _arg_6, _local_13, _local_14);
|
||||
return visualization.render(canvas, width, height, normal, useTexture, _local_13, _local_14);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export class Plane
|
||||
this._lastSize = -1;
|
||||
}
|
||||
|
||||
public isStatic(k: number): boolean
|
||||
public isStatic(size: number): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -47,49 +47,49 @@ export class Plane
|
||||
}
|
||||
}
|
||||
|
||||
public createPlaneVisualization(k: number, _arg_2: number, _arg_3: IRoomGeometry): PlaneVisualization
|
||||
public createPlaneVisualization(size: number, totalLayers: number, geometry: IRoomGeometry): PlaneVisualization
|
||||
{
|
||||
const existing = this._planeVisualizations.get(k.toString());
|
||||
const existing = this._planeVisualizations.get(size.toString());
|
||||
|
||||
if(existing) return null;
|
||||
|
||||
const plane = new PlaneVisualization(k, _arg_2, _arg_3);
|
||||
const plane = new PlaneVisualization(size, totalLayers, geometry);
|
||||
|
||||
this._planeVisualizations.set(k.toString(), plane);
|
||||
this._planeVisualizations.set(size.toString(), plane);
|
||||
|
||||
this._sizes.push(k);
|
||||
this._sizes.push(size);
|
||||
this._sizes.sort();
|
||||
|
||||
return plane;
|
||||
}
|
||||
|
||||
private getSizeIndex(k: number): number
|
||||
private getSizeIndex(size: number): number
|
||||
{
|
||||
let size = 0;
|
||||
let index = 1;
|
||||
let sizeIndex = 0;
|
||||
let i = 1;
|
||||
|
||||
while(index < this._sizes.length)
|
||||
while(i < this._sizes.length)
|
||||
{
|
||||
if(this._sizes[index] > k)
|
||||
if(this._sizes[i] > size)
|
||||
{
|
||||
if((this._sizes[index] - k) < (k - this._sizes[(index - 1)])) size = index;
|
||||
if((this._sizes[i] - size) < (size - this._sizes[(i - 1)])) sizeIndex = i;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
size = index;
|
||||
sizeIndex = i;
|
||||
|
||||
index++;
|
||||
i++;
|
||||
}
|
||||
|
||||
return size;
|
||||
return sizeIndex;
|
||||
}
|
||||
|
||||
protected getPlaneVisualization(k: number): PlaneVisualization
|
||||
protected getPlaneVisualization(size: number): PlaneVisualization
|
||||
{
|
||||
if(k === this._lastSize) return this._lastPlaneVisualization;
|
||||
if(size === this._lastSize) return this._lastPlaneVisualization;
|
||||
|
||||
const sizeIndex = this.getSizeIndex(k);
|
||||
const sizeIndex = this.getSizeIndex(size);
|
||||
|
||||
if(sizeIndex < this._sizes.length)
|
||||
{
|
||||
@ -100,7 +100,7 @@ export class Plane
|
||||
this._lastPlaneVisualization = null;
|
||||
}
|
||||
|
||||
this._lastSize = k;
|
||||
this._lastSize = size;
|
||||
|
||||
return this._lastPlaneVisualization;
|
||||
}
|
||||
|
@ -50,18 +50,18 @@ export class PlaneMaterial
|
||||
this._isCached = false;
|
||||
}
|
||||
|
||||
public addMaterialCellMatrix(k: number, _arg_2: number, _arg_3: number, _arg_4: number = -1, _arg_5: number = 1, _arg_6: number = -1, _arg_7: number = 1): PlaneMaterialCellMatrix
|
||||
public addMaterialCellMatrix(totalColumns: number, repeatMode: number, align: number, normalMinX: number = -1, normalMaxX: number = 1, normalMinY: number = -1, normalMaxY: number = 1): PlaneMaterialCellMatrix
|
||||
{
|
||||
const cellMatrix = new PlaneMaterialCellMatrix(k, _arg_2, _arg_3, _arg_4, _arg_5, _arg_6, _arg_7);
|
||||
const cellMatrix = new PlaneMaterialCellMatrix(totalColumns, repeatMode, align, normalMinX, normalMaxX, normalMinY, normalMaxY);
|
||||
|
||||
this._planeMaterialItems.push(cellMatrix);
|
||||
|
||||
return cellMatrix;
|
||||
}
|
||||
|
||||
public getMaterialCellMatrix(k: IVector3D): PlaneMaterialCellMatrix
|
||||
public getMaterialCellMatrix(normal: IVector3D): PlaneMaterialCellMatrix
|
||||
{
|
||||
if(!k) return null;
|
||||
if(!normal) return null;
|
||||
|
||||
if(this._planeMaterialItems && this._planeMaterialItems.length)
|
||||
{
|
||||
@ -69,25 +69,25 @@ export class PlaneMaterial
|
||||
{
|
||||
if(!item) continue;
|
||||
|
||||
if((((k.x >= item.normalMinX) && (k.x <= item.normalMaxX)) && (k.y >= item.normalMinY)) && (k.y <= item.normalMaxY)) return item;
|
||||
if((((normal.x >= item.normalMinX) && (normal.x <= item.normalMaxX)) && (normal.y >= item.normalMinY)) && (normal.y <= item.normalMaxY)) return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public render(k: Graphics, _arg_2: number, _arg_3: number, _arg_4: IVector3D, _arg_5: boolean, _arg_6: number, _arg_7: number, _arg_8: boolean): Graphics
|
||||
public render(canvas: Graphics, width: number, height: number, normal: IVector3D, useTexture: boolean, offsetX: number, offsetY: number, topAlign: boolean): Graphics
|
||||
{
|
||||
if(_arg_2 < 1) _arg_2 = 1;
|
||||
if(width < 1) width = 1;
|
||||
|
||||
if(_arg_3 < 1) _arg_3 = 1;
|
||||
if(height < 1) height = 1;
|
||||
|
||||
const cellMatrix = this.getMaterialCellMatrix(_arg_4);
|
||||
const cellMatrix = this.getMaterialCellMatrix(normal);
|
||||
|
||||
if(!cellMatrix) return null;
|
||||
|
||||
this._isCached = true;
|
||||
|
||||
return cellMatrix.render(k, _arg_2, _arg_3, _arg_4, _arg_5, _arg_6, _arg_7, _arg_8);
|
||||
return cellMatrix.render(canvas, width, height, normal, useTexture, offsetX, offsetY, topAlign);
|
||||
}
|
||||
}
|
||||
|
@ -15,21 +15,21 @@ export class PlaneMaterialCell
|
||||
private _extraItemAssets: IGraphicAsset[];
|
||||
private _extraItemCount: number = 0;
|
||||
|
||||
constructor(k: PlaneTexture, _arg_2: IGraphicAsset[] = null, _arg_3: Point[] = null, _arg_4: number = 0)
|
||||
constructor(texture: PlaneTexture, assets: IGraphicAsset[] = null, offsetPoints: Point[] = null, limit: number = 0)
|
||||
{
|
||||
this._cachedBitmapData = null;
|
||||
this._texture = k;
|
||||
this._texture = texture;
|
||||
this._extraItemOffsets = [];
|
||||
this._extraItemAssets = [];
|
||||
this._extraItemCount = 0;
|
||||
|
||||
if(_arg_2 && _arg_2.length && (_arg_4 > 0))
|
||||
if(assets && assets.length && (limit > 0))
|
||||
{
|
||||
let assetIndex = 0;
|
||||
|
||||
while(assetIndex < _arg_2.length)
|
||||
while(assetIndex < assets.length)
|
||||
{
|
||||
const graphic = _arg_2[assetIndex];
|
||||
const graphic = assets[assetIndex];
|
||||
|
||||
if(graphic) this._extraItemAssets.push(graphic);
|
||||
|
||||
@ -38,13 +38,13 @@ export class PlaneMaterialCell
|
||||
|
||||
if(this._extraItemAssets.length)
|
||||
{
|
||||
if(_arg_3)
|
||||
if(offsetPoints)
|
||||
{
|
||||
let pointIndex = 0;
|
||||
|
||||
while(pointIndex < _arg_3.length)
|
||||
while(pointIndex < offsetPoints.length)
|
||||
{
|
||||
const point = _arg_3[pointIndex];
|
||||
const point = offsetPoints[pointIndex];
|
||||
|
||||
if(point) this._extraItemOffsets.push(new Point(point.x, point.y));
|
||||
|
||||
@ -52,7 +52,7 @@ export class PlaneMaterialCell
|
||||
}
|
||||
}
|
||||
|
||||
this._extraItemCount = _arg_4;
|
||||
this._extraItemCount = limit;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -93,11 +93,11 @@ export class PlaneMaterialCell
|
||||
}
|
||||
}
|
||||
|
||||
public getHeight(k: IVector3D): number
|
||||
public getHeight(normal: IVector3D): number
|
||||
{
|
||||
if(this._texture)
|
||||
{
|
||||
const texture = this._texture.getBitmap(k);
|
||||
const texture = this._texture.getBitmap(normal);
|
||||
|
||||
if(texture) return texture.height;
|
||||
}
|
||||
@ -239,8 +239,8 @@ export class PlaneMaterialCell
|
||||
return null;
|
||||
}
|
||||
|
||||
public getAssetName(k:IVector3D): string
|
||||
public getAssetName(normal:IVector3D): string
|
||||
{
|
||||
return (this._texture == null) ? null : this._texture.getAssetName(k);
|
||||
return (this._texture == null) ? null : this._texture.getAssetName(normal);
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ export class PlaneMaterialCellColumn
|
||||
private _isCached: boolean;
|
||||
private _isStatic: boolean;
|
||||
|
||||
constructor(k: number, _arg_2: PlaneMaterialCell[], _arg_3: number = 1)
|
||||
constructor(width: number, cells: PlaneMaterialCell[], repeatMode: number = 1)
|
||||
{
|
||||
this._cells = [];
|
||||
this._repeatMode = _arg_3;
|
||||
this._width = (k < 1) ? 1 : k;
|
||||
this._repeatMode = repeatMode;
|
||||
this._width = (width < 1) ? 1 : width;
|
||||
this._cachedBitmapData = null;
|
||||
this._cachedBitmapNormal = null;
|
||||
this._cachedBitmapDataOffsetX = 0;
|
||||
@ -34,13 +34,13 @@ export class PlaneMaterialCellColumn
|
||||
this._isCached = false;
|
||||
this._isStatic = true;
|
||||
|
||||
if(_arg_2 && _arg_2.length)
|
||||
if(cells && cells.length)
|
||||
{
|
||||
let cellIndex = 0;
|
||||
|
||||
while(cellIndex < _arg_2.length)
|
||||
while(cellIndex < cells.length)
|
||||
{
|
||||
const cell = _arg_2[cellIndex];
|
||||
const cell = cells[cellIndex];
|
||||
|
||||
if(cell)
|
||||
{
|
||||
@ -215,18 +215,18 @@ export class PlaneMaterialCellColumn
|
||||
return this._cachedBitmapData;
|
||||
}
|
||||
|
||||
private getCellsHeight(k: PlaneMaterialCell[], _arg_2: IVector3D): number
|
||||
private getCellsHeight(cells: PlaneMaterialCell[], normal: IVector3D): number
|
||||
{
|
||||
if(!k || !k.length) return 0;
|
||||
if(!cells || !cells.length) return 0;
|
||||
|
||||
let height = 0;
|
||||
let cellIterator = 0;
|
||||
|
||||
while(cellIterator < k.length)
|
||||
while(cellIterator < cells.length)
|
||||
{
|
||||
const cell = k[cellIterator];
|
||||
const cell = cells[cellIterator];
|
||||
|
||||
if(cell) height += cell.getHeight(_arg_2);
|
||||
if(cell) height += cell.getHeight(normal);
|
||||
|
||||
cellIterator++;
|
||||
}
|
||||
@ -234,57 +234,57 @@ export class PlaneMaterialCellColumn
|
||||
return height;
|
||||
}
|
||||
|
||||
private renderCells(k: PlaneMaterialCell[], _arg_2: number, _arg_3: boolean, _arg_4: IVector3D, _arg_5: number = 0, _arg_6: number = 0): number
|
||||
private renderCells(cells: PlaneMaterialCell[], index: number, flag: boolean, normal: IVector3D, offsetX: number = 0, offsetY: number = 0): number
|
||||
{
|
||||
if(((!k || !k.length) || !this._cachedBitmapData)) return _arg_2;
|
||||
if(((!cells || !cells.length) || !this._cachedBitmapData)) return index;
|
||||
|
||||
let cellIndex = 0;
|
||||
|
||||
while(cellIndex < k.length)
|
||||
while(cellIndex < cells.length)
|
||||
{
|
||||
let cell: PlaneMaterialCell = null;
|
||||
|
||||
if(_arg_3)
|
||||
if(flag)
|
||||
{
|
||||
cell = k[cellIndex];
|
||||
cell = cells[cellIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
cell = k[((k.length - 1) - cellIndex)];
|
||||
cell = cells[((cells.length - 1) - cellIndex)];
|
||||
}
|
||||
|
||||
if(cell)
|
||||
{
|
||||
const graphic = cell.render(_arg_4, _arg_5, _arg_6);
|
||||
const graphic = cell.render(normal, offsetX, offsetY);
|
||||
|
||||
if(graphic)
|
||||
{
|
||||
if(!_arg_3) _arg_2 -= graphic.height;
|
||||
if(!flag) index -= graphic.height;
|
||||
|
||||
graphic.y = _arg_2;
|
||||
graphic.y = index;
|
||||
|
||||
this._cachedBitmapData.addChild(graphic);
|
||||
|
||||
if(_arg_3) _arg_2 = (_arg_2 + graphic.height);
|
||||
if(flag) index = (index + graphic.height);
|
||||
|
||||
if(((_arg_3) && (_arg_2 >= this._cachedBitmapData.height)) || ((!(_arg_3)) && (_arg_2 <= 0))) return _arg_2;
|
||||
if(((flag) && (index >= this._cachedBitmapData.height)) || ((!(flag)) && (index <= 0))) return index;
|
||||
}
|
||||
}
|
||||
|
||||
cellIndex++;
|
||||
}
|
||||
|
||||
return _arg_2;
|
||||
return index;
|
||||
}
|
||||
|
||||
private renderRepeatNone(k: IVector3D): void
|
||||
private renderRepeatNone(normal: IVector3D): void
|
||||
{
|
||||
if(!this._cells.length || !this._cachedBitmapData) return;
|
||||
|
||||
this.renderCells(this._cells, 0, true, k);
|
||||
this.renderCells(this._cells, 0, true, normal);
|
||||
}
|
||||
|
||||
private renderRepeatAll(k: IVector3D, _arg_2: number, _arg_3: number): void
|
||||
private renderRepeatAll(normal: IVector3D, offsetX: number, offsetY: number): void
|
||||
{
|
||||
if(!this._cells.length || !this._cachedBitmapData) return;
|
||||
|
||||
@ -292,7 +292,7 @@ export class PlaneMaterialCellColumn
|
||||
|
||||
while(index < this._cachedBitmapData.height)
|
||||
{
|
||||
index = this.renderCells(this._cells, index, true, k, _arg_2, _arg_3);
|
||||
index = this.renderCells(this._cells, index, true, normal, offsetX, offsetY);
|
||||
|
||||
if(!index) return;
|
||||
}
|
||||
|
@ -36,34 +36,34 @@ export class PlaneMaterialCellMatrix
|
||||
private _normalMinY: number = -1;
|
||||
private _normalMaxY: number = 1;
|
||||
|
||||
constructor(k: number, _arg_2: number=1, _arg_3: number=1, _arg_4: number=-1, _arg_5: number=1, _arg_6: number=-1, _arg_7: number=1)
|
||||
constructor(totalColumns: number, repeatMode: number=1, align: number=1, normalMinX: number=-1, normalMaxX: number=1, normalMinY: number=-1, normalMaxY: number=1)
|
||||
{
|
||||
this._columns = [];
|
||||
if(k < 1)
|
||||
if(totalColumns < 1)
|
||||
{
|
||||
k = 1;
|
||||
totalColumns = 1;
|
||||
}
|
||||
let _local_8 = 0;
|
||||
while(_local_8 < k)
|
||||
while(_local_8 < totalColumns)
|
||||
{
|
||||
this._columns.push(null);
|
||||
_local_8++;
|
||||
}
|
||||
this._repeatMode = _arg_2;
|
||||
this._align = _arg_3;
|
||||
this._normalMinX = _arg_4;
|
||||
this._normalMaxX = _arg_5;
|
||||
this._normalMinY = _arg_6;
|
||||
this._normalMaxY = _arg_7;
|
||||
this._repeatMode = repeatMode;
|
||||
this._align = align;
|
||||
this._normalMinX = normalMinX;
|
||||
this._normalMaxX = normalMaxX;
|
||||
this._normalMinY = normalMinY;
|
||||
this._normalMaxY = normalMaxY;
|
||||
if(this._repeatMode == PlaneMaterialCellMatrix.REPEAT_MODE_RANDOM)
|
||||
{
|
||||
this._isStatic = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static nextRandomColumnIndex(k: number): number
|
||||
private static nextRandomColumnIndex(totalColumns: number): number
|
||||
{
|
||||
return ((Randomizer.getValues(1, 0, (k * 17631))[0]) % k);
|
||||
return ((Randomizer.getValues(1, 0, (totalColumns * 17631))[0]) % totalColumns);
|
||||
}
|
||||
|
||||
public get normalMinX(): number
|
||||
@ -139,16 +139,16 @@ export class PlaneMaterialCellMatrix
|
||||
this._isCached = false;
|
||||
}
|
||||
|
||||
public createColumn(k: number, _arg_2: number, _arg_3: PlaneMaterialCell[], _arg_4: number=1): boolean
|
||||
public createColumn(index: number, width: number, cells: PlaneMaterialCell[], repeatMode: number=1): boolean
|
||||
{
|
||||
if((k < 0) || (k >= this._columns.length)) return false;
|
||||
if((index < 0) || (index >= this._columns.length)) return false;
|
||||
|
||||
const newColumn = new PlaneMaterialCellColumn(_arg_2, _arg_3, _arg_4);
|
||||
const oldColumn = this._columns[k];
|
||||
const newColumn = new PlaneMaterialCellColumn(width, cells, repeatMode);
|
||||
const oldColumn = this._columns[index];
|
||||
|
||||
if(oldColumn) oldColumn.dispose();
|
||||
|
||||
this._columns[k] = newColumn;
|
||||
this._columns[index] = newColumn;
|
||||
|
||||
if(newColumn && !newColumn.isStatic) this._isStatic = false;
|
||||
|
||||
@ -313,11 +313,11 @@ export class PlaneMaterialCellMatrix
|
||||
return this._cachedBitmapData;
|
||||
}
|
||||
|
||||
private copyCachedBitmapOnCanvas(k: Graphics, _arg_2: number, _arg_3: number, _arg_4: boolean): void
|
||||
private copyCachedBitmapOnCanvas(canvas: Graphics, height: number, offsetY: number, topAlign: boolean): void
|
||||
{
|
||||
if(!k || !this._cachedBitmapData || (k === this._cachedBitmapData)) return;
|
||||
if(!canvas || !this._cachedBitmapData || (canvas === this._cachedBitmapData)) return;
|
||||
|
||||
if(!_arg_4) _arg_3 = ((k.height - _arg_2) - _arg_3);
|
||||
if(!topAlign) offsetY = ((canvas.height - height) - offsetY);
|
||||
|
||||
let _local_5: Rectangle;
|
||||
|
||||
@ -334,20 +334,20 @@ export class PlaneMaterialCellMatrix
|
||||
|
||||
if(texture)
|
||||
{
|
||||
k
|
||||
canvas
|
||||
.beginTextureFill({ texture })
|
||||
.drawRect(0, _arg_3, _local_5.width, _local_5.height)
|
||||
.drawRect(0, offsetY, _local_5.width, _local_5.height)
|
||||
.endFill();
|
||||
}
|
||||
}
|
||||
|
||||
private getColumnsWidth(k: Graphics[]): number
|
||||
private getColumnsWidth(columns: Graphics[]): number
|
||||
{
|
||||
if(!k || !k.length) return 0;
|
||||
if(!columns || !columns.length) return 0;
|
||||
|
||||
let width = 0;
|
||||
|
||||
for(const graphic of k)
|
||||
for(const graphic of columns)
|
||||
{
|
||||
if(!graphic) continue;
|
||||
|
||||
@ -357,34 +357,34 @@ export class PlaneMaterialCellMatrix
|
||||
return width;
|
||||
}
|
||||
|
||||
private renderColumns(k: Graphics, _arg_2: Graphics[], _arg_3: number, _arg_4: boolean): Point
|
||||
private renderColumns(canvas: Graphics, columns: Graphics[], x: number, flag: boolean): Point
|
||||
{
|
||||
if(!k || !_arg_2 || !_arg_2.length) return new Point(_arg_3, 0);
|
||||
if(!canvas || !columns || !columns.length) return new Point(x, 0);
|
||||
|
||||
let height = 0;
|
||||
let _local_6: Graphics = null;
|
||||
let _local_7 = 0;
|
||||
|
||||
while(_local_7 < _arg_2.length)
|
||||
while(_local_7 < columns.length)
|
||||
{
|
||||
if(_arg_4)
|
||||
if(flag)
|
||||
{
|
||||
_local_6 = _arg_2[_local_7];
|
||||
_local_6 = columns[_local_7];
|
||||
}
|
||||
else
|
||||
{
|
||||
_local_6 = _arg_2[((_arg_2.length - 1) - _local_7)];
|
||||
_local_6 = columns[((columns.length - 1) - _local_7)];
|
||||
}
|
||||
if(_local_6 != null)
|
||||
{
|
||||
if(!_arg_4)
|
||||
if(!flag)
|
||||
{
|
||||
_arg_3 = (_arg_3 - _local_6.width);
|
||||
x = (x - _local_6.width);
|
||||
}
|
||||
let _local_8 = 0;
|
||||
if(this._align == PlaneMaterialCellMatrix.ALIGN_BOTTOM)
|
||||
{
|
||||
_local_8 = (k.height - _local_6.height);
|
||||
_local_8 = (canvas.height - _local_6.height);
|
||||
}
|
||||
|
||||
let texture = RoomVisualization.getTextureCache(_local_6);
|
||||
@ -396,40 +396,40 @@ export class PlaneMaterialCellMatrix
|
||||
RoomVisualization.addTextureCache(_local_6, texture);
|
||||
}
|
||||
|
||||
k.beginTextureFill({ texture });
|
||||
k.drawRect(_arg_3, _local_8, texture.width, texture.height);
|
||||
k.endFill();
|
||||
canvas.beginTextureFill({ texture });
|
||||
canvas.drawRect(x, _local_8, texture.width, texture.height);
|
||||
canvas.endFill();
|
||||
|
||||
if(_local_6.height > height)
|
||||
{
|
||||
height = _local_6.height;
|
||||
}
|
||||
if(_arg_4)
|
||||
if(flag)
|
||||
{
|
||||
_arg_3 = (_arg_3 + _local_6.width);
|
||||
x = (x + _local_6.width);
|
||||
}
|
||||
if((((_arg_4) && (_arg_3 >= k.width)) || ((!(_arg_4)) && (_arg_3 <= 0))))
|
||||
if((((flag) && (x >= canvas.width)) || ((!(flag)) && (x <= 0))))
|
||||
{
|
||||
return new Point(_arg_3, height);
|
||||
return new Point(x, height);
|
||||
}
|
||||
}
|
||||
_local_7++;
|
||||
}
|
||||
return new Point(_arg_3, height);
|
||||
return new Point(x, height);
|
||||
}
|
||||
|
||||
private renderRepeatAll(k: Graphics, _arg_2: Graphics[]): number
|
||||
private renderRepeatAll(canvas: Graphics, columns: Graphics[]): number
|
||||
{
|
||||
if(!k || !_arg_2 || !_arg_2.length) return 0;
|
||||
if(!canvas || !columns || !columns.length) return 0;
|
||||
|
||||
const totalWidth: number = this.getColumnsWidth(_arg_2);
|
||||
const totalWidth: number = this.getColumnsWidth(columns);
|
||||
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
|
||||
while(x < k.width)
|
||||
while(x < canvas.width)
|
||||
{
|
||||
const point = this.renderColumns(k, _arg_2, x, true);
|
||||
const point = this.renderColumns(canvas, columns, x, true);
|
||||
|
||||
x = point.x;
|
||||
|
||||
@ -695,7 +695,7 @@ export class PlaneMaterialCellMatrix
|
||||
// return _local_3;
|
||||
// }
|
||||
|
||||
public getColumns(k: number): PlaneMaterialCellColumn[]
|
||||
public getColumns(width: number): PlaneMaterialCellColumn[]
|
||||
{
|
||||
if(this._repeatMode === PlaneMaterialCellMatrix.REPEAT_MODE_RANDOM)
|
||||
{
|
||||
@ -703,7 +703,7 @@ export class PlaneMaterialCellMatrix
|
||||
|
||||
let columnIndex = 0;
|
||||
|
||||
while(columnIndex < k)
|
||||
while(columnIndex < width)
|
||||
{
|
||||
const column = this._columns[PlaneMaterialCellMatrix.nextRandomColumnIndex(this._columns.length)];
|
||||
|
||||
|
@ -152,30 +152,30 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
||||
this._textures.clear();
|
||||
}
|
||||
|
||||
protected getTexture(k: string): PlaneTexture
|
||||
protected getTexture(textureId: string): PlaneTexture
|
||||
{
|
||||
return this._textures.get(k);
|
||||
return this._textures.get(textureId);
|
||||
}
|
||||
|
||||
protected getMaterial(k: string): PlaneMaterial
|
||||
protected getMaterial(materialId: string): PlaneMaterial
|
||||
{
|
||||
return this._materials.get(k);
|
||||
return this._materials.get(materialId);
|
||||
}
|
||||
|
||||
protected getPlane(k: string): Plane
|
||||
protected getPlane(planeId: string): Plane
|
||||
{
|
||||
return this._planes.get(k);
|
||||
return this._planes.get(planeId);
|
||||
}
|
||||
|
||||
protected addPlane(k: string, _arg_2: Plane): boolean
|
||||
protected addPlane(id: string, plane: Plane): boolean
|
||||
{
|
||||
if(!_arg_2) return false;
|
||||
if(!plane) return false;
|
||||
|
||||
const existing = this._planes.get(k);
|
||||
const existing = this._planes.get(id);
|
||||
|
||||
if(!existing)
|
||||
{
|
||||
this._planes.set(k, _arg_2);
|
||||
this._planes.set(id, plane);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -183,11 +183,11 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
||||
return false;
|
||||
}
|
||||
|
||||
public initializeAssetCollection(k: IGraphicAssetCollection): void
|
||||
public initializeAssetCollection(collection: IGraphicAssetCollection): void
|
||||
{
|
||||
if(!this._data) return;
|
||||
|
||||
this._assetCollection = k;
|
||||
this._assetCollection = collection;
|
||||
|
||||
this.initializeAll();
|
||||
}
|
||||
@ -212,13 +212,13 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
||||
{
|
||||
}
|
||||
|
||||
private parseTextures(k: any, _arg_2: IGraphicAssetCollection): void
|
||||
private parseTextures(textures: any, collection: IGraphicAssetCollection): void
|
||||
{
|
||||
if(!k || !_arg_2) return;
|
||||
if(!textures || !collection) return;
|
||||
|
||||
if(k.length)
|
||||
if(textures.length)
|
||||
{
|
||||
for(const texture of k)
|
||||
for(const texture of textures)
|
||||
{
|
||||
if(!texture) continue;
|
||||
|
||||
@ -246,7 +246,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
||||
if(bitmap.normalMinY !== undefined) normalMinY = bitmap.normalMinY;
|
||||
if(bitmap.normalMaxY !== undefined) normalMaxY = bitmap.normalMaxY;
|
||||
|
||||
const asset = _arg_2.getAsset(assetName);
|
||||
const asset = collection.getAsset(assetName);
|
||||
|
||||
if(asset)
|
||||
{
|
||||
@ -273,11 +273,11 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
||||
}
|
||||
}
|
||||
|
||||
private parsePlaneMaterials(k: any): void
|
||||
private parsePlaneMaterials(materials: any): void
|
||||
{
|
||||
if(!k || !k.length) return;
|
||||
if(!materials || !materials.length) return;
|
||||
|
||||
for(const material of k)
|
||||
for(const material of materials)
|
||||
{
|
||||
if(!material) continue;
|
||||
|
||||
@ -354,17 +354,17 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
||||
}
|
||||
}
|
||||
|
||||
private parsePlaneMaterialCellColumn(k: { repeatMode: string, width: number }, _arg_2: PlaneMaterialCellMatrix, _arg_3: number): void
|
||||
private parsePlaneMaterialCellColumn(column: { repeatMode: string, width: number }, cellMatrix: PlaneMaterialCellMatrix, index: number): void
|
||||
{
|
||||
if(!k || !_arg_2) return;
|
||||
if(!column || !cellMatrix) return;
|
||||
|
||||
let repeatMode = PlaneMaterialCellColumn.REPEAT_MODE_ALL;
|
||||
|
||||
const width = k.width;
|
||||
const width = column.width;
|
||||
|
||||
const cells = this.parsePlaneMaterialCells(k);
|
||||
const cells = this.parsePlaneMaterialCells(column);
|
||||
|
||||
switch(k.repeatMode)
|
||||
switch(column.repeatMode)
|
||||
{
|
||||
case 'borders':
|
||||
repeatMode = PlaneMaterialCellColumn.REPEAT_MODE_BORDERS;
|
||||
@ -386,20 +386,20 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
||||
break;
|
||||
}
|
||||
|
||||
_arg_2.createColumn(_arg_3, width, cells, repeatMode);
|
||||
cellMatrix.createColumn(index, width, cells, repeatMode);
|
||||
}
|
||||
|
||||
private parsePlaneMaterialCells(k: any): PlaneMaterialCell[]
|
||||
private parsePlaneMaterialCells(column: any): PlaneMaterialCell[]
|
||||
{
|
||||
if(!k || !k.cells || !k.cells.length) return null;
|
||||
if(!column || !column.cells || !column.cells.length) return null;
|
||||
|
||||
const cells: PlaneMaterialCell[] = [];
|
||||
|
||||
let index = 0;
|
||||
|
||||
while(index < k.cells.length)
|
||||
while(index < column.cells.length)
|
||||
{
|
||||
const cell = k.cells[index];
|
||||
const cell = column.cells[index];
|
||||
|
||||
if(cell)
|
||||
{
|
||||
@ -509,34 +509,34 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
||||
return offsets;
|
||||
}
|
||||
|
||||
protected getGeometry(k: number, _arg_2: number, _arg_3: number): IRoomGeometry
|
||||
protected getGeometry(size: number, horizontalAngle: number, verticalAngle: number): IRoomGeometry
|
||||
{
|
||||
_arg_2 = Math.abs(_arg_2);
|
||||
if(_arg_2 > 90) _arg_2 = 90;
|
||||
horizontalAngle = Math.abs(horizontalAngle);
|
||||
if(horizontalAngle > 90) horizontalAngle = 90;
|
||||
|
||||
_arg_3 = Math.abs(_arg_3);
|
||||
if(_arg_3 > 90) _arg_3 = 90;
|
||||
verticalAngle = Math.abs(verticalAngle);
|
||||
if(verticalAngle > 90) verticalAngle = 90;
|
||||
|
||||
const identifier = `${ k }_${ Math.round(_arg_2) }_${ Math.round(_arg_3) }`;
|
||||
const identifier = `${ size }_${ Math.round(horizontalAngle) }_${ Math.round(verticalAngle) }`;
|
||||
|
||||
let geometry = this._geometries.get(identifier);
|
||||
|
||||
if(geometry) return geometry;
|
||||
|
||||
geometry = new RoomGeometry(k, new Vector3d(_arg_2, _arg_3), new Vector3d(-10, 0, 0));
|
||||
geometry = new RoomGeometry(size, new Vector3d(horizontalAngle, verticalAngle), new Vector3d(-10, 0, 0));
|
||||
|
||||
this._geometries.set(identifier, geometry);
|
||||
|
||||
return geometry;
|
||||
}
|
||||
|
||||
protected parseVisualizations(k: Plane, _arg_2: any): void
|
||||
protected parseVisualizations(plane: Plane, visualizations: any): void
|
||||
{
|
||||
if(!k || !_arg_2) return;
|
||||
if(!plane || !visualizations) return;
|
||||
|
||||
if(_arg_2 && _arg_2.length)
|
||||
if(visualizations && visualizations.length)
|
||||
{
|
||||
for(const visualization of _arg_2)
|
||||
for(const visualization of visualizations)
|
||||
{
|
||||
if(!visualization) continue;
|
||||
|
||||
@ -550,7 +550,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
||||
|
||||
const layers = visualization.layers;
|
||||
|
||||
const planeVisualization = k.createPlaneVisualization(size, ((layers && layers.length) || 0), this.getGeometry(size, horizontalAngle, verticalAngle));
|
||||
const planeVisualization = plane.createPlaneVisualization(size, ((layers && layers.length) || 0), this.getGeometry(size, horizontalAngle, verticalAngle));
|
||||
|
||||
if(planeVisualization && (layers && layers.length))
|
||||
{
|
||||
@ -590,19 +590,19 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
||||
}
|
||||
}
|
||||
|
||||
public render(k: Graphics, _arg_2: string, _arg_3: number, _arg_4: number, _arg_5: number, _arg_6: IVector3D, _arg_7: boolean, _arg_8: number =0, _arg_9: number = 0, _arg_10: number = 0, _arg_11: number = 0, _arg_12: number = 0): PlaneBitmapData
|
||||
public render(canvas: Graphics, id: string, width: number, height: number, size: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, timeSinceStartMs: number = 0): PlaneBitmapData
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public getTextureIdentifier(k: number, _arg_2: IVector3D): string
|
||||
public getTextureIdentifier(k: number, normal: IVector3D): string
|
||||
{
|
||||
return k.toString();
|
||||
}
|
||||
|
||||
public getLayers(k: string): PlaneVisualizationLayer[]
|
||||
public getLayers(id: string): PlaneVisualizationLayer[]
|
||||
{
|
||||
let planes = this.getPlane(k);
|
||||
let planes = this.getPlane(id);
|
||||
|
||||
if(!planes) planes = this.getPlane(PlaneRasterizer.DEFAULT);
|
||||
|
||||
|
@ -29,9 +29,9 @@ export class PlaneTexture
|
||||
}
|
||||
}
|
||||
|
||||
public addBitmap(k: Texture<Resource>, _arg_2: number = -1, _arg_3: number = 1, _arg_4: number = -1, _arg_5: number = 1, _arg_6: string = null): void
|
||||
public addBitmap(texture: Texture<Resource>, normalMinX: number = -1, normalMaxX: number = 1, normalMinY: number = -1, normalMaxY: number = 1, assetName: string = null): void
|
||||
{
|
||||
this._bitmaps.push(new PlaneTextureBitmap(k, _arg_2, _arg_3, _arg_4, _arg_5, _arg_6));
|
||||
this._bitmaps.push(new PlaneTextureBitmap(texture, normalMinX, normalMaxX, normalMinY, normalMaxY, assetName));
|
||||
}
|
||||
|
||||
public getBitmap(k: IVector3D): Texture<Resource>
|
||||
|
@ -12,14 +12,14 @@ export class PlaneTextureBitmap
|
||||
private _normalMaxY: number;
|
||||
private _assetName: string;
|
||||
|
||||
constructor(k: Texture<Resource>, _arg_2: number = -1, _arg_3: number = 1, _arg_4: number = -1, _arg_5: number = 1, _arg_6: string = null)
|
||||
constructor(texture: Texture<Resource>, normalMinX: number = -1, normalMaxX: number = 1, normalMinY: number = -1, normalMaxY: number = 1, assetName: string = null)
|
||||
{
|
||||
this._normalMinX = _arg_2;
|
||||
this._normalMaxX = _arg_3;
|
||||
this._normalMinY = _arg_4;
|
||||
this._normalMaxY = _arg_5;
|
||||
this._assetName = _arg_6;
|
||||
this._bitmap = k;
|
||||
this._normalMinX = normalMinX;
|
||||
this._normalMaxX = normalMaxX;
|
||||
this._normalMinY = normalMinY;
|
||||
this._normalMaxY = normalMaxY;
|
||||
this._assetName = assetName;
|
||||
this._bitmap = texture;
|
||||
}
|
||||
|
||||
public get bitmap(): Texture<Resource>
|
||||
|
@ -19,20 +19,20 @@ export class PlaneVisualization
|
||||
private _isCached: boolean;
|
||||
private _hasAnimationLayers: boolean;
|
||||
|
||||
constructor(k: number, _arg_2: number, _arg_3: IRoomGeometry)
|
||||
constructor(size: number, totalLayers: number, geometry: IRoomGeometry)
|
||||
{
|
||||
this._layers = [];
|
||||
this._geometry = _arg_3;
|
||||
this._geometry = geometry;
|
||||
this._cachedBitmapData = null;
|
||||
this._cachedBitmapNormal = new Vector3d();
|
||||
this._isCached = false;
|
||||
this._hasAnimationLayers = false;
|
||||
|
||||
if(_arg_2 < 0) _arg_2 = 0;
|
||||
if(totalLayers < 0) totalLayers = 0;
|
||||
|
||||
let index = 0;
|
||||
|
||||
while(index < _arg_2)
|
||||
while(index < totalLayers)
|
||||
{
|
||||
this._layers.push(null);
|
||||
|
||||
@ -107,32 +107,32 @@ export class PlaneVisualization
|
||||
this._isCached = false;
|
||||
}
|
||||
|
||||
public setLayer(k: number, _arg_2: PlaneMaterial, _arg_3: number, _arg_4: number, _arg_5: number = 0): boolean
|
||||
public setLayer(layerId: number, material: PlaneMaterial, color: number, align: number, offset: number = 0): boolean
|
||||
{
|
||||
if((k < 0) || (k > this._layers.length)) return false;
|
||||
if((layerId < 0) || (layerId > this._layers.length)) return false;
|
||||
|
||||
let layer = this._layers[k];
|
||||
let layer = this._layers[layerId];
|
||||
|
||||
if(layer) layer.dispose();
|
||||
|
||||
layer = new PlaneVisualizationLayer(_arg_2, _arg_3, _arg_4, _arg_5);
|
||||
layer = new PlaneVisualizationLayer(material, color, align, offset);
|
||||
|
||||
this._layers[k] = layer;
|
||||
this._layers[layerId] = layer;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public setAnimationLayer(k: number, _arg_2: any, _arg_3: IGraphicAssetCollection): boolean
|
||||
public setAnimationLayer(layerId: number, animationItems: any, collection: IGraphicAssetCollection): boolean
|
||||
{
|
||||
if((k < 0) || (k > this._layers.length)) return false;
|
||||
if((layerId < 0) || (layerId > this._layers.length)) return false;
|
||||
|
||||
let layer = this._layers[k] as IDisposable;
|
||||
let layer = this._layers[layerId] as IDisposable;
|
||||
|
||||
if(layer) layer.dispose();
|
||||
|
||||
layer = new PlaneVisualizationAnimationLayer(_arg_2, _arg_3);
|
||||
layer = new PlaneVisualizationAnimationLayer(animationItems, collection);
|
||||
|
||||
this._layers[k] = layer;
|
||||
this._layers[layerId] = layer;
|
||||
this._hasAnimationLayers = true;
|
||||
|
||||
return true;
|
||||
|
@ -19,12 +19,12 @@ export class PlaneVisualizationLayer
|
||||
private _bitmapData: Graphics;
|
||||
private _isDisposed: boolean;
|
||||
|
||||
constructor(k: PlaneMaterial, _arg_2: number, _arg_3: number, _arg_4: number = 0)
|
||||
constructor(material: PlaneMaterial, color: number, align: number, offset: number = 0)
|
||||
{
|
||||
this._material = k;
|
||||
this._offset = _arg_4;
|
||||
this._align = _arg_3;
|
||||
this._color = _arg_2;
|
||||
this._material = material;
|
||||
this._offset = offset;
|
||||
this._align = align;
|
||||
this._color = color;
|
||||
this._bitmapData = null;
|
||||
this._isDisposed = false;
|
||||
}
|
||||
|
@ -9,22 +9,22 @@ export class WallPlane extends Plane
|
||||
public static HORIZONTAL_ANGLE_DEFAULT: number = 45;
|
||||
public static VERTICAL_ANGLE_DEFAULT: number = 30;
|
||||
|
||||
public render(k: Graphics, _arg_2: number, _arg_3: number, size: number, _arg_5: IVector3D, _arg_6: boolean): Graphics
|
||||
public render(canvas: Graphics, width: number, height: number, size: number, normal: IVector3D, useTexture: boolean): Graphics
|
||||
{
|
||||
const visualization = this.getPlaneVisualization(size);
|
||||
|
||||
if(!visualization || !visualization.geometry) return null;
|
||||
|
||||
const _local_8 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 0));
|
||||
const _local_9 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, (_arg_3 / visualization.geometry.scale)));
|
||||
const _local_10 = visualization.geometry.getScreenPoint(new Vector3d(0, (_arg_2 / visualization.geometry.scale), 0));
|
||||
const _local_9 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, (height / visualization.geometry.scale)));
|
||||
const _local_10 = visualization.geometry.getScreenPoint(new Vector3d(0, (width / visualization.geometry.scale), 0));
|
||||
|
||||
if(_local_8 && _local_9 && _local_10)
|
||||
{
|
||||
_arg_2 = Math.round(Math.abs((_local_8.x - _local_10.x)));
|
||||
_arg_3 = Math.round(Math.abs((_local_8.y - _local_9.y)));
|
||||
width = Math.round(Math.abs((_local_8.x - _local_10.x)));
|
||||
height = Math.round(Math.abs((_local_8.y - _local_9.y)));
|
||||
}
|
||||
|
||||
return visualization.render(k, _arg_2, _arg_3, _arg_5, _arg_6);
|
||||
return visualization.render(canvas, width, height, normal, useTexture);
|
||||
}
|
||||
}
|
||||
|
@ -64,13 +64,13 @@ export class WallRasterizer extends PlaneRasterizer
|
||||
return new PlaneBitmapData(graphic, -1);
|
||||
}
|
||||
|
||||
public getTextureIdentifier(k: number, _arg_2: IVector3D): string
|
||||
public getTextureIdentifier(k: number, normal: IVector3D): string
|
||||
{
|
||||
if(_arg_2)
|
||||
if(normal)
|
||||
{
|
||||
return `${ k }_${ _arg_2.x }_${ _arg_2.y }_${ _arg_2.z }`;
|
||||
return `${ k }_${ normal.x }_${ normal.y }_${ normal.z }`;
|
||||
}
|
||||
|
||||
return super.getTextureIdentifier(k, _arg_2);
|
||||
return super.getTextureIdentifier(k, normal);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user