It's working!

This commit is contained in:
Zach Fox 2017-06-29 09:58:37 -07:00
parent 8d89ea75f5
commit 5ceb80b3e7

View file

@ -57,19 +57,8 @@ public:
void configure(const Config& config) {
if (config.enabled || config.alwaysEnabled) {
_attachedEntityId = config.attachedEntityId;
if (_attachedEntityId != QUuid()) {
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
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;
}
_position = config.position;
_orientation = config.orientation;
_vFoV = config.vFoV;
_nearClipPlaneDistance = config.nearClipPlaneDistance;
_farClipPlaneDistance = config.farClipPlaneDistance;
@ -97,8 +86,19 @@ public:
});
auto srcViewFrustum = args->getViewFrustum();
srcViewFrustum.setPosition(_position);
srcViewFrustum.setOrientation(_orientation);
if (_attachedEntityId != QUuid()) {
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));
// 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.