Yeah, I also thought about using/abusing the _XX_ flag system for this. I'm not sure how I could turn the flags on/off in the pipeline.xml though. It's only setup to be done from the material.xml file I think. It would probably require more hacking than I'm willing to do at this point.
I'll look into the h3dSetShaderPreambles approach. A quick look at the docstring says, "The preamble is used when a shader is compiled, so changing it will not affect any shaders that are already compiled." so I think this approach may not work for my purpose, as I'd really like to change the value between draw calls.
For fun I decided just to try using a Uniform for this to see how the performance is without loop unrolling - maybe it's not that bad! I've run into some troubles here too though... The material system in Horde3D seems setup to only handle float types. The
documentation (see "FX Section") just describes float and float4 types. So I'm forced into using a float type to check my loop iterations (which works +/-1 iteration
, but it's just not ideal).
The real problem is that I can't seem to override the value specified in the material.xml file:
Code:
<Uniform name="maxSteps" a="128"/>
with the value specified in the pipeline.xml file:
Code:
<SetUniform material="models/cube/cube.material.xml" uniform="maxSteps" a="32" />
I've stepped through the Horde3D code with a debugger and everything seems to go just fine. I can see the material resource's uniforms being set with the proper "pipeline" values in Renderer::render(). So I'm not sure where it's going wrong. I'll investigate more later. Any thoughts about where to look are appreciated!
Thanks,
Spacecookies