From 07065b27b8b37316004f40896f436d26e066f25f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Mar 2012 05:03:24 +0000 Subject: style cleanup --- source/gameengine/Ketsji/KX_Dome.cpp | 90 ++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'source/gameengine/Ketsji/KX_Dome.cpp') diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index 0be5a5609aa..adcacc0355e 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -95,9 +95,9 @@ KX_Dome::KX_Dome ( SetViewPort(viewport); - switch(m_mode){ + switch(m_mode) { case DOME_FISHEYE: - if (m_angle <= 180){ + if (m_angle <= 180) { cubetop.resize(1); cubebottom.resize(1); cubeleft.resize(2); @@ -105,7 +105,7 @@ KX_Dome::KX_Dome ( CreateMeshDome180(); m_numfaces = 4; - }else if (m_angle > 180){ + }else if (m_angle > 180) { cubetop.resize(2); cubebottom.resize(2); cubeleft.resize(2); @@ -132,7 +132,7 @@ KX_Dome::KX_Dome ( m_numfaces = 6; break; default: //DOME_TRUNCATED_FRONT and DOME_TRUNCATED_REAR - if (m_angle <= 180){ + if (m_angle <= 180) { cubetop.resize(1); cubebottom.resize(1); cubeleft.resize(2); @@ -140,7 +140,7 @@ KX_Dome::KX_Dome ( CreateMeshDome180(); m_numfaces = 4; - }else if (m_angle > 180){ + }else if (m_angle > 180) { cubetop.resize(2); cubebottom.resize(2); cubeleft.resize(2); @@ -193,7 +193,7 @@ void KX_Dome::CreateGLImages(void) { glGenTextures(m_numimages, (GLuint*)&domefacesId); - for (int j=0;j 180){ + if (m_angle > 180) { glNewList(dlistId+4, GL_COMPILE); GLDrawTriangles(cubefront, nfacesfront); glEndList(); @@ -309,7 +309,7 @@ bool KX_Dome::CreateDL() glEndList(); } - if (warp.usemesh){ + if (warp.usemesh) { glNewList((dlistId + m_numfaces), GL_COMPILE); GLDrawWarpQuads(); glEndList(); @@ -391,7 +391,7 @@ void KX_Dome::GLDrawWarpQuads(void) float uv_width = (float)(warp.bufferwidth) / warp.imagesize; float uv_height = (float)(warp.bufferheight) / warp.imagesize; - if (warp.mode ==2 ){ + if (warp.mode ==2 ) { glBegin(GL_QUADS); for (i=0;i columns, lines; lines = text.Explode('\n'); - if (lines.size() < 6){ + if (lines.size() < 6) { printf("Dome Error: Warp Mesh File with insufficient data!\n"); return false; } @@ -489,7 +489,7 @@ bool KX_Dome::ParseWarpMesh(STR_String text) if (columns.size() == 1) columns = lines[1].Explode('\t'); - if (columns.size() !=2){ + if (columns.size() !=2) { printf("Dome Error: Warp Mesh File incorrect. The second line should contain: width height.\n"); return false; } @@ -499,18 +499,18 @@ bool KX_Dome::ParseWarpMesh(STR_String text) warp.n_width = atoi(columns[0]); warp.n_height = atoi(columns[1]); - if ((int)lines.size() < 2 + (warp.n_width * warp.n_height)){ + if ((int)lines.size() < 2 + (warp.n_width * warp.n_height)) { printf("Dome Error: Warp Mesh File with insufficient data!\n"); return false; }else{ warp.nodes = vector > (warp.n_height, vector(warp.n_width)); - for (i=2; i-2 < (warp.n_width*warp.n_height); i++){ + for (i=2; i-2 < (warp.n_width*warp.n_height); i++) { columns = lines[i].Explode(' '); if (columns.size() == 1) columns = lines[i].Explode('\t'); - if (columns.size() == 5){ + if (columns.size() == 5) { nodeX = (i-2)%warp.n_width; nodeY = ((i-2) - nodeX) / warp.n_width; @@ -674,7 +674,7 @@ void KX_Dome::CreateMeshDome180(void) //Refine a triangular mesh by bisecting each edge forms 3 new triangles for each existing triangle on each iteration //Could be made more efficient for drawing if the triangles were ordered in a fan. Not that important since we are using DisplayLists - for (i=0;i 1.0){ + if (r > 1.0) { //round the border verts[i][0] = cos(phi); verts[i][1] = -3.0; @@ -1345,7 +1345,7 @@ void KX_Dome::FlattenPanorama(MT_Vector3 verts[3]) double phi; bool edge=false; - for (i=0;i<3;i++){ + for (i=0;i<3;i++) { phi = atan2(verts[i][1], verts[i][0]); phi *= -1.0; //flipping @@ -1358,17 +1358,17 @@ void KX_Dome::FlattenPanorama(MT_Vector3 verts[3]) verts[i][2] = atan2(verts[i][2], 1.0); verts[i][2] /= MT_PI / 2; } - if (edge){ + if (edge) { bool right=false; - for (i=0;i<3;i++){ - if (fmod(verts[i][0],1.0) > 0.0){ + for (i=0;i<3;i++) { + if (fmod(verts[i][0],1.0) > 0.0) { right=true; break; } } - if (right){ - for (i=0;i<3;i++){ + if (right) { + for (i=0;i<3;i++) { if (verts[i][0] < 0.0) verts[i][0] *= -1.0; } @@ -1383,7 +1383,7 @@ void KX_Dome::SplitFace(vector & face, int *nfaces) n1 = n2 = *nfaces; - for (i=0;i 180 && (m_mode == DOME_FISHEYE || m_mode == DOME_TRUNCATED_FRONT - || m_mode == DOME_TRUNCATED_REAR))){ + || m_mode == DOME_TRUNCATED_REAR))) { m_locRot[0] = MT_Matrix3x3( // 90deg - Top 1.0, 0.0, 0.0, @@ -1536,7 +1536,7 @@ void KX_Dome::CalculateCameraOrientation() 0.0, 1.0, 0.0, 0.0, 0.0,-1.0); - } else if (m_mode == DOME_PANORAM_SPH){ + } else if (m_mode == DOME_PANORAM_SPH) { m_locRot[0] = MT_Matrix3x3( // Top c, s, 0.0, @@ -1610,14 +1610,14 @@ void KX_Dome::RotateCamera(KX_Camera* cam, int i) void KX_Dome::Draw(void) { - if (fboSupported){ + if (fboSupported) { glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, warp.fboId); glViewport(0,0,warp.imagesize, warp.imagesize); glScissor(0,0,warp.imagesize, warp.imagesize); } - switch(m_mode){ + switch(m_mode) { case DOME_FISHEYE: DrawDomeFisheye(); break; @@ -1668,7 +1668,7 @@ void KX_Dome::DrawEnvMap(void) glOrtho((-1.0), 1.0, (-0.66), 0.66, -20.0, 10.0); //stretch the image to reduce resolution lost else { - if (can_width/3 <= can_height/2){ + if (can_width/3 <= can_height/2) { ortho_width = 1.0; ortho_height = (float)can_height/can_width; }else{ @@ -1798,7 +1798,7 @@ void KX_Dome::DrawDomeFisheye(void) glOrtho((-1.0), 1.0, (-1.0), 1.0, -20.0, 10.0); //stretch the image to reduce resolution lost else { - if (can_width < can_height){ + if (can_width < can_height) { ortho_width = 1.0; ortho_height = (float)can_height/can_width; }else{ @@ -1841,8 +1841,8 @@ void KX_Dome::DrawDomeFisheye(void) glEnable(GL_TEXTURE_2D); glColor3f(1.0,1.0,1.0); - if (dlistSupported){ - for (i=0;i 180){ + if (m_angle > 180) { // front triangle glBindTexture(GL_TEXTURE_2D, domefacesId[4]); GLDrawTriangles(cubefront, nfacesfront); @@ -1894,7 +1894,7 @@ void KX_Dome::DrawPanorama(void) else { //using all the screen - if ((can_width / 2) <= (can_height)){ + if ((can_width / 2) <= (can_height)) { ortho_width = 1.0; ortho_height = (float)can_height/can_width; }else{ @@ -1923,8 +1923,8 @@ void KX_Dome::DrawPanorama(void) glEnable(GL_TEXTURE_2D); glColor3f(1.0,1.0,1.0); - if (dlistSupported){ - for (i=0;i