problem scalling a 3DS mesh object

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
radubolovan
Posts: 60
Joined: Tue Nov 13, 2007 7:03 pm
Location: Bucharest - Romania
Contact:

problem scalling a 3DS mesh object

Post by radubolovan »

Hello
I'm trying to scale a mesh and nothing happens.
Here is the code:

Code: Select all

        sprintf( szFile, "%s%s", instance()->dir(), "objetcs/cub_4_laturi.3ds" );
	scene::IAnimatedMesh* m = instance()->irrSceneManager()->getMesh( szFile );
	IMeshManipulator* meshMan = instance()->irrSceneManager()->getMeshManipulator();
	meshMan->scaleMesh( m, core::vector3df( 100.0f, 1.0f, 100.0f ) );
	scene::IAnimatedMeshSceneNode* model = instance()->irrSceneManager()->addAnimatedMeshSceneNode( m );
I've searched the forums, but nothing found :(

//later
my object is a "camera" without floor ... and each wall is only a plane with a texture on it
radubolovan
Posts: 60
Joined: Tue Nov 13, 2007 7:03 pm
Location: Bucharest - Romania
Contact:

Post by radubolovan »

Yupiiiiiiiiiiiiiiiii! I did it! :)
Here is the code:

Code: Select all

	char szFile[1024];
	sprintf( szFile, "%s%s", workingDir(), "objetcs/latura_podea.3ds" );
	scene::IAnimatedMesh* m1 = sceneManager->getMesh( szFile );
	IMeshManipulator* meshMan = sceneManager->getMeshManipulator();
	int nIndex;
	for( nIndex = 0; nIndex < m1->getFrameCount(); nIndex++ )
	{
		scene::IMesh* mesh = m1->getMesh( nIndex, 0 );
		if( mesh )
		{
			meshMan->scaleMesh( mesh, core::vector3df( 10.0f, 1.0f, 10.0f ) );
		}
	}
	((scene::SAnimatedMesh*)m1)->recalculateBoundingBox();
	scene::IAnimatedMeshSceneNode* model1 = instance()->irrSceneManager()->addAnimatedMeshSceneNode( m1 );
	model1->setMaterialFlag(video::EMF_LIGHTING, false);
	model1->setMaterialFlag(video::EMF_BACK_FACE_CULLING, false);
It works just fine! :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Oh, just a hint: 3ds does not have a frame count, so your loop will only work once. But other than that it's ok. The problem with the original code is that due to the new inheritance of IMesh and IAnimatedMesh the code compiles, but does something unexpected. I guess we have to fix some things there,
Post Reply