X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameDraw.cpp;h=3e076067f232acdf3e68ed03e0bc61688ffb0e3a;hb=440a61a70a5eb14dea5d26aa7cd050e0a3e0e069;hp=204b1cf10f1e831ca06c25902d8724c5e53cad20;hpb=9b02e6c2c1987b983584afc69e60ae2efa5dccc7;p=lugaru.git diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index 204b1cf..3e07606 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -211,7 +211,7 @@ long long Game::MD5_string (char *string){ //return 1111111111111111; } -int Game::DrawGLScene(void) +int Game::DrawGLScene(StereoSide side) { static float texcoordwidth,texcoordheight; static float texviewwidth, texviewheight; @@ -230,8 +230,18 @@ int Game::DrawGLScene(void) lastcheck+=multiplier; - glColorMask( 1.0, 1.0, 1.0, 1.0 ); - + if ( stereomode == stereoAnaglyph ) { + switch(side) { + case stereoLeft: glColorMask( 0.0, 1.0, 1.0, 1.0 ); break; + case stereoRight: glColorMask( 1.0, 0.0, 0.0, 1.0 ); break; + } + } else { + glColorMask( 1.0, 1.0, 1.0, 1.0 ); + + if ( stereomode == stereoHorizontalInterlaced || stereomode == stereoVerticalInterlaced ) { + glStencilFunc(side == stereoLeft ? GL_NOTEQUAL : GL_EQUAL, 0x01, 0x01); + } + } if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){ tempmult=multiplier; @@ -347,6 +357,11 @@ int Game::DrawGLScene(void) glMatrixMode (GL_MODELVIEW); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glLoadIdentity (); + + // Move the camera for the current eye's point of view. + // Reverse the movement if we're reversing stereo + glTranslatef((stereoseparation/2) * side * (stereoreverse ? -1 : 1), 0, 0); + if(!cameramode&&!freeze&&!winfreeze){ glRotatef(float(Random()%100)/10*camerashake/*+(woozy*woozy)/10*/,0,0,1); glRotatef(rotation2+sin(woozy/2)*(player[0].damage/player[0].damagetolerance)*5,1,0,0); @@ -2253,29 +2268,29 @@ int Game::DrawGLScene(void) if(texdetail>2)texdetail=2; if(mainmenu!=oldmainmenu&&oldmainmenu!=0){ if(mainmenu==1){ - LoadTexture("/Data/Textures/Newgame.png",&Mainmenuitems[1],0,0); - LoadTexture("/Data/Textures/Quit.png",&Mainmenuitems[3],0,0); + LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0); + LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0); /*if(oldmainmenu==1||oldmainmenu==0){ - LoadTexture("/Data/Textures/World.png",&Mainmenuitems[7],0,0); - LoadTexture("/Data/Textures/Options.png",&Mainmenuitems[2],0,0); - LoadTexture("/Data/Textures/Lugaru.png",&Mainmenuitems[0],0,0); + LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0); + LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0); + LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0); loaddistrib=0; }*/ } if(mainmenu==2){ - LoadTexture("/Data/Textures/Resume.png",&Mainmenuitems[1],0,0); - LoadTexture("/Data/Textures/Endgame.png",&Mainmenuitems[3],0,0); + LoadTexture(":Data:Textures:Resume.png",&Mainmenuitems[1],0,0); + LoadTexture(":Data:Textures:Endgame.png",&Mainmenuitems[3],0,0); /*if(oldmainmenu==2||oldmainmenu==0){ - LoadTexture("/Data/Textures/World.png",&Mainmenuitems[7],0,0); - LoadTexture("/Data/Textures/Options.png",&Mainmenuitems[2],0,0); - LoadTexture("/Data/Textures/Lugaru.png",&Mainmenuitems[0],0,0); + LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0); + LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0); + LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0); loaddistrib=0; }*/ } } if(lastcheck>.5||oldmainmenu!=mainmenu){ if(mainmenu==5){ - ifstream ipstream(ConvertFileName("/Data/Campaigns/main.txt")); + ifstream ipstream(ConvertFileName(":Data:Campaigns:main.txt")); //campaignnumlevels=0; //accountcampaignchoicesmade[accountactive]=0; ipstream.ignore(256,':'); @@ -3793,10 +3808,11 @@ int Game::DrawGLScene(void) //glFlush(); - if(drawmode!=motionblurmode||mainmenu){ - - swap_gl_buffers(); - } + if ( side == stereoRight || side == stereoCenter ) { + if(drawmode!=motionblurmode||mainmenu){ + swap_gl_buffers(); + } + } //myassert(glGetError() == GL_NO_ERROR); glDrawBuffer(GL_BACK);