I thought long and hard how to solve this as awkward and complicated as possible and I think I have an idea!
- Put a specific tag on the material, e.g. “gui_beam”
- Send off the box-size-factor from the gui-script to the render-script, msg.post("@render:", “beam”, …)
- Draw the “gui_beam” tag using a separate predicate and supply the factor as shader constants!
The big flaw with this is that it sort of hard-codes the amount of beams, at least you need to count or address them on a global scope (since the constants are set in the global render-script).
Some links to achieve it:
- Passing messages to “system sockets”: http://www.defold.com/doc/message-passing
- Creating a shader constant buffers: http://www.defold.com/ref/render#render.constant_buffer
- Create a new predicate using “gui_beam” tag: http://www.defold.com/ref/render#render.predicate
- Pass the constant buffer to render.draw: http://www.defold.com/ref/render#render.draw