46 procedure DrawTextureRotated (Texture: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); |
46 procedure DrawTextureRotated (Texture: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); |
47 procedure DrawTextureRotatedF (Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real); |
47 procedure DrawTextureRotatedF (Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real); |
48 |
48 |
49 procedure DrawCircle (X, Y, Radius, Width: LongInt); |
49 procedure DrawCircle (X, Y, Radius, Width: LongInt); |
50 procedure DrawCircle (X, Y, Radius, Width: LongInt; r, g, b, a: Byte); |
50 procedure DrawCircle (X, Y, Radius, Width: LongInt; r, g, b, a: Byte); |
|
51 procedure DrawCircleFilled (X, Y, Radius: LongInt; r, g, b, a: Byte); |
51 |
52 |
52 procedure DrawLine (X0, Y0, X1, Y1, Width: Single; color: LongWord); inline; |
53 procedure DrawLine (X0, Y0, X1, Y1, Width: Single; color: LongWord); inline; |
53 procedure DrawLine (X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte); |
54 procedure DrawLine (X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte); |
54 procedure DrawLineOnScreen (X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte); |
55 procedure DrawLineOnScreen (X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte); |
55 procedure DrawRect (rect: TSDL_Rect; r, g, b, a: Byte; Fill: boolean); |
56 procedure DrawRect (rect: TSDL_Rect; r, g, b, a: Byte; Fill: boolean); |
78 procedure SetScale(f: GLfloat); |
79 procedure SetScale(f: GLfloat); |
79 procedure UpdateViewLimits(); |
80 procedure UpdateViewLimits(); |
80 |
81 |
81 procedure RendererSetup(); |
82 procedure RendererSetup(); |
82 procedure RendererCleanup(); |
83 procedure RendererCleanup(); |
|
84 |
|
85 procedure ChangeDepth(rm: TRenderMode; d: GLfloat); |
|
86 procedure ResetDepth(rm: TRenderMode); |
83 |
87 |
84 // TODO everything below this should not need a public interface |
88 // TODO everything below this should not need a public interface |
85 |
89 |
86 procedure EnableTexture(enable:Boolean); |
90 procedure EnableTexture(enable:Boolean); |
87 |
91 |
1392 //openglPopMatrix; |
1396 //openglPopMatrix; |
1393 EnableTexture(True); |
1397 EnableTexture(True); |
1394 glDisable(GL_LINE_SMOOTH); |
1398 glDisable(GL_LINE_SMOOTH); |
1395 end; |
1399 end; |
1396 |
1400 |
|
1401 procedure DrawCircleFilled(X, Y, Radius: LongInt; r, g, b, a: Byte); |
|
1402 var |
|
1403 i: LongInt; |
|
1404 begin |
|
1405 VertexBuffer[0].X := X; |
|
1406 VertexBuffer[0].Y := Y; |
|
1407 |
|
1408 for i := 1 to 19 do begin |
|
1409 VertexBuffer[i].X := X + Radius*cos(i*pi/9); |
|
1410 VertexBuffer[i].Y := Y + Radius*sin(i*pi/9); |
|
1411 end; |
|
1412 |
|
1413 EnableTexture(False); |
|
1414 Tint(r, g, b, a); |
|
1415 SetVertexPointer(@VertexBuffer[0], 20); |
|
1416 glDrawArrays(GL_TRIANGLE_FAN, 0, 20); |
|
1417 Untint(); |
|
1418 EnableTexture(True); |
|
1419 end; |
1397 |
1420 |
1398 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real); |
1421 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real); |
1399 const VertexBuffer: array [0..3] of TVertex2f = ( |
1422 const VertexBuffer: array [0..3] of TVertex2f = ( |
1400 (X: -16; Y: -16), |
1423 (X: -16; Y: -16), |
1401 (X: 16; Y: -16), |
1424 (X: 16; Y: -16), |
1884 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD) |
1907 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD) |
1885 else |
1908 else |
1886 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
1909 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
1887 end; |
1910 end; |
1888 |
1911 |
|
1912 procedure ChangeDepth(rm: TRenderMode; d: GLfloat); |
|
1913 var tmp: LongInt; |
|
1914 begin |
|
1915 {$IFNDEF USE_S3D_RENDERING} |
|
1916 rm:= rm; d:= d; tmp:= tmp; // avoid hint |
|
1917 {$ELSE} |
|
1918 d:= d / 5; |
|
1919 if rm = rmDefault then |
|
1920 exit |
|
1921 else if rm = rmLeftEye then |
|
1922 d:= -d; |
|
1923 cStereoDepth:= cStereoDepth + d; |
|
1924 openglTranslProjMatrix(d, 0, 0); |
|
1925 tmp:= round(d / cScaleFactor * cScreenWidth); |
|
1926 ViewLeftX := ViewLeftX - tmp; |
|
1927 ViewRightX:= ViewRightX - tmp; |
|
1928 {$ENDIF} |
|
1929 end; |
|
1930 |
|
1931 procedure ResetDepth(rm: TRenderMode); |
|
1932 var tmp: LongInt; |
|
1933 begin |
|
1934 {$IFNDEF USE_S3D_RENDERING} |
|
1935 rm:= rm; tmp:= tmp; // avoid hint |
|
1936 {$ELSE} |
|
1937 if rm = rmDefault then |
|
1938 exit; |
|
1939 openglTranslProjMatrix(-cStereoDepth, 0, 0); |
|
1940 tmp:= round(cStereoDepth / cScaleFactor * cScreenWidth); |
|
1941 ViewLeftX := ViewLeftX + tmp; |
|
1942 ViewRightX:= ViewRightX + tmp; |
|
1943 cStereoDepth:= 0; |
|
1944 {$ENDIF} |
|
1945 end; |
|
1946 |
|
1947 |
1889 procedure initModule; |
1948 procedure initModule; |
1890 begin |
1949 begin |
1891 LastTint:= cWhiteColor + 1; |
1950 LastTint:= cWhiteColor + 1; |
1892 LastColorPointer := nil; |
1951 LastColorPointer := nil; |
1893 LastTexCoordPointer := nil; |
1952 LastTexCoordPointer := nil; |