Commit 2123a4af authored by Jakob Weiss's avatar Jakob Weiss

Various minor fixes:

* added buildClang to .gitignore
* Minimum required glsl version is now 430 by default (might be possible to downgrade again by checking on a per-module basis)
* More of the base modules now register their processors into the factory.
* Minor bugfixes in optimizedraycaster (inverted gradient dir) and glimageresampler (renamed variable)
parent 5cbfe490
......@@ -54,3 +54,4 @@ build/
build14/
build15/
.vscode/
buildClang/
......@@ -61,7 +61,7 @@ namespace campvis {
LERRORC("CAMPVis.core.init", "Your system does not support GLSL Shader Version 3.30, which is mandatory. CAMPVis will probably not work as intended.");
}
ShdrMgr.setDefaultGlslVersion("330");
ShdrMgr.setDefaultGlslVersion("430");
for (auto it = searchPaths.cbegin(); it != searchPaths.cend(); ++it) {
ShdrMgr.addPath(*it);
ShdrMgr.addPath(*it + "/core/glsl");
......
......@@ -46,6 +46,9 @@ namespace campvis {
class AbstractProcessor;
class DataContainer;
template <typename T>
using has_ivec2_constructor = decltype(T::foobar);
/**
* Factory for creating processors by their name.
* Using some template-magic, ProcessorFactory is able to register processors during static
......@@ -211,7 +214,7 @@ namespace campvis {
};
template<typename T>
const size_t campvis::SmartProcessorRegistrar<T>::_helperField = ProcessorRegistrarSwitch< T, std::is_base_of<VisualizationProcessor, T>::value >::_factoryId;
const size_t campvis::SmartProcessorRegistrar<T>::_helperField = ProcessorRegistrarSwitch< T, std::is_constructible<T, IVec2Property*>::value>::_factoryId;
}
......
......@@ -3,6 +3,7 @@
IF(${ModuleEnabled})
# Source files:
FILE(GLOB ThisModSources RELATIVE ${ModulesDir}
modules/base/base.cpp
modules/base/processors/*.cpp
)
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2015, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitaet Muenchen
// Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.
//
// ================================================================================================
#include "core/pipeline/pipelinefactory.h"
#include "core/pipeline/processorfactory.h"
#include "modules/base/processors/lightsourceprovider.h"
#include "modules/base/processors/dataseriessplitter.h"
#include "modules/base/processors/matrixprocessor.h"
#include "modules/base/processors/trackballcameraprovider.h"
namespace campvis {
// explicitly instantiate templates to register the processors
template class SmartProcessorRegistrar<DataSeriesSplitter>;
template class SmartProcessorRegistrar<LightSourceProvider>;
template class SmartProcessorRegistrar<MatrixProcessor>;
template class SmartProcessorRegistrar<TrackballCameraProvider>;
}
......@@ -57,8 +57,10 @@ namespace campvis {
/// \see AbstractProcessor::updateResult()
virtual void updateResult(DataContainer& dataContainer);
/// To be used in ProcessorFactory static methods
static const std::string getId() { return "CameraProvider"; };
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "CameraProvider"; };
virtual const std::string getName() const { return getId(); };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Generates CameraData objects."; };
/// \see AbstractProcessor::getAuthor()
......
......@@ -45,8 +45,10 @@ namespace campvis {
**/
virtual ~DataSeriesSplitter();
/// To be used in ProcessorFactory static methods
static const std::string getId() { return "DataSeriesSplitter"; };
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "DataSeriesSplitter"; };
virtual const std::string getName() const { return getId(); };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Extracts a single AbstractData instance from a DataSeries."; };
/// \see AbstractProcessor::getAuthor()
......
......@@ -77,12 +77,14 @@ namespace campvis {
/// \see AbstractProcessor::deinit()
virtual void deinit();
/// To be used in ProcessorFactory static methods
static const std::string getId() { return "MatrixProcessor"; };
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "MatrixProcessor"; };
virtual const std::string getName() const { return getId(); };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Matrix Processor to process/combine matrices and write the result into the data container"; };
/// \see AbstractProcessor::getAuthor()
virtual const std::string getAuthor() const { return "Jakob Weiss <weissj@in.tum.de>"; };
virtual const std::string getAuthor() const { return "Jakob Weiss <jakob.weiss@tum.de>"; };
/// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
......
......@@ -62,9 +62,10 @@ namespace campvis {
**/
virtual ~TrackballCameraProvider();
/// To be used in ProcessorFactory static methods
static const std::string getId() { return "TrackballCameraProvider"; };
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "TrackballCameraProvider"; };
virtual const std::string getName() const { return getId(); };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Provides trackball navigation interaction metaphors when generating CameraData objects."; };
/// \see AbstractProcessor::getAuthor()
......
......@@ -3,6 +3,7 @@
IF(${ModuleEnabled})
# Source files:
FILE(GLOB ThisModSources RELATIVE ${ModulesDir}
modules/io/io.cpp
modules/io/processors/*.cpp
)
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2015, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitaet Muenchen
// Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.
//
// ================================================================================================
#include "core/pipeline/pipelinefactory.h"
#include "core/pipeline/processorfactory.h"
#include "modules/io/processors/genericimagereader.h"
#include "modules/io/processors/mhdimagewriter.h"
#include "modules/base/processors/matrixprocessor.h"
#include "modules/base/processors/trackballcameraprovider.h"
namespace campvis {
// explicitly instantiate templates to register the processors
template class SmartProcessorRegistrar<GenericImageReader>;
template class SmartProcessorRegistrar<MhdImageWriter>;
}
......@@ -64,8 +64,12 @@ namespace campvis {
/// \see AutoEvaluationPipeline::deinit()
virtual void deinit();
/**
* To be used in ProcessorFactory static methods
*/
static const std::string getId() { return "GenericImageReader"; };
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "GenericImageReader"; };
virtual const std::string getName() const { return getId(); };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Reads an image into the pipeline."; };
/// \see AbstractProcessor::getAuthor()
......
......@@ -52,8 +52,12 @@ namespace campvis {
**/
virtual ~MhdImageWriter();
/**
* To be used in ProcessorFactory static methods
*/
static const std::string getId() { return "MhdImageWriter"; };
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "MhdImageWriter"; };
virtual const std::string getName() const { return getId(); };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Writes an image into an MHD file."; };
/// \see AbstractProcessor::getAuthor()
......
......@@ -38,12 +38,12 @@ uniform sampler2D _texture;
void main() {
#ifdef GLRESAMPLER_3D
vec4 sample = texture(_texture, vec3(ex_TexCoord.xy, _zTexCoord));
vec4 textureSample = texture(_texture, vec3(ex_TexCoord.xy, _zTexCoord));
#endif
#ifdef GLRESAMPLER_2D
vec4 sample = texture(_texture, ex_TexCoord.xy);
vec4 textureSample = texture(_texture, ex_TexCoord.xy);
#endif
out_Color = sample;
out_Color = textureSample;
}
......@@ -168,7 +168,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
if (color.a > 0.0) {
#ifdef ENABLE_SHADING
// compute gradient (needed for shading and normals)
vec3 gradient = computeGradient(_volume, _volumeTextureParams, samplePosition);
vec3 gradient = -computeGradient(_volume, _volumeTextureParams, samplePosition);
color.rgb = calculatePhongShading(textureToWorld(_volumeTextureParams, samplePosition), _lightSource, _cameraPosition, gradient, color.rgb, color.rgb, vec3(1.0, 1.0, 1.0));
#endif
......@@ -182,7 +182,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
if (firstHitT < 0.0 && result.a > 0.0) {
firstHitT = t;
out_FHP = vec4(samplePosition, 1.0);
out_FHN = vec4(normalize(computeGradient(_volume, _volumeTextureParams, samplePosition)), 1.0);
out_FHN = vec4(normalize(-computeGradient(_volume, _volumeTextureParams, samplePosition)), 1.0);
}
// early ray termination
......
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