CUnrealMeshFileLoader

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

CUnrealMeshFileLoader

Post by wing64 »

Unreal PSK mesh and PSA animation loader.

Image

Source and binary:
http://upload.one2car.com/download.aspx ... XZZY5FF5D1
http://file2.uploadfile.biz/i/IVEDMEIMIZXDEW
http://www.4shared.com/rar/8fxu65xj/unreal_loader.html

How to use: (Tested from 01.HelloWorld)

1. Register loader (before call getmesh)

Code: Select all

CPSKMeshFileLoader* psk_loader = new CPSKMeshFileLoader( smgr );
CPSAMeshFileLoader* psa_loader = new CPSAMeshFileLoader( smgr );
smgr->addExternalMeshLoader( psk_loader );
smgr->addExternalMeshLoader( psa_loader );
psk_loader->drop( );
psa_loader->drop( );
2. use animation from psa

Code: Select all

IAnimatedMesh* animation = smgr->getMesh("Female.PSA");
s32 begin, end;
f32 speed;
((SSkinnedMesh*)animation)->getFrameLoop( core::stringc("Push"), begin, end, speed );
((ISkinnedMesh*)mesh)->useAnimationFrom( ((ISkinnedMesh*)animation) );
node->setFrameLoop( begin, end );
node->setAnimationSpeed( speed );
Happy downloading :D

female model: http://udn.epicgames.com/Two/UnrealDemoModels.html
Last edited by wing64 on Sat May 19, 2012 10:39 am, edited 1 time in total.
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: CUnrealMeshFileLoader

Post by smso »

I encounter this when I tried to download the file:
"You should Sign Up or Login to download this file"
I don't want to sign up!

Regards
smso
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: CUnrealMeshFileLoader

Post by smso »

smso wrote:I encounter this when I tried to download the file:
"You should Sign Up or Login to download this file"
I don't want to sign up!

Regards
smso
There is no direct download from the third link only. The first and second ones are OK.
Trying out the loader.
Thanks.

Regards,
smso
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: CUnrealMeshFileLoader

Post by CuteAlien »

Very nice, works on Linux with 3 minor changes: Pass all the name parameters as const reference instead of reference, so the following will work on gcc as well:

Code: Select all

 
AnimInfo( const core::stringc& name, s32 begin = 0, s32 end = 0, f32 fps = 30.0f )
void addAnimation( const core::stringc& animationName, s32 begin = 0, s32 end = 0, f32 fps = 30.0f )
bool getFrameLoop( const core::stringc& animationName, s32& begin, s32& end, f32& fps )
 
Thanks for posting!
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: CUnrealMeshFileLoader

Post by christianclavet »

Hi! Wow! Does that mean we could take ACTORX and produce our own characters? What is currently supported?

Looking at the code this look really simple to use!!

One warning!

Code: Select all

((ISkinnedMesh*)mesh)->useAnimationFrom( ((ISkinnedMesh*)animation) );
This will affect all the instances!!! So it can be only used on a single character and not multiple (we would need to append all the animations to make this work on multiple characters using the same sets of animation)

Really GREAT work! Saw the demo and I'm greatly impressed!!! Thanks also for the link to the web site, they had modeling and texturing guides using ActorX.
Sky-Fox
Posts: 29
Joined: Fri Feb 04, 2011 10:49 am

Re: CUnrealMeshFileLoader

Post by Sky-Fox »

Cool, Very nice!!!

Need for work Irrlicht 1.8 :

Code: Select all

 
virtual IMesh *getMesh ( u32 timeMs, io::IAttributes *animationParameters, u32 levelOfDetail=1.0f )
{
return Mesh->getMesh ( 0,255,-1,-1 ); //FIXME need correct Parameters
};
virtual IMesh *getMesh ( s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1 )
{
return Mesh->getMesh ( frame,detailLevel,startFrameLoop,endFrameLoop );
};
 
Image
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Re: CUnrealMeshFileLoader

Post by wing64 »

christianclavet wrote:Hi! Wow! Does that mean we could take ACTORX and produce our own characters? What is currently supported?
Yes, tested w/ actorx 249. And thanks for all comment.
Sky-Fox
Posts: 29
Joined: Fri Feb 04, 2011 10:49 am

Re: CUnrealMeshFileLoader

Post by Sky-Fox »

Not work on IOS. crash...

Code: Select all

 
 ???                            0000000000 0 + 0\
1   Game                                0x00186d4c irr::core::array<irr::scene::ISkinnedMesh::SScaleKey, irr::core::irrAllocator<irr::scene::ISkinnedMesh::SScaleKey> >::reallocate(unsigned int) (irrArray.h:67)\
2   Game                                0x00189d78 irr::core::array<irr::scene::ISkinnedMesh::SScaleKey, irr::core::irrAllocator<irr::scene::ISkinnedMesh::SScaleKey> >::insert(irr::scene::ISkinnedMesh::SScaleKey const&, unsigned int) (irrArray.h:150)\
3   Game                                0x00189f5a irr::core::array<irr::scene::ISkinnedMesh::SScaleKey, irr::core::irrAllocator<irr::scene::ISkinnedMesh::SScaleKey> >::push_back(irr::scene::ISkinnedMesh::SScaleKey const&) (irrArray.h:105)\
4   Game                                0x002a7418 irr::scene::CSkinnedMesh::addScaleKey(irr::scene::ISkinnedMesh::SJoint*) (CSkinnedMesh.cpp:1191)\
5   Game                                0x00027174 irr::scene::SSkinnedMesh::finalize() (CUnrealMeshFileLoader.h:253)\
6   Game                                0x00021898 irr::scene::CPSKMeshFileLoader::createMesh(irr::io::IReadFile*) (CUnrealMeshFileLoader.cpp:586)\
7   Game                                0x000731bc irr::scene::CSceneManager::getMesh(irr::core::string<char, irr::core::irrAllocator<char> > const&) (CSceneManager.cpp:399)\
 
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Re: CUnrealMeshFileLoader

Post by wing64 »

- I'm not sure what is your irrlicht svn version ? (didn't test on ios)
- addScaleKey() dont call in loader but why error occurred :?:
fmx

Re: CUnrealMeshFileLoader

Post by fmx »

Nice! Thanks for sharing :D
HellFlip
Posts: 4
Joined: Mon Aug 20, 2012 9:57 pm

Re: CUnrealMeshFileLoader

Post by HellFlip »

Awesome Stuff ! Thanks a lot for this !

The animation system is working fine using Irrlicht 1.7.x, but is broken with Irrlicht 1.8, because of the Irrlicht change "quaternion conversions to and from matrix4 no longer invert rotations."

To fix it using 1.8, do the following change in CUnrealMeshFileLoader.cpp: , in psk_to_irr( psk_t* psk, SSkinnedMesh* AnimatedMesh ):
Change line 396

Code: Select all

core::matrix4 rotationMatrix = joint->Animatedrotation.getMatrix();
To

Code: Select all

core::matrix4 rotationMatrix = joint->Animatedrotation.getMatrix().getTransposed();
Post Reply