Ocean
Inline.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_SCENEDESCRIPTION_SDX_X3D_INLINE_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDX_X3D_INLINE_H
10 
15 
17 
18 namespace Ocean
19 {
20 
21 namespace SceneDescription
22 {
23 
24 namespace SDX
25 {
26 
27 namespace X3D
28 {
29 
30 /**
31  * This class implements a x3d inline node.
32  * @ingroup scenedescriptionsdxx3d
33  */
34 class OCEAN_SCENEDESCRIPTION_SDX_X3D_EXPORT Inline :
35  virtual public X3DChildNode,
36  virtual public X3DBoundedObject,
37  virtual public X3DUrlObject
38 {
39  public:
40 
41  /**
42  * Creates a new x3d inline node.
43  * @param environment Node environment
44  */
45  Inline(const SDXEnvironment* environment);
46 
47  /**
48  * Returns a reference of the child scene.
49  * @return Loaded child scene
50  */
51  inline SDXSceneRef childScene() const;
52 
53  protected:
54 
55  /**
56  * Destructs a x3d inline node.
57  */
58  ~Inline() override;
59 
60  /**
61  * Specifies the node type and the fields of this node.
62  * @return Unique node specification of this node
63  */
65 
66  /**
67  * Event function to inform the node that it has been initialized and can apply all internal values to corresponding rendering objects.
68  * @see SDXNode::onInitialize().
69  */
70  void onInitialize(const Rendering::SceneRef& scene, const Timestamp timestamp) override;
71 
72  /**
73  * Event function to inform the node about a changed field.
74  * @see SDXNode::onFieldChanged().
75  */
76  void onFieldChanged(const std::string& fieldName) override;
77 
78  /**
79  * Loads all scenes specified in the url field.
80  * @param timestamp The timestamp at which the scenes will be loaded, must be valid
81  */
82  void loadScenes(const Timestamp& timestamp);
83 
84  /**
85  * Unloades all currently loaded scenes.
86  */
87  void unloadScenes();
88 
89  /**
90  * Returns the address of the most derived object.
91  * @see Node::objectAddress().
92  */
93  size_t objectAddress() const override;
94 
95  protected:
96 
97  /// Load field.
99 
100  /// State determining whether the inline node has loaded scenes.
102 
103  /// Scene reference of a possible permanent scene object.
105 };
106 
108 {
109  return permanentScene_;
110 }
111 
112 }
113 
114 }
115 
116 }
117 
118 }
119 
120 #endif // META_OCEAN_SCENEDESCRIPTION_SDX_X3D_INLINE_H
This class implements a node specification object.
Definition: scenedescription/Node.h:77
This class implements a x3d inline node.
Definition: Inline.h:38
void unloadScenes()
Unloades all currently loaded scenes.
NodeSpecification specifyNode()
Specifies the node type and the fields of this node.
SDXSceneRef childScene() const
Returns a reference of the child scene.
Definition: Inline.h:107
void onInitialize(const Rendering::SceneRef &scene, const Timestamp timestamp) override
Event function to inform the node that it has been initialized and can apply all internal values to c...
SingleBool load_
Load field.
Definition: Inline.h:98
bool hasScenes_
State determining whether the inline node has loaded scenes.
Definition: Inline.h:101
size_t objectAddress() const override
Returns the address of the most derived object.
~Inline() override
Destructs a x3d inline node.
void loadScenes(const Timestamp &timestamp)
Loads all scenes specified in the url field.
Inline(const SDXEnvironment *environment)
Creates a new x3d inline node.
void onFieldChanged(const std::string &fieldName) override
Event function to inform the node about a changed field.
SDXSceneRef permanentScene_
Scene reference of a possible permanent scene object.
Definition: Inline.h:104
This class implements an abstract x3d bounded object.
Definition: X3DBoundedObject.h:33
This class implements an abstract x3d child node.
Definition: X3DChildNode.h:31
This class implements an abstract x3d url object.
Definition: X3DUrlObject.h:35
This class implements a node environment container.
Definition: SDXNode.h:62
This class implements a timestamp.
Definition: Timestamp.h:36
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15