I am working a game engine with DirectX9. This is my first time working with DirectX9.
I am able to obtain following results:
std::vector<std::string> tex_keys = {
mesh + "_Diffuse",
mesh + "_Ambient",
mesh + "_Specular",
mesh + "_Dissolve",
mesh + "_Bump",
mesh + "_Sharpness"
};
auto device = GetDevice();
// Diffuse Map _ Base Texture
if (TextureMap[tex_keys[0]])
{
device->SetTextureStageState(TextureMap[tex_keys[0]]->GetSlot(), D3DTSS_COLOROP, D3DTOP_MODULATE);
device->SetTextureStageState(TextureMap[tex_keys[0]]->GetSlot(), D3DTSS_COLORARG1, D3DTA_TEXTURE);
device->SetTextureStageState(TextureMap[tex_keys[0]]->GetSlot(), D3DTSS_COLORARG2, D3DTA_DIFFUSE);
device->SetTextureStageState(TextureMap[tex_keys[0]]->GetSlot(), D3DTSS_ALPHAOP, D3DTOP_MODULATE);
device->SetTextureStageState(TextureMap[tex_keys[0]]->GetSlot(), D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
device->SetTextureStageState(TextureMap[tex_keys[0]]->GetSlot(), D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
TextureMap[tex_keys[0]]->Bind();
}
// Specular Map
if (TextureMap[tex_keys[2]])
{
device->SetTextureStageState(TextureMap[tex_keys[2]]->GetSlot(), D3DTSS_COLOROP, D3DTOP_ADD);
device->SetTextureStageState(TextureMap[tex_keys[2]]->GetSlot(), D3DTSS_COLORARG1, D3DTA_TEXTURE);
device->SetTextureStageState(TextureMap[tex_keys[2]]->GetSlot(), D3DTSS_COLORARG2, D3DTA_CURRENT);
TextureMap[tex_keys[2]]->Bind();
}
I would like to know how to apply bump map texture to the mesh by extending the above code.