marciano wrote:
The [ in comments is easy to fix:
Yeah, I figured it would be a quick fix. I was mainly concerned about the effect it would have when using arrays. I only mentioned it in relation to comments because that's where the problem popped up for me. 3 cheers for EngineOptions::DumpFailedShaders
marciano wrote:
Are you sure that there is some bug?
Take the following material and shader as an example.
Code:
<Material>
<Shader source="shaders/plain.shader" />
<Uniform name="color" a="1.0" b="1.0" c="1.0" d="1.0" />
</Material>
Code:
[[FX]]
<Uniform id="color" a="0.0" b="1.0" c="0.0" d="1.0" />
<Context id="AMBIENT">
<Shaders vertex="VS_general" fragment="FS_ambient"/>
</Context>
[[VS_general]]
#include "shaders/utilityLib/vertCommon.glsl"
void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * calcWorldPos(gl_Vertex);
}
[[FS_ambient]]
uniform vec4 color;
void main(void)
{
gl_FragColor = color;
}
When I use this the color applied to the object is green as set in the shader rather than white as set in the material. If I instead just use the defaults in the shader (<Uniform id="color" />) then the object is black.
marciano wrote:
Concerning the id/name issue: Actually I was thinking about using id instead of name. But usually I use id when a new variable is declared which is the case in the shader. In the material that declared variable is just referenced, that's why name is used here. Does that make sense to anyone else than me?
Well, that makes sense but personally I still would have used id in the material