57 lines
1.9 KiB
C++
57 lines
1.9 KiB
C++
|
#include "brushdef.hpp"
|
||
|
|
||
|
using namespace std;
|
||
|
// e.g GTK Radiant or older level editors.
|
||
|
void brushdef_gtk(std::stringstream &x, const vector<TPlanePoints> &y) {
|
||
|
if(y.size())
|
||
|
{
|
||
|
x << "{" << std::endl;
|
||
|
for(const TPlanePoints& krPlane : y)
|
||
|
{
|
||
|
x << "( " << krPlane.m_A[X] << " " << krPlane.m_A[Z] << " " << krPlane.m_A[Y] << " ) ";
|
||
|
x << "( " << krPlane.m_B[X] << " " << krPlane.m_B[Z] << " " << krPlane.m_B[Y] << " ) ";
|
||
|
x << "( " << krPlane.m_C[X] << " " << krPlane.m_C[Z] << " " << krPlane.m_C[Y] << " ) ";
|
||
|
if(krPlane.m_material.length())
|
||
|
{
|
||
|
x << krPlane.m_material << " 0 0 0 0.500000 0.500000" << std::endl;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
x << "common/caulk 0 0 0 0.500000 0.500000" << std::endl;
|
||
|
}
|
||
|
}
|
||
|
x << "}" << std::endl;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// e.g Net Radiant and anything else based on it.
|
||
|
void brushdef_net(std::stringstream &x, const vector<TPlanePoints> &y) {
|
||
|
if (y.size()) {
|
||
|
x << "{" << std::endl;
|
||
|
x << "brushDef" << std::endl;
|
||
|
x << "{" << std::endl;
|
||
|
for (const TPlanePoints& z : y) {
|
||
|
x << "( " << z.m_A[X] << " " << z.m_A[Z] << " " << z.m_A[Y] << " ) ";
|
||
|
x << "( " << z.m_B[X] << " " << z.m_B[Z] << " " << z.m_B[Y] << " ) ";
|
||
|
x << "( " << z.m_C[X] << " " << z.m_C[Z] << " " << z.m_C[Y] << " ) ";
|
||
|
if (z.m_material.length()) {
|
||
|
// placeholder values, for now only concerned with geometry
|
||
|
x << " ( ( 0 0 0 ) ( 0 0 0 ) ) " << z.m_material << " 0 0 0" << std::endl;
|
||
|
} else {
|
||
|
x << " ( ( 0 0 0 ) ( 0 0 0 ) ) common/caulk 0 0 0" << std::endl;
|
||
|
}
|
||
|
}
|
||
|
x << "}" << std::endl;
|
||
|
x << "}" << std::endl;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
std::string GetBrushString(const TBrush& _krBrush,
|
||
|
void (*f) (std::stringstream &, const vector<TPlanePoints> &))
|
||
|
{
|
||
|
std::vector<TPlanePoints> Planes = GetBrushPlanes(_krBrush);
|
||
|
std::stringstream ssOutput;
|
||
|
f(ssOutput, Planes);
|
||
|
return(ssOutput.str());
|
||
|
}
|