hedgewars/uWorld.pas
changeset 7082 17b0892ac794
parent 7080 dbf43c07a507
child 7108 eaef11c0d039
equal deleted inserted replaced
7080:dbf43c07a507 7082:17b0892ac794
    75     SoundTimerTicks: Longword;
    75     SoundTimerTicks: Longword;
    76     prevPoint: TPoint;
    76     prevPoint: TPoint;
    77     amSel: TAmmoType = amNothing;
    77     amSel: TAmmoType = amNothing;
    78     missionTex: PTexture;
    78     missionTex: PTexture;
    79     missionTimer: LongInt;
    79     missionTimer: LongInt;
    80     stereoDepth: GLfloat;
       
    81     isFirstFrame: boolean;
    80     isFirstFrame: boolean;
    82     AMAnimType: LongInt;
    81     AMAnimType: LongInt;
    83 
    82 
    84 const cStereo_Sky           = 0.0500;
    83 const cStereo_Sky           = 0.0500;
    85       cStereo_Horizon       = 0.0250;
    84       cStereo_Horizon       = 0.0250;
  1078     d:= d / 5;
  1077     d:= d / 5;
  1079     if rm = rmDefault then
  1078     if rm = rmDefault then
  1080         exit
  1079         exit
  1081     else if rm = rmLeftEye then
  1080     else if rm = rmLeftEye then
  1082         d:= -d;
  1081         d:= -d;
  1083     stereoDepth:= stereoDepth + d;
  1082     cStereoDepth:= cStereoDepth + d;
  1084     glMatrixMode(GL_PROJECTION);
  1083     UpdateProjection;
  1085     glTranslatef(d, 0, 0);
       
  1086     glMatrixMode(GL_MODELVIEW);
       
  1087 {$ENDIF}
  1084 {$ENDIF}
  1088 end;
  1085 end;
  1089  
  1086  
  1090 procedure ResetDepth(rm: TRenderMode);
  1087 procedure ResetDepth(rm: TRenderMode);
  1091 begin
  1088 begin
  1093     rm:= rm; // avoid hint
  1090     rm:= rm; // avoid hint
  1094     exit;
  1091     exit;
  1095 {$ELSE}
  1092 {$ELSE}
  1096     if rm = rmDefault then
  1093     if rm = rmDefault then
  1097         exit;
  1094         exit;
  1098     glMatrixMode(GL_PROJECTION);
  1095     cStereoDepth:= 0;
  1099     glTranslatef(-stereoDepth, 0, 0);
  1096     UpdateProjection;
  1100     glMatrixMode(GL_MODELVIEW);
       
  1101     stereoDepth:= 0;
       
  1102 {$ENDIF}
  1097 {$ENDIF}
  1103 end;
  1098 end;
  1104  
  1099  
  1105 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
  1100 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
  1106 var i, t, h: LongInt;
  1101 var i, t, h: LongInt;
  1817     prevPoint.X:= 0;
  1812     prevPoint.X:= 0;
  1818     prevPoint.Y:= 0;
  1813     prevPoint.Y:= 0;
  1819     missionTimer:= 0;
  1814     missionTimer:= 0;
  1820     missionTex:= nil;
  1815     missionTex:= nil;
  1821     cOffsetY:= 0;
  1816     cOffsetY:= 0;
  1822     stereoDepth:= 0;
  1817     cStereoDepth:= 0;
  1823     AMState:= AMHidden;
  1818     AMState:= AMHidden;
  1824     isFirstFrame:= true;
  1819     isFirstFrame:= true;
  1825 end;
  1820 end;
  1826 
  1821 
  1827 procedure freeModule;
  1822 procedure freeModule;
  1828 begin
  1823 begin
  1829     stereoDepth:= stereoDepth; // avoid hint
       
  1830     FreeTexture(fpsTexture);
  1824     FreeTexture(fpsTexture);
  1831     fpsTexture:= nil;
  1825     fpsTexture:= nil;
  1832     FreeTexture(timeTexture);
  1826     FreeTexture(timeTexture);
  1833     timeTexture:= nil;
  1827     timeTexture:= nil;
  1834     FreeTexture(missionTex);
  1828     FreeTexture(missionTex);