In shader language i don't know how to pass variables to struct uniform,please look the codes below,color messages can not be passed to Lighting struct.Anyone knows how to make it working?
Thank you!
Code: Select all
pixel shader:
struct Lighting
{
float R;
float G;
float B;
};
uniform Lighting L;
void main()
{
gl_FragColor = vec4(L.R,L.G,L.B,1.0);
}
irrlicht code:
float lighting[3] = {1.0,1.0,0.0};
int size = sizeof(lighting)/4;
services->setPixelShaderConstant("L",reinterpret_cast<f32*>(&lighting),size);
i also try to use this style:
struct Lighting
{
f32 R;
f32 G;
f32 B;
};
Lighting lighting = {1.0f,1.0f,0.0f};
int size = sizeof(lighting)/4;
services->setPixelShaderConstant("L",reinterpret_cast<f32*>(&lighting),size);