forked from florianblume/Qt3D-OffscreenRenderer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
offscreenengine.cpp
29 lines (25 loc) · 1.09 KB
/
offscreenengine.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "offscreenengine.h"
OffscreenEngine::OffscreenEngine(Qt3DRender::QCamera *camera, const QSize &size) {
aspectEngine = new Qt3DCore::QAspectEngine();
renderAspect = new Qt3DRender::QRenderAspect();
logicAspect = new Qt3DLogic::QLogicAspect();
aspectEngine->registerAspect(renderAspect);
aspectEngine->registerAspect(logicAspect);
root.reset(new Qt3DCore::QEntity());
renderSettings = new Qt3DRender::QRenderSettings(root.data());
root->addComponent(renderSettings);
offscreenFrameGraph = new OffscreenSurfaceFrameGraph(renderSettings, camera, size);
renderSettings->setActiveFrameGraph(offscreenFrameGraph);
renderCapture = new Qt3DRender::QRenderCapture(offscreenFrameGraph->getLastNode());
aspectEngine->setRootEntity(root);
}
void OffscreenEngine::setSceneRoot(Qt3DCore::QNode *sceneRoot) {
this->sceneRoot = sceneRoot;
sceneRoot->setParent(root.data());
}
Qt3DRender::QRenderCapture* OffscreenEngine::getRenderCapture() {
return renderCapture;
}
void OffscreenEngine::setSize(const QSize &size) {
offscreenFrameGraph->setSize(size);
}