Commit 0794b27f authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Hotfix for DevilImageReader from recent merge:

* AbstractImageReader is now again an AbstractProcessor, so that we can get rid of the dynamic_casts in GenericImageReader
* DevilImageReader is no longer a VisualizationProcessor but gets the OpenGL context through OpenGLJobProcessor::ScopedSynchronousGlJobExecution
* Fixed alglib's CMakeLists.txt
parent e3f8eeb6
......@@ -80,7 +80,7 @@ namespace campvis {
* does nothing. If this thread is not the OpenGL thread, the OpenGLJobProcessor is paused,
* an arbitrary OpenGL context acquired. Upon destruction the OpenGLJobProcessor is resumed.
*/
class ScopedSynchronousGlJobExecution {
class CAMPVIS_CORE_API ScopedSynchronousGlJobExecution {
public:
ScopedSynchronousGlJobExecution();
~ScopedSynchronousGlJobExecution();
......
......@@ -47,7 +47,7 @@ namespace campvis {
CmBatchGeneration::CmBatchGeneration(DataContainer* dc)
: AutoEvaluationPipeline(dc)
, _usReader(&_canvasSize)
, _usReader()
, _confidenceGenerator()
, _usBlurFilter(&_canvasSize)
, _usFusion(&_canvasSize)
......
......@@ -40,6 +40,8 @@
#include "core/datastructures/renderdata.h"
#include "core/datastructures/genericimagerepresentationlocal.h"
#include "core/tools/opengljobprocessor.h"
#include "core/tools/quadrenderer.h"
#include "core/tools/stringutils.h"
#include "core/tools/mapping.h"
......@@ -55,8 +57,8 @@ namespace campvis {
GenericOption<std::string>("localIntensity3", "Local Intensity Image RGB")
};
DevilImageReader::DevilImageReader(IVec2Property* viewportSizeProp)
: VisualizationProcessor(viewportSizeProp)
DevilImageReader::DevilImageReader()
: AbstractImageReader()
, p_importType("ImportType", "Import Type", importOptions, 4)
, p_importSimilar("ImportSimilar", "Import All Similar Files", false)
, _shader(nullptr)
......@@ -82,14 +84,14 @@ namespace campvis {
}
void DevilImageReader::init() {
VisualizationProcessor::init();
AbstractImageReader::init();
_shader = ShdrMgr.load("core/glsl/passthrough.vert", "core/glsl/copyimage.frag", "#define NO_DEPTH\n");
_shader->setAttributeLocation(0, "in_Position");
_shader->setAttributeLocation(1, "in_TexCoord");
}
void DevilImageReader::deinit() {
VisualizationProcessor::deinit();
AbstractImageReader::deinit();
ShdrMgr.dispose(_shader);
}
......@@ -106,34 +108,13 @@ namespace campvis {
int suffix = StringUtils::fromString<int>(numstr);
std::cout << "\nfileName Suffix: "<<suffix <<" count: "<<dotPos-_Pos <<std::endl;
// FIXME: clean up this whole implementation mess and make it fully non-OpenGL!
OpenGLJobProcessor::ScopedSynchronousGlJobExecution glGuard;
tgt::Texture* tex = _devilTextureReader->loadTexture(p_url.getValue(), tgt::Texture::LINEAR, false, true, true, false);
if (tex != 0) {
if (p_importType.getOptionValue() == "rt") {
ImageData id (3, tex->getDimensions(), tex->getNumChannels());
ImageRepresentationGL* image = ImageRepresentationGL::create(&id, tex);
FramebufferActivationGuard fag(this);
createAndAttachColorTexture();
createAndAttachDepthTexture();
_shader->activate();
_shader->setIgnoreUniformLocationError(true);
_shader->setUniform("_viewportSize", getEffectiveViewportSize());
_shader->setUniform("_viewportSizeRCP", 1.f / tgt::vec2(getEffectiveViewportSize()));
_shader->setIgnoreUniformLocationError(false);
tgt::TextureUnit texUnit;
image->bind(_shader, texUnit, "_colorTexture");
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QuadRdr.renderQuad();
_shader->deactivate();
tgt::TextureUnit::setZeroUnit();
LGL_ERROR;
data.addData(p_targetImageID.getValue(), new RenderData(_fbo));
tgtAssert(false, "This type is no longer supported.");
}
else if (p_importType.getOptionValue() == "texture") {
ImageData* id = new ImageData(3, tex->getDimensions(), tex->getNumChannels());
......
......@@ -27,7 +27,6 @@
#include <string>
#include "core/pipeline/visualizationprocessor.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/genericproperty.h"
#include "core/properties/optionproperty.h"
......@@ -47,12 +46,12 @@ namespace campvis {
*
* \note Full list of supported formats: http://openil.sourceforge.net/features.php
*/
class DevilImageReader : public AbstractImageReader, public VisualizationProcessor {
class DevilImageReader : public AbstractImageReader {
public:
/**
* Constructs a new DevilImageReader Processor
**/
DevilImageReader(IVec2Property* viewportSizeProp);
DevilImageReader();
/**
* Destructor
......
......@@ -26,7 +26,8 @@
namespace campvis {
AbstractImageReader::AbstractImageReader()
: p_url("url", "Image URL", "", StringProperty::OPEN_FILENAME)
: AbstractProcessor()
, p_url("url", "Image URL", "", StringProperty::OPEN_FILENAME)
, p_targetImageID("targetImageName", "Target Image ID", "AbstractImageReader.output", DataNameProperty::WRITE)
{
}
......
......@@ -42,7 +42,7 @@ namespace campvis {
* of files into ImageRepresentationDisk representation
*
*/
class AbstractImageReader {
class AbstractImageReader : public AbstractProcessor {
public:
/**
* Constructs a new AbstractImageReader Processor
......
......@@ -37,7 +37,7 @@ namespace campvis {
* Reads a CSVD to read multiple CSV image files into the pipeline.
* This YANF (yet another neat format) is proudly provided by Christian Schulte zu Berge.
*/
class CsvdImageReader : public AbstractImageReader, public AbstractProcessor {
class CsvdImageReader : public AbstractImageReader {
public:
/**
* Constructs a new CsvdImageReader Processor
......
......@@ -48,7 +48,7 @@ namespace campvis {
this->addReader(new MhdImageReader());
this->addReader(new RawImageReader());
this->addReader(new VtkImageReader());
this->addReader(new DevilImageReader(new IVec2Property("CanvasSize", "Canvas Size", tgt::ivec2(128, 128), tgt::ivec2(1, 1), tgt::ivec2(4096, 4096))));
this->addReader(new DevilImageReader());
this->_ext = "";
......@@ -74,7 +74,7 @@ namespace campvis {
}
// then we can delete the reader!
if (nullptr != it->first) {
dynamic_cast<AbstractProcessor*>(it->first)->deinit();
it->first->deinit();
}
}
}
......@@ -89,7 +89,7 @@ namespace campvis {
(it->second)->setVisible(true);
this->_currentlyVisible = it->second;
}
dynamic_cast<AbstractProcessor*>(it->first)->process(data);
it->first->process(data);
}
}
......@@ -162,8 +162,8 @@ namespace campvis {
}
int GenericImageReader::addReader(AbstractImageReader* reader) {
MetaProperty* meta = new MetaProperty(dynamic_cast<AbstractProcessor*>(reader)->getName()+"MetaProp", dynamic_cast<AbstractProcessor*>(reader)->getName());
meta->addPropertyCollection(*dynamic_cast<AbstractProcessor*>(reader));
MetaProperty* meta = new MetaProperty(reader->getName()+"MetaProp", reader->getName());
meta->addPropertyCollection(*reader);
meta->setVisible(false);
this->addProperty(*meta);
......
......@@ -39,7 +39,7 @@ namespace campvis {
/**
* Reads raw images into the pipeline.
*/
class LtfImageReader : public AbstractImageReader, public AbstractProcessor {
class LtfImageReader : public AbstractImageReader {
public:
/**
* Constructs a new LtfImageReader Processor
......
......@@ -38,7 +38,7 @@ namespace campvis {
*
* \note Full format specification at http://www.itk.org/Wiki/MetaIO/Documentation
*/
class MhdImageReader : public AbstractImageReader, public AbstractProcessor {
class MhdImageReader : public AbstractImageReader {
public:
/**
* Constructs a new MhdImageReader Processor
......
......@@ -41,7 +41,7 @@ namespace campvis {
/**
* Reads raw images into the pipeline.
*/
class RawImageReader : public AbstractImageReader, public AbstractProcessor {
class RawImageReader : public AbstractImageReader {
public:
/**
* Constructs a new RawImageReader Processor
......
......@@ -39,7 +39,7 @@ namespace campvis {
*
* \note Full format specification at http://www.vtk.org/VTK/img/file-formats.pdf
*/
class VtkImageReader : public AbstractImageReader, public AbstractProcessor {
class VtkImageReader : public AbstractImageReader {
public:
/**
* Constructs a new VtkImageReader Processor
......
......@@ -34,7 +34,7 @@ namespace campvis {
IxpvDemo::IxpvDemo(DataContainer* dc)
: AutoEvaluationPipeline(dc)
, _xrayReader(&_canvasSize)
, _xrayReader()
, _ctReader()
, _vrFull(&_canvasSize, new DRRRaycaster(&_canvasSize))
, _vrClipped(&_canvasSize, new DRRRaycaster(&_canvasSize))
......
......@@ -71,6 +71,5 @@ endif ( CMAKE_COMPILER_IS_GNUCC )
if ( MSVC )
# This is untested
set_property( TARGET alglib APPEND_STRING PROPERTY COMPILE_FLAGS "/W1 /EHsc" )
SET(CMAKE_CXX_FLAGS "-fno-strict-aliasing")
endif ( MSVC )
Supports Markdown
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