MCPcopy Create free account
hub / github.com/assimp/assimp / SetCubeMapBG

Method SetCubeMapBG

tools/assimp_view/Background.cpp:153–197  ·  view source on GitHub ↗

-------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

151}
152//-------------------------------------------------------------------------------
153void 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//-------------------------------------------------------------------------------
199void CBackgroundPainter::RotateSB(const aiMatrix4x4 *pm) {
200 this->mMatrix = mMatrix * (*pm);

Callers 3

LoadSkyboxFunction · 0.80
MessageProcFunction · 0.80
_tWinMainFunction · 0.80

Calls 8

InstanceClass · 0.85
FindValidPathMethod · 0.80
DeleteMaterialMethod · 0.80
SetTextureMethod · 0.80
ReleaseMethod · 0.45
SetMethod · 0.45
CreateMaterialMethod · 0.45
GetTextureMethod · 0.45

Tested by

no test coverage detected