2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 6bc3bd94 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Pre-merge cleanup:

* Cleaned up unsused code
* Fixed cppcheck issues
* Fixed depth test issues during OrientationOverlay rendering (had glitches in combination with DRRRaycaster)
parent 83307128
...@@ -427,7 +427,6 @@ namespace campvis { ...@@ -427,7 +427,6 @@ namespace campvis {
cgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard; cgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
std::string name = this->_cbProcessorFactory->currentText().toStdString(); std::string name = this->_cbProcessorFactory->currentText().toStdString();
DataContainer* dc = _selectedDataContainer;
if (_selectedPipeline == nullptr) if (_selectedPipeline == nullptr)
return; return;
......
...@@ -226,11 +226,8 @@ namespace campvis { ...@@ -226,11 +226,8 @@ namespace campvis {
campvis::GenericOptionProperty<T>::GenericOptionProperty(const std::string& name, const std::string& title, const GenericOption<T>* options, int count) campvis::GenericOptionProperty<T>::GenericOptionProperty(const std::string& name, const std::string& title, const GenericOption<T>* options, int count)
: AbstractOptionProperty(name, title) : AbstractOptionProperty(name, title)
{ {
cgtAssert(options != 0, "Pointer to options array must not be 0.")
cgtAssert(count > 0, "The number of options must be greater 0.");
_options.assign(options, options + count); _options.assign(options, options + count);
setMaxValue(count - 1); setMaxValue(std::max(count - 1, 0));
setValue(0); setValue(0);
setMinValue(0); setMinValue(0);
} }
......
...@@ -191,9 +191,12 @@ Texture* TextureReaderTga::loadTexture(const std::string& filename, Texture::Fil ...@@ -191,9 +191,12 @@ Texture* TextureReaderTga::loadTexture(const std::string& filename, Texture::Fil
} }
Texture* TextureReaderTga::loadTextureArray(const std::vector<std::string>& filenames, Texture::Filter filter) { Texture* TextureReaderTga::loadTextureArray(const std::vector<std::string>& filenames, Texture::Filter filter) {
if (filenames.empty())
return nullptr;
GLubyte* data = nullptr; GLubyte* data = nullptr;
GLint format; GLint format = 0;
GLint internalFormat; GLint internalFormat = 0;
GLenum dataType = GL_UNSIGNED_BYTE; GLenum dataType = GL_UNSIGNED_BYTE;
size_t numBytesPerTexture = 0; size_t numBytesPerTexture = 0;
cgt::ivec3 dimensions; cgt::ivec3 dimensions;
......
...@@ -61,6 +61,10 @@ namespace campvis { ...@@ -61,6 +61,10 @@ namespace campvis {
return toReturn; return toReturn;
} }
std::vector<std::string> ProcessorFactory::getRegisteredRaycastingProcessors() const {
return _raycastingProcessors;
}
AbstractProcessor* ProcessorFactory::createProcessor(const std::string& id, IVec2Property* viewPortSizeProp) const { AbstractProcessor* ProcessorFactory::createProcessor(const std::string& id, IVec2Property* viewPortSizeProp) const {
tbb::spin_mutex::scoped_lock lock(_mutex); tbb::spin_mutex::scoped_lock lock(_mutex);
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <vector> #include <vector>
#include "core/pipeline/visualizationprocessor.h" #include "core/pipeline/visualizationprocessor.h"
#include "core/pipeline/raycastingprocessor.h"
namespace campvis { namespace campvis {
class AbstractProcessor; class AbstractProcessor;
...@@ -64,9 +65,26 @@ namespace campvis { ...@@ -64,9 +65,26 @@ namespace campvis {
static void deinit(); static void deinit();
/**
* Returns the list of all registered Processors.
* \return A std::vector of the string IDs of all registered processors.
*/
std::vector<std::string> getRegisteredProcessors() const; std::vector<std::string> getRegisteredProcessors() const;
AbstractProcessor* createProcessor(const std::string& id, IVec2Property* viewPortSizeProp = 0) const; /**
* Returns the list of all registered raycasting processors (all registered processors
* inheriting from RaycastingProcessor).
* \return A std::vector of the string IDs of all registered raycasting processors.
*/
std::vector<std::string> getRegisteredRaycastingProcessors() const;
/**
* Factory method to create a processor from the given string ID.
* \param id String ID of the processor to create.
* \param viewPortSizeProp Pointer to the viewport size property that the created VisualizationProcessor should use. If the created processor is no VisualizationProcessor, then this argument is ignored. Defaults to nullptr.
* \return Pointer to the newly created processor, may be nullptr. Caller has to take ownership of the returned pointer.
*/
AbstractProcessor* createProcessor(const std::string& id, IVec2Property* viewPortSizeProp = nullptr) const;
/** /**
...@@ -79,6 +97,10 @@ namespace campvis { ...@@ -79,6 +97,10 @@ namespace campvis {
size_t registerProcessorWithDefaultConstructor(std::function<AbstractProcessor*()> callee) { size_t registerProcessorWithDefaultConstructor(std::function<AbstractProcessor*()> callee) {
tbb::spin_mutex::scoped_lock lock(_mutex); tbb::spin_mutex::scoped_lock lock(_mutex);
// add to list of raycasting processors if needed
if (std::is_base_of<RaycastingProcessor, T>::value)
_raycastingProcessors.push_back(T::getId());
auto it = _processorTypeMap.find(T::getId()); auto it = _processorTypeMap.find(T::getId());
if (it != _processorTypeMap.end()) { if (it != _processorTypeMap.end()) {
// check, whether the type is the same, then a double registration is okay since it // check, whether the type is the same, then a double registration is okay since it
...@@ -104,6 +126,10 @@ namespace campvis { ...@@ -104,6 +126,10 @@ namespace campvis {
size_t registerProcessorWithIVec2PropParam(std::function<AbstractProcessor*(IVec2Property*)> callee) { size_t registerProcessorWithIVec2PropParam(std::function<AbstractProcessor*(IVec2Property*)> callee) {
tbb::spin_mutex::scoped_lock lock(_mutex); tbb::spin_mutex::scoped_lock lock(_mutex);
// add to list of raycasting processors if needed
if (std::is_base_of<RaycastingProcessor, T>::value)
_raycastingProcessors.push_back(T::getId());
auto it = _processorTypeMap.find(T::getId()); auto it = _processorTypeMap.find(T::getId());
if (it != _processorTypeMap.end()) { if (it != _processorTypeMap.end()) {
// check, whether the type is the same, then a double registration is okay since it // check, whether the type is the same, then a double registration is okay since it
...@@ -126,6 +152,8 @@ namespace campvis { ...@@ -126,6 +152,8 @@ namespace campvis {
std::map< std::string, std::type_index> _processorTypeMap; std::map< std::string, std::type_index> _processorTypeMap;
std::map< std::string, std::function<AbstractProcessor*()> > _processorMapDefault; std::map< std::string, std::function<AbstractProcessor*()> > _processorMapDefault;
std::map< std::string, std::function<AbstractProcessor*(IVec2Property*)> > _processorMapWithIVec2Param; std::map< std::string, std::function<AbstractProcessor*(IVec2Property*)> > _processorMapWithIVec2Param;
std::vector<std::string> _raycastingProcessors;
}; };
......
...@@ -114,7 +114,6 @@ namespace campvis { ...@@ -114,7 +114,6 @@ namespace campvis {
createAndAttachColorTexture(); createAndAttachColorTexture();
createAndAttachDepthTexture(); createAndAttachDepthTexture();
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (passthroughImage) { if (passthroughImage) {
...@@ -127,6 +126,7 @@ namespace campvis { ...@@ -127,6 +126,7 @@ namespace campvis {
_passthroughShader->deactivate(); _passthroughShader->deactivate();
} }
glEnable(GL_DEPTH_TEST);
_shader->activate(); _shader->activate();
cgt::TextureUnit textureUnit; cgt::TextureUnit textureUnit;
...@@ -144,7 +144,6 @@ namespace campvis { ...@@ -144,7 +144,6 @@ namespace campvis {
_cubeGeometry->render(GL_TRIANGLE_FAN); _cubeGeometry->render(GL_TRIANGLE_FAN);
glDepthFunc(GL_LESS);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
_shader->deactivate(); _shader->deactivate();
......
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
namespace campvis { namespace campvis {
const std::string VolumeRenderer::loggerCat_ = "CAMPVis.modules.vis.VolumeRenderer"; const std::string VolumeRenderer::loggerCat_ = "CAMPVis.modules.vis.VolumeRenderer";
//static const std::string* raycastingProcessorName = &RaycasterFactory::getRef().getRegisteredRaycasters()[0];
VolumeRenderer::VolumeRenderer(IVec2Property* viewportSizeProp, RaycastingProcessor* raycaster) VolumeRenderer::VolumeRenderer(IVec2Property* viewportSizeProp, RaycastingProcessor* raycaster)
: VisualizationProcessor(viewportSizeProp) : VisualizationProcessor(viewportSizeProp)
, p_inputVolume("InputVolume", "Input Volume", "", DataNameProperty::READ) , p_inputVolume("InputVolume", "Input Volume", "", DataNameProperty::READ)
...@@ -52,7 +50,7 @@ namespace campvis { ...@@ -52,7 +50,7 @@ namespace campvis {
, p_eepProps("EEPProps", "Entry/Exit Points Generator") , p_eepProps("EEPProps", "Entry/Exit Points Generator")
, p_raycasterProps("RaycasterProps", "Raycaster") , p_raycasterProps("RaycasterProps", "Raycaster")
, p_orientationOverlayProps("OrientationOverlayProps", "Orientation Overlay") , p_orientationOverlayProps("OrientationOverlayProps", "Orientation Overlay")
, p_raycastingProcSelector("RaycasterSelector", "RaycasterSelector", new GenericOption<std::string>("select", "Select Processor"), 1) , p_raycastingProcSelector("RaycasterSelector", "Select Raycaster to Use", nullptr, 0)
, _pgGenerator() , _pgGenerator()
, _eepGenerator(viewportSizeProp) , _eepGenerator(viewportSizeProp)
, _raycaster(raycaster) , _raycaster(raycaster)
...@@ -78,10 +76,8 @@ namespace campvis { ...@@ -78,10 +76,8 @@ namespace campvis {
_eepGenerator.p_exitImageID.setVisible(false); _eepGenerator.p_exitImageID.setVisible(false);
addProperty(p_eepProps, AbstractProcessor::VALID); addProperty(p_eepProps, AbstractProcessor::VALID);
const std::vector<std::string>& raycasters = ProcessorFactory::getRef().getRegisteredProcessors(); const std::vector<std::string>& raycasters = ProcessorFactory::getRef().getRegisteredRaycastingProcessors();
for (int i = 0; i < raycasters.size(); i++) { for (size_t i = 0; i < raycasters.size(); i++) {
// Probably not the best way
if (StringUtils::lowercase(raycasters[i]).find("raycaster") != std::string::npos)
p_raycastingProcSelector.addOption(GenericOption<std::string>(raycasters[i], raycasters[i])); p_raycastingProcSelector.addOption(GenericOption<std::string>(raycasters[i], raycasters[i]));
} }
if (_raycaster != nullptr) { if (_raycaster != nullptr) {
...@@ -152,7 +148,6 @@ namespace campvis { ...@@ -152,7 +148,6 @@ namespace campvis {
} }
void VolumeRenderer::updateResult(DataContainer& data) { void VolumeRenderer::updateResult(DataContainer& data) {
int x = getInvalidationLevel();
if (getInvalidationLevel() & PG_INVALID) { if (getInvalidationLevel() & PG_INVALID) {
_pgGenerator.process(data); _pgGenerator.process(data);
} }
...@@ -213,11 +208,6 @@ namespace campvis { ...@@ -213,11 +208,6 @@ namespace campvis {
AbstractProcessor::ScopedLock lockGuard(this); AbstractProcessor::ScopedLock lockGuard(this);
RaycastingProcessor *currentRaycaster = _raycaster; RaycastingProcessor *currentRaycaster = _raycaster;
// Change to previous raycaster if "Select Processor" is selected
if (p_raycastingProcSelector.getOptionId() == p_raycastingProcSelector.getOptions()[0]._id) {
p_raycastingProcSelector.selectById(currentRaycaster->getName());
return;
}
if (p_raycastingProcSelector.getOptionId() == currentRaycaster->getName()) { if (p_raycastingProcSelector.getOptionId() == currentRaycaster->getName()) {
return; return;
} }
......
...@@ -110,8 +110,6 @@ namespace campvis { ...@@ -110,8 +110,6 @@ namespace campvis {
GenericOptionProperty<std::string> p_raycastingProcSelector; ///< Name of the RaycastingProcessor to be used GenericOptionProperty<std::string> p_raycastingProcSelector; ///< Name of the RaycastingProcessor to be used
sigslot::signal2<RaycastingProcessor*, RaycastingProcessor*> s_raycasterChanged; ///< Signal emited when the raycaster is changed
protected: protected:
/// \see AbstractProcessor::updateResult /// \see AbstractProcessor::updateResult
virtual void updateResult(DataContainer& dataContainer); virtual void updateResult(DataContainer& dataContainer);
......
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