Ocean
GLESEngine.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_RENDERING_GLES_ENGINE_H
9 #define META_OCEAN_RENDERING_GLES_ENGINE_H
10 
13 
14 #include "ocean/rendering/Engine.h"
15 
16 namespace Ocean
17 {
18 
19 namespace Rendering
20 {
21 
22 namespace GLESceneGraph
23 {
24 
25 /**
26  * This class is the base class for all GLESceneGraph engines.
27  * @ingroup renderinggles
28  */
29 class OCEAN_RENDERING_GLES_EXPORT GLESEngine : public Engine
30 {
31  public:
32 
33  /**
34  * Unregisters this engine at the global engine manager.
35  * Do not unregister this engine if using it as plugin, because it's done by the plugin itself when the plugin is unloaded.<br>
36  * Beware: This registration must not be done more than once and must not be done without previous registration!<br>
37  * @return True, if succeeded
38  */
39  static bool unregisterEngine();
40 
41  protected:
42 
43  /**
44  * Creates a new rendering engine.
45  * @param graphicAPI Preferred graphic API to use by the engine
46  */
47  GLESEngine(const GraphicAPI graphicAPI);
48 
49  /**
50  * Destructs a rendering engine.
51  */
52  ~GLESEngine() override;
53 
54  /**
55  * Returns the factory of this rendering engine.
56  * @see Engine::factory().
57  */
58  const Factory& factory() const override;
59 
60  /**
61  * Returns the specific type of this engine.
62  * @see Engine::engineId().
63  */
64  const std::string& engineName() const override;
65 
66  /**
67  * Returns the engine's graphic API.
68  * @return The graphic API
69  */
70  static constexpr GraphicAPI glesGraphicAPI();
71 
72  private:
73 
74  /// GLESceneGraph object factory.
76 
77  /// Name of this engine.
78  std::string localName_;
79 };
80 
82 {
83 #ifdef OCEAN_PLATFORM_BUILD_MOBILE
84 
85  // on mobile platforms, we use OpenGLES
86  return API_OPENGLES;
87 
88 #else
89 
90  // on desktop platforms, we use OpenGL
91  return API_OPENGL;
92 
93 #endif
94 }
95 
96 }
97 
98 }
99 
100 }
101 
102 #endif // META_OCEAN_RENDERING_GLES_ENGINE_H
This class is the base class for all rendering engines like.
Definition: Engine.h:46
GraphicAPI
Definition of different graphic APIs.
Definition: Engine.h:57
@ API_OPENGLES
OpenGL ES graphic api id.
Definition: Engine.h:63
@ API_OPENGL
OpenGL graphic api id.
Definition: Engine.h:61
This class implements a node and object factory.
Definition: rendering/Factory.h:30
This class is the base class for all GLESceneGraph engines.
Definition: GLESEngine.h:30
GLESEngine(const GraphicAPI graphicAPI)
Creates a new rendering engine.
GLESFactory factory_
GLESceneGraph object factory.
Definition: GLESEngine.h:75
const Factory & factory() const override
Returns the factory of this rendering engine.
std::string localName_
Name of this engine.
Definition: GLESEngine.h:78
~GLESEngine() override
Destructs a rendering engine.
static bool unregisterEngine()
Unregisters this engine at the global engine manager.
const std::string & engineName() const override
Returns the specific type of this engine.
static constexpr GraphicAPI glesGraphicAPI()
Returns the engine's graphic API.
Definition: GLESEngine.h:81
This class implements a class factory for all GLESceneGraph objects.
Definition: GLESFactory.h:30
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15