Sign in to follow this  
kgstation

Need Help!Export material data from 3ds max 2014 failed!

Recommended Posts

kgstation    205

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!

        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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this