mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Emit qDebug() error when trying to change position or orientation while attachedEntityId is defined
This commit is contained in:
parent
9bd80ec2bf
commit
36dfff78e2
3 changed files with 33 additions and 5 deletions
|
@ -80,7 +80,7 @@ public:
|
||||||
});
|
});
|
||||||
|
|
||||||
auto srcViewFrustum = args->getViewFrustum();
|
auto srcViewFrustum = args->getViewFrustum();
|
||||||
if (_attachedEntityId != QUuid()) {
|
if (!_attachedEntityId.isNull()) {
|
||||||
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(_attachedEntityId, _attachedEntityPropertyFlags);
|
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(_attachedEntityId, _attachedEntityPropertyFlags);
|
||||||
srcViewFrustum.setPosition(entityProperties.getPosition());
|
srcViewFrustum.setPosition(entityProperties.getPosition());
|
||||||
srcViewFrustum.setOrientation(entityProperties.getRotation());
|
srcViewFrustum.setOrientation(entityProperties.getRotation());
|
||||||
|
@ -102,6 +102,24 @@ protected:
|
||||||
RenderArgsPointer _cachedArgsPointer;
|
RenderArgsPointer _cachedArgsPointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void SecondaryCameraJobConfig::setPosition(glm::vec3 pos) {
|
||||||
|
if (attachedEntityId.isNull()) {
|
||||||
|
position = pos;
|
||||||
|
emit dirty();
|
||||||
|
} else {
|
||||||
|
qDebug() << "ERROR: Cannot set position of SecondaryCamera while attachedEntityId is set.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecondaryCameraJobConfig::setOrientation(glm::quat orient) {
|
||||||
|
if (attachedEntityId.isNull()) {
|
||||||
|
orientation = orient;
|
||||||
|
emit dirty();
|
||||||
|
} else {
|
||||||
|
qDebug() << "ERROR: Cannot set orientation of SecondaryCamera while attachedEntityId is set.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SecondaryCameraJobConfig::enableSecondaryCameraRenderConfigs(bool enabled) {
|
void SecondaryCameraJobConfig::enableSecondaryCameraRenderConfigs(bool enabled) {
|
||||||
qApp->getRenderEngine()->getConfiguration()->getConfig<SecondaryCameraRenderTask>()->setEnabled(enabled);
|
qApp->getRenderEngine()->getConfiguration()->getConfig<SecondaryCameraRenderTask>()->setEnabled(enabled);
|
||||||
setEnabled(enabled);
|
setEnabled(enabled);
|
||||||
|
|
|
@ -31,8 +31,8 @@ public:
|
||||||
class SecondaryCameraJobConfig : public render::Task::Config { // Exposes secondary camera parameters to JavaScript.
|
class SecondaryCameraJobConfig : public render::Task::Config { // Exposes secondary camera parameters to JavaScript.
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QUuid attachedEntityId MEMBER attachedEntityId NOTIFY dirty) // entity whose properties define camera position and orientation
|
Q_PROPERTY(QUuid attachedEntityId MEMBER attachedEntityId NOTIFY dirty) // entity whose properties define camera position and orientation
|
||||||
Q_PROPERTY(glm::vec3 position MEMBER position NOTIFY dirty) // of viewpoint to render from
|
Q_PROPERTY(glm::vec3 position READ getPosition WRITE setPosition) // of viewpoint to render from
|
||||||
Q_PROPERTY(glm::quat orientation MEMBER orientation NOTIFY dirty) // of viewpoint to render from
|
Q_PROPERTY(glm::quat orientation READ getOrientation WRITE setOrientation) // of viewpoint to render from
|
||||||
Q_PROPERTY(float vFoV MEMBER vFoV NOTIFY dirty) // Secondary camera's vertical field of view. In degrees.
|
Q_PROPERTY(float vFoV MEMBER vFoV NOTIFY dirty) // Secondary camera's vertical field of view. In degrees.
|
||||||
Q_PROPERTY(float nearClipPlaneDistance MEMBER nearClipPlaneDistance NOTIFY dirty) // Secondary camera's near clip plane distance. In meters.
|
Q_PROPERTY(float nearClipPlaneDistance MEMBER nearClipPlaneDistance NOTIFY dirty) // Secondary camera's near clip plane distance. In meters.
|
||||||
Q_PROPERTY(float farClipPlaneDistance MEMBER farClipPlaneDistance NOTIFY dirty) // Secondary camera's far clip plane distance. In meters.
|
Q_PROPERTY(float farClipPlaneDistance MEMBER farClipPlaneDistance NOTIFY dirty) // Secondary camera's far clip plane distance. In meters.
|
||||||
|
@ -47,6 +47,10 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void dirty();
|
void dirty();
|
||||||
public slots:
|
public slots:
|
||||||
|
glm::vec3 getPosition() { return position; }
|
||||||
|
void setPosition(glm::vec3 pos);
|
||||||
|
glm::quat getOrientation() { return orientation; }
|
||||||
|
void setOrientation(glm::quat orient);
|
||||||
void enableSecondaryCameraRenderConfigs(bool enabled);
|
void enableSecondaryCameraRenderConfigs(bool enabled);
|
||||||
void resetSizeSpectatorCamera(int width, int height);
|
void resetSizeSpectatorCamera(int width, int height);
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,8 +36,14 @@
|
||||||
//
|
//
|
||||||
// Relevant Variables:
|
// Relevant Variables:
|
||||||
// -spectatorCameraConfig: The render configuration of the spectator camera
|
// -spectatorCameraConfig: The render configuration of the spectator camera
|
||||||
// render job. It controls the orientation and position of the secondary camera whose viewport is rendered to
|
// render job. It controls various attributes of the Secondary Camera, such as:
|
||||||
// the texture, as well as the rendered texture size.
|
// -The entity ID to follow
|
||||||
|
// -Position
|
||||||
|
// -Orientation
|
||||||
|
// -Rendered texture size
|
||||||
|
// -Vertical field of view
|
||||||
|
// -Near clip plane distance
|
||||||
|
// -Far clip plane distance
|
||||||
// -viewFinderOverlay: The in-world overlay that displays the spectator camera's view.
|
// -viewFinderOverlay: The in-world overlay that displays the spectator camera's view.
|
||||||
// -camera: The in-world entity that corresponds to the spectator camera.
|
// -camera: The in-world entity that corresponds to the spectator camera.
|
||||||
// -cameraIsDynamic: "false" for now while we figure out why dynamic, parented overlays
|
// -cameraIsDynamic: "false" for now while we figure out why dynamic, parented overlays
|
||||||
|
|
Loading…
Reference in a new issue