The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 3d8aea3d authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Cleaned up CampVisPainter to fully match the new API.

parent afa7bd28
......@@ -26,6 +26,7 @@
#include "tgt/assert.h"
#include "tgt/camera.h"
#include "tgt/glcontextmanager.h"
#include "tgt/quadric.h"
#include "tgt/shadermanager.h"
#include "tgt/texture.h"
......@@ -48,8 +49,7 @@ namespace campvis {
, _copyShader(nullptr)
, _errorTexture(nullptr)
{
tgtAssert(getCanvas() != 0, "The given canvas must not be 0!");
_dirty = true;
tgtAssert(getCanvas() != nullptr, "The given canvas must not be 0!");
setPipeline(pipeline);
}
......@@ -58,7 +58,7 @@ namespace campvis {
}
void CampVisPainter::paint() {
if (getCanvas() == 0)
if (getCanvas() == nullptr)
return;
if (_copyShader == nullptr) {
......@@ -79,7 +79,7 @@ namespace campvis {
tgt::Shader::IgnoreUniformLocationErrorGuard guard(_copyShader);
// render whatever there is to render
if (rd != 0 || (repGL != 0 && repGL->getDimensionality() == 2)) {
if (rd != nullptr || (repGL != nullptr && repGL->getDimensionality() == 2)) {
_copyShader->setUniform("_viewMatrix", tgt::mat4::identity);
// bind input textures
......@@ -135,39 +135,33 @@ namespace campvis {
void CampVisPainter::deinit() {
ShdrMgr.dispose(_copyShader);
if (_pipeline != 0) {
_pipeline->s_renderTargetChanged.disconnect(this);
if (getCanvas()->getEventHandler() != 0)
if (_pipeline != nullptr) {
if (getCanvas()->getEventHandler() != nullptr)
getCanvas()->getEventHandler()->removeEventListener(_pipeline);
_pipeline = 0;
_pipeline = nullptr;
}
}
void CampVisPainter::setPipeline(AbstractPipeline* pipeline) {
tgtAssert(pipeline != 0, "The given pipeline must not be 0.");
if (_pipeline != 0) {
_pipeline->s_renderTargetChanged.disconnect(this);
if (getCanvas()->getEventHandler() != 0)
tgtAssert(pipeline != nullptr, "The given pipeline must not be 0.");
if (_pipeline != nullptr) {
if (getCanvas()->getEventHandler() != nullptr)
getCanvas()->getEventHandler()->removeEventListener(_pipeline);
}
_pipeline = pipeline;
_pipeline->s_renderTargetChanged.connect(this, &CampVisPainter::onRenderTargetChanged);
_pipeline->setRenderTargetSize(getCanvas()->getSize());
if (getCanvas()->getEventHandler() != 0)
if (getCanvas()->getEventHandler() != nullptr)
getCanvas()->getEventHandler()->addEventListenerToFront(_pipeline);
}
void CampVisPainter::repaint() {
//GLJobProc.enqueueJob(getCanvas(), makeJobOnHeap(this, &CampVisPainter::paint), OpenGLJobProcessor::PaintJob);
}
void CampVisPainter::onRenderTargetChanged() {
repaint();
// do nothing, as the painting is entirely managed by the pipeline.
}
void CampVisPainter::setCanvas(tgt::GLCanvas* canvas) {
tgtAssert(dynamic_cast<tgt::QtThreadedCanvas*>(canvas) != 0, "Canvas must be of type QtThreadedCanvas!");
tgtAssert(dynamic_cast<tgt::QtThreadedCanvas*>(canvas) != nullptr, "Canvas must be of type QtThreadedCanvas!");
Painter::setCanvas(canvas);
}
......
......@@ -91,10 +91,6 @@ namespace campvis {
void setErrorTexture(tgt::Texture* texture);
/**
* Slot being notified when the pipeline's render target changed.
*/
void onRenderTargetChanged();
private:
/**
......@@ -106,10 +102,7 @@ namespace campvis {
AbstractPipeline* _pipeline; ///< Pipeline to render
tgt::Shader* _copyShader; ///< Shader for copying the render target to the framebuffer.
tbb::atomic<bool> _dirty; ///< Flag whether render result is dirty and needs to be rerendered.
std::condition_variable _renderCondition; ///< conditional wait condition for rendering
tgt::Texture* _errorTexture;
tgt::Texture* _errorTexture; ///< Pointer to error texture
};
}
......
......@@ -138,7 +138,6 @@ namespace campvis {
executePipeline();
// paint on canvas
// FIXME: clean up the whole painter crap...
_canvas->getPainter()->paint();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment