mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-19 06:46:28 +01:00
Floor updates
This commit is contained in:
parent
296ecf4722
commit
6b11516ee8
@ -71,11 +71,11 @@ export class PlaneVisualizationAnimationLayer implements IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(k: Graphics, _arg_2: number, _arg_3: number, _arg_4: IVector3D, _arg_5: number, _arg_6: number, _arg_7: number, _arg_8: number, _arg_9: number, _arg_10: number, _arg_11: number): Graphics
|
public render(canvas: Graphics, width: number, height: number, normal: IVector3D, offsetX: number, offsetY: number, maxX: number, maxY: number, dimensionX: number, dimensionY: number, timeSinceStartMs: number): Graphics
|
||||||
{
|
{
|
||||||
if((((k == null) || (!(k.width == _arg_2))) || (!(k.height == _arg_3))))
|
if((((canvas == null) || (!(canvas.width == width))) || (!(canvas.height == height))))
|
||||||
{
|
{
|
||||||
if((((this._bitmapData == null) || (!(this._bitmapData.width == _arg_2))) || (!(this._bitmapData.height == _arg_3))))
|
if((((this._bitmapData == null) || (!(this._bitmapData.width == width))) || (!(this._bitmapData.height == height))))
|
||||||
{
|
{
|
||||||
if(this._bitmapData != null)
|
if(this._bitmapData != null)
|
||||||
{
|
{
|
||||||
@ -83,7 +83,7 @@ export class PlaneVisualizationAnimationLayer implements IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._bitmapData = new Graphics()
|
this._bitmapData = new Graphics()
|
||||||
.drawRect(0, 0, _arg_2, _arg_3);
|
.drawRect(0, 0, width, height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -94,10 +94,10 @@ export class PlaneVisualizationAnimationLayer implements IDisposable
|
|||||||
//this._bitmapData.fillRect(this._bitmapData.rect, 0xFFFFFF);
|
//this._bitmapData.fillRect(this._bitmapData.rect, 0xFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
k = this._bitmapData;
|
canvas = this._bitmapData;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((_arg_7 > 0) && (_arg_8 > 0)))
|
if(((maxX > 0) && (maxY > 0)))
|
||||||
{
|
{
|
||||||
let _local_12 = 0;
|
let _local_12 = 0;
|
||||||
|
|
||||||
@ -106,16 +106,16 @@ export class PlaneVisualizationAnimationLayer implements IDisposable
|
|||||||
const _local_13 = (this._items[_local_12] as AnimationItem);
|
const _local_13 = (this._items[_local_12] as AnimationItem);
|
||||||
if(_local_13 != null)
|
if(_local_13 != null)
|
||||||
{
|
{
|
||||||
const _local_14 = _local_13.getPosition(_arg_7, _arg_8, _arg_9, _arg_10, _arg_11);
|
const _local_14 = _local_13.getPosition(maxX, maxY, dimensionX, dimensionY, timeSinceStartMs);
|
||||||
|
|
||||||
_local_14.x = (_local_14.x - _arg_5);
|
_local_14.x = (_local_14.x - offsetX);
|
||||||
_local_14.y = (_local_14.y - _arg_6);
|
_local_14.y = (_local_14.y - offsetY);
|
||||||
|
|
||||||
if(_local_13.bitmapData)
|
if(_local_13.bitmapData)
|
||||||
{
|
{
|
||||||
if(_local_14.x > 0 && (_local_14.x + _local_13.bitmapData.width < k.width))
|
if(_local_14.x > 0 && (_local_14.x + _local_13.bitmapData.width < canvas.width))
|
||||||
{
|
{
|
||||||
k
|
canvas
|
||||||
.beginFill(0x00FF00)
|
.beginFill(0x00FF00)
|
||||||
.beginTextureFill({ texture: _local_13.bitmapData.texture, matrix: new Matrix(1, 0, 0, 1, _local_14.x, _local_14.y) })
|
.beginTextureFill({ texture: _local_13.bitmapData.texture, matrix: new Matrix(1, 0, 0, 1, _local_14.x, _local_14.y) })
|
||||||
.drawRect(_local_14.x, _local_14.y, _local_13.bitmapData.width, _local_13.bitmapData.height)
|
.drawRect(_local_14.x, _local_14.y, _local_13.bitmapData.width, _local_13.bitmapData.height)
|
||||||
@ -123,8 +123,8 @@ export class PlaneVisualizationAnimationLayer implements IDisposable
|
|||||||
}
|
}
|
||||||
else if(_local_14.x > 0)
|
else if(_local_14.x > 0)
|
||||||
{
|
{
|
||||||
const difference = k.width - _local_14.x;
|
const difference = canvas.width - _local_14.x;
|
||||||
k
|
canvas
|
||||||
.beginFill(0x00FF00)
|
.beginFill(0x00FF00)
|
||||||
.beginTextureFill({ texture: _local_13.bitmapData.texture, matrix: new Matrix(1, 0, 0, 1, _local_14.x, _local_14.y) })
|
.beginTextureFill({ texture: _local_13.bitmapData.texture, matrix: new Matrix(1, 0, 0, 1, _local_14.x, _local_14.y) })
|
||||||
.drawRect(_local_14.x, _local_14.y, difference, _local_13.bitmapData.height)
|
.drawRect(_local_14.x, _local_14.y, difference, _local_13.bitmapData.height)
|
||||||
@ -134,7 +134,7 @@ export class PlaneVisualizationAnimationLayer implements IDisposable
|
|||||||
{
|
{
|
||||||
//if(_local_14.x > -_local_13.bitmapData.width)
|
//if(_local_14.x > -_local_13.bitmapData.width)
|
||||||
const difference = _local_13.bitmapData.width + _local_14.x;
|
const difference = _local_13.bitmapData.width + _local_14.x;
|
||||||
k
|
canvas
|
||||||
.beginFill(0x00FF00)
|
.beginFill(0x00FF00)
|
||||||
.beginTextureFill({ texture: _local_13.bitmapData.texture, matrix: new Matrix(1, 0, 0, 1, _local_14.x, _local_14.y) })
|
.beginTextureFill({ texture: _local_13.bitmapData.texture, matrix: new Matrix(1, 0, 0, 1, _local_14.x, _local_14.y) })
|
||||||
.drawRect(0, _local_14.y, difference, _local_13.bitmapData.height)
|
.drawRect(0, _local_14.y, difference, _local_13.bitmapData.height)
|
||||||
@ -147,6 +147,6 @@ export class PlaneVisualizationAnimationLayer implements IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return k;
|
return canvas;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ export class FloorPlane extends Plane
|
|||||||
const _local_11 = visualization.geometry.getScreenPoint(new Vector3d(0, (height / visualization.geometry.scale), 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));
|
const _local_12 = visualization.geometry.getScreenPoint(new Vector3d((width / visualization.geometry.scale), 0, 0));
|
||||||
|
|
||||||
let _local_13 = 0;
|
let x = 0;
|
||||||
let _local_14 = 0;
|
let y = 0;
|
||||||
|
|
||||||
if(_local_10 && _local_11 && _local_12)
|
if(_local_10 && _local_11 && _local_12)
|
||||||
{
|
{
|
||||||
@ -29,10 +29,10 @@ export class FloorPlane extends Plane
|
|||||||
|
|
||||||
const _local_15 = (_local_10.x - visualization.geometry.getScreenPoint(new Vector3d(1, 0, 0)).x);
|
const _local_15 = (_local_10.x - visualization.geometry.getScreenPoint(new Vector3d(1, 0, 0)).x);
|
||||||
|
|
||||||
_local_13 = (offsetX * Math.trunc(Math.abs(_local_15)));
|
x = (offsetX * Math.trunc(Math.abs(_local_15)));
|
||||||
_local_14 = (offsetY * Math.trunc(Math.abs(_local_15)));
|
y = (offsetY * Math.trunc(Math.abs(_local_15)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return visualization.render(canvas, width, height, normal, useTexture, _local_13, _local_14);
|
return visualization.render(canvas, width, height, normal, useTexture, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,13 +43,7 @@ export class FloorRasterizer extends PlaneRasterizer
|
|||||||
|
|
||||||
if(!plane) return null;
|
if(!plane) return null;
|
||||||
|
|
||||||
if(canvas)
|
if(canvas) canvas.clear();
|
||||||
{
|
|
||||||
canvas
|
|
||||||
.beginFill(0xFFFFFF)
|
|
||||||
.drawRect(0, 0, canvas.width, canvas.height)
|
|
||||||
.endFill();
|
|
||||||
}
|
|
||||||
|
|
||||||
let graphic = plane.render(canvas, width, height, scale, normal, useTexture, offsetX, offsetY);
|
let graphic = plane.render(canvas, width, height, scale, normal, useTexture, offsetX, offsetY);
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
import { Graphics } from '@pixi/graphics';
|
import { Matrix, Point } from '@pixi/math';
|
||||||
import { Point } from '@pixi/math';
|
|
||||||
import { Sprite } from '@pixi/sprite';
|
|
||||||
import { TilingSprite } from '@pixi/sprite-tiling';
|
|
||||||
import { NitroSprite } from '../../../../../../../core';
|
import { NitroSprite } from '../../../../../../../core';
|
||||||
import { IGraphicAsset } from '../../../../../../../room/object/visualization/utils/IGraphicAsset';
|
import { IGraphicAsset } from '../../../../../../../room/object/visualization/utils/IGraphicAsset';
|
||||||
import { IVector3D } from '../../../../../../../room/utils/IVector3D';
|
import { IVector3D } from '../../../../../../../room/utils/IVector3D';
|
||||||
|
import { Randomizer } from '../../utils';
|
||||||
import { PlaneTexture } from './PlaneTexture';
|
import { PlaneTexture } from './PlaneTexture';
|
||||||
|
|
||||||
export class PlaneMaterialCell
|
export class PlaneMaterialCell
|
||||||
{
|
{
|
||||||
private _cachedBitmapData: Graphics;
|
private _cachedSprite: NitroSprite;
|
||||||
private _texture: PlaneTexture;
|
private _texture: PlaneTexture;
|
||||||
private _extraItemOffsets: Point[];
|
private _extraItemOffsets: Point[];
|
||||||
private _extraItemAssets: IGraphicAsset[];
|
private _extraItemAssets: IGraphicAsset[];
|
||||||
@ -17,7 +15,7 @@ export class PlaneMaterialCell
|
|||||||
|
|
||||||
constructor(texture: PlaneTexture, assets: IGraphicAsset[] = null, offsetPoints: Point[] = null, limit: number = 0)
|
constructor(texture: PlaneTexture, assets: IGraphicAsset[] = null, offsetPoints: Point[] = null, limit: number = 0)
|
||||||
{
|
{
|
||||||
this._cachedBitmapData = null;
|
this._cachedSprite = null;
|
||||||
this._texture = texture;
|
this._texture = texture;
|
||||||
this._extraItemOffsets = [];
|
this._extraItemOffsets = [];
|
||||||
this._extraItemAssets = [];
|
this._extraItemAssets = [];
|
||||||
@ -71,11 +69,11 @@ export class PlaneMaterialCell
|
|||||||
this._texture = null;
|
this._texture = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._cachedBitmapData)
|
if(this._cachedSprite)
|
||||||
{
|
{
|
||||||
this._cachedBitmapData.destroy();
|
this._cachedSprite.destroy();
|
||||||
|
|
||||||
this._cachedBitmapData = null;
|
this._cachedSprite = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._extraItemAssets = null;
|
this._extraItemAssets = null;
|
||||||
@ -85,11 +83,11 @@ export class PlaneMaterialCell
|
|||||||
|
|
||||||
public clearCache(): void
|
public clearCache(): void
|
||||||
{
|
{
|
||||||
if(this._cachedBitmapData)
|
if(this._cachedSprite)
|
||||||
{
|
{
|
||||||
this._cachedBitmapData.destroy();
|
this._cachedSprite.destroy();
|
||||||
|
|
||||||
this._cachedBitmapData = null;
|
this._cachedSprite = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +103,7 @@ export class PlaneMaterialCell
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(normal: IVector3D, textureOffsetX: number, textureOffsetY: number): Sprite
|
public render(normal: IVector3D, textureOffsetX: number, textureOffsetY: number): NitroSprite
|
||||||
{
|
{
|
||||||
if(!this._texture) return null;
|
if(!this._texture) return null;
|
||||||
|
|
||||||
@ -113,7 +111,7 @@ export class PlaneMaterialCell
|
|||||||
|
|
||||||
if(!texture) return null;
|
if(!texture) return null;
|
||||||
|
|
||||||
let bitmap: Sprite = null;
|
const bitmap = new NitroSprite(texture);
|
||||||
|
|
||||||
if((textureOffsetX !== 0) || (textureOffsetY !== 0))
|
if((textureOffsetX !== 0) || (textureOffsetY !== 0))
|
||||||
{
|
{
|
||||||
@ -121,117 +119,100 @@ export class PlaneMaterialCell
|
|||||||
|
|
||||||
while(textureOffsetY < 0) textureOffsetY += texture.height;
|
while(textureOffsetY < 0) textureOffsetY += texture.height;
|
||||||
|
|
||||||
const tiling = new TilingSprite(texture, texture.width, texture.height);
|
bitmap.x = (textureOffsetX % texture.width);
|
||||||
|
bitmap.y = (textureOffsetY % texture.height);
|
||||||
tiling.tilePosition.x = (textureOffsetX % texture.width);
|
|
||||||
tiling.tilePosition.y = (textureOffsetY % texture.height);
|
|
||||||
|
|
||||||
tiling.uvRespectAnchor = true;
|
|
||||||
|
|
||||||
if(textureOffsetX)
|
if(textureOffsetX)
|
||||||
{
|
{
|
||||||
tiling.anchor.x = 1;
|
bitmap.anchor.x = 1;
|
||||||
tiling.scale.x = -1;
|
bitmap.scale.x = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(textureOffsetY)
|
if(textureOffsetY)
|
||||||
{
|
{
|
||||||
tiling.anchor.y = 1;
|
bitmap.anchor.y = 1;
|
||||||
tiling.scale.y = -1;
|
bitmap.scale.y = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bitmap = tiling;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bitmap = new NitroSprite(texture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bitmap)
|
if(bitmap)
|
||||||
{
|
{
|
||||||
// if(!this.isStatic)
|
if(!this.isStatic)
|
||||||
// {
|
{
|
||||||
// if(this._cachedBitmapData)
|
if(this._cachedSprite)
|
||||||
// {
|
{
|
||||||
// if((this._cachedBitmapData.width !== bitmap.width) || (this._cachedBitmapData.height !== bitmap.height))
|
if((this._cachedSprite.width !== bitmap.width) || (this._cachedSprite.height !== bitmap.height))
|
||||||
// {
|
{
|
||||||
// this._cachedBitmapData.destroy();
|
this._cachedSprite.destroy();
|
||||||
|
|
||||||
// this._cachedBitmapData = null;
|
this._cachedSprite = null;
|
||||||
// }
|
}
|
||||||
// else
|
}
|
||||||
// {
|
|
||||||
// const bitmapTexture = TextureUtils.generateTexture(bitmap, new Rectangle(0, 0, bitmap.width, bitmap.height));
|
|
||||||
|
|
||||||
// RoomVisualization.RENDER_TEXTURES.push(bitmapTexture);
|
if(!this._cachedSprite)
|
||||||
|
{
|
||||||
|
this._cachedSprite = new NitroSprite(texture);
|
||||||
|
}
|
||||||
|
|
||||||
// if(bitmapTexture)
|
const limitMin = Math.min(this._extraItemCount, this._extraItemOffsets.length);
|
||||||
// {
|
const limitMax = Math.max(this._extraItemCount, this._extraItemOffsets.length);
|
||||||
// this._cachedBitmapData
|
const offsetIndexes = Randomizer.getArray(this._extraItemCount, limitMax);
|
||||||
// .beginTextureFill({ texture: bitmapTexture })
|
|
||||||
// .drawRect(0, 0, bitmapTexture.width, bitmapTexture.height)
|
|
||||||
// .endFill();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if(!this._cachedBitmapData) this._cachedBitmapData = bitmap.clone();
|
let i = 0;
|
||||||
|
|
||||||
// const limitMin = Math.min(this._extraItemCount, this._extraItemOffsets.length);
|
while(i < limitMin)
|
||||||
// const limitMax = Math.max(this._extraItemCount, this._extraItemOffsets.length);
|
{
|
||||||
// const offsetIndexes = Randomizer.getArray(this._extraItemCount, limitMax);
|
const offset = this._extraItemOffsets[offsetIndexes[i]];
|
||||||
|
const item = this._extraItemAssets[(i % this._extraItemAssets.length)];
|
||||||
|
|
||||||
// let i = 0;
|
if(offset && item)
|
||||||
|
{
|
||||||
|
const assetTexture = item.texture;
|
||||||
|
|
||||||
// while (i < limitMin)
|
if(assetTexture)
|
||||||
// {
|
{
|
||||||
// const offset = this._extraItemOffsets[offsetIndexes[i]];
|
const offsetFinal = new Point((offset.x + item.offsetX), (offset.y + item.offsetY));
|
||||||
// const item = this._extraItemAssets[(i % this._extraItemAssets.length)];
|
const flipMatrix = new Matrix();
|
||||||
|
|
||||||
// if(offset && item)
|
let x = 1;
|
||||||
// {
|
let y = 1;
|
||||||
// const assetTexture = item.texture;
|
let translateX = 0;
|
||||||
|
let translateY = 0;
|
||||||
|
|
||||||
// if(assetTexture)
|
if(item.flipH)
|
||||||
// {
|
{
|
||||||
// const offsetFinal = new Point((offset.x + item.offsetX), (offset.y + item.offsetY));
|
x = -1;
|
||||||
// const flipMatrix = new Matrix();
|
translateX = assetTexture.width;
|
||||||
|
}
|
||||||
|
|
||||||
// let x = 1;
|
if(item.flipV)
|
||||||
// let y = 1;
|
{
|
||||||
// let translateX = 0;
|
y = -1;
|
||||||
// let translateY = 0;
|
translateY = assetTexture.height;
|
||||||
|
}
|
||||||
|
|
||||||
// if(item.flipH)
|
let offsetX = (offsetFinal.x + translateX);
|
||||||
// {
|
offsetX = ((offsetX >> 1) << 1);
|
||||||
// x = -1;
|
|
||||||
// translateX = assetTexture.width;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if(item.flipV)
|
flipMatrix.scale(x, y);
|
||||||
// {
|
flipMatrix.translate(offsetX, (offsetFinal.y + translateY));
|
||||||
// y = -1;
|
|
||||||
// translateY = assetTexture.height;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// let offsetX = (offsetFinal.x + translateX);
|
const sprite = new NitroSprite(assetTexture);
|
||||||
// offsetX = ((offsetX >> 1) << 1);
|
|
||||||
|
|
||||||
// flipMatrix.scale(x, y);
|
sprite.transform.setFromMatrix(flipMatrix);
|
||||||
// flipMatrix.translate(offsetX, (offsetFinal.y + translateY));
|
|
||||||
|
|
||||||
// this._cachedBitmapData
|
sprite.x = flipMatrix.tx;
|
||||||
// .beginTextureFill({ texture: assetTexture, matrix: flipMatrix })
|
sprite.y = flipMatrix.ty;
|
||||||
// .drawRect(flipMatrix.tx, flipMatrix.ty, assetTexture.width, assetTexture.height)
|
|
||||||
// .endFill();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// i++;
|
this._cachedSprite.addChild(sprite);
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// return this._cachedBitmapData;
|
i++;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
return this._cachedSprite;
|
||||||
|
}
|
||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Graphics } from '@pixi/graphics';
|
import { Graphics } from '@pixi/graphics';
|
||||||
|
import { NitroRenderTexture } from '../../../../../../../core';
|
||||||
import { IVector3D } from '../../../../../../../room/utils/IVector3D';
|
import { IVector3D } from '../../../../../../../room/utils/IVector3D';
|
||||||
import { Vector3d } from '../../../../../../../room/utils/Vector3d';
|
import { Vector3d } from '../../../../../../../room/utils/Vector3d';
|
||||||
import { PlaneMaterialCell } from './PlaneMaterialCell';
|
import { PlaneMaterialCell } from './PlaneMaterialCell';
|
||||||
@ -15,6 +16,7 @@ export class PlaneMaterialCellColumn
|
|||||||
private _cells: PlaneMaterialCell[];
|
private _cells: PlaneMaterialCell[];
|
||||||
private _repeatMode: number;
|
private _repeatMode: number;
|
||||||
private _width: number;
|
private _width: number;
|
||||||
|
private _cachedTexture: NitroRenderTexture;
|
||||||
private _cachedBitmapData: Graphics;
|
private _cachedBitmapData: Graphics;
|
||||||
private _cachedBitmapNormal: Vector3d;
|
private _cachedBitmapNormal: Vector3d;
|
||||||
private _cachedBitmapDataOffsetX: number;
|
private _cachedBitmapDataOffsetX: number;
|
||||||
@ -192,19 +194,19 @@ export class PlaneMaterialCellColumn
|
|||||||
this.renderRepeatNone(normal);
|
this.renderRepeatNone(normal);
|
||||||
break;
|
break;
|
||||||
case PlaneMaterialCellColumn.REPEAT_MODE_BORDERS:
|
case PlaneMaterialCellColumn.REPEAT_MODE_BORDERS:
|
||||||
console.log('tru2');
|
console.log('REPEAT_MODE_BORDERS');
|
||||||
// this.renderRepeatBorders(normal);
|
// this.renderRepeatBorders(normal);
|
||||||
break;
|
break;
|
||||||
case PlaneMaterialCellColumn.REPEAT_MODE_CENTER:
|
case PlaneMaterialCellColumn.REPEAT_MODE_CENTER:
|
||||||
console.log('tru3');
|
console.log('REPEAT_MODE_CENTER');
|
||||||
// this.renderRepeatCenter(normal);
|
// this.renderRepeatCenter(normal);
|
||||||
break;
|
break;
|
||||||
case PlaneMaterialCellColumn.REPEAT_MODE_FIRST:
|
case PlaneMaterialCellColumn.REPEAT_MODE_FIRST:
|
||||||
console.log('tru4');
|
console.log('REPEAT_MODE_FIRST');
|
||||||
// this.renderRepeatFirst(normal);
|
// this.renderRepeatFirst(normal);
|
||||||
break;
|
break;
|
||||||
case PlaneMaterialCellColumn.REPEAT_MODE_LAST:
|
case PlaneMaterialCellColumn.REPEAT_MODE_LAST:
|
||||||
console.log('tru5');
|
console.log('REPEAT_MODE_LAST');
|
||||||
// this.renderRepeatLast(normal);
|
// this.renderRepeatLast(normal);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -362,59 +362,43 @@ export class PlaneMaterialCellMatrix
|
|||||||
if(!canvas || !columns || !columns.length) return new Point(x, 0);
|
if(!canvas || !columns || !columns.length) return new Point(x, 0);
|
||||||
|
|
||||||
let height = 0;
|
let height = 0;
|
||||||
let _local_6: Graphics = null;
|
let i = 0;
|
||||||
let _local_7 = 0;
|
|
||||||
|
|
||||||
while(_local_7 < columns.length)
|
while(i < columns.length)
|
||||||
{
|
{
|
||||||
if(flag)
|
const column = flag ? columns[i] : columns[((columns.length - 1) - i)];
|
||||||
{
|
|
||||||
_local_6 = columns[_local_7];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_local_6 = columns[((columns.length - 1) - _local_7)];
|
|
||||||
}
|
|
||||||
if(_local_6 != null)
|
|
||||||
{
|
|
||||||
if(!flag)
|
|
||||||
{
|
|
||||||
x = (x - _local_6.width);
|
|
||||||
}
|
|
||||||
let _local_8 = 0;
|
|
||||||
if(this._align == PlaneMaterialCellMatrix.ALIGN_BOTTOM)
|
|
||||||
{
|
|
||||||
_local_8 = (canvas.height - _local_6.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
let texture = RoomVisualization.getTextureCache(_local_6);
|
if(column)
|
||||||
|
{
|
||||||
|
if(!flag) x = (x - column.width);
|
||||||
|
|
||||||
|
let y = 0;
|
||||||
|
|
||||||
|
if(this._align == PlaneMaterialCellMatrix.ALIGN_BOTTOM) y = (canvas.height - column.height);
|
||||||
|
|
||||||
|
let texture = RoomVisualization.getTextureCache(column);
|
||||||
|
|
||||||
if(!texture)
|
if(!texture)
|
||||||
{
|
{
|
||||||
texture = TextureUtils.generateTexture(_local_6, new Rectangle(0, 0, _local_6.width, _local_6.height));
|
texture = TextureUtils.generateTexture(column, new Rectangle(0, 0, column.width, column.height));
|
||||||
|
|
||||||
RoomVisualization.addTextureCache(_local_6, texture);
|
RoomVisualization.addTextureCache(column, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.beginTextureFill({ texture });
|
canvas.beginTextureFill({ texture });
|
||||||
canvas.drawRect(x, _local_8, texture.width, texture.height);
|
canvas.drawRect(x, y, texture.width, texture.height);
|
||||||
canvas.endFill();
|
canvas.endFill();
|
||||||
|
|
||||||
if(_local_6.height > height)
|
if(column.height > height) height = column.height;
|
||||||
{
|
|
||||||
height = _local_6.height;
|
if(flag) x = (x + column.width);
|
||||||
|
|
||||||
|
if((flag && (x >= canvas.width)) || (!flag && (x <= 0))) return new Point(x, height);
|
||||||
}
|
}
|
||||||
if(flag)
|
|
||||||
{
|
i++;
|
||||||
x = (x + _local_6.width);
|
|
||||||
}
|
|
||||||
if((((flag) && (x >= canvas.width)) || ((!(flag)) && (x <= 0))))
|
|
||||||
{
|
|
||||||
return new Point(x, height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_local_7++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Point(x, height);
|
return new Point(x, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
import { Graphics } from '@pixi/graphics';
|
import { Graphics } from '@pixi/graphics';
|
||||||
import { Rectangle } from '@pixi/math';
|
|
||||||
import { IDisposable } from '../../../../../../../core/common/disposable/IDisposable';
|
import { IDisposable } from '../../../../../../../core/common/disposable/IDisposable';
|
||||||
import { IGraphicAssetCollection } from '../../../../../../../room/object/visualization/utils/IGraphicAssetCollection';
|
import { IGraphicAssetCollection } from '../../../../../../../room/object/visualization/utils/IGraphicAssetCollection';
|
||||||
import { IRoomGeometry } from '../../../../../../../room/utils/IRoomGeometry';
|
import { IRoomGeometry } from '../../../../../../../room/utils/IRoomGeometry';
|
||||||
import { IVector3D } from '../../../../../../../room/utils/IVector3D';
|
import { IVector3D } from '../../../../../../../room/utils/IVector3D';
|
||||||
import { TextureUtils } from '../../../../../../../room/utils/TextureUtils';
|
|
||||||
import { Vector3d } from '../../../../../../../room/utils/Vector3d';
|
import { Vector3d } from '../../../../../../../room/utils/Vector3d';
|
||||||
import { PlaneVisualizationAnimationLayer } from '../animated/PlaneVisualizationAnimationLayer';
|
import { PlaneVisualizationAnimationLayer } from '../animated/PlaneVisualizationAnimationLayer';
|
||||||
import { PlaneMaterial } from './PlaneMaterial';
|
import { PlaneMaterial } from './PlaneMaterial';
|
||||||
@ -159,17 +157,20 @@ export class PlaneVisualization
|
|||||||
{
|
{
|
||||||
if(canvas)
|
if(canvas)
|
||||||
{
|
{
|
||||||
const texture = TextureUtils.generateTexture(this._cachedBitmapData, new Rectangle(0, 0, width, height));
|
canvas.addChild(this._cachedBitmapData);
|
||||||
|
|
||||||
if(texture)
|
|
||||||
{
|
|
||||||
canvas
|
|
||||||
.beginTextureFill({ texture })
|
|
||||||
.drawRect(0, 0, texture.width, texture.height)
|
|
||||||
.endFill();
|
|
||||||
|
|
||||||
return canvas;
|
return canvas;
|
||||||
}
|
// const texture = TextureUtils.generateTexture(this._cachedBitmapData, new Rectangle(0, 0, width, height));
|
||||||
|
|
||||||
|
// if(texture)
|
||||||
|
// {
|
||||||
|
// canvas
|
||||||
|
// .beginTextureFill({ texture })
|
||||||
|
// .drawRect(0, 0, texture.width, texture.height)
|
||||||
|
// .endFill();
|
||||||
|
|
||||||
|
// return canvas;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._cachedBitmapData;
|
return this._cachedBitmapData;
|
||||||
@ -187,12 +188,10 @@ export class PlaneVisualization
|
|||||||
|
|
||||||
if(!this._cachedBitmapData)
|
if(!this._cachedBitmapData)
|
||||||
{
|
{
|
||||||
const graphic = new Graphics()
|
this._cachedBitmapData = new Graphics()
|
||||||
.beginFill(0xFFFFFF)
|
.beginFill(0xFFFFFF)
|
||||||
.drawRect(0, 0, width, height)
|
.drawRect(0, 0, width, height)
|
||||||
.endFill();
|
.endFill();
|
||||||
|
|
||||||
this._cachedBitmapData = graphic;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -226,12 +225,13 @@ export class PlaneVisualization
|
|||||||
|
|
||||||
if(canvas && (canvas !== this._cachedBitmapData))
|
if(canvas && (canvas !== this._cachedBitmapData))
|
||||||
{
|
{
|
||||||
const texture = TextureUtils.generateTexture(canvas, new Rectangle(0, 0, canvas.width, canvas.height));
|
this._cachedBitmapData.addChild(canvas.clone());
|
||||||
|
// const texture = TextureUtils.generateTexture(canvas, new Rectangle(0, 0, canvas.width, canvas.height));
|
||||||
|
|
||||||
this._cachedBitmapData
|
// this._cachedBitmapData
|
||||||
.beginTextureFill({ texture })
|
// .beginTextureFill({ texture })
|
||||||
.drawRect(0, 0, canvas.width, canvas.height)
|
// .drawRect(0, 0, canvas.width, canvas.height)
|
||||||
.endFill();
|
// .endFill();
|
||||||
|
|
||||||
return canvas;
|
return canvas;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user