Fix the material error

This commit is contained in:
Bill 2023-01-13 03:33:20 -05:00
parent 1602b4c5fc
commit 9e50ea0afe

View File

@ -68,6 +68,8 @@ export class PlaneVisualizationLayer
const b = (this._color & 0xFF);
const hasColor = ((r < 0xFF) || (g < 0xFF) || (b < 0xFF));
if(this._material)
{
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)
@ -78,6 +80,13 @@ export class PlaneVisualizationLayer
textureCache.writeToRenderTexture(sprite, canvas, false);
}
}
else
{
const bitmapData = textureCache.createAndFillRenderTexture(width, height, planeId, this._color);
textureCache.writeToRenderTexture(new Sprite(bitmapData), canvas, false);
}
return canvas;
}