Ocean
JSRenderingEngine.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_INTERACTION_JS_RENDERING_ENGINE_H
9 #define META_OCEAN_INTERACTION_JS_RENDERING_ENGINE_H
10 
13 
14 namespace Ocean
15 {
16 
17 namespace Interaction
18 {
19 
20 namespace JavaScript
21 {
22 
23 /**
24  * This class implements a wrapper for a JavaScript RenderingEngine object.
25  * @ingroup interactionjs
26  */
27 class OCEAN_INTERACTION_JS_EXPORT JSRenderingEngine : public JSObject<JSRenderingEngine, Rendering::EngineRef>
28 {
29  friend class JSObject<JSRenderingEngine, Rendering::EngineRef>;
30  friend class JSLibrary;
31 
32  public:
33 
34  /**
35  * Definition of ids for individual accessors.
36  */
37  enum AccessorId : unsigned int
38  {
39  /// The accessor for the name property, a String value.
40  AI_NAME
41  };
42 
43  /**
44  * Definition of ids for individual functions.
45  */
46  enum FunctionId : unsigned int
47  {
48  /**
49  * Creates a new rendering object.
50  * <pre>
51  * RenderingObject = RenderingEngine.createObject()
52  * </pre>
53  */
55 
56  /**
57  * Returns the framebuffer rendering object.
58  * <pre>
59  * RenderingObject = RenderingEngine.framebuffer()
60  * </pre>
61  */
63 
64  /**
65  * Returns whether this rendering engine is valid.
66  * <pre>
67  * Boolean = RenderingEngine.isValid()
68  * </pre>
69  */
71 
72  /**
73  * Returns whether this rendering engine is invalid.
74  * <pre>
75  * Boolean = RenderingEngine.isInvalid()
76  * </pre>
77  */
79 
80  /**
81  * Finds any rendering object with specified name.
82  * <pre>
83  * RenderingObject = RenderingEngine.findObject(String)
84  * </pre>
85  */
87 
88  /**
89  * Finds all rendering objects with sepcified name.
90  * <pre>
91  * Array<RenderingObject> = RenderingEngine.findObjects(String)
92  * </pre>
93  */
95 
96  /**
97  * Returns the view rendering object.
98  * <pre>
99  * RenderingObject = RenderingEngine.view()
100  * </pre>
101  */
102  FI_VIEW
103  };
104 
105  public:
106 
107  /**
108  * Returns the JavaScript name of this object.
109  * @return The object's JavaScript name
110  */
111  static inline const char* objectName();
112 
113  protected:
114 
115  /**
116  * Creates the function template and object template for this object.
117  */
118  static void createFunctionTemplate();
119 };
120 
121 inline const char* JSRenderingEngine::objectName()
122 {
123  return "RenderingEngine";
124 }
125 
126 }
127 
128 }
129 
130 }
131 
132 #endif // META_OCEAN_INTERACTION_JS_RENDERING_ENGINE_H
This class implements the java script interaction library object.
Definition: JSLibrary.h:32
This class implements the base class for all native wrapper of JavaScript objects.
Definition: JSObject.h:31
This class implements a wrapper for a JavaScript RenderingEngine object.
Definition: JSRenderingEngine.h:28
static const char * objectName()
Returns the JavaScript name of this object.
Definition: JSRenderingEngine.h:121
FunctionId
Definition of ids for individual functions.
Definition: JSRenderingEngine.h:47
@ FI_IS_VALID
Returns whether this rendering engine is valid.
Definition: JSRenderingEngine.h:70
@ FI_FRAMEBUFFER
Returns the framebuffer rendering object.
Definition: JSRenderingEngine.h:62
@ FI_FIND_OBJECT
Finds any rendering object with specified name.
Definition: JSRenderingEngine.h:86
@ FI_FIND_OBJECTS
Finds all rendering objects with sepcified name.
Definition: JSRenderingEngine.h:94
@ FI_IS_INVALID
Returns whether this rendering engine is invalid.
Definition: JSRenderingEngine.h:78
@ FI_CREATE_OBJECT
Creates a new rendering object.
Definition: JSRenderingEngine.h:54
AccessorId
Definition of ids for individual accessors.
Definition: JSRenderingEngine.h:38
static void createFunctionTemplate()
Creates the function template and object template for this object.
Ocean::ObjectRef< Engine > EngineRef
Definition of an engine reference object.
Definition: Engine.h:24
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15