Need Help!!Export material data failed!

Need Help!!Export material data failed!

Anonymous
Not applicable
524 Views
0 Replies
Message 1 of 1

Need Help!!Export material data failed!

Anonymous
Not applicable

Hi everyone!

I'm working on a mesh exporter!

I successfully export vertices and indices and face normal ets.

But I failed to export material

 

following is my code

        int materialCount = pIgame->GetRootMaterialCount();
	_cprintf("MaterialCount:%d\n", materialCount);
	Point3 p3;
	Point4 p4;
	PropType pt;
	IGameProperty* geoProperty;
	for (int matCount = 0; matCount < materialCount; matCount++)
	{
		IGameMaterial* geoMtl = pIgame->GetRootMaterial(matCount);
		geoProperty = geoMtl->GetAmbientData();
		if(geoProperty)
		{
			pt = geoProperty->GetType();
			if(pt == IGAME_POINT3_PROP)
				_cprintf("Ambient : %f %f %f\n", p3.x, p3.y, p3.z);
			if(pt == IGAME_POINT4_PROP)
				_cprintf("Ambient : %f %f %f %f\n", p4.x, p4.y, p4.z, p4.w);
		}
		geoProperty = geoMtl->GetDiffuseData();
		if(geoProperty)
		{
			pt = geoProperty->GetType();
			if(pt == IGAME_POINT3_PROP)
				_cprintf("Diffuse : %f %f %f\n", p3.x, p3.y, p3.z);
			if(pt == IGAME_POINT4_PROP)
				_cprintf("Ambient : %f %f %f %f\n", p4.x, p4.y, p4.z, p4.w);
		}
		geoProperty = geoMtl->GetSpecularData();
		if(geoProperty)
		{
			pt = geoProperty->GetType();
			if(pt == IGAME_POINT3_PROP)
				_cprintf("Specular : %f %f %f\n", p3.x, p3.y, p3.z);
			if(pt == IGAME_POINT4_PROP)
				_cprintf("Ambient : %f %f %f %f\n", p4.x, p4.y, p4.z, p4.w);
		}
		geoProperty = geoMtl->GetSpecularLevelData();
		if(geoProperty)
		{
			pt = geoProperty->GetType();
			if(pt == IGAME_POINT3_PROP)
				_cprintf("Specular Level : %f %f %f\n", p3.x, p3.y, p3.z);
			if(pt == IGAME_POINT4_PROP)
				_cprintf("Ambient : %f %f %f %f\n", p4.x, p4.y, p4.z, p4.w);
		}
	}

 

I simply create a box and six face with different material.

And I materialCount equals 1

But geoProperty always false!

I don't known what's wrong with my code.

Any help would be appreciated!

0 Likes
525 Views
0 Replies
Replies (0)