Debian Codegraph @

src/scene/x3d/x3dnodes_inventor.inc

raw
1 {%MainUnit x3dnodes.pas}
2 {
3 Copyright 2002-2022 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 { Inventor nodes that didn't make it into any VRML version. } { }
18
19 {$ifdef read_interface}
20 { IndexedTriangleMesh (from Inventor 1.0). }
21 TIndexedTriangleMeshNode_1 = class(TIndexedFacesOrTrianglesNode_1)
22 public
23 procedure InternalCoordPolygons(
24 State: TX3DGraphTraverseState;
25 PolygonHandler: TIndexedPolygonHandler); override;
26
27 function InternalTexCoord(State: TX3DGraphTraverseState;
28 out ATexCoord: TX3DNode): boolean; override;
29 {$I auto_generated_node_helpers/x3dnodes_indexedtrianglemesh_1.inc}
30 end;
31
32 { RotationXYZ node (from Inventor). It's not in VRML 1.0 spec.
33 But some invalid VRML 1.0 models use it,
34 e.g. [http://www-vrl.umich.edu/sel_prj/EECS498/]. }
35 TRotationXYZNode_1 = class(TAbstractTransformationNode_1)
36 protected
37 procedure MiddleTraverse(StateStack: TX3DGraphTraverseStateStack); override;
38 {$I auto_generated_node_helpers/x3dnodes_rotationxyz_1.inc}
39 end;
40 {$endif read_interface}
41
42 {$ifdef read_implementation}
43 function TIndexedTriangleMeshNode_1.InternalTexCoord(State: TX3DGraphTraverseState;
44 out ATexCoord: TX3DNode): boolean;
45 begin
46 Result := true;
47 ATexCoord := State.VRML1State.TextureCoordinate2;
48 end;
49
50 const
51 AxisNames: array [0..2] of String = ('X', 'Y', 'Z');
52
53 procedure TRotationXYZNode_1.MiddleTraverse(StateStack: TX3DGraphTraverseStateStack);
54 var
55 RotationAxisAngle: TVector4;
56 begin
57 inherited;
58 RotationAxisAngle := Vector4(TVector3.One[FdAxis.Value], FdAngle.Value);
59 StateStack.Top.Transformation.Multiply(RotationAxisAngle, Vector3(1, 1, 1), TVector3.Zero);
60 end;
61
62 procedure RegistedInventorNodes;
63 begin
64 NodesManager.RegisterNodeClasses([
65 TIndexedTriangleMeshNode_1,
66 TRotationXYZNode_1
67 ]);
68 end;
69 {$endif read_implementation}