/usr/src/castle-game-engine-5.0.0/x3d/x3d_picking.inc is in castle-game-engine-src 5.0.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | {
Copyright 2008-2014 Michalis Kamburelis.
This file is part of "Castle Game Engine".
"Castle Game Engine" is free software; see the file COPYING.txt,
included in this distribution, for details about the copyright.
"Castle Game Engine" is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
----------------------------------------------------------------------------
}
{$ifdef read_interface}
{ }
IAbstractPickableObject = interface(IX3DNode)
['{700E1CE8-97BD-44D2-A60F-D8639F4E72EC}']
property FdObjectType: TMFString { read GetFdobjectType }; { }
property FdPickable: TSFBool { read GetFdpickable }; { }
end;
TAbstractPickSensorNode = class(TAbstractSensorNode)
public
procedure CreateNode; override;
private FFdObjectType: TMFString;
public property FdObjectType: TMFString read FFdObjectType;
private FFdPickingGeometry: TSFNode;
public property FdPickingGeometry: TSFNode read FFdPickingGeometry;
private FFdPickTarget: TMFNode;
public property FdPickTarget: TMFNode read FFdPickTarget;
{ Event out } { }
private FEventPickedGeometry: TMFNodeEvent;
public property EventPickedGeometry: TMFNodeEvent read FEventPickedGeometry;
private FFdIntersectionType: TSFString;
public property FdIntersectionType: TSFString read FFdIntersectionType;
private FFdSortOrder: TSFString;
public property FdSortOrder: TSFString read FFdSortOrder;
end;
TLinePickSensorNode = class(TAbstractPickSensorNode)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function URNMatching(const URN: string): boolean; override;
{ Event out } { }
private FEventPickedNormal: TMFVec3fEvent;
public property EventPickedNormal: TMFVec3fEvent read FEventPickedNormal;
{ Event out } { }
private FEventPickedPoint: TMFVec3fEvent;
public property EventPickedPoint: TMFVec3fEvent read FEventPickedPoint;
{ Event out } { }
private FEventPickedTextureCoordinate: TMFVec3fEvent;
public property EventPickedTextureCoordinate: TMFVec3fEvent read FEventPickedTextureCoordinate;
end;
TPickableGroupNode = class(TAbstractX3DGroupingNode, IAbstractPickableObject)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function URNMatching(const URN: string): boolean; override;
private FFdObjectType: TMFString;
public property FdObjectType: TMFString read FFdObjectType;
private FFdPickable: TSFBool;
public property FdPickable: TSFBool read FFdPickable;
end;
TPointPickSensorNode = class(TAbstractPickSensorNode)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function URNMatching(const URN: string): boolean; override;
{ Event out } { }
private FEventPickedPoint: TMFVec3fEvent;
public property EventPickedPoint: TMFVec3fEvent read FEventPickedPoint;
end;
TPrimitivePickSensorNode = class(TAbstractPickSensorNode)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function URNMatching(const URN: string): boolean; override;
end;
TVolumePickSensorNode = class(TAbstractPickSensorNode)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function URNMatching(const URN: string): boolean; override;
end;
{$endif read_interface}
{$ifdef read_implementation}
procedure TAbstractPickSensorNode.CreateNode;
begin
inherited;
FFdObjectType := TMFString.Create(Self, 'objectType', ['ALL']);
Fields.Add(FFdObjectType);
{ X3D specification comment: ["ALL","NONE","TERRAIN",...] }
FFdPickingGeometry := TSFNode.Create(Self, 'pickingGeometry', [TAbstractX3DGeometryNode]);
Fields.Add(FFdPickingGeometry);
{ X3D specification (edition 2) specifies X3DInlineNode as 3rd value on
the list of allowed classes for "pickTarget". But there is no X3DInlineNode
in the specification... So I just added TInlineNode there (it's the only
Inline node for X3D anyway. }
FFdPickTarget := TMFNode.Create(Self, 'pickTarget', [TAbstractX3DGroupingNode, TAbstractShapeNode, TInlineNode]);
Fields.Add(FFdPickTarget);
FEventPickedGeometry := TMFNodeEvent.Create(Self, 'pickedGeometry', false);
Events.Add(FEventPickedGeometry);
FFdIntersectionType := TSFString.Create(Self, 'intersectionType', 'BOUNDS');
FFdIntersectionType.Exposed := false;
Fields.Add(FFdIntersectionType);
{ X3D specification comment: ["GEOMETRY"|"BOUNDS"] }
FFdSortOrder := TSFString.Create(Self, 'sortOrder', 'CLOSEST');
FFdSortOrder.Exposed := false;
Fields.Add(FFdSortOrder);
{ X3D specification comment: ["ANY"|"CLOSEST"|"ALL"|"ALL_SORTED"] }
DefaultContainerField := 'children';
end;
procedure TLinePickSensorNode.CreateNode;
begin
inherited;
FEventPickedNormal := TMFVec3fEvent.Create(Self, 'pickedNormal', false);
Events.Add(FEventPickedNormal);
FEventPickedPoint := TMFVec3fEvent.Create(Self, 'pickedPoint', false);
Events.Add(FEventPickedPoint);
FEventPickedTextureCoordinate := TMFVec3fEvent.Create(Self, 'pickedTextureCoordinate', false);
Events.Add(FEventPickedTextureCoordinate);
DefaultContainerField := 'children';
end;
class function TLinePickSensorNode.ClassNodeTypeName: string;
begin
Result := 'LinePickSensor';
end;
class function TLinePickSensorNode.URNMatching(const URN: string): boolean;
begin
Result := (inherited URNMatching(URN)) or
(URN = URNX3DNodes + ClassNodeTypeName);
end;
procedure TPickableGroupNode.CreateNode;
begin
inherited;
FFdObjectType := TMFString.Create(Self, 'objectType', ['ALL']);
Fields.Add(FFdObjectType);
{ X3D specification comment: ["ALL","NONE","TERRAIN",...] }
FFdPickable := TSFBool.Create(Self, 'pickable', true);
Fields.Add(FFdPickable);
DefaultContainerField := 'children';
end;
class function TPickableGroupNode.ClassNodeTypeName: string;
begin
Result := 'PickableGroup';
end;
class function TPickableGroupNode.URNMatching(const URN: string): boolean;
begin
Result := (inherited URNMatching(URN)) or
(URN = URNX3DNodes + ClassNodeTypeName);
end;
procedure TPointPickSensorNode.CreateNode;
begin
inherited;
FEventPickedPoint := TMFVec3fEvent.Create(Self, 'pickedPoint', false);
Events.Add(FEventPickedPoint);
DefaultContainerField := 'children';
end;
class function TPointPickSensorNode.ClassNodeTypeName: string;
begin
Result := 'PointPickSensor';
end;
class function TPointPickSensorNode.URNMatching(const URN: string): boolean;
begin
Result := (inherited URNMatching(URN)) or
(URN = URNX3DNodes + ClassNodeTypeName);
end;
procedure TPrimitivePickSensorNode.CreateNode;
begin
inherited;
DefaultContainerField := 'children';
end;
class function TPrimitivePickSensorNode.ClassNodeTypeName: string;
begin
Result := 'PrimitivePickSensor';
end;
class function TPrimitivePickSensorNode.URNMatching(const URN: string): boolean;
begin
Result := (inherited URNMatching(URN)) or
(URN = URNX3DNodes + ClassNodeTypeName);
end;
procedure TVolumePickSensorNode.CreateNode;
begin
inherited;
DefaultContainerField := 'children';
end;
class function TVolumePickSensorNode.ClassNodeTypeName: string;
begin
Result := 'VolumePickSensor';
end;
class function TVolumePickSensorNode.URNMatching(const URN: string): boolean;
begin
Result := (inherited URNMatching(URN)) or
(URN = URNX3DNodes + ClassNodeTypeName);
end;
procedure RegisterPickingNodes;
begin
NodesManager.RegisterNodeClasses([
TLinePickSensorNode,
TPickableGroupNode,
TPointPickSensorNode,
TPrimitivePickSensorNode,
TVolumePickSensorNode
]);
end;
{$endif read_implementation}
|