Skip to content

Commit

Permalink
UPBGE: Remove AddVertex and AddPolygonVertex.
Browse files Browse the repository at this point in the history
RAS_MeshSlot should not be the constructor of a display array. It just
use it.
  • Loading branch information
panzergame committed Jun 25, 2016
1 parent 3aa6f30 commit 52815f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 23 deletions.
19 changes: 10 additions & 9 deletions source/gameengine/Rasterizer/RAS_MeshObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ void RAS_MeshObject::AddLine(RAS_MaterialBucket *bucket, unsigned int v1, unsign
// create a new polygon
RAS_DisplayArray *darray = slot->GetDisplayArray();
darray->m_type = RAS_DisplayArray::LINES;
slot->AddPolygonVertex(v1);
slot->AddPolygonVertex(v2);
darray->m_index.push_back(v1);
darray->m_index.push_back(v2);
}

RAS_Polygon *RAS_MeshObject::AddPolygon(RAS_MaterialBucket *bucket, int numverts, unsigned int indices[4],
Expand All @@ -329,19 +329,19 @@ RAS_Polygon *RAS_MeshObject::AddPolygon(RAS_MaterialBucket *bucket, int numverts

if (visible && !bucket->IsWire()) {
// Add the first triangle.
slot->AddPolygonVertex(indices[0]);
slot->AddPolygonVertex(indices[1]);
slot->AddPolygonVertex(indices[2]);
darray->m_index.push_back(indices[0]);
darray->m_index.push_back(indices[1]);
darray->m_index.push_back(indices[2]);

poly->SetVertexOffset(0, indices[0]);
poly->SetVertexOffset(1, indices[1]);
poly->SetVertexOffset(2, indices[2]);

if (numverts == 4) {
// Add the second triangle.
slot->AddPolygonVertex(indices[0]);
slot->AddPolygonVertex(indices[2]);
slot->AddPolygonVertex(indices[3]);
darray->m_index.push_back(indices[0]);
darray->m_index.push_back(indices[2]);
darray->m_index.push_back(indices[3]);

poly->SetVertexOffset(3, indices[3]);
}
Expand Down Expand Up @@ -395,7 +395,8 @@ unsigned int RAS_MeshObject::AddVertex(RAS_MaterialBucket *bucket, int i,
}

// no shared vertex found, add a new one
int offset = slot->AddVertex(texvert);
darray->m_vertex.push_back(texvert);
int offset = darray->m_vertex.size() - 1;

{ // Shared Vertex!
SharedVertex shared;
Expand Down
11 changes: 0 additions & 11 deletions source/gameengine/Rasterizer/RAS_MeshSlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,6 @@ RAS_DisplayArray *RAS_MeshSlot::GetDisplayArray()
return m_displayArray;
}

int RAS_MeshSlot::AddVertex(const RAS_TexVert& tv)
{
m_displayArray->m_vertex.push_back(tv);
return (m_displayArray->m_vertex.size() - 1);
}

void RAS_MeshSlot::AddPolygonVertex(int offset)
{
m_displayArray->m_index.push_back(offset);
}

void RAS_MeshSlot::SetDeformer(RAS_Deformer *deformer)
{
if (deformer && m_pDeformer != deformer) {
Expand Down
3 changes: 0 additions & 3 deletions source/gameengine/Rasterizer/RAS_MeshSlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ class RAS_MeshSlot
void SetDeformer(RAS_Deformer *deformer);
void SetMeshUser(RAS_MeshUser *user);

int AddVertex(const RAS_TexVert& tv);
void AddPolygonVertex(int offset);

#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_MeshSlot")
#endif
Expand Down

0 comments on commit 52815f4

Please sign in to comment.