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 {
cgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
std::string name = this->_cbProcessorFactory->currentText().toStdString();
DataContainer* dc = _selectedDataContainer;
if (_selectedPipeline == nullptr)
return;
......
......@@ -226,11 +226,8 @@ namespace campvis {
campvis::GenericOptionProperty<T>::GenericOptionProperty(const std::string& name, const std::string& title, const GenericOption<T>* options, int count)
: 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);
setMaxValue(count - 1);
setMaxValue(std::max(count - 1, 0));
setValue(0);
setMinValue(0);
}
......
......@@ -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) {
if (filenames.empty())
return nullptr;
GLubyte* data = nullptr;
GLint format;
GLint internalFormat;
GLint format = 0;
GLint internalFormat = 0;
GLenum dataType = GL_UNSIGNED_BYTE;
size_t numBytesPerTexture = 0;
cgt::ivec3 dimensions;
......
......@@ -61,6 +61,10 @@ namespace campvis {
return toReturn;
}
std::vector<std::string> ProcessorFactory::getRegisteredRaycastingProcessors() const {
return _raycastingProcessors;
}
AbstractProcessor* ProcessorFactory::createProcessor(const std::string& id, IVec2Property* viewPortSizeProp) const {
tbb::spin_mutex::scoped_lock lock(_mutex);
......
......@@ -41,6 +41,7 @@
#include <vector>
#include "core/pipeline/visualizationprocessor.h"
#include "core/pipeline/raycastingprocessor.h"
namespace campvis {
class AbstractProcessor;
......@@ -64,9 +65,26 @@ namespace campvis {
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;
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 {
size_t registerProcessorWithDefaultConstructor(std::function<AbstractProcessor*()> callee) {
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());
if (it != _processorTypeMap.end()) {
// check, whether the type is the same, then a double registration is okay since it
......@@ -104,6 +126,10 @@ namespace campvis {
size_t registerProcessorWithIVec2PropParam(std::function<AbstractProcessor*(IVec2Property*)> callee) {
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());
if (it != _processorTypeMap.end()) {
// check, whether the type is the same, then a double registration is okay since it
......@@ -126,6 +152,8 @@ namespace campvis {
std::map< std::string, std::type_index> _processorTypeMap;
std::map< std::string, std::function<AbstractProcessor*()> > _processorMapDefault;
std::map< std::string, std::function<AbstractProcessor*(IVec2Property*)> > _processorMapWithIVec2Param;
std::vector<std::string> _raycastingProcessors;
};
......
......@@ -114,7 +114,6 @@ namespace campvis {
createAndAttachColorTexture();
createAndAttachDepthTexture();
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (passthroughImage) {
......@@ -127,6 +126,7 @@ namespace campvis {
_passthroughShader->deactivate();
}
glEnable(GL_DEPTH_TEST);
_shader->activate();
cgt::TextureUnit textureUnit;
......@@ -144,7 +144,6 @@ namespace campvis {
_cubeGeometry->render(GL_TRIANGLE_FAN);
glDepthFunc(GL_LESS);
glDisable(GL_DEPTH_TEST);
_shader->deactivate();
......
......@@ -39,8 +39,6 @@
namespace campvis {
const std::string VolumeRenderer::loggerCat_ = "CAMPVis.modules.vis.VolumeRenderer";
//static const std::string* raycastingProcessorName = &RaycasterFactory::getRef().getRegisteredRaycasters()[0];
VolumeRenderer::VolumeRenderer(IVec2Property* viewportSizeProp, RaycastingProcessor* raycaster)
: VisualizationProcessor(viewportSizeProp)
, p_inputVolume("InputVolume", "Input Volume", "", DataNameProperty::READ)
......@@ -52,7 +50,7 @@ namespace campvis {
, p_eepProps("EEPProps", "Entry/Exit Points Generator")
, p_raycasterProps("RaycasterProps", "Raycaster")
, 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()
, _eepGenerator(viewportSizeProp)
, _raycaster(raycaster)
......@@ -78,10 +76,8 @@ namespace campvis {
_eepGenerator.p_exitImageID.setVisible(false);
addProperty(p_eepProps, AbstractProcessor::VALID);
const std::vector<std::string>& raycasters = ProcessorFactory::getRef().getRegisteredProcessors();
for (int i = 0; i < raycasters.size(); i++) {
// Probably not the best way
if (StringUtils::lowercase(raycasters[i]).find("raycaster") != std::string::npos)
const std::vector<std::string>& raycasters = ProcessorFactory::getRef().getRegisteredRaycastingProcessors();
for (size_t i = 0; i < raycasters.size(); i++) {
p_raycastingProcSelector.addOption(GenericOption<std::string>(raycasters[i], raycasters[i]));
}
if (_raycaster != nullptr) {
......@@ -152,7 +148,6 @@ namespace campvis {
}
void VolumeRenderer::updateResult(DataContainer& data) {
int x = getInvalidationLevel();
if (getInvalidationLevel() & PG_INVALID) {
_pgGenerator.process(data);
}
......@@ -213,11 +208,6 @@ namespace campvis {
AbstractProcessor::ScopedLock lockGuard(this);
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()) {
return;
}
......
......@@ -110,8 +110,6 @@ namespace campvis {
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:
/// \see AbstractProcessor::updateResult
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