tumvis.cpp 1.72 KB
Newer Older
schultezub's avatar
schultezub committed
1
#include "tgt/camera.h"
2
3
#include "tgt/exception.h"
#include "tgt/shadermanager.h"
schultezub's avatar
schultezub committed
4
5
6
#include "tgt/qt/qtapplication.h"
#include "tgt/qt/qtcanvas.h"

schultezub's avatar
schultezub committed
7
8
#include "tbb/include/tbb/task_scheduler_init.h"

schultezub's avatar
schultezub committed
9
#include "tumvispainter.h"
schultezub's avatar
schultezub committed
10
11
#include "modules/pipelines/slicevis.h"

schultezub's avatar
schultezub committed
12

13
using namespace TUMVis;
schultezub's avatar
schultezub committed
14

schultezub's avatar
schultezub committed
15
16
17
18
19
20
21
/**
 * TUMVis main function, application entry point
 *
 * \param   argc    number of passed arguments
 * \param   argv    vector of arguments
 * \return  0 if program exited successfully
 **/
22
23
24
int main(int argc, char** argv) {  
    tgt::QtApplication* app = new tgt::QtApplication(argc, argv);
    tgt::QtCanvas* canvas = new tgt::QtCanvas("TUMVis");
25
    SliceVis* sliceVis = 0;
schultezub's avatar
schultezub committed
26

schultezub's avatar
schultezub committed
27
    tbb::task_scheduler_init init;
28
    app->addCanvas(canvas);  
schultezub's avatar
schultezub committed
29
    app->init();
30
    LogMgr.getConsoleLog()->addCat("", true);
31
32
33
34
35
36
37
38

    if (argc > 0) {
        // ugly hack
        std::string programPath(argv[0]);
        programPath = tgt::FileSystem::parentDir(tgt::FileSystem::parentDir(tgt::FileSystem::parentDir(programPath)));
        ShdrMgr.addPath(programPath);
        ShdrMgr.addPath(programPath + "/core/glsl");
    }
schultezub's avatar
schultezub committed
39

40
    tgt::Camera camera;  
schultezub's avatar
schultezub committed
41
42
    canvas->setCamera(&camera); 
    TumVisPainter* painter;
schultezub's avatar
schultezub committed
43

44
    try {
schultezub's avatar
schultezub committed
45
46
47
48
        sliceVis = new SliceVis();
        painter = new TumVisPainter(canvas, sliceVis);
        canvas->setPainter(painter);
        sliceVis->init();
49
50
51
52
53
54
55
    }
    catch (tgt::Exception& e) {
        LERRORC("main.cpp", "Encountered tgt::Exception: " << e.what());
    }
    catch (std::exception& e) {
        LERRORC("main.cpp", "Encountered std::exception: " << e.what());
    }
schultezub's avatar
schultezub committed
56

57
    app->run();
schultezub's avatar
schultezub committed
58

schultezub's avatar
schultezub committed
59
    delete painter;
60
61
    delete sliceVis;
    delete canvas;
62
    delete app;  
schultezub's avatar
schultezub committed
63

64
    return 0;  
schultezub's avatar
schultezub committed
65
}