mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-27 03:41:03 +00:00
- Fix: Added missing xml-writer pop-calls
- Ported mapxml plugin to Doom3 - mapxml now exports brushes with its vertices git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@159 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
parent
2e97c6dc9f
commit
97b5fa7aa7
6 changed files with 81 additions and 12 deletions
6
CHANGES
6
CHANGES
|
@ -1,6 +1,12 @@
|
||||||
This is the changelog for developers, != changelog for the end user
|
This is the changelog for developers, != changelog for the end user
|
||||||
that we distribute with the binaries. (see changelog)
|
that we distribute with the binaries. (see changelog)
|
||||||
|
|
||||||
|
27/03/2007
|
||||||
|
namespace
|
||||||
|
- Fix: Added missing xml-writer pop-calls
|
||||||
|
- Ported mapxml plugin to Doom3
|
||||||
|
- mapxml now exports brushes with its vertices
|
||||||
|
|
||||||
19/03/2007
|
19/03/2007
|
||||||
namespace
|
namespace
|
||||||
- Fix: Selection is now deleted when creating a patch out of it (aumüller / namespace)
|
- Fix: Selection is now deleted when creating a patch out of it (aumüller / namespace)
|
||||||
|
|
|
@ -159,6 +159,7 @@ public:
|
||||||
{
|
{
|
||||||
m_ostream.write('/');
|
m_ostream.write('/');
|
||||||
m_ostream.write('>');
|
m_ostream.write('>');
|
||||||
|
m_elements.pop_back();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -166,6 +167,7 @@ public:
|
||||||
m_ostream.write('/');
|
m_ostream.write('/');
|
||||||
write_string(name);
|
write_string(name);
|
||||||
m_ostream.write('>');
|
m_ostream.write('>');
|
||||||
|
m_elements.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::size_t write(const char* data, std::size_t length)
|
std::size_t write(const char* data, std::size_t length)
|
||||||
|
|
|
@ -37,29 +37,43 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
class MapXMLDependencies :
|
class MapXMLDependencies :
|
||||||
public GlobalRadiantModuleRef,
|
public GlobalRadiantModuleRef,
|
||||||
public GlobalBrushModuleRef,
|
public GlobalBrushModuleRef,
|
||||||
public GlobalPatchModuleRef,
|
|
||||||
public GlobalFiletypesModuleRef,
|
public GlobalFiletypesModuleRef,
|
||||||
public GlobalEntityClassManagerModuleRef,
|
public GlobalEntityClassManagerModuleRef,
|
||||||
public GlobalSceneGraphModuleRef
|
public GlobalSceneGraphModuleRef
|
||||||
{
|
{
|
||||||
|
PatchModuleRef m_patchDef2Doom3Module;
|
||||||
|
PatchModuleRef m_patchDoom3Module;
|
||||||
public:
|
public:
|
||||||
MapXMLDependencies() :
|
MapXMLDependencies() :
|
||||||
GlobalBrushModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("brushtypes")),
|
GlobalBrushModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("brushtypes")),
|
||||||
GlobalPatchModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("patchtypes")),
|
GlobalEntityClassManagerModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("entityclass")),
|
||||||
GlobalEntityClassManagerModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("entityclass"))
|
m_patchDef2Doom3Module("def2doom3"),
|
||||||
|
m_patchDoom3Module("doom3")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
BrushCreator& getBrushDoom3()
|
||||||
|
{
|
||||||
|
return GlobalBrushModule::getTable();
|
||||||
|
}
|
||||||
|
PatchCreator& getPatchDoom3()
|
||||||
|
{
|
||||||
|
return *m_patchDoom3Module.getTable();
|
||||||
|
}
|
||||||
|
PatchCreator& getPatchDef2Doom3()
|
||||||
|
{
|
||||||
|
return *m_patchDef2Doom3Module.getTable();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MapXMLAPI : public TypeSystemRef, public MapFormat
|
class MapXMLAPI : public TypeSystemRef, public MapFormat
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef MapFormat Type;
|
typedef MapFormat Type;
|
||||||
STRING_CONSTANT(Name, "xmlq3");
|
STRING_CONSTANT(Name, "xmldoom3");
|
||||||
|
|
||||||
MapXMLAPI()
|
MapXMLAPI()
|
||||||
{
|
{
|
||||||
GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("xml quake3 maps", "*.xmap"));
|
GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("xml doom3 maps", "*.xmap"));
|
||||||
}
|
}
|
||||||
MapFormat* getTable()
|
MapFormat* getTable()
|
||||||
{
|
{
|
||||||
|
@ -84,7 +98,10 @@ MapXMLModule g_MapXMLModule;
|
||||||
|
|
||||||
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)
|
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)
|
||||||
{
|
{
|
||||||
initialiseModule(server);
|
GlobalErrorStream::instance().setOutputStream(server.getErrorStream());
|
||||||
|
GlobalOutputStream::instance().setOutputStream(server.getOutputStream());
|
||||||
|
GlobalDebugMessageHandler::instance().setHandler(server.getDebugMessageHandler());
|
||||||
|
GlobalModuleServer::instance().set(server);
|
||||||
|
|
||||||
g_MapXMLModule.selfRegister();
|
g_MapXMLModule.selfRegister();
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MapQ3Importer : public TreeXMLImporter
|
class MapDoom3Importer : public TreeXMLImporter
|
||||||
{
|
{
|
||||||
scene::Node& m_root;
|
scene::Node& m_root;
|
||||||
char m_child[sizeof(EntityImporter)];
|
char m_child[sizeof(EntityImporter)];
|
||||||
|
@ -219,17 +219,17 @@ class MapQ3Importer : public TreeXMLImporter
|
||||||
return *reinterpret_cast<EntityImporter*>(m_child);
|
return *reinterpret_cast<EntityImporter*>(m_child);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
MapQ3Importer(scene::Node& root, EntityCreator& entityTable) : m_root(root), m_entityTable(entityTable)
|
MapDoom3Importer(scene::Node& root, EntityCreator& entityTable) : m_root(root), m_entityTable(entityTable)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void pushElement(const XMLElement& element)
|
void pushElement(const XMLElement& element)
|
||||||
{
|
{
|
||||||
ASSERT_MESSAGE(string_equal(element.name(), "mapq3"), PARSE_ERROR);
|
ASSERT_MESSAGE(string_equal(element.name(), "mapdoom3"), PARSE_ERROR);
|
||||||
constructor(getEntity(), makeReference(m_root), makeReference(m_entityTable));
|
constructor(getEntity(), makeReference(m_root), makeReference(m_entityTable));
|
||||||
}
|
}
|
||||||
void popElement(const char* name)
|
void popElement(const char* name)
|
||||||
{
|
{
|
||||||
ASSERT_MESSAGE(string_equal(name, "mapq3"), PARSE_ERROR);
|
ASSERT_MESSAGE(string_equal(name, "mapdoom3"), PARSE_ERROR);
|
||||||
destructor(getEntity());
|
destructor(getEntity());
|
||||||
}
|
}
|
||||||
std::size_t write(const char* data, std::size_t length)
|
std::size_t write(const char* data, std::size_t length)
|
||||||
|
@ -271,7 +271,7 @@ void Map_Read(scene::Node& root, TextInputStream& in, EntityCreator& entityTable
|
||||||
{
|
{
|
||||||
XMLStreamParser parser(in);
|
XMLStreamParser parser(in);
|
||||||
|
|
||||||
MapQ3Importer importer(root, entityTable);
|
MapDoom3Importer importer(root, entityTable);
|
||||||
TreeXMLImporterStack stack(importer);
|
TreeXMLImporterStack stack(importer);
|
||||||
parser.exportXML(stack);
|
parser.exportXML(stack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ void Map_Write(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream&
|
||||||
XMLStreamWriter writer(out);
|
XMLStreamWriter writer(out);
|
||||||
writer.write("\n", 1);
|
writer.write("\n", 1);
|
||||||
{
|
{
|
||||||
StaticElement element("mapq3");
|
StaticElement element("mapdoom3");
|
||||||
writer.pushElement(element);
|
writer.pushElement(element);
|
||||||
|
|
||||||
traverse(root, write_all(writer));
|
traverse(root, write_all(writer));
|
||||||
|
|
|
@ -250,6 +250,49 @@ inline void FacePlane_exportXML(const FacePlane& facePlane, XMLImporter& importe
|
||||||
importer.popElement(element.name());
|
importer.popElement(element.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void FacePolygon_exportXML(const Winding& w, const BasicVector3<double>& normal, XMLImporter& importer)
|
||||||
|
{
|
||||||
|
DynamicElement element("polygon");
|
||||||
|
|
||||||
|
char tmp[32];
|
||||||
|
|
||||||
|
sprintf(tmp, "%f", normal.x());
|
||||||
|
element.insertAttribute("nx", tmp);
|
||||||
|
|
||||||
|
sprintf(tmp, "%f", normal.y());
|
||||||
|
element.insertAttribute("ny", tmp);
|
||||||
|
|
||||||
|
sprintf(tmp, "%f", normal.z());
|
||||||
|
element.insertAttribute("nz", tmp);
|
||||||
|
|
||||||
|
importer.pushElement(element);
|
||||||
|
|
||||||
|
for(unsigned int i = 0; i < w.numpoints; ++i)
|
||||||
|
{
|
||||||
|
StaticElement c("vertex");
|
||||||
|
|
||||||
|
sprintf(tmp, "%f", w.points[i].vertex.x());
|
||||||
|
c.insertAttribute("x", tmp);
|
||||||
|
|
||||||
|
sprintf(tmp, "%f", w.points[i].vertex.y());
|
||||||
|
c.insertAttribute("y", tmp);
|
||||||
|
|
||||||
|
sprintf(tmp, "%f", w.points[i].vertex.z());
|
||||||
|
c.insertAttribute("z", tmp);
|
||||||
|
|
||||||
|
sprintf(tmp, "%f", w.points[i].texcoord.x());
|
||||||
|
c.insertAttribute("s", tmp);
|
||||||
|
|
||||||
|
sprintf(tmp, "%f", w.points[i].texcoord.y());
|
||||||
|
c.insertAttribute("t", tmp);
|
||||||
|
|
||||||
|
importer.pushElement(c);
|
||||||
|
importer.popElement(c.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
importer.popElement(element.name());
|
||||||
|
}
|
||||||
|
|
||||||
class FaceXMLExporter
|
class FaceXMLExporter
|
||||||
{
|
{
|
||||||
const Face& m_face;
|
const Face& m_face;
|
||||||
|
@ -269,6 +312,7 @@ public:
|
||||||
importer.popElement(element.name());
|
importer.popElement(element.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FacePolygon_exportXML(m_face.getWinding(), m_face.getPlane().plane3().normal(), importer);
|
||||||
FacePlane_exportXML(m_face.getPlane(), importer);
|
FacePlane_exportXML(m_face.getPlane(), importer);
|
||||||
|
|
||||||
if(!bAlternateTexdef)
|
if(!bAlternateTexdef)
|
||||||
|
|
Loading…
Reference in a new issue