Showing the changes to libraries/script-engine/src/SceneScriptingInterface.h (1 of 1 file). Show all
Unified · Split
| @@ -19,6 +19,13 @@ · 18 unmodified lines | |||
| 19 | 19 | ||
| 20 | // TODO: if QT moc ever supports nested classes, subclass these to the interface instead of namespacing | 20 | // TODO: if QT moc ever supports nested classes, subclass these to the interface instead of namespacing |
| 21 | namespace SceneScripting { | 21 | namespace SceneScripting { |
| 22 | |||
| 23 | /**jsdoc | ||
| 24 | * @typedef Scene.Stage.Location | ||
| 25 | * @property {number} longitude | ||
| 26 | * @property {number} latitude | ||
| 27 | * @property {number} altitude | ||
| 28 | */ | ||
| 22 | class Location : public QObject { | 29 | class Location : public QObject { |
| 23 | Q_OBJECT | 30 | Q_OBJECT |
| 24 | 31 | ||
| @@ -41,6 +48,11 @@ namespace SceneScripting { · 16 unmodified lines | |||
| 41 | }; | 48 | }; |
| 42 | using LocationPointer = std::unique_ptr<Location>; | 49 | using LocationPointer = std::unique_ptr<Location>; |
| 43 | 50 | ||
| 51 | /**jsdoc | ||
| 52 | * @typedef Scene.Stage.Time | ||
| 53 | * @property {number} hour | ||
| 54 | * @property {number} day | ||
| 55 | */ | ||
| 44 | class Time : public QObject { | 56 | class Time : public QObject { |
| 45 | Q_OBJECT | 57 | Q_OBJECT |
| 46 | 58 | ||
| @@ -60,6 +72,13 @@ namespace SceneScripting { · 13 unmodified lines | |||
| 60 | }; | 72 | }; |
| 61 | using TimePointer = std::unique_ptr<Time>; | 73 | using TimePointer = std::unique_ptr<Time>; |
| 62 | 74 | ||
| 75 | /**jsdoc | ||
| 76 | * @typedef Scene.Stage.KeyLight | ||
| 77 | * @property {Vec3} color | ||
| 78 | * @property {number} intensity | ||
| 79 | * @property {number} ambientIntensity | ||
| 80 | * @property {Vec3} direction | ||
| 81 | */ | ||
| 63 | class KeyLight : public QObject { | 82 | class KeyLight : public QObject { |
| 64 | Q_OBJECT | 83 | Q_OBJECT |
| 65 | 84 | ||
| @@ -91,6 +110,14 @@ namespace SceneScripting { · 25 unmodified lines | |||
| 91 | }; | 110 | }; |
| 92 | using KeyLightPointer = std::unique_ptr<KeyLight>; | 111 | using KeyLightPointer = std::unique_ptr<KeyLight>; |
| 93 | 112 | ||
| 113 | /**jsdoc | ||
| 114 | * @class Scene.Stage | ||
| 115 | * @property {string} backgroundMode | ||
| 116 | * @property {Scene.Stage.KeyLight} keyLight | ||
| 117 | * @property {Scene.Stage.Location} location | ||
| 118 | * @property {boolean} sunModel | ||
| 119 | * @property {Scene.Stage.Time} time | ||
| 120 | */ | ||
| 94 | class Stage : public QObject { | 121 | class Stage : public QObject { |
| 95 | Q_OBJECT | 122 | Q_OBJECT |
| 96 | 123 | ||
| @@ -99,10 +126,22 @@ namespace SceneScripting { · 2 unmodified lines | |||
| 99 | : _skyStage{ skyStage }, | 126 | : _skyStage{ skyStage }, |
| 100 | _location{ new Location{ skyStage } }, _time{ new Time{ skyStage } }, _keyLight{ new KeyLight{ skyStage } }{} | 127 | _location{ new Location{ skyStage } }, _time{ new Time{ skyStage } }, _keyLight{ new KeyLight{ skyStage } }{} |
| 101 | 128 | ||
| 129 | /**jsdoc | ||
| 130 | * @function Scene.Stage.setOrientation | ||
| 131 | * @param {Quat} orientation | ||
| 132 | */ | ||
| 102 | Q_INVOKABLE void setOrientation(const glm::quat& orientation) const; | 133 | Q_INVOKABLE void setOrientation(const glm::quat& orientation) const; |
| 103 | 134 | ||
| 104 | Q_PROPERTY(Location* location READ getLocation) | 135 | Q_PROPERTY(Location* location READ getLocation) |
| 136 | |||
| 105 | Location* getLocation() const { return _location.get(); } | 137 | Location* getLocation() const { return _location.get(); } |
| 138 | |||
| 139 | /**jsdoc | ||
| 140 | * @function Scene.Stage.setLocation | ||
| 141 | * @param {number} longitude | ||
| 142 | * @param {number} latitude | ||
| 143 | * @param {number} altitude | ||
| 144 | */ | ||
| 106 | Q_INVOKABLE void setLocation(float longitude, float latitude, float altitude); | 145 | Q_INVOKABLE void setLocation(float longitude, float latitude, float altitude); |
| 107 | 146 | ||
| 108 | Q_PROPERTY(Time* time READ getTime) | 147 | Q_PROPERTY(Time* time READ getTime) |
| @@ -130,10 +169,15 @@ namespace SceneScripting { · 21 unmodified lines | |||
| 130 | using StagePointer = std::unique_ptr<Stage>; | 169 | using StagePointer = std::unique_ptr<Stage>; |
| 131 | }; | 170 | }; |
| 132 | 171 | ||
| 172 | /**jsdoc | ||
| 173 | * @namespace Scene | ||
| 174 | * @property {boolean} shouldRenderAvatars | ||
| 175 | * @property {boolean} shouldRenderEntities | ||
| 176 | * @property {Scene.Stage} stage | ||
| 177 | */ | ||
| 133 | class SceneScriptingInterface : public QObject, public Dependency { | 178 | class SceneScriptingInterface : public QObject, public Dependency { |
| 134 | Q_OBJECT | 179 | Q_OBJECT |
| 135 | SINGLETON_DEPENDENCY | 180 | SINGLETON_DEPENDENCY |
| 136 | |||
| 137 | 181 | ||
| 138 | public: | 182 | public: |
| 139 | Q_PROPERTY(bool shouldRenderAvatars READ shouldRenderAvatars WRITE setShouldRenderAvatars) | 183 | Q_PROPERTY(bool shouldRenderAvatars READ shouldRenderAvatars WRITE setShouldRenderAvatars) |
| @@ -149,7 +193,19 @@ public: · 9 unmodified lines | |||
| 149 | graphics::SunSkyStagePointer getSkyStage() const; | 193 | graphics::SunSkyStagePointer getSkyStage() const; |
| 150 | 194 | ||
| 151 | signals: | 195 | signals: |
| 196 | |||
| 197 | /**jsdoc | ||
| 198 | * @function Scene.shouldRenderAvatarsChanged | ||
| 199 | * @param {boolean} shouldRenderAvatars | ||
| 200 | * @returns {Signal} | ||
| 201 | */ | ||
| 152 | void shouldRenderAvatarsChanged(bool shouldRenderAvatars); | 202 | void shouldRenderAvatarsChanged(bool shouldRenderAvatars); |
| 203 | |||
| 204 | /**jsdoc | ||
| 205 | * @function Scene.shouldRenderEntitiesChanged | ||
| 206 | * @param {boolean} shouldRenderEntities | ||
| 207 | * @returns {Signal} | ||
| 208 | */ | ||
| 153 | void shouldRenderEntitiesChanged(bool shouldRenderEntities); | 209 | void shouldRenderEntitiesChanged(bool shouldRenderEntities); |
| 154 | 210 | ||
| 155 | protected: | 211 | protected: |