Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-28 09:03:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-28 09:03:24 +0400
commit07065b27b8b37316004f40896f436d26e066f25f (patch)
tree19713fa864612e094f21a881e9816a8e1bf42b7b /source/gameengine/Ketsji/KX_Dome.cpp
parentc9f677d24d9600d9ba07f1b258c49455bc348554 (diff)
style cleanup
Diffstat (limited to 'source/gameengine/Ketsji/KX_Dome.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_Dome.cpp90
1 files changed, 45 insertions, 45 deletions
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<m_numfaces;j++){
+ for (int j=0;j<m_numfaces;j++) {
glBindTexture(GL_TEXTURE_2D, domefacesId[j]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, m_imagesize, m_imagesize, 0, GL_RGB8,
GL_UNSIGNED_BYTE, 0);
@@ -203,7 +203,7 @@ void KX_Dome::CreateGLImages(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
- if (warp.usemesh){
+ if (warp.usemesh) {
glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, warp.imagesize, warp.imagesize, 0, GL_RGB8,
GL_UNSIGNED_BYTE, 0);
@@ -243,7 +243,7 @@ void KX_Dome::CalculateImageSize(void)
i++;
m_imagesize = (1 << i);
- if (warp.usemesh){
+ if (warp.usemesh) {
// warp FBO needs to be up to twice as big as m_buffersize to get more resolution
warp.imagesize = m_imagesize;
if (m_buffersize == m_imagesize)
@@ -259,7 +259,7 @@ bool KX_Dome::CreateDL()
{
dlistId = glGenLists((GLsizei) m_numimages);
if (dlistId != 0) {
- if (m_mode == DOME_FISHEYE || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR){
+ if (m_mode == DOME_FISHEYE || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR) {
glNewList(dlistId, GL_COMPILE);
GLDrawTriangles(cubetop, nfacestop);
glEndList();
@@ -276,7 +276,7 @@ bool KX_Dome::CreateDL()
GLDrawTriangles(cuberight, nfacesright);
glEndList();
- if (m_angle > 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<warp.n_height-1;i++) {
for (j=0;j<warp.n_width-1;j++) {
@@ -417,7 +417,7 @@ void KX_Dome::GLDrawWarpQuads(void)
}
glEnd();
}
- else if (warp.mode == 1){
+ else if (warp.mode == 1) {
glBegin(GL_QUADS);
for (i=0;i<warp.n_height-1;i++) {
for (j=0;j<warp.n_width-1;j++) {
@@ -481,7 +481,7 @@ bool KX_Dome::ParseWarpMesh(STR_String text)
vector<STR_String> 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<vector<WarpMeshNode> > (warp.n_height, vector<WarpMeshNode>(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<m_resolution;i++){
+ for (i=0;i<m_resolution;i++) {
cubetop.resize(4*nfacestop);
SplitFace(cubetop,&nfacestop);
cubebottom.resize(4*nfacesbottom);
@@ -686,7 +686,7 @@ void KX_Dome::CreateMeshDome180(void)
}
// Turn into a hemisphere
- for (j=0;j<3;j++){
+ for (j=0;j<3;j++) {
for (i=0;i<nfacestop;i++)
cubetop[i].verts[j].normalize();
for (i=0;i<nfacesbottom;i++)
@@ -953,7 +953,7 @@ void KX_Dome::CreateMeshDome250(void)
//Refine a triangular mesh by bisecting each edge forms 3 new triangles for each existing triangle on each iteration
//It could be made more efficient for drawing if the triangles were ordered in a strip!
- for (i=0;i<m_resolution;i++){
+ for (i=0;i<m_resolution;i++) {
cubefront.resize(4*nfacesfront);
SplitFace(cubefront,&nfacesfront);
cubetop.resize(4*nfacestop);
@@ -967,7 +967,7 @@ void KX_Dome::CreateMeshDome250(void)
}
// Turn into a hemisphere/sphere
- for (j=0;j<3;j++){
+ for (j=0;j<3;j++) {
for (i=0;i<nfacesfront;i++)
cubefront[i].verts[j].normalize();
for (i=0;i<nfacestop;i++)
@@ -1319,7 +1319,7 @@ void KX_Dome::FlattenDome(MT_Vector3 verts[3])
{
double phi, r;
- for (int i=0;i<3;i++){
+ for (int i=0;i<3;i++) {
r = atan2(sqrt(verts[i][0]*verts[i][0] + verts[i][2]*verts[i][2]), verts[i][1]);
r /= m_radangle/2;
@@ -1329,7 +1329,7 @@ void KX_Dome::FlattenDome(MT_Vector3 verts[3])
verts[i][1] = 0;
verts[i][2] = r * sin(phi);
- if (r > 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 <DomeFace>& face, int *nfaces)
n1 = n2 = *nfaces;
- for (i=0;i<n1;i++){
+ for (i=0;i<n1;i++) {
face[n2].verts[0] = (face[i].verts[0] + face[i].verts[1]) /2;
face[n2].verts[1] = face[i].verts[1];
@@ -1480,7 +1480,7 @@ void KX_Dome::CalculateCameraOrientation()
if (m_angle <= 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
c, -s, 0.0,
@@ -1504,7 +1504,7 @@ void KX_Dome::CalculateCameraOrientation()
} else if (m_mode == DOME_ENVMAP || (m_angle > 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<m_numfaces;i++){
+ if (dlistSupported) {
+ for (i=0;i<m_numfaces;i++) {
glBindTexture(GL_TEXTURE_2D, domefacesId[i]);
glCallList(dlistId+i);
}
@@ -1864,7 +1864,7 @@ void KX_Dome::DrawDomeFisheye(void)
glBindTexture(GL_TEXTURE_2D, domefacesId[3]);
GLDrawTriangles(cuberight, nfacesright);
- if (m_angle > 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<m_numfaces;i++){
+ if (dlistSupported) {
+ for (i=0;i<m_numfaces;i++) {
glBindTexture(GL_TEXTURE_2D, domefacesId[i]);
glCallList(dlistId+i);
}
@@ -1991,7 +1991,7 @@ void KX_Dome::DrawDomeWarped(void)
glEnable(GL_TEXTURE_2D);
glColor3f(1.0,1.0,1.0);
- if (dlistSupported){
+ if (dlistSupported) {
glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]);
glCallList(dlistId + m_numfaces);
}