Page 1 of 1

how can i get textures of an 3DS File ?? [Windows MFC]

Posted: Tue Jul 24, 2007 10:44 am
by vizzy
first: sorry for an noob question and my bad english.
How can i get the textures of an 3DSFile ?
In the Scene is no problem:

Code: Select all

irr::scene::ISceneNode* n = device->getSceneManager()->getSceneNodeFromId( m_iRootMeshID );
	int count = n->getMaterialCount();
	for ( int i = 0; i < count; ++i )
	 {
		 const irr::video::SMaterial &mat = n->getMaterial(i);
		 for ( int j = 0; j < irr::video::MATERIAL_MAX_TEXTURES; ++j )
  		{
			if ( mat.Textures[j] )
			{
         //as sample
				::AfxMessageBox( (LPCTSTR)(CString)mat.Textures[j]->getName().c_str() );	
			}
		}
	} 
but how can i read the textures of an selected file ?
e.g.

Code: Select all

CFileDialog fd( TRUE, _T("3ds"), NULL, OFN_HIDEREADONLY ,
		_T("3DS Files(.3ds)|*.3ds||"));
	if ( fd.DoModal() != IDOK )
	{
		return -1;
	}
	else
	{
          //read in textures of fd.GetFileName() ?? :oops: 
   }
Thanks for your reply and help...

Posted: Tue Jul 24, 2007 9:18 pm
by hybrid
You mean you want to read the texture names from the 3ds file? You'd have to parse the file for that. At least that's what Irrlicht does to grab all the information. But why not loading the mesh (without displaying it) and query the mesh?

Posted: Tue Jul 24, 2007 11:25 pm
by Acki
if you really want to parse the file on your own you can look how Irrlicht does it in the source code file C3DSMeshFileLoader.cpp...

or you can look how 3ds files are build, a reference can be found here:
http://www.wotsit.org/list.asp?fc=2

Posted: Wed Jul 25, 2007 7:40 am
by vizzy
..thanks acki, your link help