summaryrefslogtreecommitdiffstats
path: root/src/render/jobs
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2016-01-20 16:33:53 +0100
committerPaul Lemire <paul.lemire@kdab.com>2016-01-22 14:29:34 +0000
commit86177b98e27a9d376e35039454986ff7de8f3104 (patch)
tree6ac256365641f538128666917f0b5090d873320a /src/render/jobs
parent31e4d157c6b0af0c04546af643707a3811583455 (diff)
QAspectEngine/QAbstractAspects: get rid of setData
Getting rid of set data and the refactoring on setting the surface implies that: - Given the FrameGraph configuration, there may be several RenderViews each having a different RenderSurfaceSelector/Window - This means that the Renderer/QRenderAspect can't know about the surface before reading the scene - This means that the Renderer may be dealing with more than 1 window - This means that initialization, render and shutdown procedures will have to be updated accordingly Therefore the Renderer was refactored to: - Be initialized without knowing about a surface - For each RenderView, check the surface and if different from the previous one: * Make the context current with it * Create the appropriate glHelpers (as Surfaces may have != formats) TO DO: - Fix picking - Fix windows exposition - Fix shutdown / detection of all windows beging closed Change-Id: I49d070b05f46be4b26cfb57e494feba145d1da9c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/render/jobs')
-rw-r--r--src/render/jobs/pickboundingvolumejob.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/render/jobs/pickboundingvolumejob.cpp b/src/render/jobs/pickboundingvolumejob.cpp
index 344d83bff..b0d0ab865 100644
--- a/src/render/jobs/pickboundingvolumejob.cpp
+++ b/src/render/jobs/pickboundingvolumejob.cpp
@@ -394,17 +394,18 @@ void PickBoundingVolumeJob::viewMatrixForCamera(const Qt3DCore::QNodeId &cameraI
QRect PickBoundingVolumeJob::windowViewport(const QRectF &relativeViewport) const
{
- // TO DO: find another way to retrieve the size since this won't work with Scene3D
- const QSize s = m_renderer->surfaceSize();
- if (s.isValid()) {
- const int surfaceWidth = s.width();
- const int surfaceHeight = s.height();
- return QRect(relativeViewport.x() * surfaceWidth,
- (1.0 - relativeViewport.y() - relativeViewport.height()) * surfaceHeight,
- relativeViewport.width() * surfaceWidth,
- relativeViewport.height() * surfaceHeight);
- }
- return relativeViewport.toRect();
+ // // TO DO: find another way to retrieve the size since this won't work with Scene3D
+ // const QSurface *s = m_renderer->surface();
+ // if (s) {
+ // const int surfaceWidth = s->size().width();
+ // const int surfaceHeight = s->size().height();
+ // return QRect(relativeViewport.x() * surfaceWidth,
+ // (1.0 - relativeViewport.y() - relativeViewport.height()) * surfaceHeight,
+ // relativeViewport.width() * surfaceWidth,
+ // relativeViewport.height() * surfaceHeight);
+ // }
+ // return relativeViewport.toRect();
+ return QRect();
}
@@ -419,10 +420,11 @@ QVector<Qt3DCore::QNodeId> PickBoundingVolumeJob::sphereHitsForViewportAndCamera
viewMatrixForCamera(cameraId, viewMatrix, projectionMatrix);
const QRect viewport = windowViewport(relativeViewport);
- const QSize s = m_renderer->surfaceSize();
+ // const QSurface *s = m_renderer->surface();
// TO DO: find another way to retrieve the size since this won't work with Scene3D
// In GL the y is inverted compared to Qt
- const QPoint glCorrectPos = s.isValid() ? QPoint(pos.x(), s.height() - pos.y()) : pos;
+ // const QPoint glCorrectPos = s ? QPoint(pos.x(), s->size().height() - pos.y()) : pos;
+ const QPoint glCorrectPos = pos;
const Qt3DCore::QRay3D ray = intersectionRay(glCorrectPos, viewMatrix, projectionMatrix, viewport);
const QQueryHandle rayCastingHandle = rayCasting->query(ray, QAbstractCollisionQueryService::AllHits, volumeProvider);
const QCollisionQueryResult queryResult = rayCasting->fetchResult(rayCastingHandle);
@@ -440,10 +442,11 @@ QVector<Qt3DCore::QNodeId> PickBoundingVolumeJob::triangleHitsForViewportAndCame
viewMatrixForCamera(cameraId, viewMatrix, projectionMatrix);
const QRect viewport = windowViewport(relativeViewport);
- const QSize s = m_renderer->surfaceSize();
+ // const QSurface *s = m_renderer->surface();
// TO DO: find another way to retrieve the size since this won't work with Scene3D
// In GL the y is inverted compared to Qt
- const QPoint glCorrectPos = s.isValid() ? QPoint(pos.x(), s.height() - pos.y()) : pos;
+ // const QPoint glCorrectPos = s ? QPoint(pos.x(), s->size().height() - pos.y()) : pos;
+ const QPoint glCorrectPos = pos;
const Qt3DCore::QRay3D ray = intersectionRay(glCorrectPos, viewMatrix, projectionMatrix, viewport);
// Note: improve this further to only compute this once and not every time
@@ -451,8 +454,8 @@ QVector<Qt3DCore::QNodeId> PickBoundingVolumeJob::triangleHitsForViewportAndCame
m_manager);
const QQueryHandle rayCastingHandle = rayCasting->query(ray,
- QAbstractCollisionQueryService::AllHits,
- &boundingVolumeProvider);
+ QAbstractCollisionQueryService::AllHits,
+ &boundingVolumeProvider);
const QCollisionQueryResult queryResult = rayCasting->fetchResult(rayCastingHandle);
return queryResult.entitiesHit();
}