/usr/src/castle-game-engine-5.2.0/x3d/x3d_cadgeometry.inc is in castle-game-engine-src 5.2.0-2.
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 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | {
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}
{ }
IAbstractX3DProductStructureChildNode = interface(IAbstractChildNode)
['{318249E0-BACF-4F16-9E49-3E912F24E0AA}']
property FdName: TSFString { read FFdName} { };
end;
TAbstractProductStructureChildNode = class(TAbstractChildNode,
IAbstractX3DProductStructureChildNode)
public
procedure CreateNode; override;
private FFdName: TSFString;
public property FdName: TSFString read FFdName;
end;
TCADAssemblyNode = class(TAbstractX3DGroupingNode, IAbstractX3DProductStructureChildNode)
protected
procedure DirectEnumerateActive(Func: TEnumerateChildrenFunction); override;
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function URNMatching(const URN: string): boolean; override;
private FFdName: TSFString;
public property FdName: TSFString read FFdName;
end;
TCADFaceNode = class(TAbstractProductStructureChildNode, IAbstractBoundedObject)
protected
procedure DirectEnumerateActive(Func: TEnumerateChildrenFunction); override;
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function URNMatching(const URN: string): boolean; override;
private FFdShape: TSFNode;
public property FdShape: TSFNode read FFdShape;
private FFdBboxCenter: TSFVec3f;
public property FdBboxCenter: TSFVec3f read FFdBboxCenter;
private FFdBboxSize: TSFVec3f;
public property FdBboxSize: TSFVec3f read FFdBboxSize;
end;
TCADLayerNode = class(TAbstractX3DGroupingNode)
protected
procedure DirectEnumerateActive(Func: TEnumerateChildrenFunction); override;
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function URNMatching(const URN: string): boolean; override;
private FFdName: TSFString;
public property FdName: TSFString read FFdName;
private FFdVisible: TMFBool;
public property FdVisible: TMFBool read FFdVisible;
end;
TCADPartNode = class(TAbstractX3DGroupingNode, IAbstractX3DProductStructureChildNode, ITransformNode)
protected
procedure DirectEnumerateActive(Func: TEnumerateChildrenFunction); override;
procedure ApplyTransform(State: TX3DGraphTraverseState); override;
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function URNMatching(const URN: string): boolean; override;
function TransformationChange: TNodeTransformationChange; override;
private FFdCenter: TSFVec3f;
public property FdCenter: TSFVec3f read FFdCenter;
private FFdName: TSFString;
public property FdName: TSFString read FFdName;
private FFdRotation: TSFRotation;
public property FdRotation: TSFRotation read FFdRotation;
private FFdScale: TSFVec3f;
public property FdScale: TSFVec3f read FFdScale;
private FFdScaleOrientation: TSFRotation;
public property FdScaleOrientation: TSFRotation read FFdScaleOrientation;
private FFdTranslation: TSFVec3f;
public property FdTranslation: TSFVec3f read FFdTranslation;
end;
TIndexedQuadSetNode = class(TAbstractComposedGeometryNode)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function URNMatching(const URN: string): boolean; override;
{ Event in } { }
private FEventSet_index: TMFInt32Event;
public property EventSet_index: TMFInt32Event read FEventSet_index;
private FFdIndex: TMFInt32;
public property FdIndex: TMFInt32 read FFdIndex;
function CoordIndex: TMFLong; override;
procedure CoordPolygons(
State: TX3DGraphTraverseState;
PolygonHandler: TIndexedPolygonHandler); override;
function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; override;
end;
TQuadSetNode = class(TAbstractComposedGeometryNode)
public
procedure CreateNode; override;
class function ClassNodeTypeName: string; override;
class function URNMatching(const URN: string): boolean; override;
procedure CoordPolygons(
State: TX3DGraphTraverseState;
PolygonHandler: TIndexedPolygonHandler); override;
function TrianglesCount(State: TX3DGraphTraverseState; OverTriangulate: boolean;
ProxyGeometry: TAbstractGeometryNode; ProxyState: TX3DGraphTraverseState): Cardinal; override;
end;
{$endif read_interface}
{$ifdef read_implementation}
procedure TAbstractProductStructureChildNode.CreateNode;
begin
inherited;
FFdName := TSFString.Create(Self, 'name', '');
Fields.Add(FFdName);
DefaultContainerField := 'children';
end;
procedure TCADAssemblyNode.CreateNode;
begin
inherited;
FFdName := TSFString.Create(Self, 'name', '');
Fields.Add(FFdName);
DefaultContainerField := 'children';
end;
class function TCADAssemblyNode.ClassNodeTypeName: string;
begin
Result := 'CADAssembly';
end;
class function TCADAssemblyNode.URNMatching(const URN: string): boolean;
begin
Result := (inherited URNMatching(URN)) or
(URN = URNX3DNodes + ClassNodeTypeName);
end;
procedure TCADAssemblyNode.DirectEnumerateActive(Func: TEnumerateChildrenFunction);
begin
FdChildren.EnumerateValid(Func);
end;
procedure TCADFaceNode.CreateNode;
begin
inherited;
FFdShape := TSFNode.Create(Self, 'shape', [TAbstractShapeNode, TAbstractLODNode]);
Fields.Add(FFdShape);
FFdBboxCenter := TSFVec3f.Create(Self, 'bboxCenter', Vector3Single(0, 0, 0));
FFdBboxCenter.Exposed := false;
Fields.Add(FFdBboxCenter);
{ X3D specification comment: (-Inf, Inf) }
FFdBboxSize := TSFVec3f.Create(Self, 'bboxSize', Vector3Single(-1, -1, -1));
FFdBboxSize.Exposed := false;
Fields.Add(FFdBboxSize);
{ X3D specification comment: [0, Inf) or -1 -1 -1 }
DefaultContainerField := 'children';
end;
class function TCADFaceNode.ClassNodeTypeName: string;
begin
Result := 'CADFace';
end;
class function TCADFaceNode.URNMatching(const URN: string): boolean;
begin
Result := (inherited URNMatching(URN)) or
(URN = URNX3DNodes + ClassNodeTypeName);
end;
procedure TCADFaceNode.DirectEnumerateActive(Func: TEnumerateChildrenFunction);
begin
FdShape.EnumerateValid(Func);
end;
procedure TCADLayerNode.CreateNode;
begin
inherited;
FFdName := TSFString.Create(Self, 'name', '');
Fields.Add(FFdName);
FFdVisible := TMFBool.Create(Self, 'visible', []);
Fields.Add(FFdVisible);
DefaultContainerField := 'children';
end;
class function TCADLayerNode.ClassNodeTypeName: string;
begin
Result := 'CADLayer';
end;
class function TCADLayerNode.URNMatching(const URN: string): boolean;
begin
Result := (inherited URNMatching(URN)) or
(URN = URNX3DNodes + ClassNodeTypeName);
end;
procedure TCADLayerNode.DirectEnumerateActive(Func: TEnumerateChildrenFunction);
var
I: Integer;
begin
inherited;
for I := 0 to FdChildren.Count - 1 do
if (I >= FdVisible.Count) or FdVisible.Items[I] then
Func(Self, FdChildren[I]);
end;
procedure TCADPartNode.CreateNode;
begin
inherited;
FFdCenter := TSFVec3f.Create(Self, 'center', Vector3Single(0, 0, 0));
FdCenter.ChangesAlways := [chTransform];
Fields.Add(FFdCenter);
{ X3D specification comment: (-Inf,Inf) }
FFdName := TSFString.Create(Self, 'name', '');
Fields.Add(FFdName);
FFdRotation := TSFRotation.Create(Self, 'rotation', Vector3Single(0, 0, 1), 0);
FdRotation.ChangesAlways := [chTransform];
Fields.Add(FFdRotation);
{ X3D specification comment: [-1,1] or (-Inf,Inf) }
FFdScale := TSFVec3f.Create(Self, 'scale', Vector3Single(1, 1, 1));
FdScale.ChangesAlways := [chTransform];
Fields.Add(FFdScale);
{ X3D specification comment: (0,Inf) }
FFdScaleOrientation := TSFRotation.Create(Self, 'scaleOrientation', Vector3Single(0, 0, 1), 0);
FdScaleOrientation.ChangesAlways := [chTransform];
Fields.Add(FFdScaleOrientation);
{ X3D specification comment: [-1,1] or (-Inf,Inf) }
FFdTranslation := TSFVec3f.Create(Self, 'translation', Vector3Single(0, 0, 0));
FdTranslation.ChangesAlways := [chTransform];
Fields.Add(FFdTranslation);
{ X3D specification comment: (-Inf,Inf) }
DefaultContainerField := 'children';
end;
class function TCADPartNode.ClassNodeTypeName: string;
begin
Result := 'CADPart';
end;
class function TCADPartNode.URNMatching(const URN: string): boolean;
begin
Result := (inherited URNMatching(URN)) or
(URN = URNX3DNodes + ClassNodeTypeName);
end;
procedure TCADPartNode.DirectEnumerateActive(Func: TEnumerateChildrenFunction);
begin
FdChildren.EnumerateValid(Func);
end;
function TCADPartNode.TransformationChange: TNodeTransformationChange;
begin
Result := ntcTransform;
end;
procedure TCADPartNode.ApplyTransform(State: TX3DGraphTraverseState);
begin
inherited;
TransformState(State, Fdcenter.Value, Fdrotation.Value,
Fdscale.Value, FdscaleOrientation.Value, Fdtranslation.Value);
end;
procedure TIndexedQuadSetNode.CreateNode;
begin
inherited;
FEventSet_index := TMFInt32Event.Create(Self, 'set_index', true);
Events.Add(FEventSet_index);
FFdIndex := TMFInt32.Create(Self, 'index', []);
FdIndex.Exposed := false;
FdIndex.ChangesAlways := [chGeometry];
Fields.Add(FFdIndex);
{ X3D specification comment: [0,Inf) }
end;
class function TIndexedQuadSetNode.ClassNodeTypeName: string;
begin
Result := 'IndexedQuadSet';
end;
class function TIndexedQuadSetNode.URNMatching(const URN: string): boolean;
begin
Result := (inherited URNMatching(URN)) or
(URN = URNX3DNodes + ClassNodeTypeName);
end;
function TIndexedQuadSetNode.CoordIndex: TMFLong;
begin
Result := FdIndex;
end;
procedure TQuadSetNode.CreateNode;
begin
inherited;
end;
class function TQuadSetNode.ClassNodeTypeName: string;
begin
Result := 'QuadSet';
end;
class function TQuadSetNode.URNMatching(const URN: string): boolean;
begin
Result := (inherited URNMatching(URN)) or
(URN = URNX3DNodes + ClassNodeTypeName);
end;
procedure RegisterCADGeometryNodes;
begin
NodesManager.RegisterNodeClasses([
TCADAssemblyNode,
TCADFaceNode,
TCADLayerNode,
TCADPartNode,
TIndexedQuadSetNode,
TQuadSetNode
]);
end;
{$endif read_implementation}
|