mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-02-19 19:22:36 +01:00
cleaned PlaneRasterizer
This commit is contained in:
parent
83c823222f
commit
c38c2df6bc
@ -505,10 +505,10 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
if(layer)
|
if(layer)
|
||||||
{
|
{
|
||||||
if(this._hasTexture && layer._Str_8547())
|
if(this._hasTexture && layer.getMaterial())
|
||||||
{
|
{
|
||||||
const normal = geometry.getCoordinatePosition(this._normal);
|
const normal = geometry.getCoordinatePosition(this._normal);
|
||||||
const cm = layer._Str_8547()._Str_21968(normal);
|
const cm = layer.getMaterial()._Str_21968(normal);
|
||||||
//const data = new PlaneDrawingData(maskData, blend(this._color, layer.getColor()), cm._Str_14945());
|
//const data = new PlaneDrawingData(maskData, blend(this._color, layer.getColor()), cm._Str_14945());
|
||||||
const data = new PlaneDrawingData(maskData, this._color, cm._Str_14945());
|
const data = new PlaneDrawingData(maskData, this._color, cm._Str_14945());
|
||||||
|
|
||||||
|
@ -88,10 +88,10 @@ export class RoomVisualizationData extends Disposable implements IObjectVisualiz
|
|||||||
{
|
{
|
||||||
if(this._initialized) return;
|
if(this._initialized) return;
|
||||||
|
|
||||||
this._wallRasterizer._Str_6703(collection);
|
this._wallRasterizer.initializeAssetCollection(collection);
|
||||||
this._floorRasterizer._Str_6703(collection);
|
this._floorRasterizer.initializeAssetCollection(collection);
|
||||||
this._landscapeRasterizer._Str_6703(collection);
|
this._landscapeRasterizer.initializeAssetCollection(collection);
|
||||||
this._maskManager._Str_6703(collection);
|
this._maskManager.initializeAssetCollection(collection);
|
||||||
|
|
||||||
this._initialized = true;
|
this._initialized = true;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ export class PlaneMaskManager
|
|||||||
this._data = k;
|
this._data = k;
|
||||||
}
|
}
|
||||||
|
|
||||||
public _Str_6703(k: IGraphicAssetCollection): void
|
public initializeAssetCollection(k: IGraphicAssetCollection): void
|
||||||
{
|
{
|
||||||
if(!this.data) return;
|
if(!this.data) return;
|
||||||
|
|
||||||
|
@ -9,5 +9,5 @@ export interface IPlaneRasterizer
|
|||||||
render(_arg_1: Graphics, _arg_2: string, _arg_3: number, _arg_4: number, _arg_5: number, _arg_6: IVector3D, _arg_7: boolean, _arg_8?: number, _arg_9?: number, _arg_10?: number, _arg_11?: number, _arg_12?: number): PlaneBitmapData;
|
render(_arg_1: Graphics, _arg_2: string, _arg_3: number, _arg_4: number, _arg_5: number, _arg_6: IVector3D, _arg_7: boolean, _arg_8?: number, _arg_9?: number, _arg_10?: number, _arg_11?: number, _arg_12?: number): PlaneBitmapData;
|
||||||
getTextureIdentifier(_arg_1: number, _arg_2: IVector3D): string;
|
getTextureIdentifier(_arg_1: number, _arg_2: IVector3D): string;
|
||||||
getLayers(_arg_1: string): PlaneVisualizationLayer[];
|
getLayers(_arg_1: string): PlaneVisualizationLayer[];
|
||||||
_Str_24005(): void;
|
reinitialize(): void;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
|||||||
const totalAnimatedLayers = ((animatedLayers && animatedLayers.length) || 0);
|
const totalAnimatedLayers = ((animatedLayers && animatedLayers.length) || 0);
|
||||||
const totalLayers = (totalBasicLayers + totalAnimatedLayers);
|
const totalLayers = (totalBasicLayers + totalAnimatedLayers);
|
||||||
|
|
||||||
const planeVisualization = plane.createPlaneVisualization(size, (totalLayers || 0), this._Str_17204(size, horizontalAngle, verticalAngle));
|
const planeVisualization = plane.createPlaneVisualization(size, (totalLayers || 0), this.getGeometry(size, horizontalAngle, verticalAngle));
|
||||||
|
|
||||||
if(planeVisualization)
|
if(planeVisualization)
|
||||||
{
|
{
|
||||||
@ -92,7 +92,7 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
|||||||
let color: number = LandscapePlane._Str_2531;
|
let color: number = LandscapePlane._Str_2531;
|
||||||
let offset: number = PlaneVisualizationLayer.DEFAULT_OFFSET;
|
let offset: number = PlaneVisualizationLayer.DEFAULT_OFFSET;
|
||||||
|
|
||||||
if(layer.materialId) material = this._Str_8547(layer.materialId);
|
if(layer.materialId) material = this.getMaterial(layer.materialId);
|
||||||
|
|
||||||
if(layer.color) color = layer.color;
|
if(layer.color) color = layer.color;
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this._Str_3453(id, plane)) plane.dispose();
|
if(!this.addPlane(id, plane)) plane.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,9 +199,9 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
|||||||
|
|
||||||
public render(canvas: Graphics, id: string, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, timeSinceStartMs: number = 0): PlaneBitmapData
|
public render(canvas: Graphics, id: string, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, timeSinceStartMs: number = 0): PlaneBitmapData
|
||||||
{
|
{
|
||||||
let plane = this._Str_3491(id) as LandscapePlane;
|
let plane = this.getPlane(id) as LandscapePlane;
|
||||||
|
|
||||||
if(!plane) plane = this._Str_3491(LandscapeRasterizer.DEFAULT) as LandscapePlane;
|
if(!plane) plane = this.getPlane(LandscapeRasterizer.DEFAULT) as LandscapePlane;
|
||||||
|
|
||||||
if(!plane) return null;
|
if(!plane) return null;
|
||||||
|
|
||||||
|
@ -29,17 +29,17 @@ export class FloorRasterizer extends PlaneRasterizer
|
|||||||
const visualization = floor.visualizations;
|
const visualization = floor.visualizations;
|
||||||
const plane = new FloorPlane();
|
const plane = new FloorPlane();
|
||||||
|
|
||||||
this._Str_9137(plane, visualization);
|
this.parseVisualizations(plane, visualization);
|
||||||
|
|
||||||
if(!this._Str_3453(id, plane)) plane.dispose();
|
if(!this.addPlane(id, plane)) plane.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(canvas: Graphics, id: string, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, timeSinceStartMs: number = 0): PlaneBitmapData
|
public render(canvas: Graphics, id: string, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, timeSinceStartMs: number = 0): PlaneBitmapData
|
||||||
{
|
{
|
||||||
let plane = this._Str_3491(id) as FloorPlane;
|
let plane = this.getPlane(id) as FloorPlane;
|
||||||
|
|
||||||
if(!plane) plane = this._Str_3491(PlaneRasterizer.DEFAULT) as FloorPlane;
|
if(!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as FloorPlane;
|
||||||
|
|
||||||
if(!plane) return null;
|
if(!plane) return null;
|
||||||
|
|
||||||
@ -62,4 +62,4 @@ export class FloorRasterizer extends PlaneRasterizer
|
|||||||
|
|
||||||
return new PlaneBitmapData(graphic, -1);
|
return new PlaneBitmapData(graphic, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,14 +69,14 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
|
|
||||||
if(this._materials)
|
if(this._materials)
|
||||||
{
|
{
|
||||||
this._Str_21781();
|
this.resetMaterials();
|
||||||
|
|
||||||
this._materials = null;
|
this._materials = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._textures)
|
if(this._textures)
|
||||||
{
|
{
|
||||||
this._Str_21447();
|
this.resetTextures();
|
||||||
|
|
||||||
this._textures = null;
|
this._textures = null;
|
||||||
}
|
}
|
||||||
@ -119,14 +119,14 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
this._data = data;
|
this._data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public _Str_24005(): void
|
public reinitialize(): void
|
||||||
{
|
{
|
||||||
this._Str_21447();
|
this.resetTextures();
|
||||||
this._Str_21781();
|
this.resetMaterials();
|
||||||
this._Str_22054();
|
this.initializeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _Str_21781(): void
|
private resetMaterials(): void
|
||||||
{
|
{
|
||||||
for(const material of this._materials.values())
|
for(const material of this._materials.values())
|
||||||
{
|
{
|
||||||
@ -138,7 +138,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
this._materials.clear();
|
this._materials.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _Str_21447(): void
|
private resetTextures(): void
|
||||||
{
|
{
|
||||||
for(const texture of this._textures.values())
|
for(const texture of this._textures.values())
|
||||||
{
|
{
|
||||||
@ -155,17 +155,17 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
return this._textures.get(k);
|
return this._textures.get(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _Str_8547(k: string): PlaneMaterial
|
protected getMaterial(k: string): PlaneMaterial
|
||||||
{
|
{
|
||||||
return this._materials.get(k);
|
return this._materials.get(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _Str_3491(k: string): Plane
|
protected getPlane(k: string): Plane
|
||||||
{
|
{
|
||||||
return this._planes.get(k);
|
return this._planes.get(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _Str_3453(k: string, _arg_2: Plane): boolean
|
protected addPlane(k: string, _arg_2: Plane): boolean
|
||||||
{
|
{
|
||||||
if(!_arg_2) return false;
|
if(!_arg_2) return false;
|
||||||
|
|
||||||
@ -181,36 +181,36 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public _Str_6703(k: IGraphicAssetCollection): void
|
public initializeAssetCollection(k: IGraphicAssetCollection): void
|
||||||
{
|
{
|
||||||
if(!this._data) return;
|
if(!this._data) return;
|
||||||
|
|
||||||
this._assetCollection = k;
|
this._assetCollection = k;
|
||||||
|
|
||||||
this._Str_22054();
|
this.initializeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _Str_22054(): void
|
private initializeAll(): void
|
||||||
{
|
{
|
||||||
if(!this._data) return;
|
if(!this._data) return;
|
||||||
|
|
||||||
this._Str_25281();
|
this.initializeTexturesAndMaterials();
|
||||||
|
|
||||||
this.initializePlanes();
|
this.initializePlanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _Str_25281(): void
|
private initializeTexturesAndMaterials(): void
|
||||||
{
|
{
|
||||||
if(this._data.textures && this._data.textures.length) this._Str_24250(this._data.textures, this.assetCollection);
|
if(this._data.textures && this._data.textures.length) this.parseTextures(this._data.textures, this.assetCollection);
|
||||||
|
|
||||||
if(this._data.materials && this._data.materials.length) this._Str_22388(this._data.materials);
|
if(this._data.materials && this._data.materials.length) this.parsePlaneMaterials(this._data.materials);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected initializePlanes(): void
|
protected initializePlanes(): void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private _Str_24250(k: any, _arg_2: IGraphicAssetCollection): void
|
private parseTextures(k: any, _arg_2: IGraphicAssetCollection): void
|
||||||
{
|
{
|
||||||
if(!k || !_arg_2) return;
|
if(!k || !_arg_2) return;
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _Str_22388(k: any): void
|
private parsePlaneMaterials(k: any): void
|
||||||
{
|
{
|
||||||
if(!k || !k.length) return;
|
if(!k || !k.length) return;
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
{
|
{
|
||||||
const column = matrix.columns[index];
|
const column = matrix.columns[index];
|
||||||
|
|
||||||
if(column) this._Str_24431(column, cellMatrix, index);
|
if(column) this.parsePlaneMaterialCellColumn(column, cellMatrix, index);
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _Str_24431(k: { repeatMode: string, width: number }, _arg_2: PlaneMaterialCellMatrix, _arg_3: number): void
|
private parsePlaneMaterialCellColumn(k: { repeatMode: string, width: number }, _arg_2: PlaneMaterialCellMatrix, _arg_3: number): void
|
||||||
{
|
{
|
||||||
if(!k || !_arg_2) return;
|
if(!k || !_arg_2) return;
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
|
|
||||||
const width = k.width;
|
const width = k.width;
|
||||||
|
|
||||||
const cells = this._Str_25217(k);
|
const cells = this.parsePlaneMaterialCells(k);
|
||||||
|
|
||||||
switch(k.repeatMode)
|
switch(k.repeatMode)
|
||||||
{
|
{
|
||||||
@ -387,7 +387,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
_arg_2._Str_22372(_arg_3, width, cells, repeatMode);
|
_arg_2._Str_22372(_arg_3, width, cells, repeatMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _Str_25217(k: any): PlaneMaterialCell[]
|
private parsePlaneMaterialCells(k: any): PlaneMaterialCell[]
|
||||||
{
|
{
|
||||||
if(!k || !k.cells || !k.cells.length) return null;
|
if(!k || !k.cells || !k.cells.length) return null;
|
||||||
|
|
||||||
@ -421,8 +421,8 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
const type = types[0];
|
const type = types[0];
|
||||||
const offset = offsets[0];
|
const offset = offsets[0];
|
||||||
|
|
||||||
assetNames = this._Str_25465(type);
|
assetNames = this.parseExtraItemTypes(type);
|
||||||
offsetPoints = this._Str_24448(offset);
|
offsetPoints = this.parseExtraItemOffsets(offset);
|
||||||
limit = offsetPoints.length;
|
limit = offsetPoints.length;
|
||||||
|
|
||||||
if(extra.limitMax) limit = extra.limitMax;
|
if(extra.limitMax) limit = extra.limitMax;
|
||||||
@ -460,7 +460,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
return cells;
|
return cells;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _Str_25465(k: any): string[]
|
private parseExtraItemTypes(k: any): string[]
|
||||||
{
|
{
|
||||||
const assetNames: string[] = [];
|
const assetNames: string[] = [];
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
return assetNames;
|
return assetNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _Str_24448(k: any): Point[]
|
private parseExtraItemOffsets(k: any): Point[]
|
||||||
{
|
{
|
||||||
const offsets: Point[] = [];
|
const offsets: Point[] = [];
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
return offsets;
|
return offsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _Str_17204(k: number, _arg_2: number, _arg_3: number): IRoomGeometry
|
protected getGeometry(k: number, _arg_2: number, _arg_3: number): IRoomGeometry
|
||||||
{
|
{
|
||||||
_arg_2 = Math.abs(_arg_2);
|
_arg_2 = Math.abs(_arg_2);
|
||||||
if(_arg_2 > 90) _arg_2 = 90;
|
if(_arg_2 > 90) _arg_2 = 90;
|
||||||
@ -528,7 +528,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _Str_9137(k: Plane, _arg_2: any): void
|
protected parseVisualizations(k: Plane, _arg_2: any): void
|
||||||
{
|
{
|
||||||
if(!k || !_arg_2) return;
|
if(!k || !_arg_2) return;
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
|
|
||||||
const layers = visualization.layers;
|
const layers = visualization.layers;
|
||||||
|
|
||||||
const planeVisualization = k.createPlaneVisualization(size, ((layers && layers.length) || 0), this._Str_17204(size, horizontalAngle, verticalAngle));
|
const planeVisualization = k.createPlaneVisualization(size, ((layers && layers.length) || 0), this.getGeometry(size, horizontalAngle, verticalAngle));
|
||||||
|
|
||||||
if(planeVisualization && (layers && layers.length))
|
if(planeVisualization && (layers && layers.length))
|
||||||
{
|
{
|
||||||
@ -565,7 +565,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
let color: number = FloorPlane._Str_2531;
|
let color: number = FloorPlane._Str_2531;
|
||||||
let offset: number = PlaneVisualizationLayer.DEFAULT_OFFSET;
|
let offset: number = PlaneVisualizationLayer.DEFAULT_OFFSET;
|
||||||
|
|
||||||
if(layer.materialId) material = this._Str_8547(layer.materialId);
|
if(layer.materialId) material = this.getMaterial(layer.materialId);
|
||||||
|
|
||||||
if(layer.color) color = layer.color;
|
if(layer.color) color = layer.color;
|
||||||
|
|
||||||
@ -600,9 +600,9 @@ export class PlaneRasterizer implements IPlaneRasterizer
|
|||||||
|
|
||||||
public getLayers(k: string): PlaneVisualizationLayer[]
|
public getLayers(k: string): PlaneVisualizationLayer[]
|
||||||
{
|
{
|
||||||
let planes = this._Str_3491(k);
|
let planes = this.getPlane(k);
|
||||||
|
|
||||||
if(!planes) planes = this._Str_3491(PlaneRasterizer.DEFAULT);
|
if(!planes) planes = this.getPlane(PlaneRasterizer.DEFAULT);
|
||||||
|
|
||||||
return planes.getLayers();
|
return planes.getLayers();
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ export class PlaneVisualizationLayer
|
|||||||
return bitmapData;
|
return bitmapData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public _Str_8547(): PlaneMaterial
|
public getMaterial(): PlaneMaterial
|
||||||
{
|
{
|
||||||
return this._material;
|
return this._material;
|
||||||
}
|
}
|
||||||
|
@ -29,17 +29,17 @@ export class WallRasterizer extends PlaneRasterizer
|
|||||||
const visualization = wall.visualizations;
|
const visualization = wall.visualizations;
|
||||||
const plane = new WallPlane();
|
const plane = new WallPlane();
|
||||||
|
|
||||||
this._Str_9137(plane, visualization);
|
this.parseVisualizations(plane, visualization);
|
||||||
|
|
||||||
if(!this._Str_3453(id, plane)) plane.dispose();
|
if(!this.addPlane(id, plane)) plane.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(canvas: Graphics, id: string, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, timeSinceStartMs: number = 0): PlaneBitmapData
|
public render(canvas: Graphics, id: string, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, timeSinceStartMs: number = 0): PlaneBitmapData
|
||||||
{
|
{
|
||||||
let plane = this._Str_3491(id) as WallPlane;
|
let plane = this.getPlane(id) as WallPlane;
|
||||||
|
|
||||||
if(!plane) plane = this._Str_3491(PlaneRasterizer.DEFAULT) as WallPlane;
|
if(!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as WallPlane;
|
||||||
|
|
||||||
if(!plane) return null;
|
if(!plane) return null;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user