BPL_BL_Canvas
BurrowLib 0.1.0, in the palette under BurrowLib › Canvas.
Drawing into a render target from a Blueprint.
A render target’s canvas draws every call on its own, so a picture made of many small draws costs a render draw each, and a thousand a frame is enough to stall the game. Instead, collect the picture as triangles in one array with AddRect, and hand the whole array to DrawTriangles, which draws it in a single call.
Functions
Section titled “Functions”AddRect
Section titled “AddRect”fn AddRect(tris: ref array<CanvasUVTri>, x: float, y: float, w: float, h: float, colour: LinearColor)Adds a filled rectangle to a batch, as two triangles of one colour. x and y are its top left corner, in pixels of the render target.
DrawTriangles
Section titled “DrawTriangles”fn DrawTriangles(target: TextureRenderTarget2D, tris: ref array<CanvasUVTri>)Draws a batch of triangles into a render target in one call. It draws over what the target already holds, so a picture that changes should start with a rectangle covering it.