@@ -47,8 +47,8 @@ class sdf::World::Implementation
4747 // / \return Errors, if any.
4848 public: Errors LoadSphericalCoordinates (sdf::ElementPtr _elem);
4949
50- // / \brief Optional atmosphere model.
51- public: std::optional< sdf::Atmosphere> atmosphere;
50+ // / \brief Required atmosphere model.
51+ public: sdf::Atmosphere atmosphere;
5252
5353 // / \brief Audio device name
5454 public: std::string audioDevice = " default" ;
@@ -60,8 +60,8 @@ class sdf::World::Implementation
6060 // / \brief Optional Gui parameters.
6161 public: std::optional<sdf::Gui> gui;
6262
63- // / \brief Optional Scene parameters.
64- public: std::optional< sdf::Scene> scene;
63+ // / \brief Required scene parameters.
64+ public: sdf::Scene scene;
6565
6666 // / \brief The frames specified in this world.
6767 public: std::vector<Frame> frames;
@@ -180,9 +180,8 @@ Errors World::Load(sdf::ElementPtr _sdf, const ParserConfig &_config)
180180 // Read the atmosphere element
181181 if (_sdf->HasElement (" atmosphere" ))
182182 {
183- this ->dataPtr ->atmosphere .emplace ();
184183 Errors atmosphereLoadErrors =
185- this ->dataPtr ->atmosphere -> Load (_sdf->GetElement (" atmosphere" ));
184+ this ->dataPtr ->atmosphere . Load (_sdf->GetElement (" atmosphere" ));
186185 errors.insert (errors.end (), atmosphereLoadErrors.begin (),
187186 atmosphereLoadErrors.end ());
188187 }
@@ -314,9 +313,8 @@ Errors World::Load(sdf::ElementPtr _sdf, const ParserConfig &_config)
314313 // Load the Scene
315314 if (_sdf->HasElement (" scene" ))
316315 {
317- this ->dataPtr ->scene .emplace ();
318316 Errors sceneLoadErrors =
319- this ->dataPtr ->scene -> Load (_sdf->GetElement (" scene" ), _config);
317+ this ->dataPtr ->scene . Load (_sdf->GetElement (" scene" ), _config);
320318 errors.insert (errors.end (), sceneLoadErrors.begin (), sceneLoadErrors.end ());
321319 }
322320
@@ -459,7 +457,7 @@ Model *World::ModelByName(const std::string &_name)
459457// ///////////////////////////////////////////////
460458const sdf::Atmosphere *World::Atmosphere () const
461459{
462- return optionalToPointer (this ->dataPtr ->atmosphere );
460+ return & (this ->dataPtr ->atmosphere );
463461}
464462
465463// ///////////////////////////////////////////////
@@ -497,7 +495,7 @@ void World::SetGui(const sdf::Gui &_gui)
497495// ///////////////////////////////////////////////
498496const sdf::Scene *World::Scene () const
499497{
500- return optionalToPointer (this ->dataPtr ->scene );
498+ return & (this ->dataPtr ->scene );
501499}
502500
503501// ///////////////////////////////////////////////
@@ -1033,16 +1031,14 @@ sdf::ElementPtr World::ToElement(const OutputConfig &_config) const
10331031 }
10341032
10351033 // Atmosphere
1036- if (this ->dataPtr ->atmosphere )
1037- elem->InsertElement (this ->dataPtr ->atmosphere ->ToElement (), true );
1034+ elem->InsertElement (this ->dataPtr ->atmosphere .ToElement (), true );
10381035
10391036 // Gui
10401037 if (this ->dataPtr ->gui )
10411038 elem->InsertElement (this ->dataPtr ->gui ->ToElement (), true );
10421039
10431040 // Scene
1044- if (this ->dataPtr ->scene )
1045- elem->InsertElement (this ->dataPtr ->scene ->ToElement (), true );
1041+ elem->InsertElement (this ->dataPtr ->scene .ToElement (), true );
10461042
10471043 // Audio
10481044 if (this ->dataPtr ->audioDevice != " default" )
0 commit comments