Commit 9d031b9a authored by schultezub's avatar schultezub
Browse files

introducing TUMVis

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@161 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 15a01b25
......@@ -13,6 +13,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
OPTION(TUMVIS_SHARED_LIBS "Build shared libraries?" ON )
OPTION(TUMVIS_PRECOMPILED_HEADER "Use pre-compiled headers?" ON )
OPTION(TUMVIS_DEBUG "Activate debug code?" ON )
OPTION(TUMVIS_BUILD_CORE "Build TUMVis Core" ON )
OPTION(TUMVIS_BUILD_LIB_TGT "Build TGT Library" ON )
IF(WIN32)
......@@ -31,6 +32,10 @@ IF(TUMVIS_BUILD_LIB_TGT)
ADD_SUBDIRECTORY(ext/tgt)
ENDIF()
IF(TUMVIS_BUILD_CORE)
ADD_SUBDIRECTORY(core)
ENDIF()
#
# Copy External DLLs
#
......
......@@ -59,7 +59,7 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${TUMVIS_HOME}/bin")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${TUMVIS_HOME}/bin")
# common include directories
LIST(APPEND TUMVIS_INCLUDE_DIRECTORIES "${TUMVIS_HOME}" "${TUMVIS_HOME}/ext")
LIST(APPEND TUMVIS_INCLUDE_DIRECTORIES "${TUMVIS_HOME}/core" "${TUMVIS_HOME}/ext" "${TUMVIS_HOME}/tools")
LIST(APPEND TUMVIS_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
# platform-dependent configuration
......@@ -79,6 +79,7 @@ IF(WIN32)
# C4390: ';' : empty controlled statement found; is this the intent?
# occurs when OpenGL error logging macros are disabled
#LIST(APPEND TUMVIS_DEFINITIONS /wd4305 /wd4800 /wd4290 /wd4068 /wd4251 /wd4355 /wd4390)
LIST(APPEND TUMVIS_DEFINITIONS /wd4290 /wd4390)
# enable parallel builds in Visual Studio
LIST(APPEND TUMVIS_DEFINITIONS /MP)
......
PROJECT(tumvis-core)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
INCLUDE(../cmake/commonconf.cmake)
MESSAGE(STATUS "Configuring TUMVis Core")
SET(TUMVIS_CORE_SOURCES
application/tumvis.cpp
application/tumvispainter.cpp
)
SET(TUMVIS_CORE_HEADERS
application/tumvispainter.h
)
#
# Qt related stuff:
#
FIND_PACKAGE(Qt4 ${TUMVIS_REQUIRED_QT_VERSION} REQUIRED QtCore QtGui QtOpenGL)
#QT4_WRAP_CPP(TUMVIS_CORE_MOC ${TUMVIS_CORE_HEADERS})
INCLUDE(${QT_USE_FILE})
ADD_EXECUTABLE(tumvis-core
${TUMVIS_CORE_SOURCES} ${TUMVIS_CORE_HEADERS}
# ${TUMVIS_CORE_MOC}
)
ADD_DEFINITIONS(${TUMVIS_DEFINITIONS} ${QT_DEFINITIONS})
INCLUDE_DIRECTORIES(${TUMVIS_INCLUDE_DIRECTORIES})
TARGET_LINK_LIBRARIES(tumvis-core tgt ${QT_LIBRARIES})
#include "tgt/camera.h"
#include "tgt/qt/qtapplication.h"
#include "tgt/qt/qtcanvas.h"
#include "tumvispainter.h"
namespace TUMVis {
int main(int argc, char** argv) {
tgt::QtApplication* app = new tgt::QtApplication(argc, argv);
tgt::QtCanvas* canvas = new tgt::QtCanvas("TUMVis");
app->addCanvas(canvas);
app->init();
tgt::Camera camera;
canvas->setCamera(&camera);
TumVisPainter painter(canvas);
canvas->setPainter(&painter);
app->run();
delete canvas;
delete app;
return 0;
}
}
#include "tumvispainter.h"
#include "tgt/camera.h"
#include "tgt/quadric.h"
namespace TUMVis {
const std::string TumVisPainter::loggerCat_ = "TUMVis.core.TumVisPainter";
TumVisPainter::TumVisPainter(tgt::GLCanvas* canvas)
: tgt::Painter(canvas) {
}
void TumVisPainter::paint() {
// Put TUMVis rendering pipeline evaluation inside
// Some Dummy rendering:
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
getCamera()->look();
glColor3f(1.f, 0.f, 0.f);
tgt::Sphere sphere(1.f, 64, 32);
sphere.render();
}
void TumVisPainter::sizeChanged(const tgt::ivec2& size) {
if (getCanvas()) {
getCanvas()->getGLFocus();
}
glViewport(0, 0, size.x, size.y);
}
void TumVisPainter::init() {
if (getCanvas()) {
getCanvas()->getGLFocus();
}
else {
LWARNING("initialize(): No canvas");
}
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
getCamera()->setPosition(tgt::vec3(0.f,0.f,2.f));
/*
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glDisable(GL_CULL_FACE);
glCullFace(GL_BACK);*/
}
}
\ No newline at end of file
#include "tgt/logmanager.h"
#include "tgt/glcanvas.h"
#include "tgt/painter.h"
namespace TUMVis {
/**
*
**/
class TumVisPainter : public tgt::Painter {
public:
TumVisPainter(tgt::GLCanvas* canvas);
virtual void paint();
virtual void sizeChanged(const tgt::ivec2& size);
virtual void init();
private:
static const std::string loggerCat_;
};
}
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