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

Commit 99a32bd0 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Merge branch 'gcc-fixes' of /mnt/bigone/git/repositories/berge/campvis into development

parents d7325745 442d5051
......@@ -224,6 +224,7 @@ namespace campvis {
SimpleJobProcessor::deinit();
OpenGLJobProcessor::deinit();
PipelineFactory::deinit();
tgt::QtContextManager::deinit();
tgt::deinit();
......
......@@ -87,6 +87,8 @@ namespace campvis {
}
LogHighlighter::~LogHighlighter() {
delete _filterRegExp;
delete _logLevelRegExp;
setFilterRegExp(0);
}
......
......@@ -45,31 +45,32 @@ namespace campvis {
}
LogViewerWidget::~LogViewerWidget() {
delete _logHighlighter;
delete _controls_layout;
}
void LogViewerWidget::setupGUI() {
setWindowTitle(tr("Log Viewer"));
_mainLayout = new QVBoxLayout();
setLayout(_mainLayout);
_mainLayout = new QVBoxLayout(this);
_controls_layout = new QHBoxLayout();
_mainLayout->addLayout(_controls_layout);
_filter_label = new QLabel(tr("&Filter:"));
_filter_label = new QLabel(tr("&Filter:"), this);
_controls_layout->addWidget(_filter_label);
_filter_line_edit = new QLineEdit();
_filter_line_edit = new QLineEdit(this);
_filter_line_edit->setPlaceholderText(tr("Start typing here to filter log messages"));
_filter_label->setBuddy(_filter_line_edit);
_controls_layout->addWidget(_filter_line_edit);
_controls_layout->addStretch();
_clear_button = new QPushButton(tr("&Clear"));
_clear_button = new QPushButton(tr("&Clear"), this);
_controls_layout->addWidget(_clear_button);
_logDisplay = new QTextEdit();
_logDisplay = new QTextEdit(this);
_logDisplay->setReadOnly(true);
_mainLayout->addWidget(_logDisplay);
......
......@@ -101,38 +101,38 @@ namespace campvis {
_btnPipelineFactory = new QPushButton("Add Pipeline", _containerWidget);
_cwLayout->addWidget(_btnPipelineFactory, 0, 1);
_pipelineWidget = new PipelineTreeWidget();
_pipelineWidget = new PipelineTreeWidget(this);
_containerWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
_cwLayout->addWidget(_pipelineWidget, 1, 0, 1, 2);
_containerWidget->setLayout(_cwLayout);
ui.pipelineTreeDock->setWidget(_containerWidget);
_pipelinePropertiesScrollArea = new QScrollArea();
_pipelinePropertiesScrollArea = new QScrollArea(this);
_pipelinePropertiesScrollArea->setWidgetResizable(true);
_pipelinePropertiesScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
_pipelinePropertiesScrollArea->setFrameStyle(QScrollArea::NoFrame);
_pipelinePropertiesWidget = new QWidget();
_pipelinePropertiesWidget = new QWidget(_pipelinePropertiesScrollArea);
_pipelinePropertiesWidget->installEventFilter(this);
_pipelinePropertiesScrollArea->setWidget(_pipelinePropertiesWidget);
ui.pipelinePropertiesDock->setWidget(_pipelinePropertiesScrollArea);
QVBoxLayout* rightLayout = new QVBoxLayout();
QVBoxLayout* rightLayout = new QVBoxLayout(_pipelinePropertiesWidget);
rightLayout->setSpacing(4);
_pipelinePropertiesWidget->setLayout(rightLayout);
_btnExecute = new QPushButton("Execute Selected Pipeline/Processor");
_btnExecute = new QPushButton("Execute Selected Pipeline/Processor", _pipelinePropertiesWidget);
rightLayout->addWidget(_btnExecute);
_btnShowDataContainerInspector = new QPushButton("Inspect DataContainer of Selected Pipeline");
_btnShowDataContainerInspector = new QPushButton("Inspect DataContainer of Selected Pipeline", _pipelinePropertiesWidget);
rightLayout->addWidget(_btnShowDataContainerInspector);
_propCollectionWidget = new PropertyCollectionWidget();
_propCollectionWidget = new PropertyCollectionWidget(this);
rightLayout->addWidget(_propCollectionWidget);
rightLayout->addStretch();
_logViewer = new LogViewerWidget();
_logViewer = new LogViewerWidget(this);
ui.logViewerDock->setWidget(_logViewer);
_dcInspectorWidget = new DataContainerInspectorWidget();
......
......@@ -118,8 +118,12 @@ IF(WIN32)
LIST(APPEND CampvisGlobalExternalLibs netapi32 version)
ELSEIF(UNIX)
LIST(APPEND CampvisGlobalDefinitions "-DUNIX")
LIST(APPEND CampvisGlobalDefinitions "-DUNIX")
LIST(APPEND CampvisGlobalDefinitions "-Wall")
LIST(APPEND CampvisGlobalDefinitions "-D__STDC_CONSTANT_MACROS")
# disable tree-vrp optimization in gcc, which for some strange reason breaks tgt's matrix code...
LIST(APPEND CampvisGlobalDefinitions "-fno-tree-vrp")
ENDIF(WIN32)
# tgt configuration
......
......@@ -59,11 +59,17 @@ namespace campvis {
}
void ImageMappingInformation::updateMatrices() {
tgt::mat4 t = tgt::mat4::createTranslation(_offset);
// tgt::mat4 s = tgt::mat4::createScale(_voxelSize * _size);
// _textureToWolrdTransformation = t * s;
_textureToWolrdTransformation = tgt::mat4::createTranslation(_offset) * tgt::mat4::createScale(_voxelSize * _size);
// std::cout << s << t << _textureToWolrdTransformation << "\n";
if (! _textureToWolrdTransformation.invert(_worldToTextureTransformation))
tgtAssert(false, "Could not invert texture-to-world matrix. That should not happen!");
_voxelToWorldTransformation = tgt::mat4::createTranslation(_offset) * tgt::mat4::createScale(_voxelSize);
tgt::mat4 s = tgt::mat4::createScale(_voxelSize);
_voxelToWorldTransformation = t * s;
// std::cout << s << t << _voxelToWorldTransformation << "\n";
if (! _voxelToWorldTransformation.invert(_worldToVoxelTransformation))
tgtAssert(false, "Could not invert voxel-to-world matrix. That should not happen!");
}
......
......@@ -151,32 +151,23 @@ namespace campvis {
if (_endianess != localEndianess) {
// This is not the most beautiful design, but unfortunately swapEndian needs to know the number of bytes at compiletime...
switch (_type) {
case WeaklyTypedPointer::UINT8:
case WeaklyTypedPointer::UINT8: // fallthrough
case WeaklyTypedPointer::INT8:
for (size_t i = 0; i < numElements; ++i)
data[i] = EndianHelper::swapEndian(data[i]);
// nothing to do here.
break;
case WeaklyTypedPointer::UINT16:
case WeaklyTypedPointer::UINT16: // fallthrough
case WeaklyTypedPointer::INT16: {
int16_t* tmp = reinterpret_cast<int16_t*>(data);
for (size_t i = 0; i < numElements; ++i)
tmp[i] = EndianHelper::swapEndian(tmp[i]);
break;
}
case WeaklyTypedPointer::UINT32:
case WeaklyTypedPointer::INT32: {
int32_t* tmp = reinterpret_cast<int32_t*>(data);
for (size_t i = 0; i < numElements; ++i)
tmp[i] = EndianHelper::swapEndian(tmp[i]);
EndianHelper::swapEndian<2>(data + (2*i));
break;
}
case WeaklyTypedPointer::UINT32: // fallthrough
case WeaklyTypedPointer::INT32: // fallthrough
case WeaklyTypedPointer::FLOAT: {
float* tmp = reinterpret_cast<float*>(data);
for (size_t i = 0; i < numElements; ++i)
tmp[i] = EndianHelper::swapEndian(tmp[i]);
EndianHelper::swapEndian<4>(data + (4*i));
break;
}
......
......@@ -40,6 +40,9 @@ namespace campvis {
TransFuncWindowingEventListener::TransFuncWindowingEventListener(TransferFunctionProperty* property)
: tgt::EventListener()
, _prop(property)
, _mousePressed(false)
, _mouseDownPosition(0, 0)
, _originalIntensityDomain(0.f, 1.f)
{
tgtAssert(_prop != 0, "Assigned property must not be 0.");
}
......
......@@ -33,64 +33,7 @@
#include "tgt/logmanager.h"
#include "tgt/types.h"
/// Anonymous namespace for templated endian swapping helper methods
namespace {
// template
template<typename T, size_t N>
struct SwapHelper {
static inline T swap(T value) {
LERRORC("CAMPVis.Tools.EndianHelper", "Tried to call SwapHelper<T,N>::swap() with unsupported template arguments.");
return value;
}
};
template<typename T>
struct SwapHelper<T, 2> {
static inline T swap(T value) {
return (value>>8) | (value<<8);
}
};
template<typename T>
struct SwapHelper<T, 4> {
static inline T swap(T value) {
return (value>>24) |
((value<<8) & 0x00FF0000) |
((value>>8) & 0x0000FF00) |
(value<<24);
}
};
template<>
struct SwapHelper<float, 4> {
static inline float swap(float value) {
uint32_t tmp = SwapHelper<uint32_t, 4>::swap(*reinterpret_cast<uint32_t*>(&value));
return (*reinterpret_cast<float*>(&tmp));
}
};
template<typename T>
struct SwapHelper<T, 8> {
static inline T swap(T value) {
return (value>>56) |
((value<<40) & 0x00FF000000000000) |
((value<<24) & 0x0000FF0000000000) |
((value<<8) & 0x000000FF00000000) |
((value>>8) & 0x00000000FF000000) |
((value>>24) & 0x0000000000FF0000) |
((value>>40) & 0x000000000000FF00) |
(value<<56);
}
};
template<>
struct SwapHelper<double, 8> {
static inline double swap(double value) {
uint64_t tmp = SwapHelper<uint64_t, 4>::swap(*reinterpret_cast<uint64_t*>(&value));
return (*reinterpret_cast<double*>(&tmp));
}
};
}
#include <utility>
namespace campvis {
......@@ -117,13 +60,15 @@ namespace campvis {
}
/**
* Performs endian-swapping of \a value in respect of its size.
* \param value Value to perform endian-swapping on.
* \return Endian-swapped version of \a value.
* Performs in-place endian-swapping of value pointed to by \a value, supposing its size to be \a N bytes.
* \param value Pointer to the value to be endian-swapped.
* \tparam N Number of bytes of the value to be swapped.
*/
template<typename T>
static inline T swapEndian(T value) {
return SwapHelper<T, sizeof(T)>::swap(value);
template<size_t N>
static inline void swapEndian(char* value) {
for (size_t i = 0; i < N/2; ++i) {
std::swap(value[i], value[N-i-1]);
}
}
};
......
......@@ -41,7 +41,8 @@ namespace tgt {
}
void GlContextManager::releaseCurrentContext() {
glFinish();
if (_currentContext != 0)
glFinish();
setCurrent(0);
}
......
......@@ -2,7 +2,7 @@
* *
* tgt - Tiny Graphics Toolbox *
* *
* Copyright (C) 2006-2011 Visualization and Computer Graphics Group, *
* Copyright (C) 2005-2013 Visualization and Computer Graphics Group, *
* Department of Computer Science, University of Muenster, Germany. *
* <http://viscg.uni-muenster.de> *
* *
......@@ -504,12 +504,12 @@ struct Matrix4 {
return result;
}
/// Return the main diagonal of the upper left 3x3-submatrix
/// Returns a vector representing the scaling applied to unit vectors by this matrix.
Vector3<T> getScalingPart() const {
Vector3<T> result(T(0));
result.elem[0] = t00;
result.elem[1] = t11;
result.elem[2] = t22;
result.elem[0] = length(Vector3<T>(t00, t10, t20));
result.elem[1] = length(Vector3<T>(t01, t11, t21));
result.elem[2] = length(Vector3<T>(t02, t12, t22));
return result;
}
/*
......@@ -690,6 +690,10 @@ typedef Matrix2f mat2;
typedef Matrix3f mat3;
typedef Matrix4f mat4;
typedef Matrix2f dmat2;
typedef Matrix3f dmat3;
typedef Matrix4f dmat4;
#ifdef DLL_TEMPLATE_INST
template struct TGT_API Matrix2<float>;
template struct TGT_API Matrix3<float>;
......
......@@ -48,6 +48,11 @@ namespace campvis {
return *_singleton;
}
void PipelineFactory::deinit() {
delete _singleton;
}
std::vector<std::string> PipelineFactory::getRegisteredPipelines() const {
tbb::spin_mutex::scoped_lock lock(_mutex);
......
......@@ -59,6 +59,8 @@ namespace campvis {
* \return *_singleton
*/
static PipelineFactory& getRef();
static void deinit();
std::vector<std::string> getRegisteredPipelines() const;
......
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