build flat_vertices collection for VBO
This commit is contained in:
parent
67ef0c4009
commit
6dab4e48a6
18
WFObj.cc
18
WFObj.cc
@ -442,12 +442,28 @@ bool WFObj::loadfile(const char *path, Buffer & buff)
|
|||||||
|
|
||||||
void WFObj::buildVBO()
|
void WFObj::buildVBO()
|
||||||
{
|
{
|
||||||
|
map<VertexRef, int> flat_vertices;
|
||||||
|
int vid = 0;
|
||||||
glGenBuffers(1, &m_vbo);
|
glGenBuffers(1, &m_vbo);
|
||||||
bool do_textures = m_loadtexture != NULL
|
bool do_textures = m_loadtexture != NULL
|
||||||
&& m_vertices[VERTEX_TEXTURE].size() > 0;
|
&& m_vertices[VERTEX_TEXTURE].size() > 0;
|
||||||
|
for (map<string, vector<Face> >::iterator it = m_faces.begin();
|
||||||
|
it != m_faces.end();
|
||||||
|
it++)
|
||||||
|
{
|
||||||
|
for (vector<Face>::iterator fit = it->second.begin();
|
||||||
|
fit != it->second.end();
|
||||||
|
fit++)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
flat_vertices[fit->vertices[i]] = vid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WFObj::VertexRef::operator<(const VertexRef & other)
|
bool WFObj::VertexRef::operator<(const VertexRef & other) const
|
||||||
{
|
{
|
||||||
if (vertex != other.vertex)
|
if (vertex != other.vertex)
|
||||||
return vertex < other.vertex;
|
return vertex < other.vertex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user