mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:25:52 +02:00
Add frustum property to JavaScript Camera object
This commit is contained in:
parent
28cfca993f
commit
ce58edc4e0
2 changed files with 17 additions and 0 deletions
|
@ -182,3 +182,16 @@ ViewFrustum Camera::toViewFrustum() const {
|
||||||
loadViewFrustum(result);
|
loadViewFrustum(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap Camera::getViewFrustum() {
|
||||||
|
ViewFrustum frustum;
|
||||||
|
loadViewFrustum(frustum);
|
||||||
|
|
||||||
|
QVariantMap result;
|
||||||
|
result["position"].setValue(frustum.getPosition());
|
||||||
|
result["orientation"].setValue(frustum.getOrientation());
|
||||||
|
result["projection"].setValue(frustum.getProjection());
|
||||||
|
result["centerRadius"].setValue(frustum.getCenterRadius());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,8 @@ class Camera : public QObject {
|
||||||
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)
|
||||||
Q_PROPERTY(QUuid cameraEntity READ getCameraEntity WRITE setCameraEntity)
|
Q_PROPERTY(QUuid cameraEntity READ getCameraEntity WRITE setCameraEntity)
|
||||||
|
Q_PROPERTY(QVariantMap frustum READ getViewFrustum CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Camera();
|
Camera();
|
||||||
|
|
||||||
|
@ -63,6 +65,8 @@ public:
|
||||||
const glm::mat4& getProjection() const { return _projection; }
|
const glm::mat4& getProjection() const { return _projection; }
|
||||||
void setProjection(const glm::mat4& projection);
|
void setProjection(const glm::mat4& projection);
|
||||||
|
|
||||||
|
QVariantMap getViewFrustum();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
QString getModeString() const;
|
QString getModeString() const;
|
||||||
void setModeString(const QString& mode);
|
void setModeString(const QString& mode);
|
||||||
|
|
Loading…
Reference in a new issue