equal
deleted
inserted
replaced
15 * along with this program; if not, write to the Free Software |
15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 *) |
17 *) |
18 |
18 |
19 {$INCLUDE "options.inc"} |
19 {$INCLUDE "options.inc"} |
|
20 {$IF GLunit = GL}{$DEFINE GLunit:=GL,GLext}{$ENDIF} |
20 |
21 |
21 unit uWorld; |
22 unit uWorld; |
22 interface |
23 interface |
23 uses SDLh, uGears, uConsts, uFloat, uRandom, uTypes; |
24 uses SDLh, uGears, uConsts, uFloat, uRandom, uTypes; |
24 |
25 |
62 SoundTimerTicks: Longword; |
63 SoundTimerTicks: Longword; |
63 prevPoint: TPoint; |
64 prevPoint: TPoint; |
64 amSel: TAmmoType = amNothing; |
65 amSel: TAmmoType = amNothing; |
65 missionTex: PTexture; |
66 missionTex: PTexture; |
66 missionTimer: LongInt; |
67 missionTimer: LongInt; |
67 stereoDepth: GLfloat = 0; |
68 stereoDepth: GLfloat; |
68 |
69 |
69 const cStereo_Sky = 0.0500; |
70 const cStereo_Sky = 0.0500; |
70 cStereo_Horizon = 0.0250; |
71 cStereo_Horizon = 0.0250; |
71 cStereo_Water_distant = 0.0125; |
72 cStereo_Water_distant = 0.0125; |
72 cStereo_Land = 0.0075; |
73 cStereo_Land = 0.0075; |
709 end; |
710 end; |
710 |
711 |
711 procedure ChangeDepth(rm: TRenderMode; d: GLfloat); |
712 procedure ChangeDepth(rm: TRenderMode; d: GLfloat); |
712 begin |
713 begin |
713 {$IFDEF S3D_DISABLED} |
714 {$IFDEF S3D_DISABLED} |
|
715 rm:= rm; d:= d; // avoid hint |
714 exit; |
716 exit; |
715 {$ELSE} |
717 {$ELSE} |
716 d:= d / 5; |
718 d:= d / 5; |
717 if rm = rmDefault then exit |
719 if rm = rmDefault then exit |
718 else if rm = rmLeftEye then d:= -d; |
720 else if rm = rmLeftEye then d:= -d; |
724 end; |
726 end; |
725 |
727 |
726 procedure ResetDepth(rm: TRenderMode); |
728 procedure ResetDepth(rm: TRenderMode); |
727 begin |
729 begin |
728 {$IFDEF S3D_DISABLED} |
730 {$IFDEF S3D_DISABLED} |
|
731 rm:= rm; // avoid hint |
729 exit; |
732 exit; |
730 {$ELSE} |
733 {$ELSE} |
731 if rm = rmDefault then exit; |
734 if rm = rmDefault then exit; |
732 glMatrixMode(GL_PROJECTION); |
735 glMatrixMode(GL_PROJECTION); |
733 glTranslatef(-stereoDepth, 0, 0); |
736 glTranslatef(-stereoDepth, 0, 0); |
738 |
741 |
739 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
742 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
740 var i, t: LongInt; |
743 var i, t: LongInt; |
741 r: TSDL_Rect; |
744 r: TSDL_Rect; |
742 tdx, tdy: Double; |
745 tdx, tdy: Double; |
743 grp: TCapGroup; |
|
744 s: string[15]; |
746 s: string[15]; |
745 highlight: Boolean; |
747 highlight: Boolean; |
746 offset, offsetX, offsetY, screenBottom: LongInt; |
748 offsetX, offsetY, screenBottom: LongInt; |
747 VertexBuffer: array [0..3] of TVertex2f; |
749 VertexBuffer: array [0..3] of TVertex2f; |
748 begin |
750 begin |
749 if (cReducedQuality and rqNoBackground) = 0 then |
751 if (cReducedQuality and rqNoBackground) = 0 then |
750 begin |
752 begin |
751 // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway |
753 // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway |
1311 prevPoint.X:= 0; |
1313 prevPoint.X:= 0; |
1312 prevPoint.Y:= 0; |
1314 prevPoint.Y:= 0; |
1313 missionTimer:= 0; |
1315 missionTimer:= 0; |
1314 missionTex:= nil; |
1316 missionTex:= nil; |
1315 cOffsetY:= 0; |
1317 cOffsetY:= 0; |
|
1318 stereoDepth:= 0; |
1316 end; |
1319 end; |
1317 |
1320 |
1318 procedure freeModule; |
1321 procedure freeModule; |
1319 begin |
1322 begin |
|
1323 stereoDepth:= stereoDepth; // avoid hint |
1320 end; |
1324 end; |
1321 |
1325 |
1322 end. |
1326 end. |