I'm tring to compute dynamic cubemaps (mainly for use as 3d skybox + realtime cubemaps)
I use the CRTTSkyBoxSceneNode downloaded somewhere on this forum to render my 3d skybox, then I apply its cubemap to all needed nodes
During he computation I need to convert texture to an image to feed the driver->addTextureCubemap() method (I'm using Irrlicht 1.9)
http://irrlicht.sourceforge.net/forum/v ... =9&t=22268
but the textureToImage() method is a very big resource hog, and seem pointless to me.
As I already have 6 textures, why bother creating 6 images to rebuild one cubemap texture? Maybe I missed something?
Bonus question: Is there is a way in Irrlicht to compute a dynamic cubemap in one pass? Like this:
http://cg.siomax.ru/index.php/computer- ... o-cube-map
For those who prefer to see some code, here is a method I added in CRTTSkyBoxSceneNode
Code: Select all
video::IRenderTarget* rt[6]; // Declared in CRTTSkyBoxSceneNode.h
// ...
video::ITexture* generateCubemap()
{
irr::video::IVideoDriver* driver = SceneManager->getVideoDriver();
irr::video::IImage* cubemapImages[6];
video::ITexture* result;
for (s32 i=0; i<6; ++i)
{
rt[i]->getTexture()[0]->lock();
cubemapImages[i] = Utils::textureToImage(rt[i]->getTexture()[0]);
}
result = driver->addTextureCubemap
(
"cube_map",
cubemapImages[0],
cubemapImages[1],
cubemapImages[2],
cubemapImages[3],
cubemapImages[4],
cubemapImages[5]
);
for (s32 i=0; i<6; ++i)
{
cubemapImages[i]->drop();
rt[i]->getTexture()[0]->unlock();
}
return result;
}