mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:28:03 +02:00
Add jsdoc to Camera
This commit is contained in:
parent
5629db9109
commit
ec86b82079
1 changed files with 47 additions and 10 deletions
|
@ -35,9 +35,22 @@ __attribute__((unused))
|
||||||
#endif
|
#endif
|
||||||
static int cameraModeId = qRegisterMetaType<CameraMode>();
|
static int cameraModeId = qRegisterMetaType<CameraMode>();
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* @global
|
||||||
|
*/
|
||||||
class Camera : public QObject {
|
class Camera : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* @namespace Camera
|
||||||
|
* @property position {Vec3} The position of the camera.
|
||||||
|
* @property orientation {Quat} The orientation of the camera.
|
||||||
|
* @property mode {string} The current camera mode.
|
||||||
|
* @property cameraEntity {EntityID} The position and rotation properties of
|
||||||
|
* the entity specified by this ID are then used as the camera's position and
|
||||||
|
* orientation. Only works when <code>mode</code> is "entity".
|
||||||
|
* @property frustum {Object} The frustum of the camera.
|
||||||
|
*/
|
||||||
Q_PROPERTY(glm::vec3 position READ getPosition WRITE setPosition)
|
Q_PROPERTY(glm::vec3 position READ getPosition WRITE setPosition)
|
||||||
Q_PROPERTY(glm::quat orientation READ getOrientation WRITE setOrientation)
|
Q_PROPERTY(glm::quat orientation READ getOrientation WRITE setOrientation)
|
||||||
Q_PROPERTY(QString mode READ getModeString WRITE setModeString)
|
Q_PROPERTY(QString mode READ getModeString WRITE setModeString)
|
||||||
|
@ -47,13 +60,13 @@ class Camera : public QObject {
|
||||||
public:
|
public:
|
||||||
Camera();
|
Camera();
|
||||||
|
|
||||||
void initialize(); // instantly put the camera at the ideal position and orientation.
|
void initialize(); // instantly put the camera at the ideal position and orientation.
|
||||||
|
|
||||||
void update( float deltaTime );
|
void update( float deltaTime );
|
||||||
|
|
||||||
CameraMode getMode() const { return _mode; }
|
CameraMode getMode() const { return _mode; }
|
||||||
void setMode(CameraMode m);
|
void setMode(CameraMode m);
|
||||||
|
|
||||||
void loadViewFrustum(ViewFrustum& frustum) const;
|
void loadViewFrustum(ViewFrustum& frustum) const;
|
||||||
ViewFrustum toViewFrustum() const;
|
ViewFrustum toViewFrustum() const;
|
||||||
|
|
||||||
|
@ -80,20 +93,44 @@ public slots:
|
||||||
QUuid getCameraEntity() const;
|
QUuid getCameraEntity() const;
|
||||||
void setCameraEntity(QUuid entityID);
|
void setCameraEntity(QUuid entityID);
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Compute a {PickRay} based on the current camera configuration and the position x,y on the screen.
|
||||||
|
* @function Camera.computePickRay
|
||||||
|
* @param {float} x
|
||||||
|
* @param {float} y
|
||||||
|
* @return {PickRay}
|
||||||
|
*/
|
||||||
PickRay computePickRay(float x, float y);
|
PickRay computePickRay(float x, float y);
|
||||||
|
|
||||||
// These only work on independent cameras
|
/**jsdoc
|
||||||
/// one time change to what the camera is looking at
|
* Set the camera to look at position <code>position</code>. Only works while in <code>independent</code>.
|
||||||
void lookAt(const glm::vec3& value);
|
* camera mode.
|
||||||
|
* @function Camera.lookAt
|
||||||
|
* @param {Vec3} position position to look at
|
||||||
|
*/
|
||||||
|
void lookAt(const glm::vec3& position);
|
||||||
|
|
||||||
/// fix what the camera is looking at, and keep the camera looking at this even if position changes
|
/**jsdoc
|
||||||
void keepLookingAt(const glm::vec3& value);
|
* Set the camera to continue looking at position <code>position</code>.
|
||||||
|
* Only works while in `independent` camera mode.
|
||||||
|
* @function Camera.keepLookingAt
|
||||||
|
* @param {Vec3} position position to look at
|
||||||
|
*/
|
||||||
|
void keepLookingAt(const glm::vec3& position);
|
||||||
|
|
||||||
/// stops the keep looking at feature, doesn't change what's being looked at, but will stop camera from
|
/**jsdoc
|
||||||
/// continuing to update it's orientation to keep looking at the item
|
* Stops the camera from continually looking at a position that was set with
|
||||||
|
* `keepLookingAt`
|
||||||
|
* @function Camera.stopLookingAt
|
||||||
|
*/
|
||||||
void stopLooking() { _isKeepLookingAt = false; }
|
void stopLooking() { _isKeepLookingAt = false; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
/**jsdoc
|
||||||
|
* Triggered when camera mode has changed.
|
||||||
|
* @function Camera.modeUpdated
|
||||||
|
* @return {Signal}
|
||||||
|
*/
|
||||||
void modeUpdated(const QString& newMode);
|
void modeUpdated(const QString& newMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue