1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#pragma once
#include "Doom3MapWriter.h"
#include "primitivewriters/BrushDefExporter.h"
#include "primitivewriters/LegacyBrushDefExporter.h"
#include "primitivewriters/PatchDefExporter.h"
#include "Quake3MapFormat.h"
namespace map
{
// A Q3 map writer is working nearly the same as for D3, with
// brushDef primitives instead of brushDef3 and
// patchDef2 only. No version string is written at the top of the file
class Quake3MapWriter :
public Doom3MapWriter
{
public:
virtual void beginWriteMap(const scene::IMapRootNodePtr& root, std::ostream& stream) override
{
// Write an empty line at the beginning of the file
stream << std::endl;
}
virtual void beginWriteBrush(const IBrushNodePtr& brush, std::ostream& stream) override
{
// Primitive count comment
stream << "// brush " << _primitiveCount++ << std::endl;
// Export old brush syntax to stream
LegacyBrushDefExporter::exportBrush(stream, brush);
}
virtual void beginWritePatch(const IPatchNodePtr& patch, std::ostream& stream) override
{
// Primitive count comment, not a typo, patches also seem to have "brush" in their comments
stream << "// brush " << _primitiveCount++ << std::endl;
// Export patchDef2 to stream (patchDef3 is not supported)
PatchDefExporter::exportQ3PatchDef2(stream, patch);
}
};
class Quake3AlternateMapWriter :
public Doom3MapWriter
{
public:
// Q3 alternate is writing the newer brushDef syntax
virtual void beginWriteBrush(const IBrushNodePtr& brush, std::ostream& stream) override
{
// Primitive count comment
stream << "// brush " << _primitiveCount++ << std::endl;
// Export brushDef definition to stream
BrushDefExporter::exportBrush(stream, brush);
}
};
} // namespace
|