Problem with scaleMesh() using IMeshManipulator

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
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Problem with scaleMesh() using IMeshManipulator

Post by christianclavet »

Hi. I would like to really scale the mesh from the meshbuffer (So I can be calculated right for Creating occtrees and also right for the normals when using dynamic Lighting.

Searched the SDK and found command to do this.

Here is my implementation:

Model is the IAnimatedSceneNode
MeshModel is an IAnimatedMesh

Before doing this, I do a quick test to see if it's defined.

Code: Select all

IMeshManipulator * manip = Device->getSceneManager()->getMeshManipulator(); 
                     manip->scaleMesh(ModelMesh->getMesh(0),core::vector3df(4.0f,4.0f,4.0f));
                     manip->recalculateNormals(ModelMesh->getMesh(0),true);
                     Model->remove(); 
                     Model=Device->getSceneManager()->addAnimatedMeshSceneNode(ModelMesh);
The model is cleared and re-created using the meshbuffer but its not bigger. So it's not doing what I want. (Should be 4 times bigger, but it's not)
radubolovan
Posts: 60
Joined: Tue Nov 13, 2007 7:03 pm
Location: Bucharest - Romania
Contact:

Post by radubolovan »

rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Christian is already doing ModelMesh->getMesh(0). I suspect this may be a format-specific issue. Christian, what's the model format you're using?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
radubolovan
Posts: 60
Joined: Tue Nov 13, 2007 7:03 pm
Location: Bucharest - Romania
Contact:

Post by radubolovan »

You have to call

Code: Select all

((scene::SAnimatedMesh*)ModelMesh)->recalculateBoundingBox();
after scaling the mesh!
Try to enable the debug info for scene node and see the difference.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Hi.

Is there a limitation per mesh formats? Humm. Ok. Sorry. I didnt see that. Do you know where I could see for some info about this?

The problem I see, now, is when I activate the debug view on the mesh and it's it's scaled or rotated, the normals will look very weird.

I've read somewhere that this also could affect the collision response animator and the lighting of the model. (mostly the scaling of the model)

Thanks.
Post Reply