| 1 |
{%MainUnit castleglimages.pas} |
| 2 |
{ |
| 3 |
Copyright 2001-2023 Michalis Kamburelis. |
| 4 |
|
| 5 |
This file is part of "Castle Game Engine". |
| 6 |
|
| 7 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 8 |
included in this distribution, for details about the copyright. |
| 9 |
|
| 10 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
|
| 14 |
---------------------------------------------------------------------------- |
| 15 |
} |
| 16 |
|
| 17 |
{ Part of CastleGLImages unit: texture wrapping modes. } |
| 18 |
|
| 19 |
{$ifdef read_interface} |
| 20 |
|
| 21 |
{$ifdef read_interface_type} |
| 22 |
//type - don't add type Delphi can't parse that correctly |
| 23 |
{ } |
| 24 |
TTextureWrap2D = packed record |
| 25 |
Data: packed array [0..1] of TGLenum; |
| 26 |
class operator {$ifdef FPC}={$else}Equal{$endif} (const W1, W2: TTextureWrap2D): boolean; |
| 27 |
end; |
| 28 |
|
| 29 |
TTextureWrap3D = packed record |
| 30 |
Data: packed array [0..2] of TGLenum; |
| 31 |
class operator {$ifdef FPC}={$else}Equal{$endif} (const W1, W2: TTextureWrap3D): boolean; |
| 32 |
end; |
| 33 |
{$endif read_interface_type} |
| 34 |
|
| 35 |
{$ifdef read_interface_const} |
| 36 |
const |
| 37 |
Texture2DRepeat: TTextureWrap2D = (Data: (GL_REPEAT, GL_REPEAT)); |
| 38 |
{$endif read_interface_const} |
| 39 |
|
| 40 |
{$ifdef read_interface_func} |
| 41 |
{ Return wrap GL_CLAMP_TO_EDGE in both directions. } |
| 42 |
function Texture2DClampToEdge: TTextureWrap2D; |
| 43 |
{$endif read_interface_func} |
| 44 |
|
| 45 |
{$endif read_interface} |
| 46 |
|
| 47 |
{$ifdef read_implementation} |
| 48 |
|
| 49 |
class operator TTextureWrap2D.{$ifdef FPC}={$else}Equal{$endif} (const W1, W2: TTextureWrap2D): boolean; |
| 50 |
begin |
| 51 |
Result := CompareMem(@W1, @W2, SizeOf(W1)); |
| 52 |
end; |
| 53 |
|
| 54 |
class operator TTextureWrap3D.{$ifdef FPC}={$else}Equal{$endif} (const W1, W2: TTextureWrap3D): boolean; |
| 55 |
begin |
| 56 |
Result := CompareMem(@W1, @W2, SizeOf(W1)); |
| 57 |
end; |
| 58 |
|
| 59 |
function Texture2DClampToEdge: TTextureWrap2D; |
| 60 |
begin |
| 61 |
Result.Data[0] := GLFeatures.CLAMP_TO_EDGE; |
| 62 |
Result.Data[1] := Result.Data[0]; |
| 63 |
end; |
| 64 |
|
| 65 |
{$endif read_implementation} |