style cleanup: follow style guide for/with/if spacing
This commit is contained in:
@@ -64,7 +64,7 @@ struct RAS_MeshObject::polygonSlot
|
||||
MT_Vector3 center(0, 0, 0);
|
||||
int i;
|
||||
|
||||
for(i=0; i<nvert; i++) {
|
||||
for (i=0; i<nvert; i++) {
|
||||
m_index[i] = indexarray[offset+i];
|
||||
center += vertexarray[m_index[i]].getXYZ();
|
||||
}
|
||||
@@ -79,7 +79,7 @@ struct RAS_MeshObject::polygonSlot
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<nvert; i++)
|
||||
for (i=0; i<nvert; i++)
|
||||
indexarray[offset+i] = m_index[i];
|
||||
}
|
||||
};
|
||||
@@ -115,7 +115,7 @@ RAS_MeshObject::RAS_MeshObject(Mesh* mesh)
|
||||
int count=0;
|
||||
// initialize weight cache for shape objects
|
||||
// count how many keys in this mesh
|
||||
for(kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next)
|
||||
for (kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next)
|
||||
count++;
|
||||
m_cacheWeightIndex.resize(count,-1);
|
||||
}
|
||||
@@ -129,14 +129,14 @@ RAS_MeshObject::~RAS_MeshObject()
|
||||
{
|
||||
KeyBlock *kb;
|
||||
// remove the weight cache to avoid memory leak
|
||||
for(kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) {
|
||||
if(kb->weights)
|
||||
for (kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) {
|
||||
if (kb->weights)
|
||||
MEM_freeN(kb->weights);
|
||||
kb->weights= NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for(it=m_Polygons.begin(); it!=m_Polygons.end(); it++)
|
||||
for (it=m_Polygons.begin(); it!=m_Polygons.end(); it++)
|
||||
delete (*it);
|
||||
|
||||
m_sharedvertex_map.clear();
|
||||
@@ -165,7 +165,7 @@ const STR_String& RAS_MeshObject::GetMaterialName(unsigned int matid)
|
||||
{
|
||||
RAS_MeshMaterial* mmat = GetMeshMaterial(matid);
|
||||
|
||||
if(mmat)
|
||||
if (mmat)
|
||||
return mmat->m_bucket->GetPolyMaterial()->GetMaterialName();
|
||||
|
||||
return s_emptyname;
|
||||
@@ -234,7 +234,7 @@ const STR_String& RAS_MeshObject::GetTextureName(unsigned int matid)
|
||||
{
|
||||
RAS_MeshMaterial* mmat = GetMeshMaterial(matid);
|
||||
|
||||
if(mmat)
|
||||
if (mmat)
|
||||
return mmat->m_bucket->GetPolyMaterial()->GetTextureName();
|
||||
|
||||
return s_emptyname;
|
||||
@@ -245,8 +245,8 @@ RAS_MeshMaterial *RAS_MeshObject::GetMeshMaterial(RAS_IPolyMaterial *mat)
|
||||
list<RAS_MeshMaterial>::iterator mit;
|
||||
|
||||
/* find a mesh material */
|
||||
for(mit = m_materials.begin(); mit != m_materials.end(); mit++)
|
||||
if(mit->m_bucket->GetPolyMaterial() == mat)
|
||||
for (mit = m_materials.begin(); mit != m_materials.end(); mit++)
|
||||
if (mit->m_bucket->GetPolyMaterial() == mat)
|
||||
return &*mit;
|
||||
|
||||
return NULL;
|
||||
@@ -258,8 +258,8 @@ int RAS_MeshObject::GetMaterialId(RAS_IPolyMaterial *mat)
|
||||
int imat;
|
||||
|
||||
/* find a mesh material */
|
||||
for(imat=0, mit = m_materials.begin(); mit != m_materials.end(); mit++, imat++)
|
||||
if(mit->m_bucket->GetPolyMaterial() == mat)
|
||||
for (imat=0, mit = m_materials.begin(); mit != m_materials.end(); mit++, imat++)
|
||||
if (mit->m_bucket->GetPolyMaterial() == mat)
|
||||
return imat;
|
||||
|
||||
return -1;
|
||||
@@ -275,7 +275,7 @@ RAS_Polygon* RAS_MeshObject::AddPolygon(RAS_MaterialBucket *bucket, int numverts
|
||||
mmat = GetMeshMaterial(bucket->GetPolyMaterial());
|
||||
|
||||
/* none found, create a new one */
|
||||
if(!mmat) {
|
||||
if (!mmat) {
|
||||
RAS_MeshMaterial meshmat;
|
||||
meshmat.m_bucket = bucket;
|
||||
meshmat.m_baseslot = meshmat.m_bucket->AddMesh(numverts);
|
||||
@@ -317,8 +317,8 @@ void RAS_MeshObject::SetVertexColor(RAS_IPolyMaterial* mat,MT_Vector4 rgba)
|
||||
RAS_MeshSlot::iterator it;
|
||||
size_t i;
|
||||
|
||||
for(slot->begin(it); !slot->end(it); slot->next(it))
|
||||
for(i=it.startvertex; i<it.endvertex; i++)
|
||||
for (slot->begin(it); !slot->end(it); slot->next(it))
|
||||
for (i=it.startvertex; i<it.endvertex; i++)
|
||||
it.vertex[i].SetRGBA(rgba);
|
||||
}
|
||||
|
||||
@@ -349,15 +349,15 @@ void RAS_MeshObject::AddVertex(RAS_Polygon *poly, int i,
|
||||
vector<SharedVertex>& sharedmap = m_sharedvertex_map[origindex];
|
||||
vector<SharedVertex>::iterator it;
|
||||
|
||||
for(it = sharedmap.begin(); it != sharedmap.end(); it++)
|
||||
for (it = sharedmap.begin(); it != sharedmap.end(); it++)
|
||||
{
|
||||
if(it->m_darray != darray)
|
||||
if (it->m_darray != darray)
|
||||
continue;
|
||||
if(!it->m_darray->m_vertex[it->m_offset].closeTo(&texvert))
|
||||
if (!it->m_darray->m_vertex[it->m_offset].closeTo(&texvert))
|
||||
continue;
|
||||
|
||||
/* found one, add it and we're done */
|
||||
if(poly->IsVisible())
|
||||
if (poly->IsVisible())
|
||||
slot->AddPolygonVertex(it->m_offset);
|
||||
poly->SetVertexOffset(i, it->m_offset);
|
||||
return;
|
||||
@@ -366,7 +366,7 @@ void RAS_MeshObject::AddVertex(RAS_Polygon *poly, int i,
|
||||
|
||||
/* no shared vertex found, add a new one */
|
||||
offset = slot->AddVertex(texvert);
|
||||
if(poly->IsVisible())
|
||||
if (poly->IsVisible())
|
||||
slot->AddPolygonVertex(offset);
|
||||
poly->SetVertexOffset(i, offset);
|
||||
|
||||
@@ -387,7 +387,7 @@ int RAS_MeshObject::NumVertices(RAS_IPolyMaterial* mat)
|
||||
|
||||
mmat = GetMeshMaterial(mat);
|
||||
slot = mmat->m_baseslot;
|
||||
for(slot->begin(it); !slot->end(it); slot->next(it))
|
||||
for (slot->begin(it); !slot->end(it); slot->next(it))
|
||||
len += it.endvertex - it.startvertex;
|
||||
|
||||
return len;
|
||||
@@ -404,13 +404,13 @@ RAS_TexVert* RAS_MeshObject::GetVertex(unsigned int matid,
|
||||
|
||||
mmat = GetMeshMaterial(matid);
|
||||
|
||||
if(!mmat)
|
||||
if (!mmat)
|
||||
return NULL;
|
||||
|
||||
slot = mmat->m_baseslot;
|
||||
len = 0;
|
||||
for(slot->begin(it); !slot->end(it); slot->next(it)) {
|
||||
if(index >= len + it.endvertex - it.startvertex)
|
||||
for (slot->begin(it); !slot->end(it); slot->next(it)) {
|
||||
if (index >= len + it.endvertex - it.startvertex)
|
||||
len += it.endvertex - it.startvertex;
|
||||
else
|
||||
return &it.vertex[index - len];
|
||||
@@ -431,7 +431,7 @@ void RAS_MeshObject::AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer*
|
||||
list<RAS_MeshMaterial>::iterator it;
|
||||
list<RAS_MeshMaterial>::iterator mit;
|
||||
|
||||
for(it = m_materials.begin();it!=m_materials.end();++it) {
|
||||
for (it = m_materials.begin();it!=m_materials.end();++it) {
|
||||
/* always copy from the base slot, which is never removed
|
||||
* since new objects can be created with the same mesh data */
|
||||
if (deformer && !deformer->UseVertexArray())
|
||||
@@ -444,7 +444,7 @@ void RAS_MeshObject::AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer*
|
||||
RAS_IPolyMaterial* curmat = it->m_bucket->GetPolyMaterial();
|
||||
if (curmat->GetFlag() & RAS_BLENDERGLSL)
|
||||
{
|
||||
for(mit = m_materials.begin(); mit != it; ++mit)
|
||||
for (mit = m_materials.begin(); mit != it; ++mit)
|
||||
{
|
||||
RAS_IPolyMaterial* mat = mit->m_bucket->GetPolyMaterial();
|
||||
if ((mat->GetFlag() & RAS_BLENDERGLSL) &&
|
||||
@@ -468,10 +468,10 @@ void RAS_MeshObject::RemoveFromBuckets(void *clientobj)
|
||||
{
|
||||
list<RAS_MeshMaterial>::iterator it;
|
||||
|
||||
for(it = m_materials.begin();it!=m_materials.end();++it) {
|
||||
for (it = m_materials.begin();it!=m_materials.end();++it) {
|
||||
RAS_MeshSlot **msp = it->m_slots[clientobj];
|
||||
|
||||
if(!msp)
|
||||
if (!msp)
|
||||
continue;
|
||||
|
||||
RAS_MeshSlot *ms = *msp;
|
||||
@@ -523,13 +523,13 @@ void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transfor
|
||||
RAS_MeshSlot::iterator it;
|
||||
size_t j;
|
||||
|
||||
for(ms.begin(it); !ms.end(it); ms.next(it)) {
|
||||
for (ms.begin(it); !ms.end(it); ms.next(it)) {
|
||||
unsigned int nvert = (int)it.array->m_type;
|
||||
unsigned int totpoly = it.totindex/nvert;
|
||||
|
||||
if(totpoly <= 1)
|
||||
if (totpoly <= 1)
|
||||
continue;
|
||||
if(it.array->m_type == RAS_DisplayArray::LINE)
|
||||
if (it.array->m_type == RAS_DisplayArray::LINE)
|
||||
continue;
|
||||
|
||||
// Extract camera Z plane...
|
||||
@@ -539,14 +539,14 @@ void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transfor
|
||||
vector<polygonSlot> slots(totpoly);
|
||||
|
||||
/* get indices and z into temporary array */
|
||||
for(j=0; j<totpoly; j++)
|
||||
for (j=0; j<totpoly; j++)
|
||||
slots[j].get(it.vertex, it.index, j*nvert, nvert, pnorm);
|
||||
|
||||
/* sort (stable_sort might be better, if flickering happens?) */
|
||||
std::sort(slots.begin(), slots.end(), backtofront());
|
||||
|
||||
/* get indices from temporary array again */
|
||||
for(j=0; j<totpoly; j++)
|
||||
for (j=0; j<totpoly; j++)
|
||||
slots[j].set(it.index, j*nvert, nvert);
|
||||
}
|
||||
}
|
||||
@@ -584,7 +584,7 @@ void RAS_MeshObject::CheckWeightCache(Object* obj)
|
||||
if (!m_mesh->key)
|
||||
return;
|
||||
|
||||
for(kbindex=0, kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next, kbindex++)
|
||||
for (kbindex=0, kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next, kbindex++)
|
||||
{
|
||||
// first check the cases where the weight must be cleared
|
||||
if (kb->vgroup[0] == 0 ||
|
||||
|
||||
Reference in New Issue
Block a user