Utility: Add MTL exporting
Former-commit-id: 6174df9379702cac1eac0b348143004022bc6c59 [formerly 8efc71bc323e64c88a1927d4d88453db41786b55] Former-commit-id: d713cb74ac26873e6ac6664145e78eed286c022f
This commit is contained in:
@@ -19,6 +19,22 @@ namespace Nz
|
||||
class NAZARA_UTILITY_API MTLParser
|
||||
{
|
||||
public:
|
||||
struct Material;
|
||||
|
||||
MTLParser() = default;
|
||||
~MTLParser() = default;
|
||||
|
||||
inline Material* AddMaterial(const String& matName);
|
||||
|
||||
inline void Clear();
|
||||
|
||||
inline const Material* GetMaterial(const String& materialName) const;
|
||||
inline const std::unordered_map<String, Material>& GetMaterials() const;
|
||||
|
||||
bool Parse(Stream& stream);
|
||||
|
||||
bool Save(Stream& stream) const;
|
||||
|
||||
struct Material
|
||||
{
|
||||
Color ambient = Color::White;
|
||||
@@ -39,27 +55,26 @@ namespace Nz
|
||||
unsigned int illumModel = 0;
|
||||
};
|
||||
|
||||
MTLParser(Stream& stream$);
|
||||
~MTLParser();
|
||||
|
||||
const Material* GetMaterial(const String& materialName) const;
|
||||
const std::unordered_map<String, Material>& GetMaterials() const;
|
||||
|
||||
bool Parse();
|
||||
|
||||
private:
|
||||
bool Advance(bool required = true);
|
||||
void Error(const String& message);
|
||||
void Warning(const String& message);
|
||||
void UnrecognizedLine(bool error = false);
|
||||
template<typename T> void Emit(const T& text) const;
|
||||
inline void EmitLine() const;
|
||||
template<typename T> void EmitLine(const T& line) const;
|
||||
inline void Error(const String& message);
|
||||
inline void Flush() const;
|
||||
inline void Warning(const String& message);
|
||||
inline void UnrecognizedLine(bool error = false);
|
||||
|
||||
std::unordered_map<String, Material> m_materials;
|
||||
Stream& m_stream;
|
||||
mutable Stream* m_currentStream;
|
||||
String m_currentLine;
|
||||
mutable StringStream m_outputStream;
|
||||
bool m_keepLastLine;
|
||||
unsigned int m_lineCount;
|
||||
unsigned int m_streamFlags;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/Formats/MTLParser.inl>
|
||||
|
||||
#endif // NAZARA_FORMATS_MTLPARSER_HPP
|
||||
|
||||
Reference in New Issue
Block a user