Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit 665dcf97 authored by schultezub's avatar schultezub
Browse files

more work on Virtual Mirror implementation

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@288 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 68559ca3
......@@ -56,16 +56,16 @@ namespace TUMVis {
, selected_(0)
, fullscreen_(false)
{
makeCurrent();
// Init GLEW for this context
GLenum err = glewInit();
if (err != GLEW_OK) {
// Problem: glewInit failed, something is seriously wrong.
tgtAssert(false, "glewInit failed");
std::cerr << "glewInit failed, error: " << glewGetErrorString(err) << std::endl;
exit(EXIT_FAILURE);
}
makeCurrent();
// Init GLEW for this context
GLenum err = glewInit();
if (err != GLEW_OK) {
// Problem: glewInit failed, something is seriously wrong.
tgtAssert(false, "glewInit failed");
std::cerr << "glewInit failed, error: " << glewGetErrorString(err) << std::endl;
exit(EXIT_FAILURE);
}
}
DataContainerInspectorCanvas::~DataContainerInspectorCanvas() {
......@@ -77,6 +77,8 @@ namespace TUMVis {
_paintShader = ShdrMgr.loadSeparate("core/glsl/passthrough.vert", "application/glsl/datacontainerinspector.frag", "", false);
_paintShader->setAttributeLocation(0, "in_Position");
_paintShader->setAttributeLocation(1, "in_TexCoords");
setPainter(this, false);
}
void DataContainerInspectorCanvas::deinit() {
......@@ -115,10 +117,11 @@ namespace TUMVis {
// check whether DataHandle is already existing
std::map<std::string, const DataHandle*>::iterator lb = _handles.lower_bound(name);
if (lb == _handles.end() || lb->first != name) {
// not existant
// not existant -> insert
_handles.insert(std::make_pair(name, new DataHandle(*dh)));
}
else {
// existant -> replace
delete lb->second;
lb->second = new DataHandle(*dh);
}
......@@ -168,16 +171,6 @@ namespace TUMVis {
else
setWindowTitle(title);*/
// render port contents
// glMatrixMode(GL_PROJECTION);
// glPushMatrix();
// glOrtho(0, size_.x, 0, size_.y, -1, 1);
//
// glMatrixMode(GL_MODELVIEW);
// glPushMatrix();
// glLoadIdentity();
LGL_ERROR;
// update layout dimensions
dimX_ = (int)ceil(sqrt((float)textures.size()));
dimY_ = ceil((float)textures.size() / dimX_);
......@@ -251,4 +244,8 @@ namespace TUMVis {
_quad->createGLBuffers();
}
void DataContainerInspectorCanvas::sizeChanged(const tgt::ivec2&) {
invalidate();
}
}
\ No newline at end of file
......@@ -50,7 +50,7 @@ namespace TUMVis {
class DataHandle;
class FaceGeometry;
class DataContainerInspectorCanvas : public tgt::QtThreadedCanvas, public sigslot::has_slots<> {
class DataContainerInspectorCanvas : public tgt::QtThreadedCanvas, tgt::Painter, public sigslot::has_slots<> {
Q_OBJECT;
public:
......@@ -94,6 +94,9 @@ namespace TUMVis {
*/
void paint();
/// This is meant be overridden to adjust camera settings to new canvas dimensions
virtual void sizeChanged(const tgt::ivec2&);
private slots:
protected:
......
......@@ -158,7 +158,7 @@ namespace TUMVis {
}
}
else {
tgtAssert(false, "Specified context not found. Context must be registered before they can have jobs.");
tgtAssert(false, "Specified context not found. Contexts must be registered before they can have jobs.");
}
_evaluationCondition.notify_all();
......
......@@ -161,6 +161,14 @@ void Navigation::setSceneBounds(const tgt::Bounds& bounds) {
hcam_->update();
}
void Navigation::updateClippingPlanes() {
float diag = tgt::length(_sceneBounds.diagonal()) * 0.75f;
float dist = tgt::distance(getCamera()->getPosition(), _sceneBounds.center());
getCamera()->setNearDist(std::max(dist - diag, 0.1f));
getCamera()->setFarDist(diag + 2 * dist);
}
/***********************************************************************
/// This can be used to look around the scene with the help of a mouse. Middle is used
......
......@@ -79,12 +79,7 @@ protected:
* Updates the near-/far clipping planes.
* Does not issue an update command to the camera.
*/
void updateClippingPlanes() {
float diag = tgt::length(_sceneBounds.diagonal()) * 0.75f;
float dist = tgt::distance(getCamera()->getPosition(), _sceneBounds.center());
getCamera()->setNearDist(std::max(dist - diag, 0.1f));
getCamera()->setFarDist(diag + dist);
};
void updateClippingPlanes();;
Bounds _sceneBounds;
......
......@@ -43,6 +43,7 @@ namespace TUMVis {
, _vmgGenerator()
, _vmRenderer(_renderTargetSize)
, _eepGenerator(_renderTargetSize)
, _vmEepGenerator(_renderTargetSize)
, _drrraycater(_renderTargetSize)
, _simpleRaycaster(_renderTargetSize)
, _clRaycaster(_renderTargetSize)
......@@ -58,6 +59,7 @@ namespace TUMVis {
_processors.push_back(&_vmgGenerator);
_processors.push_back(&_vmRenderer);
_processors.push_back(&_eepGenerator);
_processors.push_back(&_vmEepGenerator);
_processors.push_back(&_drrraycater);
_processors.push_back(&_simpleRaycaster);
_processors.push_back(&_clRaycaster);
......@@ -73,6 +75,7 @@ namespace TUMVis {
_camera.addSharedProperty(&_vmgGenerator._camera);
_camera.addSharedProperty(&_vmRenderer._camera);
_camera.addSharedProperty(&_eepGenerator._camera);
_camera.addSharedProperty(&_vmEepGenerator._camera);
_camera.addSharedProperty(&_drrraycater._camera);
_camera.addSharedProperty(&_simpleRaycaster._camera);
_camera.addSharedProperty(&_clRaycaster._camera);
......@@ -90,13 +93,23 @@ namespace TUMVis {
_clRaycaster._sourceImageID.setValue("clr.input");
_eepGenerator._sourceImageID.setValue("eep.input");
_vmEepGenerator._sourceImageID.setValue("eep.input");
_pgGenerator._sourceImageID.setValue("eep.input");
_vmRenderer._renderTargetID.connect(&_vmEepGenerator._maskID);
_vmEepGenerator._entryImageID.setValue("vm.eep.entry");
_vmEepGenerator._exitImageID.setValue("vm.eep.exit");
_vmEepGenerator._applyMask.setValue(true);
_vmEepGenerator._enableMirror.setValue(true);
_renderTargetID.setValue("eep.entry");
_pgGenerator._geometryID.connect(&_eepGenerator._geometryID);
_vmgGenerator._mirrorID.connect(&_eepGenerator._mirrorID);
_pgGenerator._geometryID.connect(&_vmEepGenerator._geometryID);
_vmgGenerator._mirrorID.connect(&_vmEepGenerator._mirrorID);
_vmgGenerator._mirrorID.connect(&_vmRenderer._geometryID);
_vmgGenerator._mirrorCenter.setValue(tgt::vec3(0.f, 0.f, -20.f));
_vmgGenerator._poi.setValue(tgt::vec3(40.f, 40.f, 40.f));
_vmgGenerator._size.setValue(60.f);
_eepGenerator._entryImageID.connect(&_drrraycater._entryImageID);
_eepGenerator._entryImageID.connect(&_simpleRaycaster._entryImageID);
......@@ -111,6 +124,7 @@ namespace TUMVis {
_vmRenderer.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_pgGenerator.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_eepGenerator.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_vmEepGenerator.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_drrraycater.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_simpleRaycaster.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_clRaycaster.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
......@@ -163,6 +177,9 @@ namespace TUMVis {
if (! _eepGenerator.getInvalidationLevel().isValid()) {
lockGLContextAndExecuteProcessor(&_eepGenerator);
}
if (! _vmEepGenerator.getInvalidationLevel().isValid()) {
lockGLContextAndExecuteProcessor(&_vmEepGenerator);
}
if (!_drrraycater.getInvalidationLevel().isValid()) {
lockGLContextAndExecuteProcessor(&_drrraycater);
}
......
......@@ -75,6 +75,7 @@ namespace TUMVis {
VirtualMirrorGeometryGenerator _vmgGenerator;
GeometryRenderer _vmRenderer;
EEPGenerator _eepGenerator;
EEPGenerator _vmEepGenerator;
DRRRaycaster _drrraycater;
SimpleRaycaster _simpleRaycaster;
CLRaycaster _clRaycaster;
......
......@@ -119,13 +119,13 @@ namespace TUMVis {
// mirror matrix sponsored by:
// Jiang
mirrorMatrix = tgt::mat4(
mirrorMatrix = tgt::transpose(tgt::mat4(
1 - 2*n.x*n.x, -2*n.y*n.x , -2*n.z*n.x , 0,
-2*n.x*n.y , 1 - 2*n.y*n.y, -2*n.z*n.y , 0,
-2*n.x*n.z , -2*n.y*n.z , 1 - 2*n.z*n.z, 0,
2*n.x*k , 2*n.y*k , 2*n.z*k , 1);
2*n.x*k , 2*n.y*k , 2*n.z*k , 1));
// TODO: double check, whether matrix transpose is necessary
// TODO: double check, whether matrix transpose is necessary, and if so, hardcode it
}
else {
LERROR("No suitable virtual mirror geometry found.");
......
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