Commit 524ba384 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Adjusted Lua scripting parts to forking tgt into cgt.

refs #386
parent af7bf029
%module campvis
%include factory.i
%include std_string.i
%import "ext/tgt/bindings/tgt.i"
%import "ext/cgt/bindings/cgt.i"
%include "ext/sigslot/sigslot.i"
%{
#include "core/datastructures/abstractdata.h"
......@@ -101,9 +101,9 @@ namespace campvis {
virtual ~NumericProperty();
};
%template(Ivec2GenericProperty) GenericProperty< tgt::Vector2<int> >;
%template(IVec2Property) NumericProperty< tgt::Vector2<int> >;
typedef NumericProperty< tgt::Vector2<int> > IVec2Property;
%template(Ivec2GenericProperty) GenericProperty< cgt::Vector2<int> >;
%template(IVec2Property) NumericProperty< cgt::Vector2<int> >;
typedef NumericProperty< cgt::Vector2<int> > IVec2Property;
template<typename T>
struct FloatingPointPropertyTraits {};
......@@ -139,11 +139,11 @@ namespace campvis {
/* CameraProperty */
%template(GenericProperty_Camera) GenericProperty<tgt::Camera>;
%template(GenericProperty_Camera) GenericProperty<cgt::Camera>;
class CameraProperty : public GenericProperty<tgt::Camera> {
class CameraProperty : public GenericProperty<cgt::Camera> {
public:
CameraProperty(const std::string& name, const std::string& title, tgt::Camera cam = tgt::Camera());
CameraProperty(const std::string& name, const std::string& title, cgt::Camera cam = cgt::Camera());
virtual ~CameraProperty();
};
......@@ -154,14 +154,14 @@ namespace campvis {
class TFGeometry1D {
public:
virtual ~TFGeometry1D();
static TFGeometry1D* createQuad(const tgt::vec2& interval, const tgt::col4& leftColor, const tgt::vec4& rightColor);
static TFGeometry1D* createQuad(const cgt::vec2& interval, const cgt::col4& leftColor, const cgt::vec4& rightColor);
};
/* AbstractTransferFunction */
class AbstractTransferFunction {
public:
AbstractTransferFunction(const tgt::svec3& size, const tgt::vec2& intensityDomain = tgt::vec2(0.f, 1.f));
AbstractTransferFunction(const cgt::svec3& size, const cgt::vec2& intensityDomain = cgt::vec2(0.f, 1.f));
virtual ~AbstractTransferFunction();
virtual AbstractTransferFunction* clone() const = 0;
......@@ -172,7 +172,7 @@ namespace campvis {
template<class T>
class GenericGeometryTransferFunction : public AbstractTransferFunction {
public:
GenericGeometryTransferFunction(const tgt::vec3& size, const tgt::vec2& intensityDomain = tgt::vec2(0.f, 1.f));
GenericGeometryTransferFunction(const cgt::vec3& size, const cgt::vec2& intensityDomain = cgt::vec2(0.f, 1.f));
virtual ~GenericGeometryTransferFunction();
void addGeometry(T* geometry);
......@@ -184,7 +184,7 @@ namespace campvis {
class Geometry1DTransferFunction : public GenericGeometryTransferFunction<TFGeometry1D> {
public:
Geometry1DTransferFunction(size_t size, const tgt::vec2& intensityDomain = tgt::vec2(0.f, 1.f));
Geometry1DTransferFunction(size_t size, const cgt::vec2& intensityDomain = cgt::vec2(0.f, 1.f));
virtual ~Geometry1DTransferFunction();
virtual Geometry1DTransferFunction* clone() const;
......@@ -208,7 +208,7 @@ namespace campvis {
IHasWorldBounds();
virtual ~IHasWorldBounds();
virtual tgt::Bounds getWorldBounds() const = 0;
virtual cgt::Bounds getWorldBounds() const = 0;
};
/* AbstractData */
......@@ -225,11 +225,11 @@ namespace campvis {
class ImageData : public AbstractData, public IHasWorldBounds {
public:
ImageData(size_t dimensionality, const tgt::svec3& size, size_t numChannels);
ImageData(size_t dimensionality, const cgt::svec3& size, size_t numChannels);
virtual ~ImageData();
virtual ImageData* clone() const;
virtual tgt::Bounds getWorldBounds() const;
virtual cgt::Bounds getWorldBounds() const;
};
/* Downcast the return value of DataHandle::getData to appropriate subclass */
......@@ -329,7 +329,7 @@ namespace campvis {
public:
virtual void addProcessor(AbstractProcessor* processor);
void addEventListenerToBack(tgt::EventListener* e);
void addEventListenerToBack(cgt::EventListener* e);
};
/* VisualizationProcessor */
......@@ -342,7 +342,7 @@ namespace campvis {
/* TrackballNavigationEventListener */
class TrackballNavigationEventListener : public tgt::EventListener {
class TrackballNavigationEventListener : public cgt::EventListener {
public:
TrackballNavigationEventListener(CameraProperty* cameraProperty, IVec2Property* viewportSizeProp);
virtual ~TrackballNavigationEventListener();
......@@ -351,7 +351,7 @@ namespace campvis {
void removeLqModeProcessor(VisualizationProcessor* vp);
void reinitializeCamera(const IHasWorldBounds* hwb);
void reinitializeCamera(const tgt::Bounds& worldBounds);
void reinitializeCamera(const cgt::Bounds& worldBounds);
};
}
......
%module tgt
%module cgt
%include "stdint.i"
%{
#include "ext/tgt/camera.h"
#include "ext/tgt/vector.h"
#include "ext/tgt/event/eventlistener.h"
#include "ext/cgt/camera.h"
#include "ext/cgt/vector.h"
#include "ext/cgt/event/eventlistener.h"
%}
namespace tgt {
namespace cgt {
/* Vector2 */
......
require("tgt")
require("cgt")
require("base")
require("cvio")
require("vis")
......@@ -37,12 +37,12 @@ function pipeline:init()
self.resampler.p_outputImage:setValue("resampled")
self.resampler.p_outputImage:addSharedProperty(self.ve.p_inputVolume)
local geometry1 = campvis.TFGeometry1D_createQuad(tgt.vec2(0.1, 0.125), tgt.col4(255, 0, 0, 32),
tgt.vec4(255, 0, 0, 32))
local geometry2 = campvis.TFGeometry1D_createQuad(tgt.vec2(.4, .5), tgt.col4(0, 255, 0, 128),
tgt.vec4(0, 255, 0, 128))
local geometry1 = campvis.TFGeometry1D_createQuad(cgt.vec2(0.1, 0.125), cgt.col4(255, 0, 0, 32),
cgt.vec4(255, 0, 0, 32))
local geometry2 = campvis.TFGeometry1D_createQuad(cgt.vec2(.4, .5), cgt.col4(0, 255, 0, 128),
cgt.vec4(0, 255, 0, 128))
local dvrTF = campvis.Geometry1DTransferFunction(128, tgt.vec2(0, 0.05))
local dvrTF = campvis.Geometry1DTransferFunction(128, cgt.vec2(0, 0.05))
dvrTF:addGeometry(geometry1)
dvrTF:addGeometry(geometry2)
......
......@@ -10,7 +10,7 @@
namespace campvis {
class VolumeExplorer : public VisualizationProcessor, public tgt::EventListener {
class VolumeExplorer : public VisualizationProcessor, public cgt::EventListener {
public:
VolumeExplorer(campvis::IVec2Property* viewportSizeProp);
~VolumeExplorer();
......
require("tgt")
require("cgt")
require("base")
require("cvio")
require("vis")
......@@ -42,14 +42,14 @@ function pipeline:init()
end
self.image_reader.s_validated:connect(callback)
local geometry1 = campvis.TFGeometry1D_createQuad(tgt.vec2(0.12, 0.15), tgt.col4(85, 0, 0, 128),
tgt.vec4(255, 0, 0, 128))
local geometry2 = campvis.TFGeometry1D_createQuad(tgt.vec2(.19, .28), tgt.col4(89, 89, 89, 155),
tgt.vec4(89, 89, 89, 155))
local geometry3 = campvis.TFGeometry1D_createQuad(tgt.vec2(.41, .51), tgt.col4(170, 170, 128, 64),
tgt.vec4(192, 192, 128, 64))
local geometry1 = campvis.TFGeometry1D_createQuad(cgt.vec2(0.12, 0.15), cgt.col4(85, 0, 0, 128),
cgt.vec4(255, 0, 0, 128))
local geometry2 = campvis.TFGeometry1D_createQuad(cgt.vec2(.19, .28), cgt.col4(89, 89, 89, 155),
cgt.vec4(89, 89, 89, 155))
local geometry3 = campvis.TFGeometry1D_createQuad(cgt.vec2(.41, .51), cgt.col4(170, 170, 128, 64),
cgt.vec4(192, 192, 128, 64))
local dvrTF = campvis.Geometry1DTransferFunction(128, tgt.vec2(0, 0.05))
local dvrTF = campvis.Geometry1DTransferFunction(128, cgt.vec2(0, 0.05))
dvrTF:addGeometry(geometry1)
dvrTF:addGeometry(geometry2)
dvrTF:addGeometry(geometry3)
......
......@@ -33,7 +33,7 @@ SET(CampvisLuaModulesDirectory "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_IN
LIST(APPEND CampvisGlobalDefinitions "-DCAMPVIS_LUA_MODS_PATH=\"${CampvisLuaModulesDirectory}?${CMAKE_SHARED_MODULE_SUFFIX}\"")
SET(CampvisGlobalDefinitions "${CampvisGlobalDefinitions}" PARENT_SCOPE)
SET(CampvisBindingDirs ext/tgt core)
SET(CampvisBindingDirs ext/cgt core)
# Look for bindings for all enabled CAMPVis modules
FOREACH(ModName ${CampvisModules})
......@@ -65,7 +65,7 @@ MACRO(DECLARE_LUA_MODULE InterfaceFile)
SET_SOURCE_FILES_PROPERTIES(${InterfaceFile} PROPERTIES SWIG_FLAGS "-I${CampvisHome}")
LINK_DIRECTORIES(${CampvisGlobalLinkDirectories} ${CampvisModulesLinkDirectories})
SWIG_ADD_MODULE(${LuaModName} lua ${InterfaceFile})
SWIG_LINK_LIBRARIES(${LuaModName} tgt campvis-core campvis-modules ${CampvisGlobalExternalLibs})
SWIG_LINK_LIBRARIES(${LuaModName} cgt campvis-core campvis-modules ${CampvisGlobalExternalLibs})
SET(LuaModFullPath "${CampvisLuaModulesDirectory}${LuaModShortName}${CMAKE_SHARED_LIBRARY_SUFFIX}")
......@@ -122,4 +122,4 @@ ADD_LIBRARY(campvis-scripting ${CampvisSharedStaticModulesFix}
)
ADD_DEPENDENCIES(campvis-scripting ${CampvisLuaModules})
TARGET_LINK_LIBRARIES(campvis-scripting campvis-core campvis-modules tgt ${CampvisGlobalExternalLibs})
TARGET_LINK_LIBRARIES(campvis-scripting campvis-core campvis-modules cgt ${CampvisGlobalExternalLibs})
......@@ -3,7 +3,7 @@
#include <iostream>
#include "globalluatable.h"
#include "tgt/logmanager.h"
#include "cgt/logmanager.h"
extern "C" {
#include "lua.h"
......@@ -32,7 +32,7 @@ static int lua_campvis_print(lua_State* L) {
lua_pop(L, 1); /* pop result */
}
LogMgr.log("Lua", tgt::LuaInfo, str);
LogMgr.log("Lua", cgt::LuaInfo, str);
return 0;
}
......@@ -80,9 +80,9 @@ namespace campvis {
const char* errorMsg = lua_tostring(_luaState, -1);
if (errorMsg == nullptr)
LogMgr.log("Lua", tgt::LuaError, "(error object is not a string)");
LogMgr.log("Lua", cgt::LuaError, "(error object is not a string)");
else
LogMgr.log("Lua", tgt::LuaError, errorMsg);
LogMgr.log("Lua", cgt::LuaError, errorMsg);
lua_pop(_luaState, 1);
}
......
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