update updateAABB()
This commit is contained in:
parent
8e6cd37dc9
commit
3506ad6b57
49
WFObj.cc
49
WFObj.cc
@ -227,32 +227,35 @@ void WFObj::processInputLine(const std::string & input)
|
||||
}
|
||||
}
|
||||
|
||||
void WFObj::updateAABB(const float * const vertex)
|
||||
void WFObj::updateAABB()
|
||||
{
|
||||
#ifdef TODO
|
||||
if (m_loadedVertex)
|
||||
bool firstVertex = true;
|
||||
for (int i = 0, sz = m_vertices[VERTEX].size(); i < sz; i++)
|
||||
{
|
||||
if (vertex[0] < m_aabb[0])
|
||||
m_aabb[0] = vertex[0];
|
||||
else if (vertex[0] > m_aabb[3])
|
||||
m_aabb[3] = vertex[0];
|
||||
if (vertex[1] < m_aabb[1])
|
||||
m_aabb[1] = vertex[1];
|
||||
else if (vertex[1] > m_aabb[4])
|
||||
m_aabb[4] = vertex[1];
|
||||
if (vertex[2] < m_aabb[2])
|
||||
m_aabb[2] = vertex[2];
|
||||
else if (vertex[2] > m_aabb[5])
|
||||
m_aabb[5] = vertex[2];
|
||||
Vertex & v = m_vertices[VERTEX][i];
|
||||
if (firstVertex)
|
||||
{
|
||||
m_aabb[0] = m_aabb[3] = v[0];
|
||||
m_aabb[1] = m_aabb[4] = v[1];
|
||||
m_aabb[2] = m_aabb[5] = v[2];
|
||||
firstVertex = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (v[0] < m_aabb[0])
|
||||
m_aabb[0] = v[0];
|
||||
else if (v[0] > m_aabb[3])
|
||||
m_aabb[3] = v[0];
|
||||
if (v[1] < m_aabb[1])
|
||||
m_aabb[1] = v[1];
|
||||
else if (v[1] > m_aabb[4])
|
||||
m_aabb[4] = v[1];
|
||||
if (v[2] < m_aabb[2])
|
||||
m_aabb[2] = v[2];
|
||||
else if (v[2] > m_aabb[5])
|
||||
m_aabb[5] = v[2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_aabb[0] = m_aabb[3] = vertex[0];
|
||||
m_aabb[1] = m_aabb[4] = vertex[1];
|
||||
m_aabb[2] = m_aabb[5] = vertex[2];
|
||||
m_loadedVertex = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
WFObj::Vertex WFObj::readVertex(const vector<string> & parts)
|
||||
|
2
WFObj.h
2
WFObj.h
@ -65,7 +65,7 @@ protected:
|
||||
Vertex readVertex(const std::vector<std::string> & parts);
|
||||
std::vector<Face> readFaces(const std::vector<std::string> & parts);
|
||||
VertexRef readVertexRef(const std::string ref);
|
||||
void updateAABB(const float * const vertex);
|
||||
void updateAABB();
|
||||
static bool loadfile(const char *path, Buffer *buff);
|
||||
std::string getLine(const Buffer & buff, size_t idx, size_t *update_idx);
|
||||
void loadMaterial(const std::string & name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user