Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit d3090418 authored by schultezub's avatar schultezub
Browse files

Added shader deployment CMake script

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@482 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 1272554d
......@@ -17,7 +17,9 @@ 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_BUILD_LIB_TGT "Build TGT Library" ON )
OPTION(CAMPVIS_BUILD_LIB_KISSCL "Build KissCL Library" OFF )
OPTION(CAMPVIS_BUILD_LIB_KISSCL "Build KissCL Library" OFF)
OPTION(CAMPVIS_DEPLOY_SHADERS "Deploy Shader files to binary directory" OFF)
IF(WIN32)
OPTION(CAMPVIS_COPY_EXTERNAL_DLLS "Copy external DLLs to bin directory?" ON )
......@@ -52,10 +54,12 @@ IF(CAMPVIS_BUILD_MODULES)
ADD_SUBDIRECTORY(modules)
ENDIF()
IF(CAMPVIS_BUILD_APPLICATION)
ADD_SUBDIRECTORY(application)
ENDIF()
#
# Copy External DLLs
#
......
......@@ -63,3 +63,15 @@ ADD_EXECUTABLE(campvis-application
ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisModulesDefinitions} ${CampvisApplicationDefinitions} ${QT_DEFINITIONS})
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CampvisModulesIncludeDirs})
TARGET_LINK_LIBRARIES(campvis-application campvis-core campvis-modules tgt ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs} ${QT_LIBRARIES})
IF(CAMPVIS_DEPLOY_SHADERS)
LIST(APPEND CampvisShaderDirectories "application/glsl")
LIST(APPEND CampvisShaderDirectories "core/glsl")
FOREACH(Directory ${CampvisShaderDirectories})
ADD_CUSTOM_COMMAND(
TARGET campvis-application
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CampvisHome}/${Directory}" "$<TARGET_FILE_DIR:campvis-application>/${Directory}"
)
ENDFOREACH()
ENDIF(CAMPVIS_DEPLOY_SHADERS)
......@@ -55,25 +55,16 @@ MACRO(COPY_EXTERNAL_DLLS DebugDLLs ReleaseDLLs failOnError)
ENDFOREACH()
ENDMACRO()
# adds custom commands to a target that copy the passed debug and release DLLs
# to the corresponding output directories (currently not in use)
MACRO(ADD_COPY_DLL_COMMAND Target DebugDLLs ReleaseDLLs)
#MESSAGE(${${DebugDLLs}})
MACRO(DEPLOY_DIRECTORY Target DirectoryList)
MESSAGE(${Target})
FOREACH(dll ${${DebugDLLs}})
MESSAGE(${dll})
MESSAGE(${DirectoryList})
FOREACH(Directory ${DirectoryList})
ADD_CUSTOM_COMMAND(
TARGET ${Target}
COMMAND ${CMAKE_COMMAND} -E copy ${dll} ${CMAKE_BINARY_DIR}/bin/Debug
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_PATH}/${Directory}" "$<TARGET_FILE_DIR:${Target}>/${Directory}"
)
ENDFOREACH()
FOREACH(dll ${${ReleaseDLLs}})
ADD_CUSTOM_COMMAND(
TARGET ${Target}
COMMAND ${CMAKE_COMMAND} -E copy ${dll} ${CMAKE_BINARY_DIR}/bin/Release
)
ENDFOREACH()
ENDMACRO(ADD_COPY_DLL_COMMAND)
ENDMACRO(DEPLOY_DIRECTORY)
# adapted from: http://stackoverflow.com/questions/148570/using-pre-compiled-headers-with-cmake
MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
......
......@@ -39,6 +39,9 @@ FOREACH(ModDir ${ModDirs})
LIST(APPEND CampvisExternalDllsDebug ${ThisModExternalDllsDebug})
LIST(APPEND CampvisExternalDllsRelease ${ThisModExternalDllsRelease})
# add shader directory to deployment list
LIST(APPEND CampvisShaderDirectories ${ThisModShaderDirectories})
# add definition that this module is activated
LIST(APPEND CampvisGlobalDefinitions -DCAMPVIS_HAS_MODULE_${ModDirUpper})
......@@ -53,6 +56,7 @@ FOREACH(ModDir ${ModDirs})
UNSET(ThisModCoreHeaders)
UNSET(ThisModExternalDllsDebug)
UNSET(ThisModExternalDllsRelease)
UNSET(ThisModShaderDirectories)
ELSE()
MESSAGE(STATUS "* Found Module '${ModDir}'")
ENDIF(CAMPVIS_BUILD_MODULE_${ModDirUpper})
......
......@@ -13,3 +13,5 @@ FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
modules/advancedusvis/pipelines/*.h
modules/advancedusvis/processors/*.h
)
SET(ThisModShaderDirectories "modules/advancedusvis/glsl")
......@@ -17,5 +17,5 @@ FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
modules/opencl/processors/*.h
)
LIST(APPEND ThisModExternalLibs kisscl)
\ No newline at end of file
LIST(APPEND ThisModExternalLibs kisscl)
SET(ThisModShaderDirectories "modules/opencl/cl")
\ No newline at end of file
......@@ -42,10 +42,15 @@ uniform sampler1D _transferFunction;
uniform TFParameters1D _transferFunctionParams;
void main() {
float intensity = getElement2DNormalized(_texture, _textureParameters, ex_TexCoord.xy).a;
out_Color = lookupTF(_transferFunction, _transferFunctionParams, intensity);
if (ex_TexCoord.x < 0.0) {
out_Color = vec4(1.0);
}
else {
float intensity = getElement2DNormalized(_texture, _textureParameters, ex_TexCoord.xy).a;
out_Color = lookupTF(_transferFunction, _transferFunctionParams, intensity);
// don't write fragment if fully transparent (in particular don't write to depth buffer!)
if (out_Color == 0.0)
discard;
// don't write fragment if fully transparent (in particular don't write to depth buffer!)
if (out_Color == 0.0)
discard;
}
}
......@@ -38,3 +38,5 @@ FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
modules/scr_msk/pipelines/*.h
modules/scr_msk/processors/*.h
)
SET(ThisModShaderDirectories "modules/scr_msk/glsl")
\ No newline at end of file
......@@ -13,3 +13,5 @@ FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
modules/vis/pipelines/*.h
modules/vis/processors/*.h
)
SET(ThisModShaderDirectories "modules/vis/glsl")
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