mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:23:33 +02:00
It's working!
This commit is contained in:
parent
8d89ea75f5
commit
5ceb80b3e7
1 changed files with 15 additions and 15 deletions
|
@ -57,19 +57,8 @@ public:
|
||||||
void configure(const Config& config) {
|
void configure(const Config& config) {
|
||||||
if (config.enabled || config.alwaysEnabled) {
|
if (config.enabled || config.alwaysEnabled) {
|
||||||
_attachedEntityId = config.attachedEntityId;
|
_attachedEntityId = config.attachedEntityId;
|
||||||
if (_attachedEntityId != QUuid()) {
|
_position = config.position;
|
||||||
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
|
_orientation = config.orientation;
|
||||||
EntityPropertyFlags entityPropertyFlags;
|
|
||||||
entityPropertyFlags += PROP_POSITION;
|
|
||||||
entityPropertyFlags += PROP_ROTATION;
|
|
||||||
EntityItemProperties entityProperties = entityScriptingInterface->getEntityProperties(config.attachedEntityId, entityPropertyFlags);
|
|
||||||
|
|
||||||
_position = entityProperties.getPosition();
|
|
||||||
_orientation = entityProperties.getRotation();
|
|
||||||
} else {
|
|
||||||
_position = config.position;
|
|
||||||
_orientation = config.orientation;
|
|
||||||
}
|
|
||||||
_vFoV = config.vFoV;
|
_vFoV = config.vFoV;
|
||||||
_nearClipPlaneDistance = config.nearClipPlaneDistance;
|
_nearClipPlaneDistance = config.nearClipPlaneDistance;
|
||||||
_farClipPlaneDistance = config.farClipPlaneDistance;
|
_farClipPlaneDistance = config.farClipPlaneDistance;
|
||||||
|
@ -97,8 +86,19 @@ public:
|
||||||
});
|
});
|
||||||
|
|
||||||
auto srcViewFrustum = args->getViewFrustum();
|
auto srcViewFrustum = args->getViewFrustum();
|
||||||
srcViewFrustum.setPosition(_position);
|
if (_attachedEntityId != QUuid()) {
|
||||||
srcViewFrustum.setOrientation(_orientation);
|
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
|
||||||
|
EntityPropertyFlags entityPropertyFlags;
|
||||||
|
entityPropertyFlags += PROP_POSITION;
|
||||||
|
entityPropertyFlags += PROP_ROTATION;
|
||||||
|
EntityItemProperties entityProperties = entityScriptingInterface->getEntityProperties(_attachedEntityId, entityPropertyFlags);
|
||||||
|
|
||||||
|
srcViewFrustum.setPosition(entityProperties.getPosition());
|
||||||
|
srcViewFrustum.setOrientation(entityProperties.getRotation());
|
||||||
|
} else {
|
||||||
|
srcViewFrustum.setPosition(_position);
|
||||||
|
srcViewFrustum.setOrientation(_orientation);
|
||||||
|
}
|
||||||
srcViewFrustum.setProjection(glm::perspective(glm::radians(_vFoV), ((float)args->_viewport.z / (float)args->_viewport.w), _nearClipPlaneDistance, _farClipPlaneDistance));
|
srcViewFrustum.setProjection(glm::perspective(glm::radians(_vFoV), ((float)args->_viewport.z / (float)args->_viewport.w), _nearClipPlaneDistance, _farClipPlaneDistance));
|
||||||
// Without calculating the bound planes, the secondary camera will use the same culling frustum as the main camera,
|
// Without calculating the bound planes, the secondary camera will use the same culling frustum as the main camera,
|
||||||
// which is not what we want here.
|
// which is not what we want here.
|
||||||
|
|
Loading…
Reference in a new issue