Hi, there!
I trying to save cube map into image *.png files.
for code example I use carnalis ProcSky.cc (void ProcSky::DumpTexCubeImages) also I look into Sinoid code for cubemap baking.
so, I have this code and it’s no working (
void ProcSkyPostRenderUpdate()
{
if (input.keyPress[KEY_T] )
{
DumpTextureCube(procSkyCubeTexture, "C:/Urho3D/bin/Data/Textures/");
}
if (!procSkyRenderQueued) return;
//
}
void DumpTextureCube(TextureCube@ texCube, String filePath)
{
if (texCube is null) return;
for (int i = 0; i < MAX_CUBEMAP_FACES; i++)
{
Texture2D@ faceTex = cast<Texture2D>(texCube.renderSurfaces[CubeMapFace(i)].parentTexture);
if (faceTex !is null)
{
MessageBox("OK - get Texture2D from cubemap face" + String(i));
Image@ texImage = faceTex.GetImage();
fileSystem.CreateDir(filePath);
String path(filePath + String(i) + ".png");
if (texImage !is null)
{
texImage.SavePNG(path);
MessageBox(path);
}
}
else
{
MessageBox("Failure get Texture2D from cubemap face" + String(i));
}
}
}
Every time then I pressing on T-key I got this message - “Failure get Texture2D from cubemap face” and no one time "Sucessed msg"
What i’m doing wrong ?