mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-26 17:30:52 +01:00
Fix mask error
This commit is contained in:
parent
cef89934d3
commit
354f72c9c5
@ -779,7 +779,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
{
|
{
|
||||||
if(!canvas || !geometry) return;
|
if(!canvas || !geometry) return;
|
||||||
|
|
||||||
if(((!this._useMask) || ((!this._bitmapMasks.length && !this._rectangleMasks.length) && !this._maskChanged)) || !this._maskManager) return;
|
if(!this._useMask || ((!this._bitmapMasks.length && !this._rectangleMasks.length) && !this._maskChanged) || !this._maskManager) return;
|
||||||
|
|
||||||
const width = canvas.width;
|
const width = canvas.width;
|
||||||
const height = canvas.height;
|
const height = canvas.height;
|
||||||
@ -788,12 +788,6 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
if(!this._maskBitmapData || (this._maskBitmapData.width !== width) || (this._maskBitmapData.height !== height))
|
if(!this._maskBitmapData || (this._maskBitmapData.width !== width) || (this._maskBitmapData.height !== height))
|
||||||
{
|
{
|
||||||
if(this._maskBitmapData)
|
|
||||||
{
|
|
||||||
this._maskBitmapData.destroy(true);
|
|
||||||
this._maskBitmapData = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._maskBitmapData = this._textureCache.createAndFillRenderTexture(width, height, 'mask');
|
this._maskBitmapData = this._textureCache.createAndFillRenderTexture(width, height, 'mask');
|
||||||
this._maskChanged = true;
|
this._maskChanged = true;
|
||||||
}
|
}
|
||||||
@ -845,10 +839,14 @@ export class RoomPlane implements IRoomPlane
|
|||||||
const wd = ((this._maskBitmapData.width * rectMask.leftSideLength) / this._leftSide.length);
|
const wd = ((this._maskBitmapData.width * rectMask.leftSideLength) / this._leftSide.length);
|
||||||
const ht = ((this._maskBitmapData.height * rectMask.rightSideLength) / this._rightSide.length);
|
const ht = ((this._maskBitmapData.height * rectMask.rightSideLength) / this._rightSide.length);
|
||||||
|
|
||||||
/* this._maskBitmapData
|
const sprite = new Sprite(Texture.WHITE);
|
||||||
.beginFill(0xFF0000)
|
|
||||||
.drawRect((posX - wd), (posY - ht), wd, ht)
|
sprite.tint = 0x000000;
|
||||||
.endFill(); */
|
sprite.width = wd;
|
||||||
|
sprite.height = ht;
|
||||||
|
sprite.position.set((posX - wd), (posY - ht));
|
||||||
|
|
||||||
|
this._textureCache.writeToRenderTexture(sprite, this._maskBitmapData, false);
|
||||||
|
|
||||||
this._rectangleMasksOld.push(new RoomPlaneRectangleMask(rectMask.leftSideLength, rectMask.rightSideLoc, rectMask.leftSideLength, rectMask.rightSideLength));
|
this._rectangleMasksOld.push(new RoomPlaneRectangleMask(rectMask.leftSideLength, rectMask.rightSideLoc, rectMask.leftSideLength, rectMask.rightSideLength));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user