[solved]Too fast ISceneNodeAnimator* animation

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
RespectIsEverything
Posts: 30
Joined: Fri Feb 01, 2013 12:06 pm

[solved]Too fast ISceneNodeAnimator* animation

Post by RespectIsEverything »

Hello everyone,

I have a problem.I created a billboard node and added scene::ISceneNodeAnimator* texture animation.Even if i set timePerFrame to 1 on
ISceneNodeAnimator*,it is too fast.What can i do?

Best regards.

My codes:

Code: Select all

 
 
#include <irrlicht.h>
 
#include <string>
 
using namespace irr;
 
 
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
 
 
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
 
int main()
{
 
    // create device
 
    IrrlichtDevice *device = createDevice( video::EDT_DIRECT3D9, dimension2d<u32>(1024, 768), 32,
            false, false, true, 0);
        
    if (device == 0)
        return 1; // could not create selected driver.
 
    // create engine and camera
 
    device->setWindowCaption(L"Irrlicht Engine Demo");
 
    video::IVideoDriver* driver = device->getVideoDriver();
    scene::ISceneManager* smgr = device->getSceneManager();
 
    int posx=50;
    int posy=0;
    ICameraSceneNode* camera = smgr->addCameraSceneNode(0, core::vector3df(posx,posy,-100), core::vector3df(posx,posy,0) );
    
 
 
 
     IBillboardSceneNode* billboard=smgr->addBillboardSceneNode(0,dimension2d<f32>(20,20),vector3df(50,20,-0));
 
    billboard->setMaterialFlag(EMF_LIGHTING, false);
    billboard->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL); 
    
        array<ITexture*,irrAllocator<ITexture*>> textures;
 
        for (int i=0;i<9;i++)
        {
            video::ITexture* texture ;
            
            
            char textureFileName[90];
            strcpy(textureFileName, "Data/character/frame");
            strcat(textureFileName, (std::to_string((long double)i)).c_str());
            strcat(textureFileName, ".png");
 
            texture = smgr->getVideoDriver()->getTexture((char*)textureFileName);
            
            if(!texture)
            {
                device->drop();
                return 1;
            }
            
            textures.push_back(texture);
 
        }
 
        scene::ISceneNodeAnimator* anim =
        smgr->createTextureAnimator(textures,1,true);//<-----------too fast :(
 
        
        if(anim)
    {
        billboard->addAnimator(anim);
        
        
        anim->drop();
        anim = 0;
    }
    
        
    u32 frames=0;
    while(device->run())
    {
 
        driver->beginScene(true, true, video::SColor(0,100,100,100));
 
        smgr->drawAll();
 
        driver->endScene();
        if (++frames==100)
        {
            core::stringw str = L"Irrlicht Engine [";
            str += driver->getName();
            str += L"] FPS: ";
            str += (s32)driver->getFPS();
 
            device->setWindowCaption(str.c_str());
            frames=0;
        }
    }
 
    device->drop();
    
    return 0;
}
 
 
And you can download release version:

http://www.mediafire.com/?0lk0x2cnqmm1273

Thanks.
Last edited by RespectIsEverything on Thu Feb 21, 2013 1:27 am, edited 1 time in total.
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Too fast ISceneNodeAnimator* animation

Post by zerochen »

hi,

if 1 ms is to short set it to 1s (=1000) ? :D

from the api
timePerFrame,: Time in milliseconds, how long any texture in the list should be visible.

regards
zerochen
RespectIsEverything
Posts: 30
Joined: Fri Feb 01, 2013 12:06 pm

Re: Too fast ISceneNodeAnimator* animation

Post by RespectIsEverything »

Thanks.I feel like a stupid now :oops: .I am really sorry.My english is bad,and i am sleepy.I did a very bad mistake. :cry: I saw the timePerFrame as speed .Admin,can you delete this topic?
Post Reply