I have a RenderPath which is responsible for rendering a quad with a texture. So far i created a command for using a texture from disk.
<renderpath>
<command output="viewport" ps="Quad" type="quad" vs="Quad"
<texture unit="diffuse" name="Textures/Mushroom.dds"/>
</command>
</renderpath>
This works fine, now i want to change this texture programmatically in each new frame. How can i achieve this with c++? The texture is ready and i can grab the render path via the viewport in an eventcallback for begin_frame. But i am only able to change texture name.
Viewport* overlayViewport = renderer->GetViewport(1);
RenderPath * rp = overlayViewport->GetRenderPath();
for ( int i = 0; i < rp->GetNumCommands(); i++ ) {
RenderPathCommand *cmd = rp->GetCommand(i);
if (cmd->type_ == RenderCommandType::CMD_QUAD) {
cmd->SetTextureName(TextureUnit::TU_DIFFUSE, "texturename");
}
}