2024-08-07 15:23:31 -03:00
|
|
|
#include "xna/pipeline/compiler.hpp"
|
2024-09-06 21:22:38 -03:00
|
|
|
#include "xna/pipeline/writer.hpp"
|
2024-08-07 15:23:31 -03:00
|
|
|
|
|
|
|
namespace xna {
|
2024-09-06 21:22:38 -03:00
|
|
|
ContentCompiler::ContentCompiler() {
|
|
|
|
const auto writers = typeWriterFactory->Initialize();
|
2024-08-07 15:23:31 -03:00
|
|
|
|
2024-09-06 21:22:38 -03:00
|
|
|
for (auto& writer : writers)
|
|
|
|
AddTypeWriter(writer);
|
|
|
|
|
|
|
|
for (auto& dic : writerInstances) {
|
|
|
|
auto& writer = dic.second;
|
|
|
|
AddTypeWriter(writer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ContentCompiler::Compile(
|
|
|
|
P_Stream const& output,
|
|
|
|
Object& value,
|
|
|
|
TargetPlatform targetPlatform,
|
|
|
|
GraphicsProfile targetProfile,
|
|
|
|
bool compressContent,
|
|
|
|
String const& rootDirectory,
|
|
|
|
String const& referenceRelocationPath) {
|
|
|
|
if (compressContent)
|
|
|
|
compressContent = ShouldCompressContent(targetPlatform, value);
|
|
|
|
|
|
|
|
auto _this = shared_from_this();
|
|
|
|
|
|
|
|
auto contentWriter = unew<ContentWriter>(
|
|
|
|
_this, output, targetPlatform,
|
|
|
|
targetProfile, compressContent,
|
|
|
|
rootDirectory, referenceRelocationPath);
|
|
|
|
|
|
|
|
contentWriter->WriteObject(value);
|
|
|
|
contentWriter->FlushOutput();
|
|
|
|
}
|
2024-08-07 15:23:31 -03:00
|
|
|
}
|