TFace attributes offset, scale, and rotation are assigned.
This commit is contained in:
parent
4c529c4f82
commit
697cce13ef
@ -226,56 +226,35 @@ EParserState CMapParser::ParseVertex(const std::string _Line)
|
|||||||
return(PARSERSTATE_VERTEX);
|
return(PARSERSTATE_VERTEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
EParserState CMapParser::ParseFace(const std::string _Line)
|
EParserState CMapParser::ParseFace(const std::string _Line) {
|
||||||
{
|
stringstream ss(_Line);
|
||||||
const size_t kszLineSize = 2048;
|
string material;
|
||||||
char pcLine[kszLineSize];
|
vector<int> Indices;
|
||||||
const char* kpcDelim = " \t";
|
TFace Face;
|
||||||
char* pcToken;
|
float *f = &Face.m_fXOffset;
|
||||||
char* pcContext;
|
string data;
|
||||||
|
unsigned int i = 0;
|
||||||
strcpy_s(pcLine, _Line.c_str());
|
// For a primitive in Reflex, there is at least 9 and at most 10 fields.
|
||||||
pcToken = strtok_s(pcLine, kpcDelim, &pcContext);
|
while (ss >> data) {
|
||||||
|
if (i < 5) {
|
||||||
int iTokenNum = 0;
|
if (isdigit(data[0], std::locale()) || data[0] == '-') {
|
||||||
|
double dvalue = stod(data);
|
||||||
std::string material;
|
*f = (float)dvalue;
|
||||||
|
f++;
|
||||||
std::vector<int> Indices;
|
} else {
|
||||||
while(pcToken != nullptr)
|
return PARSERSTATE_BRUSH;
|
||||||
{
|
}
|
||||||
if(iTokenNum < 5)
|
} else if (i == 9) {
|
||||||
{
|
|
||||||
if(std::isdigit(pcToken[0], std::locale()) || pcToken[0] == '-')
|
|
||||||
{
|
|
||||||
double dValue = std::stod(pcToken);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return(PARSERSTATE_BRUSH);
|
|
||||||
}
|
|
||||||
} else if (iTokenNum == 9) {
|
|
||||||
// this should be '0x' something, which wasn't in V6.
|
|
||||||
;
|
;
|
||||||
|
} else {
|
||||||
|
if (isdigit(data[0], std::locale()) || data[0] == '-') {
|
||||||
|
Indices.push_back(stoi(data));
|
||||||
|
} else {
|
||||||
|
material = data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
i++;
|
||||||
{
|
}
|
||||||
if(std::isdigit(pcToken[0], std::locale()) || pcToken[0] == '-')
|
|
||||||
{
|
|
||||||
int iValue = std::stoi(pcToken);
|
|
||||||
Indices.push_back(iValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
material = pcToken;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
iTokenNum++;
|
|
||||||
pcToken = strtok_s(nullptr, kpcDelim, &pcContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
TFace Face;
|
|
||||||
Face.m_Indices = Indices;
|
Face.m_Indices = Indices;
|
||||||
Face.m_Material = material;
|
Face.m_Material = material;
|
||||||
m_WorldSpawn.m_Brushes[m_WorldSpawn.m_Brushes.size()-1].m_Faces.push_back(Face);
|
m_WorldSpawn.m_Brushes[m_WorldSpawn.m_Brushes.size()-1].m_Faces.push_back(Face);
|
||||||
|
Loading…
Reference in New Issue
Block a user