|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001206||OpenClonk||Engine - C4Script||public||2015-01-01 20:19||2016-11-12 23:28|
|Target Version||Fixed in Version||8.0|
|Summary||0001206: Script functions to affect shaders at runtime|
|Description||It's already possible to overload shaders in local Graphics.ocg files in scenarios. This potentially offers great possibilities for scenario authors to create special effects. However, you cannot really control them at runtime by script. I would like to see:|
* Functions to set variables in the shader from script
* Options to have multiple sets of shaders which differ by values for #defines and between which you can switch.
|Tags||No tags attached.|
I added AddFragmentShader()  which allows adding (and also removing) shader slices during runtime. It could be used for the second point, although it involves re-compiling the shader on each switch.
Hi! There's been a check-in that references this bug. For more information you can visit the repository browser at this address:
Changeset 6847e50 by Lukas Werling <firstname.lastname@example.org>
Implement setting shader uniforms from script (0001206)
Uniform variables are read from the "Uniforms" proplist set on Scenario
or on individual objects. Proplist keys are uniform names. Values can
either be an int or an array of one to four ints in C4Script. In GLSL,
the uniforms then need a matching type (int/ivec2/ivec3/ivec4). There is
no error reporting; uniforms are only set if both name and type match.
The implementation walks the "Uniforms" proplists on each Draw call. We
may need to cache the uniform maps if this turns out to be too slow.
|It's now possible to load custom shaders and to set uniforms globally, per definition, or per object. This should be enough for most graphical effects, I think.|
|2015-01-01 20:19||Sven2||New Issue|
|2016-10-30 11:45||Luchs||Note Added: 0005476|
|2016-10-30 11:46||Luchs||Status||new => acknowledged|
|2016-11-12 21:10||occ||Note Added: 0005490|
|2016-11-12 23:28||Luchs||Assigned To||=> Luchs|
|2016-11-12 23:28||Luchs||Status||acknowledged => resolved|
|2016-11-12 23:28||Luchs||Resolution||open => fixed|
|2016-11-12 23:28||Luchs||Fixed in Version||=> 8.0|
|2016-11-12 23:28||Luchs||Note Added: 0005491|