We are using UrhoSharp.
We create a lot of quads (that each render an icon). Each has a color that should be looked up in a table. I’d like to have each vertex use the “Y” Position component simply as an Index into this Color Table, as shown in this HLSL mock-up:
uniform float3 cColorTable;
void VS(float4 iPos : POSITION)
int colorIndex = int(iPos.Y);
oColor = cColorTable[colorIndex];
iPos.Y = 0;
How do you fill the cColorTable data from Urho?
I saw an API for “Graphics.SetShaderParameter(StringHash Name, float* data, uint count)” - but this appears to be too “global”. We’re just wanting to set the cColorTable for this one material, similar to what we see with “material.SetShaderParameter(…)” but there are no overloads here for setting an array of values.
This solution is needed for other shaders as well.
If we are forced to use the “Graphics.SetShaderParameter(name, float* data, uint count)” interface, it seems like we would need to follow some special method for inserting this logic at the appropriate time before each Batch render call (as the data may render for each batch of renderables). When we set it on the “Material”, I’m assuming that Urho3D magically handles this timing for us. So it’s a bit frustrating that Urho3D Material.SetShaderParameter doesn’t permit us to set Array data.