Page 1 of 1

[fixed]CIrrMeshWriter or CIrrMeshFileLoader bug.

Posted: Sun May 23, 2010 10:44 am
by shine5128
NOTE: my English is very bad :)

ok, i use the code: ( load OBJ file )

Code: Select all

	node = smgr->addMeshSceneNode( smgr->getMesh( "../Media/Map/sponza_clean.obj" ) );
	node->setMaterialFlag( EMF_LIGHTING, false );
Final results:
Image



now, i use the code convertion OBJ to IRRMESH:

Code: Select all

	IWriteFile *wf = device->getFileSystem()->createAndWriteFile( "../Media/Map/sponza_clean.irrmesh" );
	smgr->createMeshWriter( EMWT_IRR_MESH )->writeMesh( wf, smgr->getMesh( "../Media/Map/sponza_clean.obj" ), EMWT_IRR_MESH );
	wf->drop();


then, i use the code: ( load IRRMESH file )

Code: Select all

	node = smgr->addMeshSceneNode( smgr->getMesh( "../Media/Map/sponza_clean.irrmesh" ) );
	node->setMaterialFlag( EMF_LIGHTING, false );
Final results:
Image


We have seen, the color wrong.
But I found a solution.

Solution:
at CIrrMeshWriter.cpp line 186:

Code: Select all

sprintf(tmp, " %02x%02x%02x%02x ", vtx[j].Color.getAlpha(), vtx[j].Color.getRed(), vtx[j].Color.getBlue(), vtx[j].Color.getGreen());
Change to:

Code: Select all

sprintf(tmp, " %02x%02x%02x%02x ", vtx[j].Color.getAlpha(), vtx[j].Color.getRed(), vtx[j].Color.getGreen(), vtx[j].Color.getBlue());
Solve the problem! :D

Posted: Sun May 23, 2010 5:43 pm
by hybrid
Ok, thanks, that's fixed now.