void RenderSystem_Deferred::SetMaterialGBuffer(MaterialPtr pMaterial) { MaterialParameterPtr pParam = pMaterial->GetParameterByName("_DR_G_BUFFER_0"); pParam ? pParam->SetParameterTexture(m_pGBuffer->GetTexture(0)) : (void)0; pParam = pMaterial->GetParameterByName("_DR_G_BUFFER_1"); pParam ? pParam->SetParameterTexture(m_pGBuffer->GetTexture(1)) : (void)0; pParam = pMaterial->GetParameterByName("_DR_G_BUFFER_2"); pParam ? pParam->SetParameterTexture(m_pGBuffer->GetTexture(2)) : (void)0; }
bool VoxelWorldMaterialManager::Initialize(RenderManagerPtr pRenderManager) { MaterialParameterPtr pParam; TexturePtr pTex; MaterialPtr pMat; // soil pTex = pRenderManager->CreateTextureFromFile("assets/voxel/texture/dirt.dds"); pMat = pRenderManager->CreateMaterialFromFile("assets/voxel/material/voxel_world.material"); pParam = pMat->GetParameterByName("diffuse_map"); pParam->SetParameterTexture(pTex); m_materials[VT_SOIL].pTex = pTex; m_materials[VT_SOIL].pMaterial = pMat; // rock pTex = pRenderManager->CreateTextureFromFile("assets/voxel/texture/rock.dds"); pMat = pRenderManager->CreateMaterialFromFile("assets/voxel/material/voxel_world.material"); pParam = pMat->GetParameterByName("diffuse_map"); pParam->SetParameterTexture(pTex); m_materials[VT_STONE].pTex = pTex; m_materials[VT_STONE].pMaterial = pMat; // iron pTex = pRenderManager->CreateTextureFromFile("assets/voxel/texture/rock.dds"); pMat = pRenderManager->CreateMaterialFromFile("assets/voxel/material/voxel_world.material"); pParam = pMat->GetParameterByName("diffuse_map"); pParam->SetParameterTexture(pTex); m_materials[VT_IRON].pTex = pTex; m_materials[VT_IRON].pMaterial = pMat; // silver pTex = pRenderManager->CreateTextureFromFile("assets/voxel/texture/rock.dds"); pMat = pRenderManager->CreateMaterialFromFile("assets/voxel/material/voxel_world.material"); pParam = pMat->GetParameterByName("diffuse_map"); pParam->SetParameterTexture(pTex); m_materials[VT_SILVER].pTex = pTex; m_materials[VT_SILVER].pMaterial = pMat; // gold pTex = pRenderManager->CreateTextureFromFile("assets/voxel/texture/rock.dds"); pMat = pRenderManager->CreateMaterialFromFile("assets/voxel/material/voxel_world.material"); pParam = pMat->GetParameterByName("diffuse_map"); pParam->SetParameterTexture(pTex); m_materials[VT_GOLD].pTex = pTex; m_materials[VT_GOLD].pMaterial = pMat; // water pTex = pRenderManager->CreateTextureFromFile("assets/voxel/texture/dirt.dds"); pMat = pRenderManager->CreateMaterialFromFile("assets/voxel/material/voxel_world.material"); pParam = pMat->GetParameterByName("diffuse_map"); pParam->SetParameterTexture(pTex); m_materials[VT_WATER].pTex = pTex; m_materials[VT_WATER].pMaterial = pMat; // grass pTex = pRenderManager->CreateTextureFromFile("assets/voxel/texture/dirt.dds"); pMat = pRenderManager->CreateMaterialFromFile("assets/voxel/material/voxel_world.material"); pParam = pMat->GetParameterByName("diffuse_map"); pParam->SetParameterTexture(pTex); m_materials[VT_GRASS].pTex = pTex; m_materials[VT_GRASS].pMaterial = pMat; // sand pTex = pRenderManager->CreateTextureFromFile("assets/voxel/texture/sand.dds"); pMat = pRenderManager->CreateMaterialFromFile("assets/voxel/material/voxel_world.material"); pParam = pMat->GetParameterByName("diffuse_map"); pParam->SetParameterTexture(pTex); m_materials[VT_BEACH].pTex = pTex; m_materials[VT_BEACH].pMaterial = pMat; // tree leaf pTex = pRenderManager->CreateTextureFromFile("assets/voxel/texture/sand.dds"); pMat = pRenderManager->CreateMaterialFromFile("assets/voxel/material/voxel_world.material"); pParam = pMat->GetParameterByName("diffuse_map"); pParam->SetParameterTexture(pTex); m_materials[VT_TREE_LEAF].pTex = pTex; m_materials[VT_TREE_LEAF].pMaterial = pMat; // tree trunk pTex = pRenderManager->CreateTextureFromFile("assets/voxel/texture/sand.dds"); pMat = pRenderManager->CreateMaterialFromFile("assets/voxel/material/voxel_world.material"); pParam = pMat->GetParameterByName("diffuse_map"); pParam->SetParameterTexture(pTex); m_materials[VT_TREE_TRUNK].pTex = pTex; m_materials[VT_TREE_TRUNK].pMaterial = pMat; return true; }
void RenderSystem_Deferred::SetMaterialABuffer(MaterialPtr pMaterial) { MaterialParameterPtr pParam = pMaterial->GetParameterByName("_DR_A_BUFFER"); pParam ? pParam->SetParameterTexture(m_pABuffer->GetTexture(0)) : (void)0 ; }