Commit 533d5618 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Changed all occurences of tgt in code to cgt.

refs #386
parent 760e01f1
......@@ -17,7 +17,7 @@ OPTION(CAMPVIS_BUILD_APPLICATION "Build CAMPVis Application"
OPTION(CAMPVIS_BUILD_CORE "Build CAMPVis Core" ON)
OPTION(CAMPVIS_BUILD_MODULES "Build CAMPVis Modules" ON)
OPTION(CAMPVIS_ENABLE_SCRIPTING "Add support for scripting CAMPVis using Lua" OFF)
OPTION(CAMPVIS_BUILD_LIB_TGT "Build TGT Library" ON)
OPTION(CAMPVIS_BUILD_LIB_CGT "Build CGT Library" ON)
OPTION(CAMPVIS_BUILD_LIB_LUA "Build Lua Library" OFF)
OPTION(CAMPVIS_BUILD_DOXYGEN "Build Doxygen Documentation" OFF)
......@@ -43,7 +43,7 @@ include(cmake/parseModulesDir.cmake)
MESSAGE(STATUS "--------------------------------------------------------------------------------")
IF(CAMPVIS_BUILD_LIB_TGT)
IF(CAMPVIS_BUILD_LIB_CGT)
ADD_SUBDIRECTORY(ext/cgt)
ADD_SUBDIRECTORY(ext/sigslot)
ENDIF()
......
......@@ -97,7 +97,7 @@ LIST(APPEND CampvisApplicationSources ${CampvisApplicationFormsHeaders})
LINK_DIRECTORIES(${CampvisGlobalLinkDirectories} ${CampvisModulesLinkDirectories})
SET(CampvisMainLibs campvis-core campvis-modules tgt sigslot)
SET(CampvisMainLibs campvis-core campvis-modules cgt sigslot)
IF(CAMPVIS_ENABLE_SCRIPTING)
LIST(APPEND CampvisMainLibs campvis-scripting)
......
......@@ -75,14 +75,14 @@ namespace campvis {
sigslot::signal_manager::init();
sigslot::signal_manager::getRef().start();
tgt::GlContextManager::init();
cgt::GlContextManager::init();
OpenGLJobProcessor::init();
SimpleJobProcessor::init();
QtJobProcessor::init();
}
CampVisApplication::~CampVisApplication() {
tgtAssert(_initialized == false, "Destructing initialized CampVisApplication, deinitialize first!");
cgtAssert(_initialized == false, "Destructing initialized CampVisApplication, deinitialize first!");
// delete everything in the right order:
for (std::vector<PipelineRecord>::iterator it = _pipelines.begin(); it != _pipelines.end(); ++it) {
......@@ -98,20 +98,20 @@ namespace campvis {
}
void CampVisApplication::init() {
tgtAssert(_initialized == false, "Tried to initialize CampVisApplication twice.");
cgtAssert(_initialized == false, "Tried to initialize CampVisApplication twice.");
// Init TGT
tgt::InitFeature::Features featureset = tgt::InitFeature::ALL;
tgt::init(featureset);
// Init CGT
cgt::InitFeature::Features featureset = cgt::InitFeature::ALL;
cgt::init(featureset);
LogMgr.getConsoleLog()->addCat("", true);
_mainWindow = new MainWindow(this);
// create a local OpenGL context and init GL
_localContext = new QtThreadedCanvas("", tgt::ivec2(16, 16));
tgt::GlContextManager::getRef().registerContextAndInitGlew(_localContext, "Local Context");
_localContext = new QtThreadedCanvas("", cgt::ivec2(16, 16));
cgt::GlContextManager::getRef().registerContextAndInitGlew(_localContext, "Local Context");
tgt::initGL(featureset);
cgt::initGL(featureset);
ShdrMgr.setDefaultGlslVersion("330");
LGL_ERROR;
......@@ -120,11 +120,11 @@ namespace campvis {
if (_argc > 0) {
// ugly hack
std::string basePath(_argv[0]);
basePath = tgt::FileSystem::parentDir(basePath);
basePath = cgt::FileSystem::parentDir(basePath);
ShdrMgr.addPath(basePath);
ShdrMgr.addPath(basePath + "/core/glsl");
basePath = tgt::FileSystem::parentDir(tgt::FileSystem::parentDir(basePath));
basePath = cgt::FileSystem::parentDir(cgt::FileSystem::parentDir(basePath));
ShdrMgr.addPath(basePath);
ShdrMgr.addPath(basePath + "/core/glsl");
......@@ -142,17 +142,17 @@ namespace campvis {
// ensure matching OpenGL specs
LINFO("Using Graphics Hardware " << GpuCaps.getVendorAsString() << " " << GpuCaps.getGlRendererString() << " on " << GpuCaps.getOSVersionString());
LINFO("Supported OpenGL " << GpuCaps.getGlVersion() << ", GLSL " << GpuCaps.getShaderVersion());
if (GpuCaps.getGlVersion() < tgt::GpuCapabilities::GlVersion::TGT_GL_VERSION_3_3) {
if (GpuCaps.getGlVersion() < cgt::GpuCapabilities::GlVersion::CGT_GL_VERSION_3_3) {
LERROR("Your system does not support OpenGL 3.3, which is mandatory. CAMPVis will probably not work as intended.");
}
if (GpuCaps.getShaderVersion() < tgt::GpuCapabilities::GlVersion::SHADER_VERSION_330) {
if (GpuCaps.getShaderVersion() < cgt::GpuCapabilities::GlVersion::SHADER_VERSION_330) {
LERROR("Your system does not support GLSL Shader Version 3.30, which is mandatory. CAMPVis will probably not work as intended.");
}
// load textureData from file
tgt::TextureReaderTga trt;
_errorTexture = trt.loadTexture(ShdrMgr.completePath("application/data/no_input.tga"), tgt::Texture::LINEAR);
cgt::TextureReaderTga trt;
_errorTexture = trt.loadTexture(ShdrMgr.completePath("application/data/no_input.tga"), cgt::Texture::LINEAR);
#ifdef CAMPVIS_HAS_SCRIPTING
......@@ -167,7 +167,7 @@ namespace campvis {
// Load CAMPVis' core Lua module to have SWIG glue for AutoEvaluationPipeline available
if (! _luaVmState->execString("require(\"campvis\")"))
LERROR("Error setting up Lua VM.");
if (! _luaVmState->execString("require(\"tgt\")"))
if (! _luaVmState->execString("require(\"cgt\")"))
LERROR("Error setting up Lua VM.");
if (! _luaVmState->execString("pipelines = {}"))
......@@ -194,7 +194,7 @@ namespace campvis {
}
void CampVisApplication::deinit() {
tgtAssert(_initialized, "Tried to deinitialize uninitialized CampVisApplication.");
cgtAssert(_initialized, "Tried to deinitialize uninitialized CampVisApplication.");
// Stop all pipeline threads.
for (std::vector<PipelineRecord>::iterator it = _pipelines.begin(); it != _pipelines.end(); ++it) {
......@@ -203,7 +203,7 @@ namespace campvis {
{
// Deinit everything OpenGL related using the local context.
tgt::GLContextScopedLock lock(_localContext);
cgt::GLContextScopedLock lock(_localContext);
delete _errorTexture;
......@@ -216,8 +216,8 @@ namespace campvis {
_mainWindow->deinit();
QuadRenderer::deinit();
// deinit OpenGL and tgt
tgt::deinitGL();
// deinit OpenGL and cgt
cgt::deinitGL();
}
// MainWindow dtor needs a valid CampVisApplication, so we need to call it here instead of during destruction.
......@@ -227,8 +227,8 @@ namespace campvis {
OpenGLJobProcessor::deinit();
SimpleJobProcessor::deinit();
tgt::GlContextManager::deinit();
tgt::deinit();
cgt::GlContextManager::deinit();
cgt::deinit();
PropertyWidgetFactory::deinit();
ImageRepresentationConverter::deinit();
......@@ -238,10 +238,10 @@ namespace campvis {
}
int CampVisApplication::run() {
tgtAssert(_initialized, "Tried to run uninitialized CampVisApplication.");
cgtAssert(_initialized, "Tried to run uninitialized CampVisApplication.");
// disconnect OpenGL context from this thread so that the other threads can acquire an OpenGL context.
//tgt::GlContextManager::getRef().releaseCurrentContext();
//cgt::GlContextManager::getRef().releaseCurrentContext();
_mainWindow->show();
......@@ -252,10 +252,10 @@ namespace campvis {
}
void CampVisApplication::addPipeline(const std::string& name, AbstractPipeline* pipeline) {
tgtAssert(pipeline != 0, "Pipeline must not be 0.");
cgtAssert(pipeline != 0, "Pipeline must not be 0.");
// create canvas and painter for the pipeline and connect all together
tgt::QtThreadedCanvas* canvas = new tgt::QtThreadedCanvas("CAMPVis", tgt::ivec2(512, 512));
cgt::QtThreadedCanvas* canvas = new cgt::QtThreadedCanvas("CAMPVis", cgt::ivec2(512, 512));
canvas->init();
CampVisPainter* painter = new CampVisPainter(canvas, pipeline);
......@@ -284,8 +284,8 @@ namespace campvis {
pipeline->start();
}
void CampVisApplication::initGlContextAndPipeline(tgt::GLCanvas* canvas, AbstractPipeline* pipeline) {
tgt::GlContextManager::getRef().registerContextAndInitGlew(canvas, pipeline->getName());
void CampVisApplication::initGlContextAndPipeline(cgt::GLCanvas* canvas, AbstractPipeline* pipeline) {
cgt::GlContextManager::getRef().registerContextAndInitGlew(canvas, pipeline->getName());
pipeline->init();
LGL_ERROR;
......@@ -300,7 +300,7 @@ namespace campvis {
}
void CampVisApplication::registerDockWidget(Qt::DockWidgetArea area, QDockWidget* dock) {
tgtAssert(dock != 0, "Dock widget must not be 0.");
cgtAssert(dock != 0, "Dock widget must not be 0.");
_mainWindow->addDockWidget(area, dock);
}
......
......@@ -40,7 +40,7 @@
#include "scripting/glue/luavmstate.h"
#endif
namespace tgt {
namespace cgt {
class GLCanvas;
class QtThreadedCanvas;
class Texture;
......@@ -88,13 +88,13 @@ namespace campvis {
~CampVisApplication();
/**
* Initializes tgt, OpenGL, and all pipelines, evaluators and painters.
* Initializes cgt, OpenGL, and all pipelines, evaluators and painters.
* Make sure to have everything setup before calling init().
*/
void init();
/**
* Deinitializes tgt, OpenGL, and all pipelines, evaluators and painters.
* Deinitializes cgt, OpenGL, and all pipelines, evaluators and painters.
*/
void deinit();
......@@ -153,7 +153,7 @@ namespace campvis {
sigslot::signal0 s_DataContainersChanged;
private:
void initGlContextAndPipeline(tgt::GLCanvas* canvas, AbstractPipeline* pipeline);
void initGlContextAndPipeline(cgt::GLCanvas* canvas, AbstractPipeline* pipeline);
/// All pipelines
......@@ -171,12 +171,12 @@ namespace campvis {
void triggerShaderRebuild();
/// A local OpenGL context used for initialization
tgt::GLCanvas* _localContext;
cgt::GLCanvas* _localContext;
/// Main window hosting GUI stuff
MainWindow* _mainWindow;
/// Error texture to show if there is no output found
tgt::Texture* _errorTexture;
cgt::Texture* _errorTexture;
/// the global LuaVmState of this application
LuaVmState* _luaVmState;
......
......@@ -42,13 +42,13 @@
namespace campvis {
const std::string CampVisPainter::loggerCat_ = "CAMPVis.core.CampVisPainter";
CampVisPainter::CampVisPainter(tgt::GLCanvas* canvas, AbstractPipeline* pipeline)
: tgt::Painter(canvas)
CampVisPainter::CampVisPainter(cgt::GLCanvas* canvas, AbstractPipeline* pipeline)
: cgt::Painter(canvas)
, _pipeline(nullptr)
, _copyShader(nullptr)
, _errorTexture(nullptr)
{
tgtAssert(getCanvas() != nullptr, "The given canvas must not be 0!");
cgtAssert(getCanvas() != nullptr, "The given canvas must not be 0!");
setPipeline(pipeline);
}
......@@ -65,7 +65,7 @@ namespace campvis {
return;
}
const tgt::ivec2& size = getCanvas()->getSize();
const cgt::ivec2& size = getCanvas()->getSize();
glViewport(0, 0, size.x, size.y);
// try get Data
......@@ -75,14 +75,14 @@ namespace campvis {
// activate the shader
_copyShader->activate();
tgt::Shader::IgnoreUniformLocationErrorGuard guard(_copyShader);
cgt::Shader::IgnoreUniformLocationErrorGuard guard(_copyShader);
// render whatever there is to render
if (rd != nullptr || (repGL != nullptr && repGL->getDimensionality() == 2)) {
_copyShader->setUniform("_viewMatrix", tgt::mat4::identity);
_copyShader->setUniform("_viewMatrix", cgt::mat4::identity);
// bind input textures
tgt::TextureUnit colorUnit;
cgt::TextureUnit colorUnit;
if (rd)
rd->bindColorTexture(_copyShader, colorUnit);
else if (repGL)
......@@ -94,11 +94,11 @@ namespace campvis {
// if there is nothing to render, render the error texture
else if (_errorTexture != nullptr) {
float ratioRatio = static_cast<float>(size.y) / size.x;
tgt::mat4 viewMatrix = (ratioRatio > 1) ? tgt::mat4::createScale(tgt::vec3(1.f, 1.f / ratioRatio, 1.f)) : tgt::mat4::createScale(tgt::vec3(ratioRatio, 1.f, 1.f));
cgt::mat4 viewMatrix = (ratioRatio > 1) ? cgt::mat4::createScale(cgt::vec3(1.f, 1.f / ratioRatio, 1.f)) : cgt::mat4::createScale(cgt::vec3(ratioRatio, 1.f, 1.f));
_copyShader->setUniform("_viewMatrix", viewMatrix);
// bind input textures
tgt::TextureUnit colorUnit;
cgt::TextureUnit colorUnit;
colorUnit.activate();
_errorTexture->bind();
_copyShader->setUniform("_colorTexture", colorUnit.getUnitNumber());
......@@ -116,7 +116,7 @@ namespace campvis {
getCanvas()->swap();
}
void CampVisPainter::sizeChanged(const tgt::ivec2& size) {
void CampVisPainter::sizeChanged(const cgt::ivec2& size) {
_pipeline->setRenderTargetSize(size);
}
......@@ -126,8 +126,8 @@ namespace campvis {
_copyShader->setAttributeLocation(0, "in_Position");
_copyShader->setAttributeLocation(1, "in_TexCoords");
}
catch (tgt::Exception& e) {
LFATAL("Encountered tgt::Exception: " << e.what());
catch (cgt::Exception& e) {
LFATAL("Encountered cgt::Exception: " << e.what());
}
}
......@@ -142,7 +142,7 @@ namespace campvis {
}
void CampVisPainter::setPipeline(AbstractPipeline* pipeline) {
tgtAssert(pipeline != nullptr, "The given pipeline must not be 0.");
cgtAssert(pipeline != nullptr, "The given pipeline must not be 0.");
if (_pipeline != nullptr) {
if (getCanvas()->getEventHandler() != nullptr)
......@@ -159,12 +159,12 @@ namespace campvis {
// do nothing, as the painting is entirely managed by the pipeline.
}
void CampVisPainter::setCanvas(tgt::GLCanvas* canvas) {
tgtAssert(dynamic_cast<tgt::QtThreadedCanvas*>(canvas) != nullptr, "Canvas must be of type QtThreadedCanvas!");
void CampVisPainter::setCanvas(cgt::GLCanvas* canvas) {
cgtAssert(dynamic_cast<cgt::QtThreadedCanvas*>(canvas) != nullptr, "Canvas must be of type QtThreadedCanvas!");
Painter::setCanvas(canvas);
}
void CampVisPainter::setErrorTexture(tgt::Texture* texture) {
void CampVisPainter::setErrorTexture(cgt::Texture* texture) {
_errorTexture = texture;
}
......
......@@ -33,7 +33,7 @@
#include "cgt/logmanager.h"
#include "cgt/painter.h"
namespace tgt {
namespace cgt {
class Shader;
class QtThreadedCanvas;
class Texture;
......@@ -45,14 +45,14 @@ namespace campvis {
/**
* Painter class for CAMPVis, rendering the render target of an AbstractPipeline.
*/
class CampVisPainter : public tgt::Painter, public sigslot::has_slots {
class CampVisPainter : public cgt::Painter, public sigslot::has_slots {
public:
/**
* Creates a new CampVisPainter rendering the render target of \a pipeline on \a canvas.
* \param canvas Canvas to render on
* \param pipeline Pipeline to render
*/
CampVisPainter(tgt::GLCanvas* canvas, AbstractPipeline* pipeline);
CampVisPainter(cgt::GLCanvas* canvas, AbstractPipeline* pipeline);
/**
* Destructor, stops and waits for the rendering thread if it's still running.
......@@ -64,8 +64,8 @@ namespace campvis {
*/
virtual void repaint();
/// \see tgt::Painter::sizeChanged
virtual void sizeChanged(const tgt::ivec2& size);
/// \see cgt::Painter::sizeChanged
virtual void sizeChanged(const cgt::ivec2& size);
/**
* Initializes the painter, i.e. loads the OpenGL shader.
......@@ -81,7 +81,7 @@ namespace campvis {
* Sets the target canvas for rendering
* \param canvas Canvas to render on, must be of type QtThreadedCanvas
*/
virtual void setCanvas(tgt::GLCanvas* canvas);
virtual void setCanvas(cgt::GLCanvas* canvas);
/**
* Pipeline with the render target to render.
......@@ -89,7 +89,7 @@ namespace campvis {
*/
void setPipeline(AbstractPipeline* pipeline);
void setErrorTexture(tgt::Texture* texture);
void setErrorTexture(cgt::Texture* texture);
private:
......@@ -101,8 +101,8 @@ namespace campvis {
static const std::string loggerCat_;
AbstractPipeline* _pipeline; ///< Pipeline to render
tgt::Shader* _copyShader; ///< Shader for copying the render target to the framebuffer.
tgt::Texture* _errorTexture; ///< Pointer to error texture
cgt::Shader* _copyShader; ///< Shader for copying the render target to the framebuffer.
cgt::Texture* _errorTexture; ///< Pointer to error texture
};
}
......
......@@ -45,9 +45,9 @@
namespace campvis {
DataContainerInspectorCanvas::DataContainerInspectorCanvas(QWidget* parent /*= 0*/)
: tgt::QtThreadedCanvas("DataContainer Inspector", tgt::ivec2(640, 480), tgt::GLCanvas::RGBA_BUFFER, parent, true)
: cgt::QtThreadedCanvas("DataContainer Inspector", cgt::ivec2(640, 480), cgt::GLCanvas::RGBA_BUFFER, parent, true)
, p_currentSlice("CurrentSlice", "Slice", -1, -1, -1)
, p_transferFunction("TransferFunction", "Transfer Function", new Geometry1DTransferFunction(256, tgt::vec2(0.f, 1.f)))
, p_transferFunction("TransferFunction", "Transfer Function", new Geometry1DTransferFunction(256, cgt::vec2(0.f, 1.f)))
, p_renderRChannel("RenderRChannel", "Render Red Channel", true)
, p_renderGChannel("RenderGChannel", "Render Green Channel", true)
, p_renderBChannel("RenderBChannel", "Render Blue Channel", true)
......@@ -60,11 +60,11 @@ namespace campvis {
, _numTiles(0, 0)
, _quadSize(0, 0)
, _localDataContainer("Local DataContainer for DataContainerInspectorCanvas")
, p_viewportSize("ViewportSize", "Viewport Size", tgt::ivec2(200), tgt::ivec2(0, 0), tgt::ivec2(10000))
, p_viewportSize("ViewportSize", "Viewport Size", cgt::ivec2(200), cgt::ivec2(0, 0), cgt::ivec2(10000))
, _geometryRenderer(&p_viewportSize)
, _trackballEH(nullptr)
{
static_cast<Geometry1DTransferFunction*>(p_transferFunction.getTF())->addGeometry(TFGeometry1D::createQuad(tgt::vec2(0.f, 1.f), tgt::col4(0, 0, 0, 255), tgt::col4(255, 255, 255, 255)));
static_cast<Geometry1DTransferFunction*>(p_transferFunction.getTF())->addGeometry(TFGeometry1D::createQuad(cgt::vec2(0.f, 1.f), cgt::col4(0, 0, 0, 255), cgt::col4(255, 255, 255, 255)));
GLCtxtMgr.registerContextAndInitGlew(this, "DataContainerInspector");
GLCtxtMgr.releaseContext(this, false);
......@@ -176,10 +176,10 @@ namespace campvis {
_paintShader->activate();
tgt::mat4 projection = tgt::mat4::createOrtho(0, size_.x, 0, size_.y, -1, 1);
cgt::mat4 projection = cgt::mat4::createOrtho(0, size_.x, 0, size_.y, -1, 1);
_paintShader->setUniform("_projectionMatrix", projection);
tgt::TextureUnit tfUnit, unit2d, unit3d;
cgt::TextureUnit tfUnit, unit2d, unit3d;
p_transferFunction.getTF()->bind(_paintShader, tfUnit);
_paintShader->setUniform("_texture2d", unit2d.getUnitNumber());
_paintShader->setUniform("_texture3d", unit3d.getUnitNumber());
......@@ -196,7 +196,7 @@ namespace campvis {
break;
// gather image
tgtAssert(dynamic_cast<const ImageData*>(_textures[index].getData()), "Found sth. else than ImageData in render texture vector. This should not happen!");
cgtAssert(dynamic_cast<const ImageData*>(_textures[index].getData()), "Found sth. else than ImageData in render texture vector. This should not happen!");
const ImageData* id = static_cast<const ImageData*>(_textures[index].getData());
// compute transformation matrices
......@@ -204,10 +204,10 @@ namespace campvis {
float sliceRatio = (static_cast<float>(id->getSize().x) * id->getMappingInformation().getVoxelSize().x)
/ (static_cast<float>(id->getSize().y) * id->getMappingInformation().getVoxelSize().y);
float ratioRatio = sliceRatio / renderTargetRatio;
tgt::mat4 viewMatrix = (ratioRatio > 1) ? tgt::mat4::createScale(tgt::vec3(1.f, 1.f / ratioRatio, 1.f)) : tgt::mat4::createScale(tgt::vec3(ratioRatio, 1.f, 1.f));
cgt::mat4 viewMatrix = (ratioRatio > 1) ? cgt::mat4::createScale(cgt::vec3(1.f, 1.f / ratioRatio, 1.f)) : cgt::mat4::createScale(cgt::vec3(ratioRatio, 1.f, 1.f));
tgt::mat4 scaleMatrix = tgt::mat4::createScale(tgt::vec3(_quadSize, 1.f));
tgt::mat4 translation = tgt::mat4::createTranslation(tgt::vec3(_quadSize.x * x, _quadSize.y * y, 0.f));
cgt::mat4 scaleMatrix = cgt::mat4::createScale(cgt::vec3(_quadSize, 1.f));
cgt::mat4 translation = cgt::mat4::createTranslation(cgt::vec3(_quadSize.x * x, _quadSize.y * y, 0.f));
_paintShader->setUniform("_modelMatrix", translation * scaleMatrix * viewMatrix);
......@@ -221,8 +221,8 @@ namespace campvis {
glPopAttrib();
}
void DataContainerInspectorCanvas::paintTexture(const tgt::Texture* texture, const tgt::TextureUnit& unit2d, const tgt::TextureUnit& unit3d) {
tgtAssert(texture != nullptr, "Texture to paint is 0. This should not happen!");
void DataContainerInspectorCanvas::paintTexture(const cgt::Texture* texture, const cgt::TextureUnit& unit2d, const cgt::TextureUnit& unit3d) {
cgtAssert(texture != nullptr, "Texture to paint is 0. This should not happen!");
if (texture == nullptr)
return;
......@@ -232,8 +232,8 @@ namespace campvis {
texture->bind();
_paintShader->setUniform("_is3d", false);
_paintShader->setUniform("_isDepthTexture", texture->isDepthTexture());
_paintShader->setUniform("_2dTextureParams._size", tgt::vec2(texture->getDimensions().xy()));
_paintShader->setUniform("_2dTextureParams._sizeRCP", tgt::vec2(1.f) / tgt::vec2(texture->getDimensions().xy()));
_paintShader->setUniform("_2dTextureParams._size", cgt::vec2(texture->getDimensions().xy()));
_paintShader->setUniform("_2dTextureParams._sizeRCP", cgt::vec2(1.f) / cgt::vec2(texture->getDimensions().xy()));
_paintShader->setUniform("_2dTextureParams._numChannels", static_cast<int>(texture->getNumChannels()));
}
else {
......@@ -241,8 +241,8 @@ namespace campvis {
texture->bind();
_paintShader->setUniform("_is3d", true);
_paintShader->setUniform("_sliceNumber", p_currentSlice.getValue());
_paintShader->setUniform("_3dTextureParams._size", tgt::vec3(texture->getDimensions()));
_paintShader->setUniform("_3dTextureParams._sizeRCP", tgt::vec3(1.f) / tgt::vec3(texture->getDimensions()));
_paintShader->setUniform("_3dTextureParams._size", cgt::vec3(texture->getDimensions()));
_paintShader->setUniform("_3dTextureParams._sizeRCP", cgt::vec3(1.f) / cgt::vec3(texture->getDimensions()));
_paintShader->setUniform("_3dTextureParams._numChannels", static_cast<int>(texture->getNumChannels()));
}
_paintShader->setIgnoreUniformLocationError(false);
......@@ -255,7 +255,7 @@ namespace campvis {
// only if inited
if (_quad != 0 && _paintShader != 0) {
// TODO: check, whether this should be done in an extra thread
tgt::GLContextScopedLock lock(this);
cgt::GLContextScopedLock lock(this);
paint();
}
}
......@@ -263,29 +263,29 @@ namespace campvis {
void DataContainerInspectorCanvas::createQuad() {
delete _quad;
_quad = 0;
_quad = GeometryDataFactory::createQuad(tgt::vec3(0.f), tgt::vec3(1.f), tgt::vec3(0.f, 1.f, 0.f), tgt::vec3(1.f, 0.f, 0.f));
_quad = GeometryDataFactory::createQuad(cgt::vec3(0.f), cgt::vec3(1.f), cgt::vec3(0.f, 1.f, 0.f), cgt::vec3(1.f, 0.f, 0.f));
}
void DataContainerInspectorCanvas::repaint() {
invalidate();
}
void DataContainerInspectorCanvas::sizeChanged(const tgt::ivec2& size) {
void DataContainerInspectorCanvas::sizeChanged(const cgt::ivec2& size) {
invalidate();
}
void DataContainerInspectorCanvas::mouseMoveEvent(tgt::MouseEvent* e)
void DataContainerInspectorCanvas::mouseMoveEvent(cgt::MouseEvent* e)
{
if (e->modifiers() & tgt::Event::CTRL) {
if (e->modifiers() & cgt::Event::CTRL) {
int texIndx = (e->y() / _quadSize.y) * _numTiles.x + (e->x() / _quadSize.x);
if (texIndx < 0 || texIndx >= static_cast<int>(_textures.size()))
return;
const ImageData* id = static_cast<const ImageData*>(_textures[texIndx].getData());
const tgt::Texture* tex = id->getRepresentation<ImageRepresentationGL>()->getTexture();
tgt::ivec2 imageSize = id->getSize().xy();
const cgt::Texture* tex = id->getRepresentation<ImageRepresentationGL>()->getTexture();
cgt::ivec2 imageSize = id->getSize().xy();
tgt::vec2 lookupTexelFloat = tgt::vec2((e->coord() % _quadSize) * imageSize) / tgt::vec2(_quadSize);
cgt::vec2 lookupTexelFloat = cgt::vec2((e->coord() % _quadSize) * imageSize) / cgt::vec2(_quadSize);
// compute transformation matrices
float renderTargetRatio = static_cast<float>(_quadSize.x) / static_cast<float>(_quadSize.y);
......@@ -293,9 +293,9 @@ namespace campvis {
/ (static_cast<float>(id->getSize().y) * id->getMappingInformation().getVoxelSize().y);
float ratioRatio = sliceRatio / renderTargetRatio;
lookupTexelFloat /= (ratioRatio > 1) ? tgt::vec2(1.f, 1.f / ratioRatio) : tgt::vec2(ratioRatio, 1.f);
lookupTexelFloat /= (ratioRatio > 1) ? cgt::vec2(1.f, 1.f / ratioRatio) : cgt::vec2(ratioRatio, 1.f);
tgt::ivec2 lookupTexel(lookupTexelFloat);
cgt::ivec2 lookupTexel(lookupTexelFloat);
if (lookupTexel.x >= 0 && lookupTexel.y >= 0 && lookupTexel.x < imageSize.x && lookupTexel.y < imageSize.y) {
if(tex->isDepthTexture()) {
emit s_depthChanged(tex->depthAsFloat(lookupTexel.x, imageSize.y - lookupTexel.y - 1));
......@@ -317,8 +317,8 @@ namespace campvis {
}
}
void DataContainerInspectorCanvas::onEvent(tgt::Event* e) {
tgt::EventListener::onEvent(e);
void DataContainerInspectorCanvas::onEvent(cgt::Event* e) {
cgt::EventListener::onEvent(e);
if (_trackballEH && !e->isAccepted()) {
_trackballEH->onEvent(e);
......@@ -380,7 +380,7 @@ namespace campvis {
/// Calculate the maximum slices of the textures and fill the textures array
int maxSlices = 1;
_textures.clear();
p_viewportSize.setValue(tgt::ivec2(width(), height()));
p_viewportSize.setValue(cgt::ivec2(width(), height()));
for (std::map<QString, QtDataHandle>::iterator it = _handles.begin(); it != _handles.end(); ++it) {
if (const ImageData* img = dynamic_cast<const ImageData*>(it->second.getData())) {
......@@ -452,7 +452,7 @@ namespace campvis {
if (rd != nullptr && rd->getNumColorTextures() > 0) {
auto rep = rd->getColorTexture(0)->getRepresentation<ImageRepresentationGL>();
if (rep != nullptr) {
const_cast<tgt::Texture*>(rep->getTexture())->downloadTexture();
const_cast<cgt::Texture*>(rep->getTexture())->downloadTexture();
if (textureIndex < 0 || textureIndex >= static_cast<int>(_textures.size())) {
_textures.push_back(rd->getColorDataHandle(0));
......@@ -462,11 +462,11 @@ namespace campvis {
}
}
else {