style cleanup: follow style guide for/with/if spacing
This commit is contained in:
@@ -323,7 +323,7 @@ void RAS_OpenGLRasterizer::SetDrawingMode(int drawingmode)
|
||||
{
|
||||
m_drawingmode = drawingmode;
|
||||
|
||||
if(m_drawingmode == KX_WIREFRAME)
|
||||
if (m_drawingmode == KX_WIREFRAME)
|
||||
glDisable(GL_CULL_FACE);
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ void RAS_OpenGLRasterizer::ClearCachingInfo(void)
|
||||
|
||||
void RAS_OpenGLRasterizer::FlushDebugShapes()
|
||||
{
|
||||
if(!m_debugShapes.size())
|
||||
if (!m_debugShapes.size())
|
||||
return;
|
||||
|
||||
// DrawDebugLines
|
||||
@@ -368,8 +368,8 @@ void RAS_OpenGLRasterizer::FlushDebugShapes()
|
||||
light= glIsEnabled(GL_LIGHTING);
|
||||
tex= glIsEnabled(GL_TEXTURE_2D);
|
||||
|
||||
if(light) glDisable(GL_LIGHTING);
|
||||
if(tex) glDisable(GL_TEXTURE_2D);
|
||||
if (light) glDisable(GL_LIGHTING);
|
||||
if (tex) glDisable(GL_TEXTURE_2D);
|
||||
|
||||
//draw lines
|
||||
glBegin(GL_LINES);
|
||||
@@ -423,8 +423,8 @@ void RAS_OpenGLRasterizer::FlushDebugShapes()
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if(light) glEnable(GL_LIGHTING);
|
||||
if(tex) glEnable(GL_TEXTURE_2D);
|
||||
if (light) glEnable(GL_LIGHTING);
|
||||
if (tex) glEnable(GL_TEXTURE_2D);
|
||||
|
||||
m_debugShapes.clear();
|
||||
}
|
||||
@@ -513,7 +513,7 @@ RAS_IRasterizer::StereoMode RAS_OpenGLRasterizer::GetStereoMode()
|
||||
|
||||
bool RAS_OpenGLRasterizer::Stereo()
|
||||
{
|
||||
if(m_stereomode > RAS_STEREO_NOSTEREO) // > 0
|
||||
if (m_stereomode > RAS_STEREO_NOSTEREO) // > 0
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@@ -624,17 +624,17 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms,
|
||||
else
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
for(ms.begin(it); !ms.end(it); ms.next(it)) {
|
||||
for (ms.begin(it); !ms.end(it); ms.next(it)) {
|
||||
RAS_TexVert *vertex;
|
||||
size_t i, j, numvert;
|
||||
|
||||
numvert = it.array->m_type;
|
||||
|
||||
if(it.array->m_type == RAS_DisplayArray::LINE) {
|
||||
if (it.array->m_type == RAS_DisplayArray::LINE) {
|
||||
// line drawing, no text
|
||||
glBegin(GL_LINES);
|
||||
|
||||
for(i=0; i<it.totindex; i+=2)
|
||||
for (i=0; i<it.totindex; i+=2)
|
||||
{
|
||||
vertex = &it.vertex[it.index[i]];
|
||||
glVertex3fv(vertex->getXYZ());
|
||||
@@ -647,12 +647,12 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms,
|
||||
}
|
||||
else {
|
||||
// triangle and quad text drawing
|
||||
for(i=0; i<it.totindex; i+=numvert)
|
||||
for (i=0; i<it.totindex; i+=numvert)
|
||||
{
|
||||
float v[4][3];
|
||||
int glattrib, unit;
|
||||
|
||||
for(j=0; j<numvert; j++) {
|
||||
for (j=0; j<numvert; j++) {
|
||||
vertex = &it.vertex[it.index[i+j]];
|
||||
|
||||
v[j][0] = vertex->getXYZ()[0];
|
||||
@@ -662,9 +662,9 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms,
|
||||
|
||||
// find the right opengl attribute
|
||||
glattrib = -1;
|
||||
if(GLEW_ARB_vertex_program)
|
||||
for(unit=0; unit<m_attrib_num; unit++)
|
||||
if(m_attrib[unit] == RAS_TEXCO_UV1)
|
||||
if (GLEW_ARB_vertex_program)
|
||||
for (unit=0; unit<m_attrib_num; unit++)
|
||||
if (m_attrib[unit] == RAS_TEXCO_UV1)
|
||||
glattrib = unit;
|
||||
|
||||
rendertools->RenderText(polymat->GetDrawingMode(), polymat,
|
||||
@@ -681,28 +681,28 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms,
|
||||
void RAS_OpenGLRasterizer::SetTexCoordNum(int num)
|
||||
{
|
||||
m_texco_num = num;
|
||||
if(m_texco_num > RAS_MAX_TEXCO)
|
||||
if (m_texco_num > RAS_MAX_TEXCO)
|
||||
m_texco_num = RAS_MAX_TEXCO;
|
||||
}
|
||||
|
||||
void RAS_OpenGLRasterizer::SetAttribNum(int num)
|
||||
{
|
||||
m_attrib_num = num;
|
||||
if(m_attrib_num > RAS_MAX_ATTRIB)
|
||||
if (m_attrib_num > RAS_MAX_ATTRIB)
|
||||
m_attrib_num = RAS_MAX_ATTRIB;
|
||||
}
|
||||
|
||||
void RAS_OpenGLRasterizer::SetTexCoord(TexCoGen coords, int unit)
|
||||
{
|
||||
// this changes from material to material
|
||||
if(unit < RAS_MAX_TEXCO)
|
||||
if (unit < RAS_MAX_TEXCO)
|
||||
m_texco[unit] = coords;
|
||||
}
|
||||
|
||||
void RAS_OpenGLRasterizer::SetAttrib(TexCoGen coords, int unit)
|
||||
{
|
||||
// this changes from material to material
|
||||
if(unit < RAS_MAX_ATTRIB)
|
||||
if (unit < RAS_MAX_ATTRIB)
|
||||
m_attrib[unit] = coords;
|
||||
}
|
||||
|
||||
@@ -710,9 +710,9 @@ void RAS_OpenGLRasterizer::TexCoord(const RAS_TexVert &tv)
|
||||
{
|
||||
int unit;
|
||||
|
||||
if(GLEW_ARB_multitexture) {
|
||||
for(unit=0; unit<m_texco_num; unit++) {
|
||||
if(tv.getFlag() & RAS_TexVert::SECOND_UV && (int)tv.getUnit() == unit) {
|
||||
if (GLEW_ARB_multitexture) {
|
||||
for (unit=0; unit<m_texco_num; unit++) {
|
||||
if (tv.getFlag() & RAS_TexVert::SECOND_UV && (int)tv.getUnit() == unit) {
|
||||
glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, tv.getUV2());
|
||||
continue;
|
||||
}
|
||||
@@ -739,8 +739,8 @@ void RAS_OpenGLRasterizer::TexCoord(const RAS_TexVert &tv)
|
||||
}
|
||||
}
|
||||
|
||||
if(GLEW_ARB_vertex_program) {
|
||||
for(unit=0; unit<m_attrib_num; unit++) {
|
||||
if (GLEW_ARB_vertex_program) {
|
||||
for (unit=0; unit<m_attrib_num; unit++) {
|
||||
switch(m_attrib[unit]) {
|
||||
case RAS_TEXCO_ORCO:
|
||||
case RAS_TEXCO_GLOB:
|
||||
@@ -901,17 +901,17 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
|
||||
return;
|
||||
}
|
||||
// iterate over display arrays, each containing an index + vertex array
|
||||
for(ms.begin(it); !ms.end(it); ms.next(it)) {
|
||||
for (ms.begin(it); !ms.end(it); ms.next(it)) {
|
||||
RAS_TexVert *vertex;
|
||||
size_t i, j, numvert;
|
||||
|
||||
numvert = it.array->m_type;
|
||||
|
||||
if(it.array->m_type == RAS_DisplayArray::LINE) {
|
||||
if (it.array->m_type == RAS_DisplayArray::LINE) {
|
||||
// line drawing
|
||||
glBegin(GL_LINES);
|
||||
|
||||
for(i=0; i<it.totindex; i+=2)
|
||||
for (i=0; i<it.totindex; i+=2)
|
||||
{
|
||||
vertex = &it.vertex[it.index[i]];
|
||||
glVertex3fv(vertex->getXYZ());
|
||||
@@ -924,26 +924,26 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
|
||||
}
|
||||
else {
|
||||
// triangle and quad drawing
|
||||
if(it.array->m_type == RAS_DisplayArray::TRIANGLE)
|
||||
if (it.array->m_type == RAS_DisplayArray::TRIANGLE)
|
||||
glBegin(GL_TRIANGLES);
|
||||
else
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
for(i=0; i<it.totindex; i+=numvert)
|
||||
for (i=0; i<it.totindex; i+=numvert)
|
||||
{
|
||||
if(obcolor)
|
||||
if (obcolor)
|
||||
glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]);
|
||||
|
||||
for(j=0; j<numvert; j++) {
|
||||
for (j=0; j<numvert; j++) {
|
||||
vertex = &it.vertex[it.index[i+j]];
|
||||
|
||||
if(!wireframe) {
|
||||
if(!obcolor)
|
||||
if (!wireframe) {
|
||||
if (!obcolor)
|
||||
glColor4ubv((const GLubyte *)(vertex->getRGBA()));
|
||||
|
||||
glNormal3fv(vertex->getNormal());
|
||||
|
||||
if(multi)
|
||||
if (multi)
|
||||
TexCoord(*vertex);
|
||||
else
|
||||
glTexCoord2fv(vertex->getUV1());
|
||||
@@ -993,7 +993,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
|
||||
double mat[16];
|
||||
|
||||
// correction for stereo
|
||||
if(Stereo())
|
||||
if (Stereo())
|
||||
{
|
||||
float near_div_focallength;
|
||||
float offset;
|
||||
@@ -1062,7 +1062,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat,
|
||||
m_viewmatrix = mat;
|
||||
|
||||
// correction for stereo
|
||||
if(Stereo() && perspective)
|
||||
if (Stereo() && perspective)
|
||||
{
|
||||
MT_Vector3 unitViewDir(0.0, -1.0, 0.0); // minus y direction, Blender convention
|
||||
MT_Vector3 unitViewupVec(0.0, 0.0, 1.0);
|
||||
@@ -1192,7 +1192,7 @@ void RAS_OpenGLRasterizer::EnableMotionBlur(float motionblurvalue)
|
||||
{
|
||||
/* don't just set m_motionblur to 1, but check if it is 0 so
|
||||
* we don't reset a motion blur that is already enabled */
|
||||
if(m_motionblur == 0)
|
||||
if (m_motionblur == 0)
|
||||
m_motionblur = 1;
|
||||
m_motionblurvalue = motionblurvalue;
|
||||
}
|
||||
@@ -1207,26 +1207,26 @@ void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend)
|
||||
{
|
||||
GPU_set_material_alpha_blend(alphablend);
|
||||
/*
|
||||
if(alphablend == m_last_alphablend)
|
||||
if (alphablend == m_last_alphablend)
|
||||
return;
|
||||
|
||||
if(alphablend == GPU_BLEND_SOLID) {
|
||||
if (alphablend == GPU_BLEND_SOLID) {
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
else if(alphablend == GPU_BLEND_ADD) {
|
||||
else if (alphablend == GPU_BLEND_ADD) {
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
}
|
||||
else if(alphablend == GPU_BLEND_ALPHA) {
|
||||
else if (alphablend == GPU_BLEND_ALPHA) {
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0.0f);
|
||||
}
|
||||
else if(alphablend == GPU_BLEND_CLIP) {
|
||||
else if (alphablend == GPU_BLEND_CLIP) {
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0.5f);
|
||||
@@ -1238,10 +1238,10 @@ void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend)
|
||||
|
||||
void RAS_OpenGLRasterizer::SetFrontFace(bool ccw)
|
||||
{
|
||||
if(m_last_frontface == ccw)
|
||||
if (m_last_frontface == ccw)
|
||||
return;
|
||||
|
||||
if(ccw)
|
||||
if (ccw)
|
||||
glFrontFace(GL_CCW);
|
||||
else
|
||||
glFrontFace(GL_CW);
|
||||
|
Reference in New Issue
Block a user