http://irrlicht.sourceforge.net/phpBB2/ ... =8399#8399
:
http://www.rhrk.uni-kl.de/~rochel/files ... cstest.zip
It loads the techdemo map and a number of fairies u can specify at startup (src included, If you'ld like to have a look)
CollidesSlide is where I call getCollisionResultPosition:
Code: Select all
void Visual::CollideSlide(float *p, float *v, bool *falling, float *pnew)
{
core::triangle3df tri;
core::vector3df res=colmgr->getCollisionResultPosition(
selector,
core::vector3df(p[0],p[2]+15,p[1]),
core::vector3df(10,40,10),
core::vector3df(v[0],v[2],v[1]),
tri,
*falling,
0.0005f,
core::vector3df(0,-9,0)
);
pnew[0]=res.X;
pnew[2]=res.Y-15;
pnew[1]=res.Z;
}
Code: Select all
void Visual::Render()
{
driver->beginScene(false, true, 0);
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
static int lastFPS;
if (lastFPS != fps)
{
wchar_t tmp[1024];
swprintf(tmp, 1024, L"Marc's Irrlicht Testgame - (fps:%d) Triangles:%d",
fps, driver->getPrimitiveCountDrawn());
device->setWindowCaption(tmp);
lastFPS = fps;
}
}
First I used 50 fairies, I got 15fps, and here are the timings:
Code: Select all
Func Func+Child Hit
Time % Time % Count Function
---------------------------------------------------------
24346,182 61,7 24407,416 61,9 25806 Visual::CollideSlide(float *,float *,bool *,float *) (visual.obj)
12498,282 31,7 12498,444 31,7 506 Visual::Render(void) (visual.obj)
1120,676 2,8 39396,302 99,9 782 CWinThread::PumpMessage(void) (mfc42d.dll)
609,633 1,5 609,645 1,5 1 Visual::LoadMap(char *) (visual.obj)
127,017 0,3 189,732 0,5 1 Visual::Init(void) (visual.obj)
110,084 0,3 219,180 0,6 129589 AfxAssertValidObject(class CObject const *,char const *,int) (mfc42d.dll)
85,801 0,2 352,088 0,9 129030 CMap<unsigned int,unsigned int,class ZObject *,class ZObject *>::GetNextAssoc(struct __POSITION * &,unsigned int &,class ZObject * &) (world.obj)
79,536 0,2 24884,484 63,1 506 World::Iterate(void) (world.obj)
62,482 0,2 62,704 0,2 1 irr::createDevice(enum irr::video::EDriverType,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,class irr::IEventReceiver *,unsigned short const *) (irrlicht.dll)
53,179 0,1 53,179 0,1 145014 AfxIsValidAddress(void const *,unsigned int,int) (mfc42d.dll)
51,621 0,1 84,342 0,2 129589 CMap<unsigned int,unsigned int,class ZObject *,class ZObject *>::AssertValid(void) (world.obj)
47,952 0,1 39447,236 100,0 1 CDialog::DoModal(void) (mfc42d.dll)
Without Collisionresponsing, I got 30 fps and these timings:
Code: Select all
Func Func+Child Hit
Time % Time % Count Function
---------------------------------------------------------
23181,167 87,7 23181,360 87,7 875 Visual::Render(void) (visual.obj)
1408,637 5,3 26353,222 99,7 1494 CWinThread::PumpMessage(void) (mfc42d.dll)
555,843 2,1 555,855 2,1 1 Visual::LoadMap(char *) (visual.obj)
219,320 0,8 422,140 1,6 224053 AfxAssertValidObject(class CObject const *,char const *,int) (mfc42d.dll)
179,142 0,7 234,328 0,9 1 Visual::Init(void) (visual.obj)
149,961 0,6 636,152 2,4 223125 CMap<unsigned int,unsigned int,class ZObject *,class ZObject *>::GetNextAssoc(struct __POSITION * &,unsigned int &,class ZObject * &) (world.obj)
112,316 0,4 839,242 3,2 875 World::Iterate(void) (world.obj)
Something has to be done in model-handling I think. We need to be able to have 50 objects moving around in a map, with correct collision detection/sliding without such a slowdown in framerate.
In relation to this, I'ld like to know about the level of optimiziation of collision and rendering functionality. So niko, do u think these functions are optimized very much or do u think it's possible to speed them up?
I don't want to blame u. Irrlicht has a wonderful easy interface and does lots of things I'ld never like to implement myself. But it's too slow right now I think.
Comments appreciated