bool MaterialExporter::streamMaterial(std::ostream &of) {

		// serialize this information to the material file
		MaterialMap::iterator it = m_materialMap.begin();

		while (it != m_materialMap.end()) {
			std::string matName(it->first);
			IGameMaterial *mtl = it->second;

			of << "material " << matName << std::endl;
			of << std::showpoint;
			of << "{" << std::endl;

			of << "\ttechnique" << std::endl;
			of << "\t{" << std::endl;

			int numSubMtl = 0;
			
			if (mtl != NULL) {
				numSubMtl = mtl->GetSubMaterialCount();

				if (numSubMtl > 0) {
					int i;
					for (i=0; i<numSubMtl; i++) {
						streamPass(of, mtl->GetSubMaterial(i));
					}
				}
				else
					streamPass(of, mtl);
			}
			else {
				streamPass(of, mtl);
			}

			of << "\t}" << std::endl;
			of << "}" << std::endl;

			it++;
		}

		m_materialMap.clear();

		return true;
	}