I’m not seeing any mention of how to reference them
A short manual for render constant buffers and how they related with materials / drawing predicates would be useful. I’ll answer some of what you mention even if it’s clear to you now.
You want to edit the material and fragment program to add the constants you are interested in. See how the tint constant is setup for the builtin sprite material. Unused constants are automatically stripped from shader programs.
You can pass the view size of the window as an additional constant when drawing a predicate. The code sample I posted above is an example of using constants.
local constants_1 = render.constant_buffer()
constants.sector = vmath.vector4(sector_start, sector_end, 1, 1)
render.draw(self.pred_1, constants_1)
So you could do
local clip_constants = render.constant_buffer()
local window_view_size = vmath.vector4()
window_view_size.x = render.get_window_width()
window_view_size.y = render.get_window_height()
render.draw(self.pred_tiles, clip_constants)
(I’m pretty sure render.get_window_width() etc is for the actual view size of the window but don’t remember for sure atm, DefOS has a get view size function too.)
Then in a “pred_tiles” predicate it would be sent a window_view_size vec4 and you would be able to use it similar to how tint is used in sprites.
You can also update constants directly on for example sprite components but that breaks batching and in this case isn’t useful.
Also, I think it sounds like they don’t have any inherent meaning other that what you use them for
Right, vec4s are just the container being always used for right now. You don’t have to use all of the fields.
Something like vec4(center_x, center_y, sector_start, sector_end)
Yes, you can do that.