Ocean
OBJLibrary.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_SDL_OBJ_OBJ_LIBRARY_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDL_OBJ_OBJ_LIBRARY_H
10 
12 
15 
16 namespace Ocean
17 {
18 
19 namespace SceneDescription
20 {
21 
22 namespace SDL
23 {
24 
25 namespace OBJ
26 {
27 
28 /**
29  * This class implements the scene library for all obj file types.
30  * @ingroup scenedescriptionsdlobj
31  */
32 class OCEAN_SCENEDESCRIPTION_SDL_OBJ_EXPORT OBJLibrary : public Library
33 {
35 
36  public:
37 
38  /**
39  * Registers this library at the global scene description manager.
40  * With each register call, the reference counter for a specific library will be incremented.
41  * Each call to registerLibrary() needs to be balanced with a corresponding call of unregisterLibrary() before shutting down.
42  * @return True, if the library has not been registered before
43  * @see Manager, unregisterLibrary()
44  */
45  static bool registerLibrary();
46 
47  /**
48  * Unregisters this library at the global scene description manager.
49  * With each unregister call, the reference counter for a specific library will be decremented and removed from the system if the counter reaches zero.
50  * Each call to registerLibrary() needs to be balanced with a corresponding call of unregisterLibrary() before shutting down.
51  * @return True, if the library was actually removed from the system (as the reference counter reached zero); False, if the library is still used by someone else
52  * @see registerLibrary().
53  */
54  static bool unregisterLibrary();
55 
56  protected:
57 
58  /**
59  * Creates a new obj library.
60  */
62 
63  /**
64  * Destructs a obj library.
65  */
66  ~OBJLibrary() override;
67 
68  /**
69  * Creates this library and returns it an object reference.
70  * @return The new library object
71  */
72  static LibraryRef create();
73 
74  /**
75  * Loads a new scene by a given filename and returns a transient scene hierarchy which can be converted to a rendering scene graph afterwards.
76  * @see Library::loadTransient().
77  */
78  SceneRef loadTransient(const std::string& filename, const std::string& fileExtension, float* progress, bool* cancel) override;
79 };
80 
81 }
82 
83 }
84 
85 }
86 
87 }
88 
89 #endif // META_OCEAN_SCENEDESCRIPTION_SDL_OBJ_OBJ_LIBRARY_H
This template class implements a object reference with an internal reference counter.
Definition: base/ObjectRef.h:58
This class is the base class for all scene description libraries.
Definition: scenedescription/Library.h:37
This class implements the manager for all scene descriptions.
Definition: scenedescription/Manager.h:101
This class implements the scene library for all obj file types.
Definition: OBJLibrary.h:33
static bool registerLibrary()
Registers this library at the global scene description manager.
OBJLibrary()
Creates a new obj library.
~OBJLibrary() override
Destructs a obj library.
static LibraryRef create()
Creates this library and returns it an object reference.
SceneRef loadTransient(const std::string &filename, const std::string &fileExtension, float *progress, bool *cancel) override
Loads a new scene by a given filename and returns a transient scene hierarchy which can be converted ...
static bool unregisterLibrary()
Unregisters this library at the global scene description manager.
This template class implements a smart object reference which is a specialization of an ObjectRef obj...
Definition: SmartObjectRef.h:90
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15