| 1 |
{ -*- buffer-read-only: t -*- |
| 2 |
|
| 3 |
Copyright 2015-2024 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 |
{ Automatically generated node properties. |
| 18 |
|
| 19 |
Do not edit this file manually! |
| 20 |
To add new properties: |
| 21 |
- add them to the text files in tools/internal/x3d-nodes-to-pascal/nodes-specification/ , |
| 22 |
- and regenerate include files by running x3d-nodes-to-pascal } |
| 23 |
|
| 24 |
{$ifdef read_interface} |
| 25 |
|
| 26 |
strict private |
| 27 |
function GetColor: TCastleColor; |
| 28 |
procedure SetColor(const Value: TCastleColor); |
| 29 |
function GetTexture: TAbstractTextureNode; |
| 30 |
procedure SetTexture(const Value: TAbstractTextureNode); |
| 31 |
public |
| 32 |
{ Create node fields and events. } |
| 33 |
procedure CreateNode; override; |
| 34 |
class function ClassX3DType: String; override; |
| 35 |
|
| 36 |
strict private FFdColor: TSFColorRGBA; |
| 37 |
{ Internal wrapper for property @code(Color). This wrapper API may change, we advise to access simpler @code(Color) instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart). } |
| 38 |
public property FdColor: TSFColorRGBA read FFdColor; |
| 39 |
{ Color that is multiplied by the texture color. Opaque white by default. Note that the alpha component of this color matters (just like the alpha channel of the texture in @link(Texture)). If the resulting image is partially-transparent, it will be mixed with black underneath. } |
| 40 |
property Color: TCastleColor read GetColor write SetColor; |
| 41 |
|
| 42 |
strict private FFdTexture: TSFNode; |
| 43 |
{ Internal wrapper for property @code(Texture). This wrapper API may change, we advise to access simpler @code(Texture) instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart). } |
| 44 |
public property FdTexture: TSFNode read FFdTexture; |
| 45 |
{ Texture displayed in a full-screen quad. Only 2D single-texture nodes are supported now. If you leave this as @nil, the TImageBackgroundNode has no visible effect. } |
| 46 |
property Texture: TAbstractTextureNode read GetTexture write SetTexture; |
| 47 |
|
| 48 |
strict private FFdTexCoords: TMFVec2f; |
| 49 |
{ Internal wrapper for property @code(TexCoords). This wrapper API may change, we advise to access simpler @code(TexCoords) instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart). } |
| 50 |
public property FdTexCoords: TMFVec2f read FFdTexCoords; |
| 51 |
{ Texture coordinates of the full-screen quad. By default they use the whole texture area: @orderedList( @item(Vector2(0, 0),) @item(Vector2(1, 0),) @item(Vector2(1, 1),) @item(Vector2(0, 1)) ) It is undefined what happens if there are not exactly 4 items. } |
| 52 |
procedure SetTexCoords(const Value: array of TVector2); overload; |
| 53 |
{ Texture coordinates of the full-screen quad. By default they use the whole texture area: @orderedList( @item(Vector2(0, 0),) @item(Vector2(1, 0),) @item(Vector2(1, 1),) @item(Vector2(0, 1)) ) It is undefined what happens if there are not exactly 4 items. } |
| 54 |
procedure SetTexCoords(const Value: TVector2List); overload; |
| 55 |
|
| 56 |
{$endif read_interface} |
| 57 |
|
| 58 |
{$ifdef read_implementation} |
| 59 |
|
| 60 |
{ TImageBackgroundNode ----------------------------------------------- } |
| 61 |
|
| 62 |
function TImageBackgroundNode.GetColor: TCastleColor; |
| 63 |
begin |
| 64 |
Result := FdColor.Value; |
| 65 |
end; |
| 66 |
|
| 67 |
procedure TImageBackgroundNode.SetColor(const Value: TCastleColor); |
| 68 |
begin |
| 69 |
FdColor.Send(Value); |
| 70 |
end; |
| 71 |
|
| 72 |
function TImageBackgroundNode.GetTexture: TAbstractTextureNode; |
| 73 |
begin |
| 74 |
if FdTexture.Value is TAbstractTextureNode then |
| 75 |
Result := TAbstractTextureNode(FdTexture.Value) |
| 76 |
else |
| 77 |
Result := nil; |
| 78 |
end; |
| 79 |
|
| 80 |
procedure TImageBackgroundNode.SetTexture(const Value: TAbstractTextureNode); |
| 81 |
begin |
| 82 |
FdTexture.Send(Value); |
| 83 |
end; |
| 84 |
|
| 85 |
procedure TImageBackgroundNode.SetTexCoords(const Value: array of TVector2); |
| 86 |
begin |
| 87 |
FdTexCoords.Send(Value); |
| 88 |
end; |
| 89 |
|
| 90 |
procedure TImageBackgroundNode.SetTexCoords(const Value: TVector2List); |
| 91 |
begin |
| 92 |
FdTexCoords.Send(Value); |
| 93 |
end; |
| 94 |
|
| 95 |
class function TImageBackgroundNode.ClassX3DType: String; |
| 96 |
begin |
| 97 |
Result := 'ImageBackground'; |
| 98 |
end; |
| 99 |
|
| 100 |
procedure TImageBackgroundNode.CreateNode; |
| 101 |
begin |
| 102 |
inherited; |
| 103 |
|
| 104 |
FFdColor := TSFColorRGBA.Create(Self, True, 'color', Vector4(1, 1, 1, 1)); |
| 105 |
FdColor.ChangeAlways := chVisibleNonGeometry; |
| 106 |
AddField(FFdColor); |
| 107 |
|
| 108 |
FFdTexture := TSFNode.Create(Self, True, 'texture', [TAbstractTextureNode]); |
| 109 |
FdTexture.ChangeAlways := chVisibleNonGeometry; |
| 110 |
AddField(FFdTexture); |
| 111 |
|
| 112 |
FFdTexCoords := TMFVec2f.Create(Self, True, 'texCoords', [ Vector2(0, 0), Vector2(1, 0), Vector2(1, 1), Vector2(0, 1) ]); |
| 113 |
FdTexCoords.ChangeAlways := chVisibleNonGeometry; |
| 114 |
AddField(FFdTexCoords); |
| 115 |
end; |
| 116 |
|
| 117 |
{$endif read_implementation} |