is there an easy way to split a texture into smaller ones (just like sprites) ?
At the moment i'm using some code from the special FX tutorial to have an animated Effect from several textures.
This code loads a number (data.s_Frames) of single textures into an array an uses this to animate an effect.
To load a texture array from a single file im looking for a solution, to:
1. load a single texture
2. split this texture into an arry of (data.s_Frames) elements
(usuallay when this single texture contains 16 Frames they are 4x4 frames of the same size).
Code: Select all
/*
Next we add a volumetric light node, which adds a glowing fake area light to
the scene. Like with the billboards and particle systems we also assign a
texture for the desired effect, though this time we'll use a texture animator
to create the illusion of a magical glowing area effect.*/
//*edit add an animated effect
//*old scene::IVolumeLightSceneNode * n
L_node = smgr_main->addVolumeLightSceneNode(0, -1,
32, // Subdivisions on U axis
32, // Subdivisions on V axis
data.sColor, // foot color
data.eColor); // tail color
if (L_node)
{
L_node->setScale(data.Scale);
L_node->setPosition(vector3df((pos.X*255.f), data.emitArea.Y, (pos.Y*-255.f)));
// load textures for animation
core::array<video::ITexture*> textures;
for (s32 g=data.s_Frames; g > 0; --g)
{
core::stringc tmp;
tmp = data.t_texture;
tmp += g;
tmp += ".png";
video::ITexture* t = driver->getTexture( tmp.c_str() );
driver->makeColorKeyTexture(t, core::position2d<s32>(1,1));
textures.push_back(t);
}
// create texture animator
scene::ISceneNodeAnimator* glow = smgr_main->createTextureAnimator(textures, 150);
// add the animator
L_node->addAnimator(glow);
L_node->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
// drop the animator because it was created with a create() function
glow->drop();