From 9e50ea0afee695b8e3c4233f5b420a6fd8f849fe Mon Sep 17 00:00:00 2001 From: Bill Date: Fri, 13 Jan 2023 03:33:20 -0500 Subject: [PATCH] Fix the material error --- .../basic/PlaneVisualizationLayer.ts | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts index 026abd88..2906167d 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts @@ -68,15 +68,24 @@ export class PlaneVisualizationLayer const b = (this._color & 0xFF); const hasColor = ((r < 0xFF) || (g < 0xFF) || (b < 0xFF)); - const bitmapData = this._material.render(planeId, textureCache, hasColor ? null : canvas, width, height, normal, useTexture, offsetX, (offsetY + this.offset), (this.align === PlaneVisualizationLayer.ALIGN_TOP)); - - if(bitmapData && hasColor) + if(this._material) { - const sprite = new Sprite(bitmapData); + const bitmapData = this._material.render(planeId, textureCache, hasColor ? null : canvas, width, height, normal, useTexture, offsetX, (offsetY + this.offset), (this.align === PlaneVisualizationLayer.ALIGN_TOP)); - if(hasColor) sprite.tint = this._color; + if(bitmapData && hasColor) + { + const sprite = new Sprite(bitmapData); - textureCache.writeToRenderTexture(sprite, canvas, false); + if(hasColor) sprite.tint = this._color; + + textureCache.writeToRenderTexture(sprite, canvas, false); + } + } + else + { + const bitmapData = textureCache.createAndFillRenderTexture(width, height, planeId, this._color); + + textureCache.writeToRenderTexture(new Sprite(bitmapData), canvas, false); } return canvas;