Using a renderer to draw things


I’m trying to figure out how to draw things using component renderers. I’ve done a little of this so far, as well as the heatmap extension, but so far I’ve just been finding existing examples of functions and altering them slightly for my purposes.

With vines, I used the ladder component’s drawing of models as a basis for rendering the vine qb models on appropriate faces of the vine entity’s voxel location (_radiant.client.create_qubicle_matrix_node). With connections, I used the mining zone component’s drawing of outlines as a basis for rendering the connector regions that connection entities use for determining if they can connect to one another (_radiant.client.create_region_outline_node). With heatmaps, I’m just using the same code from the original appeal heatmap code to draw colored squares, though I corrected the half-voxel displacement on the x-axis (node:add_filled_xz_quad). In the pathfinder renderer, I can see an example of drawing simple lines (node:add_line), and there’re some very specifically stylized zone rendering functions (_radiant.client.create_designation_node and _radiant.client.create_stockpile_node).

But that’s basically it. And maybe there are other optional arguments for something like that add_line function that allow you to specify width or something, but I’m limited by the examples that exist in the game, since as far as I can tell, all the rendering engine stuff is in the C++ engine and there’s no documentation for it.

Are there any functions I can use to draw arbitrary polygons? Filled shapes specified by vertices? Even just a triangle? Filling with patterns, gradients, or textures? Options for drawing a line with some sort of width, pattern, or color gradient?


The renderer API is pretty minimal - mostly just enough to create and manage render nodes, and most of the actual appearance is done through assets and materials. I don’t know if there’s an easy way to export all Lua binding signatures, but I know @ayazar wanted to do that at some point. As a last resort, just posting the bindings parts of lua_renderer.cpp and open_client.cpp should probably give modders enough to start experimenting (since calling a method with invalid args tells you all its valid signatures).