| 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 GetBBox: TBox3D; |
| 28 |
procedure SetBBox(const Value: TBox3D); |
| 29 |
{$ifndef CASTLE_SLIM_NODES} |
| 30 |
function GetVisible: Boolean; |
| 31 |
procedure SetVisible(const Value: Boolean); |
| 32 |
{$endif not CASTLE_SLIM_NODES} |
| 33 |
{$ifndef CASTLE_SLIM_NODES} |
| 34 |
function GetBboxDisplay: Boolean; |
| 35 |
procedure SetBboxDisplay(const Value: Boolean); |
| 36 |
{$endif not CASTLE_SLIM_NODES} |
| 37 |
public |
| 38 |
{ Create node fields and events. } |
| 39 |
procedure CreateNode; override; |
| 40 |
class function ClassX3DType: String; override; |
| 41 |
|
| 42 |
strict private FEventAddChildren: TMFNodeEvent; |
| 43 |
{ } |
| 44 |
public property EventAddChildren: TMFNodeEvent read FEventAddChildren; |
| 45 |
|
| 46 |
strict private FEventRemoveChildren: TMFNodeEvent; |
| 47 |
{ } |
| 48 |
public property EventRemoveChildren: TMFNodeEvent read FEventRemoveChildren; |
| 49 |
|
| 50 |
strict private FFdChildren: TMFNode; |
| 51 |
{ Internal wrapper for property @code(Children). This wrapper API may change, we advise to access simpler @code(Children) instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart). } |
| 52 |
public property FdChildren: TMFNode read FFdChildren; |
| 53 |
{ } |
| 54 |
procedure SetChildren(const Value: array of TX3DNode); |
| 55 |
|
| 56 |
strict private FFdBboxCenter: TSFVec3f; |
| 57 |
{ Internal wrapper for property @code(BboxCenter). This wrapper API may change, we advise to access simpler @code(BboxCenter) instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart). } |
| 58 |
public property FdBboxCenter: TSFVec3f read FFdBboxCenter; |
| 59 |
{ You can provide a manually-calculated bounding box of the group here, for optimization purposes. @italic(Ignored for now.) Leave this field as empty (TBox3D.Empty) to let the engine calculate best bounding box automatically. @seealso TAbstractShapeNode.BBox } |
| 60 |
property BBox: TBox3D read GetBBox write SetBBox; |
| 61 |
|
| 62 |
strict private FFdBboxSize: TSFVec3f; |
| 63 |
{ Internal wrapper for property @code(BboxSize). This wrapper API may change, we advise to access simpler @code(BboxSize) instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart). } |
| 64 |
public property FdBboxSize: TSFVec3f read FFdBboxSize; |
| 65 |
|
| 66 |
{$ifndef CASTLE_SLIM_NODES} |
| 67 |
strict private FFdVisible: TSFBool; |
| 68 |
{ Internal wrapper for property @code(Visible). This wrapper API may change, we advise to access simpler @code(Visible) instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart). } |
| 69 |
public property FdVisible: TSFBool read FFdVisible; |
| 70 |
{$endif not CASTLE_SLIM_NODES} |
| 71 |
{$ifndef CASTLE_SLIM_NODES} |
| 72 |
{ Is this group visible (@italic(not implemented yet)). While this is not implemented for an entire group, note that you can use @link(TAbstractShapeNode.Visible) to toggle visibility of each shape. } |
| 73 |
property Visible: Boolean read GetVisible write SetVisible; |
| 74 |
{$endif not CASTLE_SLIM_NODES} |
| 75 |
|
| 76 |
{$ifndef CASTLE_SLIM_NODES} |
| 77 |
strict private FFdBboxDisplay: TSFBool; |
| 78 |
{ Internal wrapper for property @code(BboxDisplay). This wrapper API may change, we advise to access simpler @code(BboxDisplay) instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart). } |
| 79 |
public property FdBboxDisplay: TSFBool read FFdBboxDisplay; |
| 80 |
{$endif not CASTLE_SLIM_NODES} |
| 81 |
{$ifndef CASTLE_SLIM_NODES} |
| 82 |
{ Is the bounding box of this group visible (@italic(not implemented yet)). While this is not implemented for an X3D group, note that you can use @link(TDebugTransformBox) to easily display bounding box of a whole @link(TCastleTransform). } |
| 83 |
property BboxDisplay: Boolean read GetBboxDisplay write SetBboxDisplay; |
| 84 |
{$endif not CASTLE_SLIM_NODES} |
| 85 |
|
| 86 |
{$endif read_interface} |
| 87 |
|
| 88 |
{$ifdef read_implementation} |
| 89 |
|
| 90 |
{ TAbstractGroupingNode ----------------------------------------------- } |
| 91 |
|
| 92 |
procedure TAbstractGroupingNode.SetChildren(const Value: array of TX3DNode); |
| 93 |
var |
| 94 |
L: Integer; |
| 95 |
A: array of TX3DNode; |
| 96 |
begin |
| 97 |
L := High(Value) + 1; |
| 98 |
SetLength(A, L); |
| 99 |
if L > 0 then |
| 100 |
Move(Value[0], A[0], L * SizeOf(TX3DNode)); |
| 101 |
FdChildren.Send(A); |
| 102 |
end; |
| 103 |
|
| 104 |
function TAbstractGroupingNode.GetBBox: TBox3D; |
| 105 |
begin |
| 106 |
Result := TBox3D.FromCenterSize(FdBBoxCenter.Value, FdBBoxSize.Value); |
| 107 |
end; |
| 108 |
|
| 109 |
procedure TAbstractGroupingNode.SetBBox(const Value: TBox3D); |
| 110 |
var |
| 111 |
ValueCenter, ValueSize: TVector3; |
| 112 |
begin |
| 113 |
Value.ToCenterSize(ValueCenter, ValueSize); |
| 114 |
FdBBoxCenter.Send(ValueCenter); |
| 115 |
FdBBoxSize.Send(ValueSize); |
| 116 |
end; |
| 117 |
|
| 118 |
{$ifndef CASTLE_SLIM_NODES} |
| 119 |
function TAbstractGroupingNode.GetVisible: Boolean; |
| 120 |
begin |
| 121 |
Result := FdVisible.Value; |
| 122 |
end; |
| 123 |
|
| 124 |
procedure TAbstractGroupingNode.SetVisible(const Value: Boolean); |
| 125 |
begin |
| 126 |
FdVisible.Send(Value); |
| 127 |
end; |
| 128 |
|
| 129 |
{$endif not CASTLE_SLIM_NODES} |
| 130 |
{$ifndef CASTLE_SLIM_NODES} |
| 131 |
function TAbstractGroupingNode.GetBboxDisplay: Boolean; |
| 132 |
begin |
| 133 |
Result := FdBboxDisplay.Value; |
| 134 |
end; |
| 135 |
|
| 136 |
procedure TAbstractGroupingNode.SetBboxDisplay(const Value: Boolean); |
| 137 |
begin |
| 138 |
FdBboxDisplay.Send(Value); |
| 139 |
end; |
| 140 |
|
| 141 |
{$endif not CASTLE_SLIM_NODES} |
| 142 |
class function TAbstractGroupingNode.ClassX3DType: String; |
| 143 |
begin |
| 144 |
Result := 'X3DGroupingNode'; |
| 145 |
end; |
| 146 |
|
| 147 |
procedure TAbstractGroupingNode.CreateNode; |
| 148 |
begin |
| 149 |
inherited; |
| 150 |
|
| 151 |
FEventAddChildren := TMFNodeEvent.Create(Self, 'addChildren', true); |
| 152 |
AddEvent(FEventAddChildren); |
| 153 |
|
| 154 |
FEventRemoveChildren := TMFNodeEvent.Create(Self, 'removeChildren', true); |
| 155 |
AddEvent(FEventRemoveChildren); |
| 156 |
|
| 157 |
FFdChildren := TMFNode.Create(Self, True, 'children', [TAbstractChildNode, TAbstractGeometryNode_1]); |
| 158 |
FdChildren.ChangeAlways := chGroupChildren; |
| 159 |
AddField(FFdChildren); |
| 160 |
|
| 161 |
FFdBboxCenter := TSFVec3f.Create(Self, False, 'bboxCenter', Vector3(0, 0, 0)); |
| 162 |
FdBboxCenter.ChangeAlways := chVisibleNonGeometry; |
| 163 |
AddField(FFdBboxCenter); |
| 164 |
|
| 165 |
FFdBboxSize := TSFVec3f.Create(Self, False, 'bboxSize', Vector3(-1, -1, -1)); |
| 166 |
FdBboxSize.ChangeAlways := chVisibleNonGeometry; |
| 167 |
AddField(FFdBboxSize); |
| 168 |
|
| 169 |
{$ifndef CASTLE_SLIM_NODES} |
| 170 |
FFdVisible := TSFBool.Create(Self, True, 'visible', true); |
| 171 |
FdVisible.ChangeAlways := chVisibleNonGeometry; |
| 172 |
AddField(FFdVisible); |
| 173 |
{$endif not CASTLE_SLIM_NODES} |
| 174 |
|
| 175 |
{$ifndef CASTLE_SLIM_NODES} |
| 176 |
FFdBboxDisplay := TSFBool.Create(Self, True, 'bboxDisplay', false); |
| 177 |
FdBboxDisplay.ChangeAlways := chVisibleNonGeometry; |
| 178 |
AddField(FFdBboxDisplay); |
| 179 |
{$endif not CASTLE_SLIM_NODES} |
| 180 |
end; |
| 181 |
|
| 182 |
{$endif read_implementation} |