Fixed some really stupid bugs.
This commit is contained in:
parent
435a16977c
commit
091f81edcb
@ -14,6 +14,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Platform Libraries
|
// Platform Libraries
|
||||||
|
#define NOMINMAX
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
@ -32,11 +32,17 @@ TPlanePoints GetPlanePoints(const TVector3f* _kpPoints, const size_t _kNumPoints
|
|||||||
}
|
}
|
||||||
const TVector3f kCenter = ScalarMultiply(TVector3f(), Temp, (1.0f / (float)_kNumPoints));
|
const TVector3f kCenter = ScalarMultiply(TVector3f(), Temp, (1.0f / (float)_kNumPoints));
|
||||||
|
|
||||||
|
float fWidth = 1.0f;
|
||||||
|
for(size_t i = 0; i < _kNumPoints; ++i)
|
||||||
|
{
|
||||||
|
fWidth = std::max(fWidth, VectorMagnitude(Subtract(TVector3f(), _kpPoints[i], kCenter)));
|
||||||
|
}
|
||||||
|
|
||||||
// Find Tangent
|
// Find Tangent
|
||||||
const TVector3f kTangent = ScalarMultiply(TVector3f(), Normalize(TVector3f(), Subtract(TVector3f(), _kpPoints[1], _kpPoints[0])), 8192.0f);
|
const TVector3f kTangent = ScalarMultiply(TVector3f(), Normalize(TVector3f(), Subtract(TVector3f(), _kpPoints[1], _kpPoints[0])), fWidth);
|
||||||
|
|
||||||
// Find BiTangent
|
// Find BiTangent
|
||||||
const TVector3f kBiTangent = ScalarMultiply(TVector3f(), Normalize(TVector3f(), CrossProduct(TVector3f(), kNormal, kTangent)), 8192.0f);
|
const TVector3f kBiTangent = ScalarMultiply(TVector3f(), Normalize(TVector3f(), CrossProduct(TVector3f(), kNormal, kTangent)), fWidth);
|
||||||
|
|
||||||
PlanePoints.m_A = Add(TVector3f(), kCenter, kBiTangent);
|
PlanePoints.m_A = Add(TVector3f(), kCenter, kBiTangent);
|
||||||
PlanePoints.m_B = kCenter;
|
PlanePoints.m_B = kCenter;
|
||||||
|
@ -140,7 +140,7 @@ EParserState CMapParser::ParseBrush(const std::string _Line)
|
|||||||
|
|
||||||
EParserState CMapParser::ParseVertex(const std::string _Line)
|
EParserState CMapParser::ParseVertex(const std::string _Line)
|
||||||
{
|
{
|
||||||
const size_t kszLineSize = 256;
|
const size_t kszLineSize = 2048;
|
||||||
char pcLine[kszLineSize];
|
char pcLine[kszLineSize];
|
||||||
const char* kpcDelim = " \t";
|
const char* kpcDelim = " \t";
|
||||||
char* pcToken;
|
char* pcToken;
|
||||||
@ -184,7 +184,7 @@ EParserState CMapParser::ParseVertex(const std::string _Line)
|
|||||||
|
|
||||||
EParserState CMapParser::ParseFace(const std::string _Line)
|
EParserState CMapParser::ParseFace(const std::string _Line)
|
||||||
{
|
{
|
||||||
const size_t kszLineSize = 256;
|
const size_t kszLineSize = 2048;
|
||||||
char pcLine[kszLineSize];
|
char pcLine[kszLineSize];
|
||||||
const char* kpcDelim = " \t";
|
const char* kpcDelim = " \t";
|
||||||
char* pcToken;
|
char* pcToken;
|
||||||
@ -195,6 +195,8 @@ EParserState CMapParser::ParseFace(const std::string _Line)
|
|||||||
|
|
||||||
int iTokenNum = 0;
|
int iTokenNum = 0;
|
||||||
|
|
||||||
|
std::string material;
|
||||||
|
|
||||||
std::vector<int> Indices;
|
std::vector<int> Indices;
|
||||||
while(pcToken != nullptr)
|
while(pcToken != nullptr)
|
||||||
{
|
{
|
||||||
@ -209,7 +211,7 @@ EParserState CMapParser::ParseFace(const std::string _Line)
|
|||||||
return(PARSERSTATE_BRUSH);
|
return(PARSERSTATE_BRUSH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(iTokenNum < 9)
|
else
|
||||||
{
|
{
|
||||||
if(std::isdigit(pcToken[0], std::locale()) || pcToken[0] == '-')
|
if(std::isdigit(pcToken[0], std::locale()) || pcToken[0] == '-')
|
||||||
{
|
{
|
||||||
@ -218,7 +220,7 @@ EParserState CMapParser::ParseFace(const std::string _Line)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return(PARSERSTATE_BRUSH);
|
material = pcToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,6 +230,7 @@ EParserState CMapParser::ParseFace(const std::string _Line)
|
|||||||
|
|
||||||
TFace Face;
|
TFace Face;
|
||||||
Face.m_Indices = Indices;
|
Face.m_Indices = Indices;
|
||||||
|
Face.m_Material = material;
|
||||||
this->m_WorldSpawn.m_Brushes[this->m_WorldSpawn.m_Brushes.size()-1].m_Faces.push_back(Face);
|
this->m_WorldSpawn.m_Brushes[this->m_WorldSpawn.m_Brushes.size()-1].m_Faces.push_back(Face);
|
||||||
return(PARSERSTATE_FACE);
|
return(PARSERSTATE_FACE);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user