Faulty shader system
Here's my shader's callback:
This is why I said it's a hack and could be done better. Ideally, niko should add a setPixelShaderConstant() overload taking ints. I just hacked it together to make sure it works.
Code: Select all
class TerrainShader : public video::IShaderConstantSetCallBack
{
public:
virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 user)
{
// set 4 texture units for splatting terrain
int c[] = { 0, 1, 2, 3 }; // sampler2d IDs
services->setPixelShaderConstant("dirt", (float*)&c[0], 1);
services->setPixelShaderConstant("grass", (float*)&c[1], 1);
services->setPixelShaderConstant("pebbles", (float*)&c[2], 1);
services->setPixelShaderConstant("alphamap", (float*)&c[3], 1);
}
};
-
Guest