Page 1 of 1

problem scalling a 3DS mesh object

Posted: Sat Dec 15, 2007 1:17 pm
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

Posted: Fri Jan 11, 2008 6:31 pm
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! :)

Posted: Sat Jan 12, 2008 12:22 am
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,