-------------------------------------------------------------------------------
| 151 | } |
| 152 | //------------------------------------------------------------------------------- |
| 153 | void CBackgroundPainter::SetCubeMapBG(const char *p_szPath) { |
| 154 | bool bHad = false; |
| 155 | if (pcTexture) { |
| 156 | pcTexture->Release(); |
| 157 | pcTexture = nullptr; |
| 158 | if (TEXTURE_CUBE == eMode) bHad = true; |
| 159 | } |
| 160 | |
| 161 | eMode = TEXTURE_CUBE; |
| 162 | |
| 163 | szPath = std::string(p_szPath); |
| 164 | |
| 165 | // ARRRGHH... ugly. TODO: Rewrite this! |
| 166 | aiString sz; |
| 167 | sz.Set(szPath); |
| 168 | CMaterialManager::Instance().FindValidPath(&sz); |
| 169 | szPath = std::string(sz.data); |
| 170 | |
| 171 | // now recreate all native resources |
| 172 | RecreateNativeResource(); |
| 173 | |
| 174 | if (SIMPLE_COLOR != this->eMode) { |
| 175 | // this influences all material with specular components |
| 176 | if (!bHad) { |
| 177 | if (g_pcAsset && g_pcAsset->pcScene) { |
| 178 | for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes; ++i) { |
| 179 | if (aiShadingMode_Phong == g_pcAsset->apcMeshes[i]->eShadingMode) { |
| 180 | CMaterialManager::Instance().DeleteMaterial(g_pcAsset->apcMeshes[i]); |
| 181 | CMaterialManager::Instance().CreateMaterial( |
| 182 | g_pcAsset->apcMeshes[i], g_pcAsset->pcScene->mMeshes[i]); |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | } else { |
| 187 | if (g_pcAsset && g_pcAsset->pcScene) { |
| 188 | for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes; ++i) { |
| 189 | if (aiShadingMode_Phong == g_pcAsset->apcMeshes[i]->eShadingMode) { |
| 190 | g_pcAsset->apcMeshes[i]->piEffect->SetTexture( |
| 191 | "lw_tex_envmap", CBackgroundPainter::Instance().GetTexture()); |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | //------------------------------------------------------------------------------- |
| 199 | void CBackgroundPainter::RotateSB(const aiMatrix4x4 *pm) { |
| 200 | this->mMatrix = mMatrix * (*pm); |
no test coverage detected