Ocean
SDXScene.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_SCENE_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDX_SCENE_H
10 
14 
15 namespace Ocean
16 {
17 
18 namespace SceneDescription
19 {
20 
21 // Forward declaration.
22 class SDXScene;
23 
24 /**
25  * Definition of a smart object reference for scene desciption X scenes.
26  * @see SDXScene, Node.
27  * @ingroup scenedescription
28  */
30 
31 /**
32  * This class implements the base class for all sdx scene object providing access to all elements of a scene.
33  * A new scene object can be created by the scene description Manager object.
34  * @ingroup scenedescription
35  */
36 class OCEAN_SCENEDESCRIPTION_EXPORT SDXScene :
37  virtual public Scene,
38  virtual public SDXNode
39 {
40  public:
41 
42  /**
43  * Returns the name of the file defining this node.
44  * Beware: A node can be defined outside a file context and thus does not have a file!
45  * @return Filename
46  */
47  inline const std::string& filename() const;
48 
49  /**
50  * Returns the associated scene rendering object.
51  * @return Associated scene rendering object
52  */
53  inline Rendering::SceneRef renderingScene() const;
54 
55  /**
56  * Returns the environment object of this scene.
57  * @return Environment object
58  */
59  inline const SDXEnvironment* environment() const;
60 
61  /**
62  * Registers a global light source to this scene.
63  * Licht sources in local transformations with global state should be registered only.<br>
64  * The transformation, position or orientation of the light source is unchanged.
65  * @param lightSource Rendering light source object to be registered
66  * @see unregisterGlobalLight().
67  */
68  virtual void registerGlobalLight(const Rendering::LightSourceRef& lightSource);
69 
70  /**
71  * Unregisters a global light source from this scene.
72  * @param lightSource Renring light source object to be unregistered
73  * @see registerGlobalLight().
74  */
75  virtual void unregisterGlobalLight(const Rendering::LightSourceRef& lightSource);
76 
77  /**
78  * Event function to inform the scene that it has been initialized and can apply all internal values to corresponding rendering objects.
79  * @param timestamp Initialization timestamp
80  */
81  virtual void initialize(const Timestamp timestamp);
82 
83  protected:
84 
85  /**
86  * Creates a new scene object.
87  * @param filename Name of the scene file, if any
88  * @param library Library providing this scene node
89  * @param engine Rendering engine corresponding with this scene and all child nodes
90  */
91  SDXScene(const std::string& filename, const Library& library, const Rendering::EngineRef& engine);
92 
93  /**
94  * Event function to inform the node that it has been initialized and can apply all internal values to corresponding rendering objects.
95  * The scene node has an own initialize() function, use this instead
96  * @see SDXNode::initialize().
97  */
98  void initialize(const Rendering::SceneRef& scene, const Timestamp timestamp, const bool reinitialize = false) override;
99 
100  /**
101  * Internal event function to inform the scene that it has been initialized and can apply all internal values to corresponding rendering objects.
102  * @param timestamp Initialization timestamp
103  */
104  virtual void onInitialize(const Timestamp timestamp);
105 
106  /**
107  * Internal event function to inform the node that it has been initialized and can apply all internal values to corresponding rendering objects.
108  * The scene node has an own onInitialize() function, use this instead
109  * @see SDXNode::onInitialize().
110  */
111  void onInitialize(const Rendering::SceneRef& scene, const Timestamp timestamp) override;
112 
113  protected:
114 
115  /// Scene environment object.
117 };
118 
119 inline const std::string& SDXScene::filename() const
120 {
121  return SDXNode::filename();
122 }
123 
125 {
127 }
128 
130 {
131  return environment_;
132 }
133 
134 }
135 
136 }
137 
138 #endif // META_OCEAN_SCENEDESCRIPTION_SDX_SCENE_H
This class is the base class for all scene description libraries.
Definition: scenedescription/Library.h:37
This class implements a node environment container.
Definition: SDXNode.h:62
This class implements the base class for all SDX scene description nodes.
Definition: SDXNode.h:50
const std::string & filename() const
Returns the name of the file defining this node.
Definition: SDXNode.h:310
const SDXEnvironment * environment_
Object specifying the environment of this node.
Definition: SDXNode.h:252
virtual const Rendering::ObjectRef & renderingObject() const
Returns the associated rendering object.
This class implements the base class for all sdx scene object providing access to all elements of a s...
Definition: SDXScene.h:39
virtual void initialize(const Timestamp timestamp)
Event function to inform the scene that it has been initialized and can apply all internal values to ...
virtual void registerGlobalLight(const Rendering::LightSourceRef &lightSource)
Registers a global light source to this scene.
const SDXEnvironment * environment() const
Returns the environment object of this scene.
Definition: SDXScene.h:129
virtual void unregisterGlobalLight(const Rendering::LightSourceRef &lightSource)
Unregisters a global light source from this scene.
virtual void onInitialize(const Timestamp timestamp)
Internal event function to inform the scene that it has been initialized and can apply all internal v...
Rendering::SceneRef renderingScene() const
Returns the associated scene rendering object.
Definition: SDXScene.h:124
void onInitialize(const Rendering::SceneRef &scene, const Timestamp timestamp) override
Internal event function to inform the node that it has been initialized and can apply all internal va...
void initialize(const Rendering::SceneRef &scene, const Timestamp timestamp, const bool reinitialize=false) override
Event function to inform the node that it has been initialized and can apply all internal values to c...
SDXScene(const std::string &filename, const Library &library, const Rendering::EngineRef &engine)
Creates a new scene object.
const std::string & filename() const
Returns the name of the file defining this node.
Definition: SDXScene.h:119
SDXEnvironment sceneEnvironment_
Scene environment object.
Definition: SDXScene.h:116
This class implements the base class for all scene objects providing access to all elements of a scen...
Definition: scenedescription/Scene.h:36
This class implements a timestamp.
Definition: Timestamp.h:36
SmartObjectRef< Scene > SceneRef
Definition of a smart object reference holding a scene node.
Definition: rendering/Scene.h:22
SmartObjectRef< SDXScene, Node > SDXSceneRef
Definition of a smart object reference for scene desciption X scenes.
Definition: SDXScene.h:22
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15