parseMaterial method

dynamic parseMaterial(
  1. Map<String, dynamic> materialNode,
  2. Map textureMap
)

Implementation

parseMaterial( Map<String, dynamic> materialNode, Map textureMap ) {

	var ID = materialNode["id"];
	var name = materialNode["attrName"];
	var type = materialNode["ShadingModel"];

	// Case where FBX wraps shading model in property object.
	if ( type is! String ) {

		type = type.value;

	}

	// Ignore unused materials which don't have any connections.
	if ( ! connections.containsKey( ID ) ) return null;

	Map parameters = this.parseParameters( materialNode, textureMap, ID );

	var material;

	switch ( type.toLowerCase() ) {

		case 'phong':
			material = new MeshPhongMaterial();
			break;
		case 'lambert':
			material = new MeshLambertMaterial();
			break;
		default:
			print( 'THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.${type}' );
			material = new MeshPhongMaterial();
			break;

	}

	material.setValues( parameters );
	material.name = name;

	return material;

}