├── modules ├── meta.cmake ├── rndgenmwc64x │ ├── depends.cmake │ ├── README.txt │ ├── cl │ │ ├── random.cl │ │ ├── randstategen.cl │ │ └── randomnumbergenerator.cl │ ├── rndgenmwc64xmoduledefine.h │ ├── LICENSE.txt │ ├── CMakeLists.txt │ ├── rndgenmwc64xmodule.h │ ├── rndgenmwc64xmodule.cpp │ ├── mwc64xseedgenerator.h │ ├── processors │ │ ├── randomnumbergeneratorcl.h │ │ └── randomnumbergenerator2dcl.h │ └── mwc64xrandomnumbergenerator.h ├── lightcl │ ├── LICENSE.txt │ ├── depends.cmake │ ├── lightclmoduledefine.h │ ├── samplegenerator2dcl.cpp │ ├── lightsourcesamplercl.cpp │ ├── convexhull2d.h │ ├── CMakeLists.txt │ ├── sample.h │ ├── lightclmodule.h │ ├── lightsourcescl.cpp │ ├── pointplaneprojection.cpp │ ├── cl │ │ ├── intersection │ │ │ └── lightsamplemeshintersection.cl │ │ └── directionallightsampler.cl │ ├── lightsourcescl.h │ ├── lightsample.cpp │ ├── processors │ │ ├── samplestoimageprocessor.h │ │ ├── directionallightsamplerclprocessor.h │ │ └── samplestoimageprocessor.cpp │ ├── lightsamplemeshintersectioncl.h │ └── lightsourcesamplercl.h ├── radixsortcl │ ├── depends.cmake │ ├── README │ ├── ext │ │ └── clogs │ │ │ ├── src │ │ │ ├── clhpp11.h │ │ │ ├── tr1_random.h │ │ │ ├── tr1_functional.h │ │ │ ├── cache_types.cpp │ │ │ └── parameters.cpp │ │ │ ├── LICENSE │ │ │ ├── visibility_pop.h │ │ │ ├── visibility_push.h │ │ │ ├── clogs.h │ │ │ ├── platform.h │ │ │ ├── visibility.h │ │ │ ├── Changelog │ │ │ └── tune.h │ ├── radixsortclmoduledefine.h │ ├── CMakeLists.txt │ ├── radixsortclmodule.h │ ├── processors │ │ └── radixsortcl.h │ └── radixsortclmodule.cpp ├── importancesamplingcl │ ├── LICENSE.txt │ ├── depends.cmake │ ├── importancesamplingclmoduledefine.h │ ├── CMakeLists.txt │ ├── cl │ │ ├── uniformsamplegenerator2d.cl │ │ ├── intersection │ │ │ └── lightsamplemeshintersection.cl │ │ ├── datastructures │ │ │ └── ray.cl │ │ └── samplegridindex.cl │ ├── importanceuniformgrid3d.h │ ├── importancesamplingclmodule.h │ ├── processors │ │ └── uniformsamplegenerator2dprocessorcl.h │ ├── uniformsamplegenerator2dcl.h │ └── minmaxuniformgrid3dimportancecl.h ├── progressivephotonmapping │ ├── LICENSE.txt │ ├── photonrecomputationdetector.h │ ├── photonrecomputationdetector.cpp │ ├── depends.cmake │ ├── progressivephotonmappingmoduledefine.h │ ├── cl │ │ ├── indextobuffer.cl │ │ ├── threshold.cl │ │ ├── photon.cl │ │ ├── hashlightsample.cl │ │ └── densityestimationkernel.cl │ ├── CMakeLists.txt │ ├── progressivephotonmappingmodule.h │ └── progressivephotonmappingmodule.cpp └── uniformgridcl │ ├── uniformgrid3dreader.h │ ├── uniformgrid3dwriter.h │ ├── uniformgrid3dreader.cpp │ ├── uniformgrid3dwriter.cpp │ ├── processors │ ├── uniformgrid3dexport.h │ ├── uniformgrid3dexport.cpp │ ├── uniformgrid3dvectorsource.cpp │ ├── uniformgrid3dvectorsource.h │ ├── uniformgrid3dplayerprocessor.h │ ├── uniformgrid3dsequenceselector.h │ ├── uniformgrid3dsourceprocessor.h │ ├── dynamicvolumedifferenceanalysis.h │ ├── uniformgrid3dplayerprocessor.cpp │ ├── uniformgrid3dsequenceselector.cpp │ ├── uniformgrid3dsourceprocessor.cpp │ ├── dynamicvolumedifferenceanalysis.cpp │ └── volumesequenceplayer.h │ ├── depends.cmake │ ├── uniformgridclmoduledefine.h │ ├── LICENSE.txt │ ├── uniformgrid3d.cpp │ ├── cl │ ├── buffermixer.cl │ └── uniformgrid │ │ └── volumeminmax.cl │ ├── glsl │ └── volume_mix.frag │ ├── minmaxuniformgrid3d.h │ ├── uniformgridclmodule.h │ ├── buffermixercl.h │ └── CMakeLists.txt └── README.md /modules/meta.cmake: -------------------------------------------------------------------------------- 1 | # setup a custom group name for the modules 2 | set(group_name "modules-photon-mapping") 3 | -------------------------------------------------------------------------------- /modules/rndgenmwc64x/depends.cmake: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # Dependencies for module 3 | set(dependencies 4 | InviwoOpenCLModule 5 | ) 6 | -------------------------------------------------------------------------------- /modules/lightcl/LICENSE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/lightcl/LICENSE.txt -------------------------------------------------------------------------------- /modules/radixsortcl/depends.cmake: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # Dependencies for current module 3 | set(dependencies 4 | InviwoOpenCLModule 5 | ) 6 | -------------------------------------------------------------------------------- /modules/rndgenmwc64x/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/rndgenmwc64x/README.txt -------------------------------------------------------------------------------- /modules/rndgenmwc64x/cl/random.cl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/rndgenmwc64x/cl/random.cl -------------------------------------------------------------------------------- /modules/rndgenmwc64x/cl/randstategen.cl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/rndgenmwc64x/cl/randstategen.cl -------------------------------------------------------------------------------- /modules/importancesamplingcl/LICENSE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/importancesamplingcl/LICENSE.txt -------------------------------------------------------------------------------- /modules/progressivephotonmapping/LICENSE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/progressivephotonmapping/LICENSE.txt -------------------------------------------------------------------------------- /modules/uniformgridcl/uniformgrid3dreader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/uniformgrid3dreader.h -------------------------------------------------------------------------------- /modules/uniformgridcl/uniformgrid3dwriter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/uniformgrid3dwriter.h -------------------------------------------------------------------------------- /modules/uniformgridcl/uniformgrid3dreader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/uniformgrid3dreader.cpp -------------------------------------------------------------------------------- /modules/uniformgridcl/uniformgrid3dwriter.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/uniformgrid3dwriter.cpp -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/uniformgrid3dexport.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/uniformgrid3dexport.h -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/uniformgrid3dexport.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/uniformgrid3dexport.cpp -------------------------------------------------------------------------------- /modules/progressivephotonmapping/photonrecomputationdetector.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/progressivephotonmapping/photonrecomputationdetector.h -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/uniformgrid3dvectorsource.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/uniformgrid3dvectorsource.cpp -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/uniformgrid3dvectorsource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/uniformgrid3dvectorsource.h -------------------------------------------------------------------------------- /modules/progressivephotonmapping/photonrecomputationdetector.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/progressivephotonmapping/photonrecomputationdetector.cpp -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/uniformgrid3dplayerprocessor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/uniformgrid3dplayerprocessor.h -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/uniformgrid3dsequenceselector.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/uniformgrid3dsequenceselector.h -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/uniformgrid3dsourceprocessor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/uniformgrid3dsourceprocessor.h -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/dynamicvolumedifferenceanalysis.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/dynamicvolumedifferenceanalysis.h -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/uniformgrid3dplayerprocessor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/uniformgrid3dplayerprocessor.cpp -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/uniformgrid3dsequenceselector.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/uniformgrid3dsequenceselector.cpp -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/uniformgrid3dsourceprocessor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/uniformgrid3dsourceprocessor.cpp -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/dynamicvolumedifferenceanalysis.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ResearchDaniel/Correlated-Photon-Mapping-for-Interactive-Global-Illumination-of-Time-Varying-Volumetric-Data/HEAD/modules/uniformgridcl/processors/dynamicvolumedifferenceanalysis.cpp -------------------------------------------------------------------------------- /modules/lightcl/depends.cmake: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # Dependencies for current module 3 | # List modules on the format "InviwoModule" 4 | set(dependencies 5 | InviwoOpenCLModule 6 | InviwoBaseCLModule 7 | ) 8 | -------------------------------------------------------------------------------- /modules/uniformgridcl/depends.cmake: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # Dependencies for current module 3 | # List modules on the format "InviwoModule" 4 | set(dependencies 5 | InviwoBaseModule 6 | InviwoOpenCLModule 7 | ) 8 | -------------------------------------------------------------------------------- /modules/progressivephotonmapping/depends.cmake: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # Dependencies for module 3 | set(dependencies 4 | InviwoOpenGLModule 5 | InviwoOpenCLModule 6 | InviwoLightCLModule 7 | InviwoImportanceSamplingCLModule 8 | InviwoRndGenMWC64XModule 9 | ) 10 | -------------------------------------------------------------------------------- /modules/importancesamplingcl/depends.cmake: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # Dependencies for current module 3 | # List modules on the format "InviwoModule" 4 | set(dependencies 5 | InviwoOpenCLModule 6 | InviwoLightCLModule 7 | InviwoRndGenMWC64XModule 8 | InviwoRadixSortCLModule 9 | InviwoUniformGridCLModule 10 | ) 11 | -------------------------------------------------------------------------------- /modules/radixsortcl/README: -------------------------------------------------------------------------------- 1 | Guide to upgrading clogs: 2 | 1. Replace includes of "#include " with "#include " 3 | 2. In utils.h: make getSourceMap(); return a non-constant map. In utils.cpp; add 4 | static std::map g_sources = std::map(); 5 | 6 | std::map &getSourceMap() { return g_sources; }; 7 | 8 | 9 | 3. Optionally run python script to generate hash string (we use the files instead of putting it into source code: 10 | python clc2cpp.py kernels/radixsort.cl kernels/reduce.cl kernels/scan.cl output.cpp 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/src/clhpp11.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * Includes cl.hpp with the appropriate definitions to avoid depending on any 5 | * OpenCL 1.2+ symbols. It must be included before anything directly includes 6 | * cl.hpp. 7 | */ 8 | 9 | #ifndef CLOGS_CLHPP11_H 10 | #define CLOGS_CLHPP11_H 11 | 12 | #ifdef CL_HPP_ 13 | # error "cl.hpp has already been included" 14 | #endif 15 | 16 | #ifndef __CL_ENABLE_EXCEPTIONS 17 | # define __CL_ENABLE_EXCEPTIONS 18 | #endif 19 | 20 | #define CL_USE_DEPRECATED_OPENCL_1_1_APIS 21 | #define CL_USE_DEPRECATED_OPENCL_1_2_APIS 22 | #include 23 | #undef CL_VERSION_1_2 24 | #undef CL_VERSION_2_0 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /modules/lightcl/lightclmoduledefine.h: -------------------------------------------------------------------------------- 1 | #ifndef _IVW_MODULE_LIGHTCL_DEFINE_H_ 2 | #define _IVW_MODULE_LIGHTCL_DEFINE_H_ 3 | 4 | #ifdef INVIWO_ALL_DYN_LINK //DYNAMIC 5 | // If we are building DLL files we must declare dllexport/dllimport 6 | #ifdef IVW_MODULE_LIGHTCL_EXPORTS 7 | #ifdef _WIN32 8 | #define IVW_MODULE_LIGHTCL_API __declspec(dllexport) 9 | #else //UNIX (GCC) 10 | #define IVW_MODULE_LIGHTCL_API __attribute__ ((visibility ("default"))) 11 | #endif 12 | #else 13 | #ifdef _WIN32 14 | #define IVW_MODULE_LIGHTCL_API __declspec(dllimport) 15 | #else 16 | #define IVW_MODULE_LIGHTCL_API 17 | #endif 18 | #endif 19 | #else //STATIC 20 | #define IVW_MODULE_LIGHTCL_API 21 | #endif 22 | 23 | #endif /* _IVW_MODULE_LIGHTCL_DEFINE_H_ */ -------------------------------------------------------------------------------- /modules/radixsortcl/radixsortclmoduledefine.h: -------------------------------------------------------------------------------- 1 | #ifndef _IVW_MODULE_RADIXSORTCL_DEFINE_H_ 2 | #define _IVW_MODULE_RADIXSORTCL_DEFINE_H_ 3 | 4 | #ifdef INVIWO_ALL_DYN_LINK //DYNAMIC 5 | // If we are building DLL files we must declare dllexport/dllimport 6 | #ifdef IVW_MODULE_RADIXSORTCL_EXPORTS 7 | #ifdef _WIN32 8 | #define IVW_MODULE_RADIXSORTCL_API __declspec(dllexport) 9 | #else //UNIX (GCC) 10 | #define IVW_MODULE_RADIXSORTCL_API __attribute__ ((visibility ("default"))) 11 | #endif 12 | #else 13 | #ifdef _WIN32 14 | #define IVW_MODULE_RADIXSORTCL_API __declspec(dllimport) 15 | #else 16 | #define IVW_MODULE_RADIXSORTCL_API 17 | #endif 18 | #endif 19 | #else //STATIC 20 | #define IVW_MODULE_RADIXSORTCL_API 21 | #endif 22 | 23 | #endif /* _IVW_MODULE_RADIXSORTCL_DEFINE_H_ */ -------------------------------------------------------------------------------- /modules/rndgenmwc64x/rndgenmwc64xmoduledefine.h: -------------------------------------------------------------------------------- 1 | #ifndef _IVW_MODULE_RNDGENMWC64X_DEFINE_H_ 2 | #define _IVW_MODULE_RNDGENMWC64X_DEFINE_H_ 3 | 4 | #ifdef INVIWO_ALL_DYN_LINK //DYNAMIC 5 | // If we are building DLL files we must declare dllexport/dllimport 6 | #ifdef IVW_MODULE_RNDGENMWC64X_EXPORTS 7 | #ifdef _WIN32 8 | #define IVW_MODULE_RNDGENMWC64X_API __declspec(dllexport) 9 | #else //UNIX (GCC) 10 | #define IVW_MODULE_RNDGENMWC64X_API __attribute__ ((visibility ("default"))) 11 | #endif 12 | #else 13 | #ifdef _WIN32 14 | #define IVW_MODULE_RNDGENMWC64X_API __declspec(dllimport) 15 | #else 16 | #define IVW_MODULE_RNDGENMWC64X_API 17 | #endif 18 | #endif 19 | #else //STATIC 20 | #define IVW_MODULE_RNDGENMWC64X_API 21 | #endif 22 | 23 | #endif /* _IVW_MODULE_RNDGENMWC64X_DEFINE_H_ */ -------------------------------------------------------------------------------- /modules/uniformgridcl/uniformgridclmoduledefine.h: -------------------------------------------------------------------------------- 1 | #ifndef _IVW_MODULE_UNIFORMGRIDCL_DEFINE_H_ 2 | #define _IVW_MODULE_UNIFORMGRIDCL_DEFINE_H_ 3 | 4 | #ifdef INVIWO_ALL_DYN_LINK //DYNAMIC 5 | // If we are building DLL files we must declare dllexport/dllimport 6 | #ifdef IVW_MODULE_UNIFORMGRIDCL_EXPORTS 7 | #ifdef _WIN32 8 | #define IVW_MODULE_UNIFORMGRIDCL_API __declspec(dllexport) 9 | #else //UNIX (GCC) 10 | #define IVW_MODULE_UNIFORMGRIDCL_API __attribute__ ((visibility ("default"))) 11 | #endif 12 | #else 13 | #ifdef _WIN32 14 | #define IVW_MODULE_UNIFORMGRIDCL_API __declspec(dllimport) 15 | #else 16 | #define IVW_MODULE_UNIFORMGRIDCL_API 17 | #endif 18 | #endif 19 | #else //STATIC 20 | #define IVW_MODULE_UNIFORMGRIDCL_API 21 | #endif 22 | 23 | #endif /* _IVW_MODULE_UNIFORMGRIDCL_DEFINE_H_ */ -------------------------------------------------------------------------------- /modules/importancesamplingcl/importancesamplingclmoduledefine.h: -------------------------------------------------------------------------------- 1 | #ifndef _IVW_MODULE_IMPORTANCESAMPLINGCL_DEFINE_H_ 2 | #define _IVW_MODULE_IMPORTANCESAMPLINGCL_DEFINE_H_ 3 | 4 | #ifdef INVIWO_ALL_DYN_LINK //DYNAMIC 5 | // If we are building DLL files we must declare dllexport/dllimport 6 | #ifdef IVW_MODULE_IMPORTANCESAMPLINGCL_EXPORTS 7 | #ifdef _WIN32 8 | #define IVW_MODULE_IMPORTANCESAMPLINGCL_API __declspec(dllexport) 9 | #else //UNIX (GCC) 10 | #define IVW_MODULE_IMPORTANCESAMPLINGCL_API __attribute__ ((visibility ("default"))) 11 | #endif 12 | #else 13 | #ifdef _WIN32 14 | #define IVW_MODULE_IMPORTANCESAMPLINGCL_API __declspec(dllimport) 15 | #else 16 | #define IVW_MODULE_IMPORTANCESAMPLINGCL_API 17 | #endif 18 | #endif 19 | #else //STATIC 20 | #define IVW_MODULE_IMPORTANCESAMPLINGCL_API 21 | #endif 22 | 23 | #endif /* _IVW_MODULE_IMPORTANCESAMPLINGCL_DEFINE_H_ */ -------------------------------------------------------------------------------- /modules/progressivephotonmapping/progressivephotonmappingmoduledefine.h: -------------------------------------------------------------------------------- 1 | #ifndef _IVW_MODULE_PROGRESSIVEPHOTONMAPPING_DEFINE_H_ 2 | #define _IVW_MODULE_PROGRESSIVEPHOTONMAPPING_DEFINE_H_ 3 | 4 | #ifdef INVIWO_ALL_DYN_LINK //DYNAMIC 5 | // If we are building DLL files we must declare dllexport/dllimport 6 | #ifdef IVW_MODULE_PROGRESSIVEPHOTONMAPPING_EXPORTS 7 | #ifdef _WIN32 8 | #define IVW_MODULE_PROGRESSIVEPHOTONMAPPING_API __declspec(dllexport) 9 | #else //UNIX (GCC) 10 | #define IVW_MODULE_PROGRESSIVEPHOTONMAPPING_API __attribute__ ((visibility ("default"))) 11 | #endif 12 | #else 13 | #ifdef _WIN32 14 | #define IVW_MODULE_PROGRESSIVEPHOTONMAPPING_API __declspec(dllimport) 15 | #else 16 | #define IVW_MODULE_PROGRESSIVEPHOTONMAPPING_API 17 | #endif 18 | #endif 19 | #else //STATIC 20 | #define IVW_MODULE_PROGRESSIVEPHOTONMAPPING_API 21 | #endif 22 | 23 | #endif /* _IVW_MODULE_PROGRESSIVEPHOTONMAPPING_DEFINE_H_ */ -------------------------------------------------------------------------------- /modules/radixsortcl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(ext/clogs) 2 | 3 | #-------------------------------------------------------------------- 4 | # RadixSortCL Module 5 | ivw_module(RadixSortCL) 6 | 7 | #-------------------------------------------------------------------- 8 | # Add header files 9 | set(HEADER_FILES 10 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/radixsortcl.h 11 | ) 12 | ivw_group("Header Files" ${HEADER_FILES}) 13 | 14 | #-------------------------------------------------------------------- 15 | # Add source files 16 | set(SOURCE_FILES 17 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/radixsortcl.cpp 18 | ) 19 | ivw_group("Source Files" ${SOURCE_FILES}) 20 | 21 | 22 | ivw_group("Shader Files" ${SHADER_FILES}) 23 | 24 | #-------------------------------------------------------------------- 25 | # Create module 26 | ivw_create_module(${SOURCE_FILES} ${HEADER_FILES} ${SHADER_FILES}) 27 | 28 | 29 | target_link_libraries(inviwo-module-radixsortcl PUBLIC inviwo::clogs) 30 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2013 University of Cape Town 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /modules/uniformgridcl/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Daniel Jönsson 2 | All rights reserved. 3 | 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | 26 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/visibility_pop.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 University of Cape Town 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** 23 | * @file 24 | * 25 | * Pops default visibility if appropriate. Note that the lack of include 26 | * guards is intentional. Do not include this file directly. 27 | */ 28 | 29 | #include 30 | 31 | #ifdef CLOGS_DLL_DO_PUSH_POP 32 | # pragma GCC visibility pop 33 | #endif 34 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/visibility_push.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 University of Cape Town 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** 23 | * @file 24 | * 25 | * Pushes default visibility if appropriate. Note that the lack of include 26 | * guards is intentional. Do not include this file directly. 27 | */ 28 | 29 | #include 30 | 31 | #ifdef CLOGS_DLL_DO_PUSH_POP 32 | # pragma GCC visibility push(default) 33 | #endif 34 | -------------------------------------------------------------------------------- /modules/rndgenmwc64x/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, David Thomas 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of Imperial College London nor the names of its 13 | contributors may be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 24 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /modules/rndgenmwc64x/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # MWC64X Random Generator Module 3 | ivw_module(RndGenMWC64X) 4 | 5 | #-------------------------------------------------------------------- 6 | # Add header files 7 | set(HEADER_FILES 8 | ${CMAKE_CURRENT_SOURCE_DIR}/mwc64xrandomnumbergenerator.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/mwc64xseedgenerator.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/randomnumbergenerator2dcl.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/randomnumbergeneratorcl.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/rndgenmwc64xmodule.h 13 | ) 14 | ivw_group("Header Files" ${HEADER_FILES}) 15 | 16 | #-------------------------------------------------------------------- 17 | # Add source files 18 | set(SOURCE_FILES 19 | ${CMAKE_CURRENT_SOURCE_DIR}/mwc64xrandomnumbergenerator.cpp 20 | ${CMAKE_CURRENT_SOURCE_DIR}/mwc64xseedgenerator.cpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/randomnumbergenerator2dcl.cpp 22 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/randomnumbergeneratorcl.cpp 23 | ${CMAKE_CURRENT_SOURCE_DIR}/rndgenmwc64xmodule.cpp 24 | ) 25 | ivw_group("Source Files" ${SOURCE_FILES}) 26 | 27 | #-------------------------------------------------------------------- 28 | # Add OpenCL files 29 | set(SHADER_FILES 30 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/random.cl 31 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/skip_mwc.cl 32 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/randomnumbergenerator.cl 33 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/randstategen.cl 34 | ) 35 | ivw_group("Shader Files" ${SHADER_FILES}) 36 | 37 | #-------------------------------------------------------------------- 38 | # Create module 39 | ivw_create_module(${SOURCE_FILES} ${HEADER_FILES} ${SHADER_FILES}) 40 | 41 | #-------------------------------------------------------------------- 42 | # Add shader directory to pack 43 | ivw_add_to_module_pack(${CMAKE_CURRENT_SOURCE_DIR}/cl) 44 | 45 | 46 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/src/tr1_random.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 University of Cape Town 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** 23 | * @file 24 | * 25 | * Include the functionality of from an appropriate place. 26 | * It doesn't work to just include , because under GCC 27 | * this conflicts with the system that is pulled in by cl.hpp. 28 | */ 29 | 30 | #ifndef CLOGS_TR1_RANDOM_H 31 | #define CLOGS_TR1_RANDOM_H 32 | 33 | // config.h is not found on mac, disable 34 | //#if HAVE_CONFIG_H 35 | //# include 36 | //#endif 37 | #if HAVE_TR1_RANDOM 38 | # include 39 | # define RANDOM_NAMESPACE std::tr1 40 | #elif HAVE_RANDOM 41 | # include 42 | # define RANDOM_NAMESPACE std 43 | #else 44 | # include 45 | # define RANDOM_NAMESPACE std::tr1 46 | #endif 47 | 48 | #endif /* CLOGS_TR1_RANDOM_H */ 49 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/src/tr1_functional.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 University of Cape Town 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** 23 | * @file 24 | * 25 | * Include the functionality of from an appropriate place. 26 | * It doesn't work to just include , because under GCC 27 | * this conflicts with the system that is pulled in by cl.hpp. 28 | */ 29 | 30 | #ifndef CLOGS_TR1_FUNCTIONAL_H 31 | #define CLOGS_TR1_FUNCTIONAL_H 32 | 33 | // config.h is not found on mac, disable 34 | //#if HAVE_CONFIG_H 35 | //# include 36 | //#endif 37 | #if HAVE_TR1_FUNCTIONAL 38 | # include 39 | # define FUNCTIONAL_NAMESPACE std::tr1 40 | #elif HAVE_FUNCTIONAL 41 | # include 42 | # define FUNCTIONAL_NAMESPACE std 43 | #else 44 | # include 45 | # define FUNCTIONAL_NAMESPACE std::tr1 46 | #endif 47 | 48 | #endif /* CLOGS_TR1_FUNCTIONAL_H */ 49 | -------------------------------------------------------------------------------- /modules/rndgenmwc64x/rndgenmwc64xmodule.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2013-2016 Inviwo Foundation 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #ifndef IVW_RND_GEN_MWC64X_MODULE_H 31 | #define IVW_RND_GEN_MWC64X_MODULE_H 32 | 33 | #include 34 | #include 35 | namespace inviwo { 36 | 37 | class IVW_MODULE_RNDGENMWC64X_API RndGenMWC64XModule : public InviwoModule { 38 | public: 39 | RndGenMWC64XModule(InviwoApplication* app); 40 | 41 | protected: 42 | 43 | 44 | }; 45 | 46 | } // namespace 47 | 48 | #endif // IVW_RND_GEN_MWC64X_MODULE_H 49 | -------------------------------------------------------------------------------- /modules/uniformgridcl/uniformgrid3d.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2016 Daniel Jönsson 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | 31 | #include 32 | 33 | namespace inviwo { 34 | 35 | 36 | UniformGrid3DBase::UniformGrid3DBase(size3_t cellDimension /*= size3_t(1)*/) : StructuredGridEntity<3>(), cellDimension_(cellDimension) { 37 | 38 | } 39 | 40 | UniformGrid3DBase::UniformGrid3DBase(const UniformGrid3DBase&) = default; 41 | 42 | UniformGrid3DBase::~UniformGrid3DBase() = default; 43 | 44 | UniformGrid3DBase& UniformGrid3DBase::operator=(const UniformGrid3DBase& that) = default; 45 | 46 | } // namespace 47 | 48 | 49 | -------------------------------------------------------------------------------- /modules/lightcl/samplegenerator2dcl.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | #include "samplegenerator2dcl.h" 33 | 34 | namespace inviwo { 35 | 36 | 37 | SampleGenerator2DCL::SampleGenerator2DCL(bool useGLSharing /*= true*/) 38 | : useGLSharing_{ useGLSharing } { 39 | 40 | } 41 | 42 | } // namespace 43 | 44 | -------------------------------------------------------------------------------- /modules/progressivephotonmapping/cl/indextobuffer.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | __kernel void indexToBufferKernel(__global unsigned int* indices, int nElements) 34 | { 35 | int threadId = get_global_id(0); 36 | if (threadId >= nElements) { 37 | return; 38 | } 39 | indices[threadId] = threadId; 40 | } -------------------------------------------------------------------------------- /modules/uniformgridcl/cl/buffermixer.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2016 Daniel Jönsson 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | #ifndef BUFFER_MIX_CL 30 | #define BUFFER_MIX_CL 31 | 32 | #ifndef MIX_T 33 | # error "MIX_T must be specified" 34 | # define MIX_T int 35 | #endif 36 | 37 | __kernel void mixKernel(__global const MIX_T *x, __global const MIX_T *y, float a, uint len, __global MIX_T *out) 38 | { 39 | uint index = get_global_id(0); 40 | if (index >= len) { 41 | return; 42 | } 43 | #ifdef CONVERT_T_TO_FLOAT 44 | out[index] = CONVERT_FLOAT_TO_T(mix(CONVERT_T_TO_FLOAT(x[index]), CONVERT_T_TO_FLOAT(y[index]), a)); 45 | #else 46 | out[index] = mix(x[index], y[index], a); 47 | #endif 48 | } 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /modules/rndgenmwc64x/rndgenmwc64xmodule.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2013-2016 Inviwo Foundation 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | 36 | 37 | 38 | namespace inviwo { 39 | 40 | RndGenMWC64XModule::RndGenMWC64XModule(InviwoApplication* app) : InviwoModule(app, "RndGenMWC64X") { 41 | registerProcessor(); 42 | registerProcessor(); 43 | OpenCL::getPtr()->addCommonIncludeDirectory(getPath(ModulePath::CL)); 44 | } 45 | 46 | } // namespace 47 | -------------------------------------------------------------------------------- /modules/radixsortcl/radixsortclmodule.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2014-2019 Inviwo Foundation 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #ifndef IVW_RADIX_SORT_CL_MODULE_H 31 | #define IVW_RADIX_SORT_CL_MODULE_H 32 | 33 | #include 34 | #include 35 | 36 | #include 37 | 38 | namespace inviwo { 39 | 40 | class IVW_MODULE_RADIXSORTCL_API RadixSortCLModule: public InviwoModule { 41 | 42 | public: 43 | RadixSortCLModule(InviwoApplication* app); 44 | 45 | virtual ~RadixSortCLModule(); 46 | 47 | private: 48 | void addSourceToClogs(const std::filesystem::path& path, const std::string& hash); 49 | 50 | }; 51 | 52 | } // namespace 53 | 54 | #endif // IVW_RADIX_SORT_CL_MODULE_H 55 | -------------------------------------------------------------------------------- /modules/progressivephotonmapping/cl/threshold.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | __kernel void thresholdKernel(__global const unsigned int* data, unsigned int threshold, int nElements, __global unsigned int* out) 34 | { 35 | int threadId = get_global_id(0); 36 | if (threadId >= nElements) { 37 | return; 38 | } 39 | out[threadId] = convert_uint(data[threadId] < threshold); 40 | } 41 | -------------------------------------------------------------------------------- /modules/progressivephotonmapping/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # Progressive Photon Mapping Module 3 | ivw_module(ProgressivePhotonMapping) 4 | 5 | #-------------------------------------------------------------------- 6 | # Add header files 7 | set(HEADER_FILES 8 | ${CMAKE_CURRENT_SOURCE_DIR}/photondata.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/photonrecomputationdetector.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/photontracercl.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/processor/photontolightvolumeprocessorcl.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/processor/progressivephotontracercl.h 13 | ${CMAKE_CURRENT_SOURCE_DIR}/progressivephotonmappingmodule.h 14 | ) 15 | ivw_group("Header Files" ${HEADER_FILES}) 16 | 17 | #-------------------------------------------------------------------- 18 | # Add source files 19 | set(SOURCE_FILES 20 | ${CMAKE_CURRENT_SOURCE_DIR}/photondata.cpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/photonrecomputationdetector.cpp 22 | ${CMAKE_CURRENT_SOURCE_DIR}/photontracercl.cpp 23 | ${CMAKE_CURRENT_SOURCE_DIR}/processor/photontolightvolumeprocessorcl.cpp 24 | ${CMAKE_CURRENT_SOURCE_DIR}/processor/progressivephotontracercl.cpp 25 | ${CMAKE_CURRENT_SOURCE_DIR}/progressivephotonmappingmodule.cpp 26 | ) 27 | ivw_group("Source Files" ${SOURCE_FILES}) 28 | 29 | #-------------------------------------------------------------------- 30 | # Add OpenCL files 31 | set(SHADER_FILES 32 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/densityestimationkernel.cl 33 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/hashlightsample.cl 34 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/indextobuffer.cl 35 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/photon.cl 36 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/photonrecomputationdetector.cl 37 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/photonstolightvolume.cl 38 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/photontracer.cl 39 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/threshold.cl 40 | ) 41 | source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/cl PREFIX "Shader Files" FILES ${SHADER_FILES}) 42 | 43 | #-------------------------------------------------------------------- 44 | # Create module 45 | ivw_create_module(${SOURCE_FILES} ${HEADER_FILES} ${SHADER_FILES}) 46 | 47 | #-------------------------------------------------------------------- 48 | # Add shader and kernel directory to pack 49 | ivw_add_to_module_pack(${CMAKE_CURRENT_SOURCE_DIR}/cl) 50 | ivw_add_to_module_pack(${CMAKE_CURRENT_SOURCE_DIR}/workspaces) 51 | 52 | 53 | -------------------------------------------------------------------------------- /modules/lightcl/lightsourcesamplercl.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #include "lightsourcesamplercl.h" 34 | 35 | namespace inviwo { 36 | 37 | 38 | LightSourceSamplerCL::LightSourceSamplerCL(std::shared_ptr lightSource, std::shared_ptr sampleGenerator) 39 | : sampleGenerator_(sampleGenerator), lightSource_(lightSource) 40 | { 41 | 42 | } 43 | 44 | LightSourceSamplerCL::~LightSourceSamplerCL() { 45 | 46 | } 47 | 48 | } // namespace 49 | 50 | -------------------------------------------------------------------------------- /modules/importancesamplingcl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # Inviwo ImportanceSamplingCL Module 3 | ivw_module(ImportanceSamplingCL) 4 | 5 | #-------------------------------------------------------------------- 6 | # Add header files 7 | set(HEADER_FILES 8 | ${CMAKE_CURRENT_SOURCE_DIR}/importancesamplingclmodule.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/importanceuniformgrid3d.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/minmaxuniformgrid3dimportancecl.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/minmaxuniformgrid3dimportanceclprocessor.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformsamplegenerator2dprocessorcl.h 13 | ${CMAKE_CURRENT_SOURCE_DIR}/uniformsamplegenerator2dcl.h 14 | ) 15 | ivw_group("Header Files" ${HEADER_FILES}) 16 | 17 | #-------------------------------------------------------------------- 18 | # Add source files 19 | set(SOURCE_FILES 20 | ${CMAKE_CURRENT_SOURCE_DIR}/importancesamplingclmodule.cpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/minmaxuniformgrid3dimportancecl.cpp 22 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/minmaxuniformgrid3dimportanceclprocessor.cpp 23 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformsamplegenerator2dprocessorcl.cpp 24 | ${CMAKE_CURRENT_SOURCE_DIR}/uniformsamplegenerator2dcl.cpp 25 | ) 26 | ivw_group("Source Files" ${SOURCE_FILES}) 27 | 28 | 29 | #-------------------------------------------------------------------- 30 | # Add shaders 31 | set(SHADER_FILES 32 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/datastructures/ray.cl 33 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/intersection/lightsamplemeshintersection.cl 34 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/minmaxuniformgrid3dimportance.cl 35 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/light/light.cl 36 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/light/lightsampling.cl 37 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/uniformsamplegenerator2d.cl 38 | ) 39 | ivw_group("Shader Files" ${SHADER_FILES}) 40 | 41 | 42 | #-------------------------------------------------------------------- 43 | # Add Unittests 44 | #set(TEST_FILES 45 | # ${CMAKE_CURRENT_SOURCE_DIR}/tests/importancesamplingcl-test.cpp 46 | #) 47 | #ivw_add_unittest(${TEST_FILES}) 48 | 49 | #-------------------------------------------------------------------- 50 | # Create module 51 | ivw_create_module(${SOURCE_FILES} ${HEADER_FILES} ${SHADER_FILES}) 52 | 53 | #-------------------------------------------------------------------- 54 | # Add shader directory to pack 55 | ivw_add_to_module_pack(${CMAKE_CURRENT_SOURCE_DIR}/cl) -------------------------------------------------------------------------------- /modules/uniformgridcl/glsl/volume_mix.frag: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2014-2015 Inviwo Foundation 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #include "utils/structs.glsl" 31 | #include "utils/sampler3d.glsl" 32 | 33 | uniform sampler3D volume; 34 | uniform VolumeParameters volumeParameters; 35 | 36 | uniform sampler3D volume1; 37 | uniform VolumeParameters volume1Parameters; 38 | 39 | uniform float weight; 40 | 41 | in vec4 texCoord_; 42 | 43 | 44 | void main() { 45 | vec4 v1 = texture(volume, texCoord_.xyz); 46 | vec4 v2 = texture(volume1, texCoord_.xyz); 47 | //vec4 v1 = getNormalizedVoxel(volume, volumeParameters, texCoord_.xyz); 48 | //vec4 v2 = getNormalizedVoxel(volume1, volume1Parameters, texCoord_.xyz); 49 | //vec4 v1 = getVoxel(volume0, volume0Parameters, texCoord_.xyz); 50 | //vec4 v2 = getVoxel(volume1, volume1Parameters, texCoord_.xyz); 51 | vec4 result = mix(v1, v2, weight); 52 | 53 | FragData0 = result; 54 | } -------------------------------------------------------------------------------- /modules/uniformgridcl/minmaxuniformgrid3d.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2016 Daniel Jönsson 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #ifndef IVW_MINMAXUNIFORMGRID3D_H 31 | #define IVW_MINMAXUNIFORMGRID3D_H 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include 39 | namespace inviwo { 40 | 41 | //< Information about the minimum and maximum value within each grid cell. 42 | using MinMaxUniformGrid3D = UniformGrid3D; 43 | using MinMaxUniformGrid3DVector = std::vector>; 44 | 45 | using MinMaxUniformGrid3DInport = DataInport; 46 | using MinMaxUniformGrid3DOutport = DataOutport; 47 | } // namespace 48 | 49 | #endif // IVW_MINMAXUNIFORMGRID3D_H 50 | 51 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/clogs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 University of Cape Town 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** 23 | * @file 24 | * 25 | * OpenCL primitives. 26 | */ 27 | 28 | #ifndef CLOGS_CLOGS_H 29 | #define CLOGS_CLOGS_H 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | #if defined(__clang__) 39 | // Not available 40 | #elif defined(__GNUC__) 41 | // Not available 42 | #elif defined(_MSC_VER) 43 | # if (_MSC_FULL_VER >= 130000000) 44 | // Return conversion from size_t to cl_uint, possible loss of data 45 | # pragma warning(disable: 4267) 46 | # endif 47 | #endif 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | /** 56 | * @mainpage 57 | * 58 | * Please refer to the user manual for an introduction to CLOGS, or the 59 | * @ref clogs namespace page for reference documentation of the classes. 60 | */ 61 | 62 | /** 63 | * OpenCL primitives. 64 | * 65 | * The primary classes of interest are @ref Scan, @ref Reduce and @ref Radixsort, which 66 | * provide the algorithms. The other classes are utilities and helpers. 67 | */ 68 | namespace clogs 69 | { 70 | } // namespace clogs 71 | 72 | #endif /* !CLOGS_CLOGS_H */ 73 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/platform.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Bruce Merry 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** 23 | * @file 24 | * 25 | * Detects compiler properties. 26 | */ 27 | 28 | #ifndef CLOGS_PLATFORM_H 29 | #define CLOGS_PLATFORM_H 30 | 31 | #if __cplusplus >= 201103L 32 | # define CLOGS_HAVE_RVALUE_REFERENCES 1 33 | #elif defined(_MSC_VER) 34 | # if _MSC_VER >= 1600 // VC 2010 35 | # define CLOGS_HAVE_RVALUE_REFERENCES 1 36 | # endif 37 | #elif defined(__has_extension) 38 | # if __has_extension(cxx_rvalue_references) 39 | # define CLOGS_HAVE_RVALUE_REFERENCES 1 40 | # endif 41 | #endif 42 | 43 | #if __cplusplus >= 201103L 44 | # define CLOGS_HAVE_NOEXCEPT 1 45 | #elif defined(__has_extension) 46 | # if __has_extension(cxx_noexcept) 47 | # define CLOGS_HAVE_NOEXCEPT 1 48 | # endif 49 | #endif 50 | #ifdef CLOGS_HAVE_NOEXCEPT 51 | # define CLOGS_NOEXCEPT noexcept 52 | #else 53 | # define CLOGS_NOEXCEPT 54 | #endif 55 | 56 | #if __cplusplus >= 201103L 57 | # define CLOGS_HAVE_DELETED_FUNCTIONS 1 58 | #elif defined(_MSC_VER) 59 | # if _MSC_VER >= 1800 60 | # define CLOGS_HAVE_DELETED_FUNCTIONS 1 61 | # endif 62 | #elif defined(__has_extension) 63 | # if __has_extension(cxx_deleted_functions) 64 | # define CLOGS_HAVE_DELETED_FUNCTIONS 1 65 | # endif 66 | #endif 67 | #ifdef CLOGS_HAVE_DELETED_FUNCTION 68 | # define CLOGS_DELETE_FUNCTION = delete 69 | #else 70 | # define CLOGS_DELETE_FUNCTION 71 | #endif 72 | 73 | #endif /* !CLOGS_PLATFORM_H */ 74 | -------------------------------------------------------------------------------- /modules/progressivephotonmapping/progressivephotonmappingmodule.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_PROGRESSIVE_PHOTON_MAPPING_MODULE_H 34 | #define IVW_PROGRESSIVE_PHOTON_MAPPING_MODULE_H 35 | 36 | #include 37 | #include 38 | namespace inviwo { 39 | 40 | class IVW_MODULE_PROGRESSIVEPHOTONMAPPING_API ProgressivePhotonMappingModule : public InviwoModule { 41 | 42 | public: 43 | ProgressivePhotonMappingModule(InviwoApplication* app); 44 | 45 | }; 46 | 47 | } // namespace 48 | 49 | #endif // IVW_PROGRESSIVE_PHOTON_MAPPING_MODULE_H 50 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/visibility.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 University of Cape Town 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** 23 | * @file 24 | * 25 | * Internal header file that provides macros to control symbol visibility. 26 | * Do not include this header directly or use any of the macros it defines. 27 | * They are not part of the API and are subject to change. 28 | * 29 | * @see http://gcc.gnu.org/wiki/Visibility 30 | */ 31 | 32 | #ifndef CLOGS_VISIBILITY_H 33 | #define CLOGS_VISIBILITY_H 34 | 35 | #if defined(_WIN32) || defined(__CYGWIN__) 36 | # define CLOGS_DLL_IMPORT __declspec(dllimport) 37 | # define CLOGS_DLL_EXPORT __declspec(dllexport) 38 | # define CLOGS_DLL_LOCAL 39 | #else 40 | # if __GNUC__ >= 4 41 | # define CLOGS_DLL_DO_PUSH_POP 42 | # define CLOGS_DLL_IMPORT __attribute__((visibility("default"))) 43 | # define CLOGS_DLL_EXPORT __attribute__((visibility("default"))) 44 | # define CLOGS_DLL_LOCAL __attribute__((visibility("hidden"))) 45 | # else 46 | # define CLOGS_DLL_IMPORT 47 | # define CLOGS_DLL_EXPORT 48 | # define CLOGS_DLL_LOCAL 49 | # endif 50 | #endif 51 | 52 | #ifdef CLOGS_DLL_DO_STATIC /* defined by build system in static lib builds */ 53 | # define CLOGS_API CLOGS_DLL_LOCAL 54 | #else 55 | /* CLOGS_DLL_DO_EXPORT is defined by the build system when building the library */ 56 | #ifdef CLOGS_DLL_DO_EXPORT 57 | # define CLOGS_API CLOGS_DLL_EXPORT 58 | #else 59 | # define CLOGS_API CLOGS_DLL_IMPORT 60 | #endif 61 | #endif 62 | #define CLOGS_LOCAL CLOGS_DLL_LOCAL 63 | 64 | #endif /* !CLOGS_VISIBILITY_H */ 65 | -------------------------------------------------------------------------------- /modules/uniformgridcl/uniformgridclmodule.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2016 Daniel Jönsson 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #ifndef IVW_UNIFORMGRIDCLMODULE_H 31 | #define IVW_UNIFORMGRIDCLMODULE_H 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | 38 | namespace inviwo { 39 | 40 | class IVW_MODULE_UNIFORMGRIDCL_API UniformGridCLModule : public InviwoModule { 41 | 42 | public: 43 | UniformGridCLModule(InviwoApplication* app); 44 | 45 | virtual int getVersion() const override; 46 | virtual std::unique_ptr getConverter(int version) const override; 47 | 48 | private: 49 | class Converter : public VersionConverter { 50 | public: 51 | Converter(int version); 52 | virtual bool convert(TxElement* root) override; 53 | 54 | private: 55 | int version_; 56 | }; 57 | }; 58 | 59 | } // namespace 60 | 61 | #endif // IVW_UNIFORMGRIDCLMODULE_H 62 | -------------------------------------------------------------------------------- /modules/importancesamplingcl/cl/uniformsamplegenerator2d.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #include "samplers.cl" 34 | 35 | __kernel void uniformSampleGenerator2DKernel( 36 | float2 dimensions 37 | , int nElements 38 | //, __global half* samples 39 | , __global float4* samples 40 | ) 41 | { 42 | int threadId = get_global_id(0); 43 | if (threadId >= nElements) { 44 | return; 45 | } 46 | float2 coord = (float2)(fmod(convert_float(threadId), dimensions.x), convert_float(threadId) / dimensions.x); 47 | float2 uv = (0.5f + coord) / convert_float2(dimensions); 48 | //vstore_half2(uv, threadId, samples); 49 | float pdf = 1.f; 50 | samples[threadId] = (float4)(uv, 0.f, pdf); 51 | 52 | } -------------------------------------------------------------------------------- /modules/lightcl/convexhull2d.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_CONVEXHULL2D_H 34 | #define IVW_CONVEXHULL2D_H 35 | 36 | #include 37 | #include 38 | 39 | namespace inviwo { 40 | namespace geometry { 41 | /** 42 | * \brief Compute the convex hull of a set of 2D points. 43 | * 44 | * Uses Andrew's monotone chain algorithm: 45 | * http://geomalgorithms.com/a10-_hull-1.html 46 | * or page 109-112 in Real-Time Collision Detection 47 | * 48 | * @param std::vector points Points to compute hull 49 | * @return std::vector Hull in counter-clockwise order. 50 | */ 51 | IVW_MODULE_LIGHTCL_API std::vector convexHull2D(std::vector points); 52 | 53 | } // namespace geometry 54 | } // namespace 55 | 56 | #endif // IVW_CONVEXHULL2D_H 57 | 58 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/Changelog: -------------------------------------------------------------------------------- 1 | 1.5.0 2 | ----- 3 | * Make tuning work on-the-fly instead of requiring up-front tuning 4 | * Make the ABI robust against changes to OpenCL C++ bindings 5 | * Add method overloads that take OpenCL C API handles 6 | * Add free callback to setEventCallback functions 7 | * Add support for arbitrary function objects to setEventCallback functions 8 | * Allow algorithm objects to be default constructed, swapped, and moved 9 | * Fix CLOGS_VERSION_MINOR 10 | 11 | 1.4.0 12 | ----- 13 | * Reduction has been added 14 | * Introduced the ScanProblem and RadixsortProblem classes 15 | * The cache is now stored in a SQLite database instead of lots of files 16 | * The cache is now located in an XDG-compliant location on UNIX (~/.cache/clogs by default). 17 | * The tuning caching mechanism has been significantly rewritten for use with SQLite 18 | * All kernels generated during tuning are now cached (this can use a lot of space) 19 | 20 | 1.3.0 21 | ----- 22 | * Program binaries are now extracted during tuning and saved in the cache (see #8). This can also make tuning faster on systems that don't cache kernels. 23 | * Out-of-place scan is now supported (partially implements #12). 24 | * Workaround to avoid depending on OpenCL 1.2 ICD 25 | 26 | 1.2.4 27 | ----- 28 | * Fix definition of WARP_VOLATILE (#28) 29 | 30 | 1.2.3 31 | ----- 32 | * Fix a bug causing incorrect results when SCAN_BLOCKS is small (#26) 33 | * Avoid building the unit test kernels except when testing (#24) 34 | * Speed up tuning on CPU devices (#25) 35 | 36 | 1.2.2 37 | ----- 38 | * Fix a race condition in radix sort (mostly affects CPU devices) 39 | * Work around an AMD driver bug that caused segfaults in tuning 40 | * Avoid passing defines with both -D and #define 41 | 42 | 1.2.1 43 | ----- 44 | * Performance improvements, particularly for AMD GPUs 45 | * Added --keep-going option to clogs-tune, as a temporary work-around for #23 46 | 47 | 1.2.0 48 | ----- 49 | * Kernel parameters are now autotuned (refer to user manual) 50 | * Added benchmark support for scan 51 | * Fixed sorting in benchmark tool to support 3-element value types 52 | * Improved robustness to non-default locale 53 | * Added --split-debug and --variant=symbols configuration options 54 | 55 | 1.1.0 56 | ----- 57 | * Add setEventCallback methods to Scan and Radixsort 58 | * Worked around a bug in the Intel OpenCL compiler 59 | 60 | 1.0.3 61 | ----- 62 | * Some minor tweaks to allow building on Windows with MSVC 63 | * Allow build to complete (without tests) if CppUnit is missing 64 | 65 | 1.0.2 66 | ----- 67 | * Fix a build system error that caused builds to fail when documentation was built from a pristine installation 68 | 69 | 1.0.1 70 | ----- 71 | * Fix a packaging error that prevented installation from working when building docs 72 | 73 | 1.0.0 74 | ----- 75 | * First public release 76 | -------------------------------------------------------------------------------- /modules/importancesamplingcl/importanceuniformgrid3d.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_IMPORTANCEUNIFORMGRID3D_H 34 | #define IVW_IMPORTANCEUNIFORMGRID3D_H 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #include 42 | 43 | namespace inviwo { 44 | 45 | //< Information about the importance of each grid cell. 46 | using ImportanceUniformGrid3D = UniformGrid3D; 47 | 48 | using ImportanceUniformGrid3DInport = DataInport; 49 | using ImportanceUniformGrid3DOutport = DataOutport; 50 | 51 | } // namespace 52 | 53 | #endif // IVW_IMPORTANCEUNIFORMGRID3D_H 54 | 55 | -------------------------------------------------------------------------------- /modules/lightcl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # Inviwo LightCL Module 3 | ivw_module(LightCL) 4 | 5 | #-------------------------------------------------------------------- 6 | # Add header files 7 | set(HEADER_FILES 8 | #${CMAKE_CURRENT_SOURCE_DIR}/lightclprocessor.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/convexhull2d.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/directionallightsamplercl.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/lightsample.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/lightsamplemeshintersectioncl.h 13 | ${CMAKE_CURRENT_SOURCE_DIR}/lightsourcesamplercl.h 14 | ${CMAKE_CURRENT_SOURCE_DIR}/lightsourcescl.h 15 | ${CMAKE_CURRENT_SOURCE_DIR}/orientedboundingbox2d.h 16 | ${CMAKE_CURRENT_SOURCE_DIR}/pointplaneprojection.h 17 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/directionallightsamplerclprocessor.h 18 | ${CMAKE_CURRENT_SOURCE_DIR}/sample.h 19 | ${CMAKE_CURRENT_SOURCE_DIR}/samplegenerator2dcl.h 20 | ) 21 | ivw_group("Header Files" ${HEADER_FILES}) 22 | 23 | #-------------------------------------------------------------------- 24 | # Add source files 25 | set(SOURCE_FILES 26 | #${CMAKE_CURRENT_SOURCE_DIR}/lightclprocessor.cpp 27 | ${CMAKE_CURRENT_SOURCE_DIR}/convexhull2d.cpp 28 | ${CMAKE_CURRENT_SOURCE_DIR}/directionallightsamplercl.cpp 29 | ${CMAKE_CURRENT_SOURCE_DIR}/lightsample.cpp 30 | ${CMAKE_CURRENT_SOURCE_DIR}/lightsamplemeshintersectioncl.cpp 31 | ${CMAKE_CURRENT_SOURCE_DIR}/lightsourcesamplercl.cpp 32 | ${CMAKE_CURRENT_SOURCE_DIR}/lightsourcescl.cpp 33 | ${CMAKE_CURRENT_SOURCE_DIR}/orientedboundingbox2d.cpp 34 | ${CMAKE_CURRENT_SOURCE_DIR}/pointplaneprojection.cpp 35 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/directionallightsamplerclprocessor.cpp 36 | ${CMAKE_CURRENT_SOURCE_DIR}/samplegenerator2dcl.cpp 37 | ) 38 | ivw_group("Source Files" ${SOURCE_FILES}) 39 | 40 | 41 | #-------------------------------------------------------------------- 42 | # Add shaders 43 | set(SHADER_FILES 44 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/directionallightsampler.cl 45 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/datastructures/lightsample.cl 46 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/intersection/lightsamplemeshintersection.cl 47 | ) 48 | ivw_group("Shader Files" ${SHADER_FILES}) 49 | 50 | 51 | #-------------------------------------------------------------------- 52 | # Add Unittests 53 | #set(TEST_FILES 54 | # ${CMAKE_CURRENT_SOURCE_DIR}/tests/lightcl-test.cpp 55 | #) 56 | #ivw_add_unittest(${TEST_FILES}) 57 | 58 | #-------------------------------------------------------------------- 59 | # Create module 60 | ivw_create_module(${SOURCE_FILES} ${HEADER_FILES} ${SHADER_FILES}) 61 | 62 | #-------------------------------------------------------------------- 63 | # Add shader directory to pack 64 | ivw_add_to_module_pack(${CMAKE_CURRENT_SOURCE_DIR}/cl) -------------------------------------------------------------------------------- /modules/lightcl/sample.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_SAMPLE3D_H 34 | #define IVW_SAMPLE3D_H 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | namespace inviwo { 43 | 44 | /** 45 | * \class Sample 46 | * 47 | * \brief Location and pdf for a sample. 48 | * A sample consist of: 49 | * position (vec3) 50 | * pdf (float) 51 | * 52 | * Surface samples (2D) only uses the uv coordinates of the position. 53 | */ 54 | using SampleBuffer = Buffer; 55 | 56 | using SampleInport = DataInport; 57 | using SampleOutport = DataOutport; 58 | 59 | } // namespace 60 | 61 | #endif // IVW_SAMPLE3D_H 62 | 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Correlated Photon Mapping for Interactive Global Illumination of Time-Varying Volumetric Data 2 | 3 | Example code for tracing photons in time-varying heterogenous media using a visual importance map as described in the publication "Correlated Photon Mapping for Interactive Global Illumination of Time-Varying Volumetric Data". 4 | Note that each folder may have different licenses. 5 | 6 | Please cite the article when making use of this code: 7 | 8 | > @article{JFY16,
9 | author = {J{\"o}nsson, Daniel and Ynnerman, Anders},
10 | title = {{Correlated Photon Mapping for Interactive Global Illumination of Time-Varying Volumetric Data}},
11 | journal = {IEEE Transactions on Visualization and Computer Graphics (TVCG)},
12 | number = {1},
13 | volume = {23},
14 | pages = {901 - 910},
15 | year = {2017}
16 | } 17 | 18 | #### Build 19 | 1. Download and setup [Inviwo](https://github.com/inviwo/inviwo) (tested with version Inviwo commit [989dc16e00aff2e3955281dbcf5a224ec53d2001](https://github.com/inviwo/inviwo/tree/989dc16e00aff2e3955281dbcf5a224ec53d2001)): 20 | - Download link: https://github.com/inviwo/inviwo/tree/989dc16e00aff2e3955281dbcf5a224ec53d2001 21 | - Setup instructions: https://github.com/inviwo/inviwo/wiki 22 | - OpenCL Required (For Nvidia: https://developer.nvidia.com/cuda-toolkit) 23 | 24 | 2. Download and setup boost (required by the radix sorting library) 25 | - http://www.boost.org/ 26 | 27 | 28 | 3. Set the directory to this folder in CMake, IVW_EXTERNAL_MODULES path/to/CorrelatedPhotonMapping/modules; 29 | - Press Configure in CMake 30 | 4. Enable the IVW_MODULE_PROGRESSIVE_PHOTONMAPPING 31 | - Press Configure/Generate in CMake until no errors appear. 32 | - Compile and run! 33 | - Load workspace workspaces/CorrelatedPhotonMappingSingleVolume.inv for and example. 34 | - Be patient: Optimal OpenCL workgroup sizes are found for sorting the first time loading the workspace. 35 | 36 | #### Build system 37 | - The project and module configuration/generation is performed through CMake. 38 | - [Inviwo](https://github.com/inviwo/inviwo) interactive visualization workshop is required. 39 | - OpenCL Required (For Nvidia: https://developer.nvidia.com/cuda-toolkit) 40 | - Boost Required 41 | 42 | ### Licenses 43 | Each folder can be under a different license. See license.txt in each folder. 44 | 45 | radixsortcl: clogs 1.5.0 is under MIT license 46 | 47 | rndgenmwc64x: MWC64X is under BSD license 48 | 49 | uniformgridcl: is under MIT license 50 | 51 | importancesamplingcl is under Creative Commons Attribution-NonCommercial 4.0 International license 52 | 53 | lightcl is under Creative Commons Attribution-NonCommercial 4.0 International license 54 | 55 | progressivephotonmapping is under Creative Commons Attribution-NonCommercial 4.0 International license 56 | -------------------------------------------------------------------------------- /modules/progressivephotonmapping/progressivephotonmappingmodule.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | 38 | #include 39 | 40 | 41 | namespace inviwo { 42 | 43 | ProgressivePhotonMappingModule::ProgressivePhotonMappingModule(InviwoApplication* app) : InviwoModule(app, "ProgressivePhotonMapping") { 44 | // Processors 45 | registerProcessor(); 46 | registerProcessor(); 47 | OpenCL::getPtr()->addCommonIncludeDirectory(getPath(ModulePath::CL)); 48 | 49 | registerPort>(); 50 | registerPort>(); 51 | } 52 | 53 | } // namespace 54 | -------------------------------------------------------------------------------- /modules/uniformgridcl/cl/uniformgrid/volumeminmax.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2016 Daniel Jönsson 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #include "samplers.cl" 31 | #include "image3d_write.cl" 32 | 33 | __kernel void volumeMinMaxKernel(read_only image3d_t volumeIn, __constant VolumeParameters* volumeParams 34 | , image_3d_write_vec2_uint16_t volumeOut 35 | , int4 outDim 36 | , int4 region 37 | ) 38 | { 39 | // output coordinates 40 | int3 globalId = (int3)(get_global_id(0), get_global_id(1), get_global_id(2)); 41 | 42 | 43 | if (any(globalId>=outDim.xyz)) { 44 | return; 45 | } 46 | float2 minMaxVal = (float2)(FLT_MAX, 0); 47 | int4 startCoord = (int4)(globalId*region.xyz, 0); 48 | int4 endCoord = min(startCoord+region, get_image_dim(volumeIn)); 49 | for (int z = startCoord.z; z < endCoord.z; ++z) { 50 | for (int y = startCoord.y; y < endCoord.y; ++y) { 51 | for (int x = startCoord.x; x < endCoord.x; ++x) { 52 | float value = getNormalizedVoxelUnorm(volumeIn, volumeParams, (int4)(x, y, z, 0)).x; 53 | minMaxVal.x = min(minMaxVal.x, value); 54 | minMaxVal.y = max(minMaxVal.y, value); 55 | } 56 | } 57 | } 58 | 59 | writeImageVec2UInt16f(volumeOut, as_int4(globalId), outDim, minMaxVal); 60 | 61 | } -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/tune.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bruce Merry 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** 23 | * @file 24 | * 25 | * Control over tuning policy. 26 | */ 27 | 28 | #ifndef CLOGS_TUNE_H 29 | #define CLOGS_TUNE_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace clogs 36 | { 37 | 38 | class TunePolicy; 39 | 40 | namespace detail 41 | { 42 | class TunePolicy; 43 | 44 | CLOGS_LOCAL const TunePolicy &getDetail(const clogs::TunePolicy &); 45 | } // namespace detail 46 | 47 | enum TuneVerbosity 48 | { 49 | TUNE_VERBOSITY_SILENT = 0, 50 | TUNE_VERBOSITY_TERSE = 1, 51 | TUNE_VERBOSITY_NORMAL = 2, 52 | TUNE_VERBOSITY_DEBUG = 3 53 | }; 54 | 55 | class CLOGS_API TunePolicy 56 | { 57 | private: 58 | friend const detail::TunePolicy &detail::getDetail(const clogs::TunePolicy &); 59 | detail::TunePolicy *detail_; 60 | 61 | public: 62 | TunePolicy(); 63 | ~TunePolicy(); 64 | TunePolicy(const TunePolicy &); 65 | TunePolicy &operator=(const TunePolicy &); 66 | 67 | /** 68 | * Specify whether on-the-fly tuning is permitted. If it is not permitted, 69 | * then any attempt to construct an algorithm which isn't already tuned 70 | * will throw @ref clogs::CacheError. The default is that tuning is 71 | * permitted. 72 | */ 73 | void setEnabled(bool enabled); 74 | 75 | /** 76 | * Set the verbosity level. The default is @c TUNE_VERBOSITY_NORMAL. 77 | */ 78 | void setVerbosity(TuneVerbosity verbosity); 79 | 80 | /** 81 | * Set the output stream for reporting tuning progress. The default is 82 | * @c std::cout. 83 | */ 84 | void setOutput(std::ostream &out); 85 | }; 86 | 87 | } // namespace clogs 88 | 89 | #endif /* !CLOGS_TUNE_H */ 90 | -------------------------------------------------------------------------------- /modules/lightcl/lightclmodule.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_LIGHTCLMODULE_H 34 | #define IVW_LIGHTCLMODULE_H 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | namespace inviwo { 41 | 42 | class IVW_MODULE_LIGHTCL_API LightCLModule : public InviwoModule { 43 | 44 | public: 45 | LightCLModule(InviwoApplication* app); 46 | virtual int getVersion() const override; 47 | virtual std::unique_ptr getConverter(int version) const override; 48 | private: 49 | class Converter : public VersionConverter { 50 | public: 51 | Converter(int version); 52 | virtual ~Converter() = default; 53 | virtual bool convert(TxElement* root) override; 54 | 55 | private: 56 | int version_; 57 | }; 58 | }; 59 | 60 | } // namespace 61 | 62 | #endif // IVW_LIGHTCLMODULE_H 63 | -------------------------------------------------------------------------------- /modules/importancesamplingcl/cl/intersection/lightsamplemeshintersection.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #include "datastructures/lightsample.cl" 34 | #include "intersection/raymeshintersection.cl" 35 | 36 | // Compute intersection point along ray for light samples. 37 | __kernel void meshLightSampleIntersectionKernel( 38 | __global float const * __restrict vertices 39 | , __global int const * __restrict indices 40 | , int nIndices 41 | , __global StoredLightSample const * __restrict lightSamples 42 | , int nSamples 43 | , __global StoredIntersectionPoint* intersectionPoints 44 | ) 45 | { 46 | int threadId = get_global_id(0); 47 | if (threadId >= nSamples) { 48 | return; 49 | } 50 | LightSample lightSample = readLightSample(lightSamples, threadId); 51 | float2 intersectionPoint; 52 | float t0 = 0; float t1 = FLT_MAX; 53 | bool hit = rayMeshIntersection(vertices, indices, nIndices, lightSample.origin, lightSample.direction, &t0, &t1); 54 | writeIntersectionPoint((float2)(t0, t1), intersectionPoints, threadId); 55 | } -------------------------------------------------------------------------------- /modules/importancesamplingcl/importancesamplingclmodule.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_IMPORTANCESAMPLINGCLMODULE_H 34 | #define IVW_IMPORTANCESAMPLINGCLMODULE_H 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | namespace inviwo { 41 | 42 | class IVW_MODULE_IMPORTANCESAMPLINGCL_API ImportanceSamplingCLModule : public InviwoModule { 43 | 44 | public: 45 | ImportanceSamplingCLModule(InviwoApplication* app); 46 | 47 | virtual int getVersion() const override; 48 | virtual std::unique_ptr getConverter(int version) const override; 49 | private: 50 | class Converter : public VersionConverter { 51 | public: 52 | Converter(int version); 53 | virtual bool convert(TxElement* root) override; 54 | 55 | private: 56 | int version_; 57 | }; 58 | 59 | }; 60 | 61 | } // namespace 62 | 63 | #endif // IVW_IMPORTANCESAMPLINGCLMODULE_H 64 | -------------------------------------------------------------------------------- /modules/lightcl/lightsourcescl.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #include "lightsourcescl.h" 34 | 35 | namespace inviwo { 36 | 37 | 38 | size_t uploadLightSources(std::vector>::const_iterator begin, std::vector>::const_iterator end, const mat4& transformation, float radianceScale, BufferCL* lightSourcesCLOut) { 39 | std::vector packedLights; 40 | for (auto light = begin; light != end; ++light) { 41 | if (*light) { 42 | packedLights.emplace_back(baseLightToPackedLight((*light).get(), 43 | radianceScale, transformation)); 44 | } 45 | } 46 | 47 | 48 | if (packedLights.size() != lightSourcesCLOut->getSize() / sizeof(PackedLightSource)) { 49 | lightSourcesCLOut->setSize(sizeof(PackedLightSource)*packedLights.size()); 50 | } 51 | if (packedLights.size() > 0) 52 | lightSourcesCLOut->upload(&packedLights[0], sizeof(PackedLightSource)*packedLights.size()); 53 | 54 | return packedLights.size(); 55 | } 56 | 57 | } // namespace 58 | 59 | -------------------------------------------------------------------------------- /modules/lightcl/pointplaneprojection.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #include "pointplaneprojection.h" 34 | 35 | namespace inviwo { 36 | namespace geometry { 37 | 38 | 39 | void projectPointsOnPlane(const std::vector &points, const Plane &plane, vec3 u, vec3 v, std::vector& projectedPoints) { 40 | vec3 n = plane.getNormal(); 41 | float d = glm::dot(n, plane.getPoint()); 42 | projectedPoints.reserve(points.size()); 43 | 44 | for (const auto& elem : points) { 45 | //auto projectedPoint = plane.projectPoint(elem) - plane.getPoint(); 46 | // Project point onto plane 47 | float distanceFromPlane = glm::dot(n, elem) - d; 48 | auto projectedPoint = elem - distanceFromPlane*n; 49 | // Compute vector from origin to projected point 50 | auto originToProjectedPoint = projectedPoint - plane.getPoint(); 51 | // Transform to new coordinate system 52 | projectedPoints.emplace_back(vec2(glm::dot(u, originToProjectedPoint), glm::dot(v, originToProjectedPoint))); 53 | } 54 | } 55 | 56 | } // namespace geometry 57 | } // namespace 58 | 59 | -------------------------------------------------------------------------------- /modules/lightcl/cl/intersection/lightsamplemeshintersection.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #include "datastructures/lightsample.cl" 34 | #include "intersection/raymeshintersection.cl" 35 | 36 | // Compute intersection point along ray for light samples. 37 | __kernel void lightSampleMeshIntersectionKernel( 38 | __global float const * __restrict vertices 39 | , __global int const * __restrict indices 40 | , int nIndices 41 | , __global StoredLightSample const * __restrict lightSamples 42 | , int nSamples 43 | , __global StoredIntersectionPoint* intersectionPoints 44 | ) 45 | { 46 | int threadId = get_global_id(0); 47 | if (threadId >= nSamples) { 48 | return; 49 | } 50 | LightSample lightSample = readLightSample(lightSamples, threadId); 51 | float2 intersectionPoint; 52 | float t0 = 0; float t1 = FLT_MAX; 53 | bool hit = rayMeshIntersection(vertices, indices, nIndices, lightSample.origin, lightSample.direction, &t0, &t1); 54 | if (!hit) { 55 | t0 = 0.f; t1 = -1.f; 56 | } 57 | 58 | writeIntersectionPoint((float2)(t0, t1), intersectionPoints, threadId); 59 | } -------------------------------------------------------------------------------- /modules/progressivephotonmapping/cl/photon.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | #ifndef PHOTON_CL 33 | #define PHOTON_CL 34 | 35 | #define PHOTON_DATA_TYPE float8 36 | //#define PHOTON_DATA_TYPE half 37 | 38 | //struct Photon { 39 | // // (float8)(photonPos.x, photonPos.y, photonPos.z, photonPower.x, photonPower.y, photonPower.z, dirAngles.x, dirAngles.y); 40 | // vec3 pos; 41 | // vec3 power; // RGB 42 | // vec2 encodedDirection; // Storing the direction encoded to make struct 8 float * 4 byte = 32 byte => aligned reads 43 | // 44 | // void setDirection(vec3 dir); 45 | // vec3 getDirection() const; 46 | // 47 | //}; 48 | 49 | float8 readPhoton(__global const PHOTON_DATA_TYPE* photonData, int photonId) { 50 | #ifdef PHOTON_DATA_TYPE_HALF 51 | return vloada_half8(photonId, photonData); 52 | #else 53 | return photonData[photonId]; 54 | #endif 55 | } 56 | 57 | void writePhoton(float8 photon, __global PHOTON_DATA_TYPE* photonData, int photonId) { 58 | #ifdef PHOTON_DATA_TYPE_HALF 59 | vstore_half8(photon, photonId, photonData); 60 | #else 61 | photonData[photonId] = photon; 62 | #endif 63 | } 64 | 65 | 66 | #endif -------------------------------------------------------------------------------- /modules/rndgenmwc64x/cl/randomnumbergenerator.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2014-2016 Inviwo Foundation 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #include "random.cl" 31 | 32 | #define N_NUMBERS_PER_THREAD 1 33 | 34 | __kernel void randomNumberGeneratorKernel( 35 | __global RANDOM_SEED_TYPE* randomSeeds 36 | , int size 37 | , __global float* generatedNumbers 38 | ) 39 | { 40 | if (get_global_id(0) >= size) { 41 | return; 42 | } 43 | random_state randstate; 44 | loadRandState(randomSeeds, get_global_id(0), &randstate); 45 | for (int i = 0; i < N_NUMBERS_PER_THREAD; ++i) { 46 | generatedNumbers[get_global_id(0)*N_NUMBERS_PER_THREAD+i] = random_01(&randstate); 47 | } 48 | saveRandState(randomSeeds, get_global_id(0), &randstate); 49 | } 50 | 51 | __kernel void randomNumberGenerator2DKernel( 52 | __global RANDOM_SEED_TYPE* randomSeeds 53 | , int2 size 54 | , write_only image2d_t generatedNumbers 55 | ) 56 | { 57 | if (get_global_id(0) >= size.x*size.y) { 58 | return; 59 | } 60 | random_state randstate; 61 | loadRandState(randomSeeds, get_global_id(0), &randstate); 62 | for (int i = 0; i < N_NUMBERS_PER_THREAD; ++i) { 63 | //generatedNumbers[get_global_id(0)*N_NUMBERS_PER_THREAD+i] = random_01(&randstate); 64 | int idx = get_global_id(0)*N_NUMBERS_PER_THREAD+i; 65 | int2 coord = (int2)(idx % size.x, idx / size.x); 66 | write_imagef(generatedNumbers, coord, random_01(&randstate)); 67 | } 68 | saveRandState(randomSeeds, get_global_id(0), &randstate); 69 | 70 | 71 | } -------------------------------------------------------------------------------- /modules/rndgenmwc64x/mwc64xseedgenerator.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2013-2016 Inviwo Foundation 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #ifndef IVW_MWC64X_SEED_GENERATOR_H 31 | #define IVW_MWC64X_SEED_GENERATOR_H 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | namespace inviwo { 39 | 40 | // Generating seed numbers for MWC64X can be very time consuming. 41 | // This class performs the generation on the GPU to speed up the process. 42 | class IVW_MODULE_RNDGENMWC64X_API MWC64XSeedGenerator { 43 | 44 | public: 45 | /** 46 | * Creates and compiles OpenCL kernel. 47 | * 48 | */ 49 | MWC64XSeedGenerator(); 50 | virtual ~MWC64XSeedGenerator(); 51 | 52 | /** 53 | * Generate random state for MWC64X random number generator in OpenCL. 54 | * 55 | * @param buffer uvec2 buffer to be filled with random seeds 56 | * @param seed Start seed number 57 | * @param useGLSharing True if BufferCLGL should be used, otherwise BufferCL 58 | * @param localWorkGroupSize Local work group size to be used by the kernel 59 | */ 60 | void generateRandomSeeds(Buffer* buffer, unsigned int seed, bool useGLSharing = true, size_t localWorkGroupSize = 256); 61 | 62 | protected: 63 | void generateSeeds( BufferCLBase* randomSeedBufferCL, int nRandomSeeds, size_t localWorkGroupSize ); 64 | 65 | cl::Kernel* kernel_; 66 | }; 67 | 68 | } // namespace 69 | 70 | #endif // IVW_MWC64X_SEED_GENERATOR_H -------------------------------------------------------------------------------- /modules/importancesamplingcl/cl/datastructures/ray.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_RAY_CL 34 | #define IVW_RAY_CL 35 | 36 | /** 37 | * \class Ray 38 | * 39 | * \brief Ray origin, normalized direction and entry-exit point. 40 | * Ray structure layout: 41 | * float3 origin (ray start position) 42 | * float t0 (ray start position along the ray) 43 | * float3 direction (normalized ray direction) 44 | * float t1 (ray end position along the ray) 45 | * 46 | * @note OpenCL does not support storage of float3, 47 | * the underlying data will be float4 anyway, 48 | * so we need to use float4. 49 | */ 50 | typedef struct 51 | { 52 | float4 origin; // (x,y,z, t0) 53 | float4 direction; //< (x,y,z, t1) Normalized direction and end point along ray 54 | } Ray; 55 | 56 | inline Ray readRay(__global Ray const * __restrict rays, int index) { 57 | return rays[index]; 58 | } 59 | 60 | inline void writeRay(__global Ray* rays, int index, const Ray* ray) { 61 | rays[index] = *ray; 62 | } 63 | 64 | //inline void writeRay(__global Ray const * __restrict rays, int index, float3 origin, float3 direction, float t0, float t1) { 65 | // rays[index] = ; 66 | //} 67 | 68 | #endif // IVW_RAY_CL 69 | -------------------------------------------------------------------------------- /modules/uniformgridcl/buffermixercl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2016 Daniel Jönsson 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #ifndef IVW_BUFFERMIXERCL_H 31 | #define IVW_BUFFERMIXERCL_H 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | namespace inviwo { 42 | 43 | /** 44 | * \class BufferMixerCL 45 | * \brief mix two buffers 46 | * 47 | */ 48 | class IVW_MODULE_UNIFORMGRIDCL_API BufferMixerCL : public KernelOwner { 49 | public: 50 | BufferMixerCL(const size_t& workgroupSize = 128, bool useGLSharing = true); 51 | virtual ~BufferMixerCL(); 52 | 53 | void mix(const BufferBase& x, const BufferBase& y, float a, BufferBase& out, const VECTOR_CLASS *waitForEvents, cl::Event *event = nullptr); 54 | 55 | void mix(const BufferCLBase* xCL, const BufferCLBase* yCL, float a, BufferCLBase* outCL, size_t nElements, const VECTOR_CLASS * waitForEvents, cl::Event * event); 56 | 57 | void compileKernel(); 58 | 59 | size_t workGroupSize() const { return workGroupSize_; } 60 | void workGroupSize(size_t val) { workGroupSize_ = val; } 61 | bool useGLSharing() const { return useGLSharing_; } 62 | void useGLSharing(bool val) { useGLSharing_ = val; } 63 | protected: 64 | const DataFormatBase* format_; 65 | cl::Kernel* kernel_; 66 | size_t workGroupSize_; 67 | bool useGLSharing_; 68 | }; 69 | 70 | } // namespace 71 | 72 | #endif // IVW_BUFFERMIXERCL_H 73 | 74 | -------------------------------------------------------------------------------- /modules/lightcl/cl/directionallightsampler.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #include "samplers.cl" 34 | #include "light/light.cl" 35 | #include "datastructures/lightsample.cl" 36 | 37 | 38 | __kernel void directionalLightSamplerKernel( 39 | __global float4 const * __restrict positionSamples 40 | , float4 radiance 41 | , float4 direction // Light plane normal 42 | , float4 planeOrigin // Light plane origin 43 | , float4 planeTangentU // Light plane tangent u-direction 44 | , float4 planeTangentV // Light plane tangent v-direction 45 | , float planeArea // length(planeTangentU.xyz)*length(planeTangentV.xyz) 46 | , int nSamples 47 | , __global StoredLightSample* lightSamples 48 | ) 49 | { 50 | 51 | int threadId = get_global_id(0); 52 | if (threadId >= nSamples) { 53 | return; 54 | } 55 | float4 positionSample = positionSamples[threadId]; // u,v,w, pdf 56 | LightSample lightSample; 57 | lightSample.origin = planeOrigin.xyz + planeTangentU.xyz*positionSample.x + planeTangentV.xyz*positionSample.y; 58 | lightSample.direction = direction.xyz; 59 | float pdf = positionSample.w / (planeArea); 60 | lightSample.power = radiance.xyz / pdf; 61 | 62 | writeLightSample(lightSample, lightSamples, threadId); 63 | } 64 | -------------------------------------------------------------------------------- /modules/lightcl/lightsourcescl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_LIGHTSOURCESCL_H 34 | #define IVW_LIGHTSOURCESCL_H 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | namespace inviwo { 43 | 44 | 45 | 46 | /** 47 | * \brief Uploads PackedLightSources to supplied buffer. 48 | * Will resize lightSourcesCLOut to fit all light sources. 49 | * 50 | * @param const std::vector< std::shared_ptr > & lightSources Light sources to upload 51 | * @param const mat4 & transformation Transformation to apply to all light sources (i.e. worldToTexture) 52 | * @param float radianceScale Scaling of light source intensity 53 | * @param BufferCL * lightSourcesCLOut OpenCL buffer with light sources (size = sizeof(PackedLightSource)*lightSources.size() 54 | * @return the number of uploaded light sources 55 | */ 56 | IVW_MODULE_LIGHTCL_API size_t uploadLightSources(std::vector>::const_iterator begin, std::vector>::const_iterator end, const mat4& transformation, float radianceScale, BufferCL* lightSourcesCLOut); 57 | 58 | 59 | } // namespace 60 | 61 | #endif // IVW_LIGHTSOURCESCL_H 62 | 63 | -------------------------------------------------------------------------------- /modules/lightcl/lightsample.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #include "lightsample.h" 34 | 35 | namespace inviwo { 36 | 37 | LightSample::LightSample() { 38 | 39 | } 40 | 41 | LightSample::~LightSample() { 42 | 43 | } 44 | 45 | inviwo::vec3 LightSample::getDirection() const { 46 | vec2 cosAngles = glm::cos(encodedDirection); 47 | vec2 sinAngles = glm::sin(encodedDirection); 48 | return vec3{ sinAngles.x*cosAngles.y, 49 | sinAngles.x*sinAngles.y, 50 | cosAngles.x }; 51 | } 52 | 53 | void LightSample::setDirection(vec3 dir) { 54 | float phi = atan2(dir.y, dir.x); 55 | //if ( !isfinite(phi) ) { 56 | //if(dir.y < 0.f) phi = -0.5f*M_PI; 57 | //else phi = 0.5f*M_PI; 58 | //} 59 | // Important: clamp dir.z to avoid NaN 60 | float theta = acos(glm::clamp(dir.z, -1.f, 1.f)); 61 | encodedDirection = vec2{ theta, phi }; 62 | } 63 | 64 | LightSamples::LightSamples(size_t nSamples /*= 0*/) 65 | : lightSamples_(nSamples*sizeof(LightSample)), intersectionPoints_(nSamples) { 66 | 67 | } 68 | 69 | LightSamples::~LightSamples() { 70 | 71 | } 72 | 73 | void LightSamples::setSize(size_t nSamples) { 74 | lightSamples_.setSize(nSamples*sizeof(LightSample)); 75 | intersectionPoints_.setSize(nSamples); 76 | } 77 | 78 | size_t LightSamples::getSize() const { 79 | return lightSamples_.getSize() / sizeof(LightSample); 80 | 81 | } 82 | 83 | } // namespace 84 | 85 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/src/cache_types.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 Bruce Merry 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** 23 | * @file 24 | * 25 | * Structures used in the persistent cache. 26 | */ 27 | 28 | // config.h is not found on mac, disable 29 | //#if HAVE_CONFIG_H 30 | //# include 31 | //#endif 32 | 33 | #include "clhpp11.h" 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include "parameters.h" 41 | #include "cache_types.h" 42 | 43 | namespace clogs 44 | { 45 | namespace detail 46 | { 47 | 48 | CLOGS_STRUCT( 49 | DeviceKey, 50 | (platformName)(deviceName)(deviceVendorId)(driverVersion) 51 | ) 52 | 53 | CLOGS_STRUCT( 54 | KernelParameters::Key, 55 | (device)(header)(checksum) 56 | ) 57 | CLOGS_STRUCT( 58 | KernelParameters::Value, 59 | (binary) 60 | ) 61 | 62 | CLOGS_STRUCT( 63 | ScanParameters::Key, 64 | (device) 65 | (elementType) 66 | ) 67 | CLOGS_STRUCT( 68 | ScanParameters::Value, 69 | (warpSizeMem) 70 | (warpSizeSchedule) 71 | (reduceWorkGroupSize) 72 | (scanWorkGroupSize) 73 | (scanWorkScale) 74 | (scanBlocks) 75 | ) 76 | 77 | CLOGS_STRUCT( 78 | ReduceParameters::Key, 79 | (device) 80 | (elementType) 81 | ) 82 | CLOGS_STRUCT( 83 | ReduceParameters::Value, 84 | (reduceWorkGroupSize) 85 | (reduceBlocks) 86 | ) 87 | 88 | CLOGS_STRUCT( 89 | RadixsortParameters::Key, 90 | (device) 91 | (keyType) 92 | (valueSize) 93 | ) 94 | CLOGS_STRUCT( 95 | RadixsortParameters::Value, 96 | (warpSizeMem) 97 | (warpSizeSchedule) 98 | (reduceWorkGroupSize) 99 | (scanWorkGroupSize) 100 | (scatterWorkGroupSize) 101 | (scatterWorkScale) 102 | (scanBlocks) 103 | (radixBits) 104 | ) 105 | 106 | CLOGS_LOCAL DeviceKey deviceKey(const cl::Device &device) 107 | { 108 | DeviceKey key; 109 | cl::Platform platform(device.getInfo()); 110 | key.platformName = platform.getInfo(); 111 | key.deviceName = device.getInfo(); 112 | key.deviceVendorId = device.getInfo(); 113 | key.driverVersion = device.getInfo(); 114 | return key; 115 | } 116 | 117 | } // namespace detail 118 | } // namespace clogs 119 | -------------------------------------------------------------------------------- /modules/radixsortcl/processors/radixsortcl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2014-2019 Inviwo Foundation 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #ifndef IVW_RADIXSORTCL_H 31 | #define IVW_RADIXSORTCL_H 32 | 33 | #include 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | 43 | 44 | namespace inviwo { 45 | 46 | IVW_MODULE_RADIXSORTCL_API clogs::Type dataFormatToClogsType(const DataFormatBase* dataFormat); 47 | 48 | /** \docpage{org.inviwo.RadixSortCL, RadixSortCL} 49 | * ![](org.inviwo.RadixSortCL.png?classIdentifier=org.inviwo.RadixSortCL) 50 | * 51 | * Sort data in ascending order based on keys. 52 | * Uses default OpenCL device to perform radix sort. 53 | * 54 | * ### Inports 55 | * * __keysPort___ Keys to sort 56 | * * __unsortedData__ Data belonging to keys 57 | * 58 | * ### Outports 59 | * * __sortedData__ Sorted data 60 | * 61 | * ### Properties 62 | * 63 | */ 64 | class IVW_MODULE_RADIXSORTCL_API RadixSortCL : public Processor { 65 | public: 66 | RadixSortCL(); 67 | virtual ~RadixSortCL() {} 68 | 69 | virtual const ProcessorInfo getProcessorInfo() const override; 70 | static const ProcessorInfo processorInfo_; 71 | 72 | protected: 73 | virtual void process() override; 74 | 75 | BufferInport keysPort_; ///< Keys to sort 76 | BufferInport inputPort_; ///< Data belonging to keys 77 | BufferOutport outputPort_; ///< Sorted data 78 | 79 | // Sorting algorithm 80 | clogs::Radixsort* radixSort_; 81 | // Cached values to determine if input changed 82 | const BufferCLBase* prevKeysCL_; 83 | const BufferCLBase* prevDataCL_; 84 | }; 85 | 86 | } // namespace 87 | 88 | #endif // IVW_RADIXSORTCL_H 89 | 90 | -------------------------------------------------------------------------------- /modules/radixsortcl/ext/clogs/src/parameters.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012-2014 University of Cape Town 2 | * Copyright (c) 2014 Bruce Merry 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /** 24 | * @file 25 | * 26 | * Utilities for passing around generic sets of key/value parameters. 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include "parameters.h" 40 | 41 | namespace clogs 42 | { 43 | namespace detail 44 | { 45 | 46 | CLOGS_LOCAL int bindFields(sqlite3_stmt *stmt, int pos, sqlite3_int64 value) 47 | { 48 | int status = sqlite3_bind_int64(stmt, pos, value); 49 | if (status != SQLITE_OK) 50 | throw CacheError(sqlite3_errstr(status)); 51 | return pos + 1; 52 | } 53 | 54 | CLOGS_LOCAL int bindFields(sqlite3_stmt *stmt, int pos, const std::string &value) 55 | { 56 | int status = sqlite3_bind_text(stmt, pos, value.data(), value.size(), SQLITE_TRANSIENT); 57 | if (status != SQLITE_OK) 58 | throw CacheError(sqlite3_errstr(status)); 59 | return pos + 1; 60 | } 61 | 62 | CLOGS_LOCAL int bindFields(sqlite3_stmt *stmt, int pos, const std::vector &value) 63 | { 64 | const unsigned char dummy = 0; 65 | int status = sqlite3_bind_blob( 66 | stmt, pos, 67 | static_cast(value.empty() ? &dummy : &value[0]), 68 | value.size(), SQLITE_TRANSIENT); 69 | if (status != SQLITE_OK) 70 | throw CacheError(sqlite3_errstr(status)); 71 | return pos + 1; 72 | } 73 | 74 | 75 | CLOGS_LOCAL int readFields(sqlite3_stmt *stmt, int pos, std::string &value) 76 | { 77 | assert(pos >= 0 && pos < sqlite3_column_count(stmt)); 78 | assert(sqlite3_column_type(stmt, pos) == SQLITE_TEXT); 79 | const char *data = (const char *) sqlite3_column_text(stmt, pos); 80 | ::size_t size = sqlite3_column_bytes(stmt, pos); 81 | value.assign(data, size); 82 | return pos + 1; 83 | } 84 | 85 | CLOGS_LOCAL int readFields(sqlite3_stmt *stmt, int pos, std::vector &value) 86 | { 87 | assert(pos >= 0 && pos < sqlite3_column_count(stmt)); 88 | assert(sqlite3_column_type(stmt, pos) == SQLITE_BLOB); 89 | const unsigned char *data = (const unsigned char *) sqlite3_column_blob(stmt, pos); 90 | ::size_t size = sqlite3_column_bytes(stmt, pos); 91 | value.assign(data, data + size); 92 | return pos + 1; 93 | } 94 | 95 | } // namespace detail 96 | } // namespace clogs 97 | -------------------------------------------------------------------------------- /modules/uniformgridcl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # Inviwo uniformgridcl Module 3 | ivw_module(UniformGridCL) 4 | 5 | #-------------------------------------------------------------------- 6 | # Add header files 7 | set(HEADER_FILES 8 | ${CMAKE_CURRENT_SOURCE_DIR}/buffermixercl.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/minmaxuniformgrid3d.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/dynamicvolumedifferenceanalysis.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformgrid3dexport.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformgrid3dplayerprocessor.h 13 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformgrid3dsequenceselector.h 14 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformgrid3dsourceprocessor.h 15 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformgrid3dvectorsource.h 16 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/volumeminmaxclprocessor.h 17 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/volumesequenceplayer.h 18 | ${CMAKE_CURRENT_SOURCE_DIR}/uniformgrid3d.h 19 | ${CMAKE_CURRENT_SOURCE_DIR}/uniformgrid3dreader.h 20 | ${CMAKE_CURRENT_SOURCE_DIR}/uniformgrid3dwriter.h 21 | ${CMAKE_CURRENT_SOURCE_DIR}/uniformgridclmodule.h 22 | ${CMAKE_CURRENT_SOURCE_DIR}/uniformgridclmoduledefine.h 23 | ) 24 | ivw_group("Header Files" ${HEADER_FILES}) 25 | 26 | #-------------------------------------------------------------------- 27 | # Add source files 28 | set(SOURCE_FILES 29 | ${CMAKE_CURRENT_SOURCE_DIR}/buffermixercl.cpp 30 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/dynamicvolumedifferenceanalysis.cpp 31 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformgrid3dexport.cpp 32 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformgrid3dplayerprocessor.cpp 33 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformgrid3dsequenceselector.cpp 34 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformgrid3dsourceprocessor.cpp 35 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/uniformgrid3dvectorsource.cpp 36 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/volumeminmaxclprocessor.cpp 37 | ${CMAKE_CURRENT_SOURCE_DIR}/processors/volumesequenceplayer.cpp 38 | ${CMAKE_CURRENT_SOURCE_DIR}/uniformgrid3d.cpp 39 | ${CMAKE_CURRENT_SOURCE_DIR}/uniformgrid3dreader.cpp 40 | ${CMAKE_CURRENT_SOURCE_DIR}/uniformgrid3dwriter.cpp 41 | ${CMAKE_CURRENT_SOURCE_DIR}/uniformgridclmodule.cpp 42 | ) 43 | ivw_group("Source Files" ${SOURCE_FILES}) 44 | 45 | 46 | #-------------------------------------------------------------------- 47 | # Add shaders 48 | set(CL_FILES 49 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/buffermixer.cl 50 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/uniformgrid/uniformgrid.cl 51 | ${CMAKE_CURRENT_SOURCE_DIR}/cl/uniformgrid/volumeminmax.cl 52 | ) 53 | source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/cl PREFIX "Shader Files" FILES ${CL_FILES}) 54 | 55 | set(SHADER_FILES 56 | ${CMAKE_CURRENT_SOURCE_DIR}/glsl/volume_mix.frag 57 | ) 58 | ivw_group("Shader Files" ${SHADER_FILES}) 59 | 60 | 61 | #-------------------------------------------------------------------- 62 | # Add Unittests 63 | #set(TEST_FILES 64 | # ${CMAKE_CURRENT_SOURCE_DIR}/uniformgridcl/tests/uniformgridcl-test.cpp 65 | #) 66 | #ivw_add_unittest(${TEST_FILES}) 67 | 68 | #-------------------------------------------------------------------- 69 | # Create module 70 | ivw_create_module(${SOURCE_FILES} ${HEADER_FILES} ${SHADER_FILES} ${CL_FILES}) 71 | 72 | #-------------------------------------------------------------------- 73 | # Add shader directory to pack 74 | ivw_add_to_module_pack(${CMAKE_CURRENT_SOURCE_DIR}/cl) 75 | ivw_handle_shader_resources(${CMAKE_CURRENT_SOURCE_DIR}/glsl ${SHADER_FILES}) 76 | ivw_add_to_module_pack(${CMAKE_CURRENT_SOURCE_DIR}/workspaces) -------------------------------------------------------------------------------- /modules/lightcl/processors/samplestoimageprocessor.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_SAMPLESTOIMAGEPROCESSOR_H 34 | #define IVW_SAMPLESTOIMAGEPROCESSOR_H 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include 43 | 44 | namespace inviwo { 45 | 46 | /** \docpage{org.inviwo.SamplesToImageProcessor, Samples To Image Processor} 47 | * ![](org.inviwo.SamplesToImageProcessor.png?classIdentifier=org.inviwo.SamplesToImageProcessor) 48 | * Explanation of how to use the processor. 49 | * 50 | * ### Inports 51 | * * ____ . 52 | * 53 | * ### Outports 54 | * * ____ . 55 | * 56 | * ### Properties 57 | * * ____ . 58 | * * ____ 59 | */ 60 | 61 | 62 | /** 63 | * \class SamplesToImageProcessor 64 | * \brief 65 | * 66 | */ 67 | class IVW_MODULE_LIGHTCL_API SamplesToImageProcessor : public Processor { 68 | public: 69 | virtual const ProcessorInfo getProcessorInfo() const override; 70 | static const ProcessorInfo processorInfo_; 71 | SamplesToImageProcessor(); 72 | virtual ~SamplesToImageProcessor() = default; 73 | 74 | virtual void process() override; 75 | 76 | private: 77 | SampleInport samplesPort_; 78 | ImageOutport outport_; 79 | 80 | FloatProperty sampleValue_; 81 | std::shared_ptr imageOut_; 82 | }; 83 | 84 | } // namespace 85 | 86 | #endif // IVW_SAMPLESTOIMAGEPROCESSOR_H 87 | 88 | -------------------------------------------------------------------------------- /modules/importancesamplingcl/cl/samplegridindex.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #include "samplers.cl" 34 | 35 | // rotate/flip a quadrant appropriately 36 | void rotateHilbertQuadrant(int n, int *x, int *y, int rx, int ry) { 37 | if (ry == 0) { 38 | if (rx == 1) { 39 | *x = n-1 - *x; 40 | *y = n-1 - *y; 41 | } 42 | //Swap x and y 43 | int t = *x; 44 | *x = *y; 45 | *y = t; 46 | } 47 | } 48 | 49 | // Flatten (x,y) location to index d, http://en.wikipedia.org/wiki/Hilbert_curve 50 | // n is power of two, which divides a square into nxn blocks. 51 | int HilbertCurve2D (int n, int x, int y) { 52 | int rx, ry, s, d=0; 53 | for (s=n/2; s>0; s/=2) { 54 | rx = (x & s) > 0; 55 | ry = (y & s) > 0; 56 | d += s * s * ((3 * rx) ^ ry); 57 | rotateHilbertQuadrant(s, &x, &y, rx, ry); 58 | } 59 | return d; 60 | } 61 | 62 | // Compute a 1D grid index from samples in [0 1], stored in the xy component of a float4 63 | __kernel void sampleGridIndexKernel( 64 | __global float4* samples 65 | , float2 invBlockSize 66 | , int2 nBlocks 67 | , int nSamples 68 | , __global unsigned int* gridIndices 69 | ) 70 | { 71 | //output image pixel coordinates 72 | int threadId = get_global_id(0); 73 | if (threadId>=nSamples) { 74 | return; 75 | } 76 | float4 sample = samples[threadId]; 77 | uint2 gridIndex = convert_uint2(sample.xy*invBlockSize); 78 | #ifdef USE_REGULAR_GRID 79 | gridIndices[threadId] = gridIndex.y*nBlocks.x + gridIndex.x; 80 | #else 81 | // Hilbert curve http://en.wikipedia.org/wiki/Hilbert_curve 82 | gridIndices[threadId] = HilbertCurve2D(nBlocks.x, gridIndex.x, gridIndex.y); 83 | #endif 84 | 85 | } -------------------------------------------------------------------------------- /modules/progressivephotonmapping/cl/hashlightsample.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef HASHLIGHTSAMPLE_CL 34 | #define HASHLIGHTSAMPLE_CL 35 | #include "datastructures/lightsample.cl" 36 | 37 | 38 | __kernel void hashLightSampleKernel( 39 | __global StoredLightSample const* __restrict lightSamples 40 | , __global StoredIntersectionPoint const* __restrict intersectionPoints // tStart, tEnd for each light sample 41 | , int nLightSourceSamples 42 | , __global unsigned int const* __restrict lightSampleId // tStart, tEnd for each light sample 43 | , int nLightSampleIds 44 | , float3 cellSize, int3 nBlocks 45 | , __global uint* whichBucket 46 | , int outOffset) { 47 | 48 | if (get_global_id(0) >= nLightSampleIds) { 49 | return; 50 | } 51 | uint id = lightSampleId[get_global_id(0)]; 52 | if (id < outOffset || id >= nLightSourceSamples) { 53 | return; 54 | } 55 | LightSample lightSample = readLightSample(lightSamples, id); 56 | float2 intersectionPoint = readIntersectionPoint(intersectionPoints, id); 57 | float tStart = intersectionPoint.x; float tEnd = intersectionPoint.y; 58 | bool scatterEvent = tStart < tEnd; 59 | float3 pos = lightSample.origin + tStart*lightSample.direction; 60 | uint3 hashGridPos = convert_uint3(pos*(cellSize)); 61 | uint index = hashGridPos.z*nBlocks.x*nBlocks.y + hashGridPos.y*nBlocks.x + hashGridPos.x; 62 | //uint index = hashGridPos.z + hashGridPos.y + hashGridPos.x; 63 | //index = ((hashGridPos.x * 73856093) ^ (hashGridPos.y * 19349663) ^ (hashGridPos.z * 83492791)) % (nBlocks.x*nBlocks.y*nBlocks.z); 64 | whichBucket[outOffset + get_global_id(0)] = index; 65 | //whichBucket[outOffset + get_global_id(0)] = id; 66 | } 67 | 68 | 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /modules/importancesamplingcl/processors/uniformsamplegenerator2dprocessorcl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_UNIFORM_SAMPLE_GENERATOR_2D_PROCESSOR_CL_H 34 | #define IVW_UNIFORM_SAMPLE_GENERATOR_2D_PROCESSOR_CL_H 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #include 45 | 46 | 47 | namespace inviwo { 48 | 49 | class IVW_MODULE_IMPORTANCESAMPLINGCL_API UniformSampleGenerator2DProcessorCL : public Processor, public ProcessorKernelOwner { 50 | 51 | public: 52 | UniformSampleGenerator2DProcessorCL(); 53 | ~UniformSampleGenerator2DProcessorCL() = default; 54 | 55 | virtual const ProcessorInfo getProcessorInfo() const override; 56 | static const ProcessorInfo processorInfo_; 57 | virtual void process() override; 58 | private: 59 | SampleOutport samplesPort_; ///< Generated sample xy locations between [0 1] 60 | SampleOutport directionalSamplesPort_; ///< Generated directional sample xy locations between [0 1] 61 | SampleGenerator2DCLOutport sampleGeneratorPort_; 62 | 63 | IntVec2Property nSamples_; 64 | IntVec2Property workGroupSize_; 65 | BoolProperty useGLSharing_; 66 | 67 | std::shared_ptr< SampleBuffer > samples_; //< uv-coordinates, unsued, pdf=1 68 | std::shared_ptr< SampleBuffer > directionalSamples_; //< uv-coordinates, unsued, pdf=1 69 | UniformSampleGenerator2DCL sampleGenerator_; 70 | }; 71 | 72 | } 73 | 74 | #endif // IVW_UNIFORM_SAMPLE_GENERATOR_2D_CL_H 75 | -------------------------------------------------------------------------------- /modules/rndgenmwc64x/processors/randomnumbergeneratorcl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2014-2016 Inviwo Foundation 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #ifndef IVW_RANDOM_NUMBER_GENERATOR_CL_H 31 | #define IVW_RANDOM_NUMBER_GENERATOR_CL_H 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | 46 | #include 47 | #include 48 | 49 | 50 | namespace inviwo { 51 | 52 | /** \docpage{org.inviwo.RandomNumberGeneratorCL, Random Number Generator} 53 | * ![](org.inviwo.RandomNumberGeneratorCL.png?classIdentifier=org.inviwo.RandomNumberGeneratorCL) 54 | * 55 | * ... 56 | * 57 | * 58 | * ### Outports 59 | * * __samples__ ... 60 | * 61 | * ### Properties 62 | * * __Use OpenGL sharing__ ... 63 | * * __N samples__ ... 64 | * * __Regenerate__ ... 65 | * * __Seed number__ ... 66 | * * __Work group size__ ... 67 | * 68 | */ 69 | class IVW_MODULE_RNDGENMWC64X_API RandomNumberGeneratorCL : public Processor, public ProcessorKernelOwner { 70 | 71 | public: 72 | RandomNumberGeneratorCL(); 73 | ~RandomNumberGeneratorCL() = default; 74 | 75 | virtual const ProcessorInfo getProcessorInfo() const override; 76 | static const ProcessorInfo processorInfo_; 77 | 78 | virtual void process() override; 79 | private: 80 | DataOutport< Buffer > randomNumbersPort_; 81 | 82 | IntProperty nRandomNumbers_; 83 | ButtonProperty regenerateNumbers_; 84 | IntProperty seed_; 85 | IntProperty workGroupSize_; 86 | BoolProperty useGLSharing_; 87 | 88 | MWC64XRandomNumberGenerator randomNumberGenerator_; 89 | std::shared_ptr< Buffer > randomNumbersOut_; 90 | }; 91 | 92 | } 93 | 94 | #endif // IVW_RANDOM_NUMBER_GENERATOR_CL_H 95 | -------------------------------------------------------------------------------- /modules/lightcl/lightsamplemeshintersectioncl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_LIGHTSAMPLEMESHINTERSECTIONCL_H 34 | #define IVW_LIGHTSAMPLEMESHINTERSECTIONCL_H 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | #include 45 | #include 46 | 47 | namespace inviwo { 48 | 49 | /** 50 | * \class LightSampleMeshIntersectionCL 51 | * 52 | * \brief Computes the intersection point with the light sample rays and the mesh. 53 | * 54 | */ 55 | class IVW_MODULE_LIGHTCL_API LightSampleMeshIntersectionCL : public KernelOwner { 56 | public: 57 | LightSampleMeshIntersectionCL(size_t workGroupSize = 128, bool useGLSharing = true); 58 | virtual ~LightSampleMeshIntersectionCL(); 59 | 60 | bool isValid() const { return intersectionKernel_ != nullptr; } 61 | 62 | void meshSampleIntersection(const Mesh* mesh, LightSamples* samples); 63 | 64 | void meshSampleIntersection(const BufferCLBase* verticesCL, const BufferCLBase* indicesCL, size_t nIndices, size_t nSamples, const BufferCLBase* lightSamplesCL, BufferCLBase* intersectionPointsCL, const VECTOR_CLASS* waitForEvents = nullptr, cl::Event* event = nullptr); 65 | 66 | bool getUseGLSharing() const { return useGLSharing_; } 67 | void setUseGLSharing(bool val) { useGLSharing_ = val; } 68 | size_t getWorkGroupSize() const { return workGroupSize_; } 69 | void setWorkGroupSize(size_t val) { workGroupSize_ = val; } 70 | private: 71 | bool useGLSharing_; 72 | size_t workGroupSize_; 73 | cl::Kernel* intersectionKernel_; 74 | }; 75 | 76 | } // namespace 77 | 78 | #endif // IVW_LIGHTSAMPLEMESHINTERSECTIONCL_H 79 | 80 | -------------------------------------------------------------------------------- /modules/lightcl/processors/directionallightsamplerclprocessor.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_DIRECTIONAL_LIGHT_SAMPLER_CL_PROCESSOR_H 34 | #define IVW_DIRECTIONAL_LIGHT_SAMPLER_CL_PROCESSOR_H 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | 52 | namespace inviwo { 53 | 54 | class IVW_MODULE_LIGHTCL_API DirectionalLightSamplerCLProcessor : public Processor, public KernelObserver { 55 | 56 | public: 57 | DirectionalLightSamplerCLProcessor(); 58 | ~DirectionalLightSamplerCLProcessor() = default; 59 | 60 | virtual const ProcessorInfo getProcessorInfo() const override; 61 | static const ProcessorInfo processorInfo_; 62 | 63 | virtual void onKernelCompiled(const cl::Kernel* kernel) override { invalidate(InvalidationLevel::InvalidOutput); }; 64 | 65 | virtual void process() override; 66 | 67 | private: 68 | MeshInport boundingVolume_; 69 | SampleInport samplesPort_; 70 | DataInport lights_; 71 | LightSamplesOutport lightSamplesPort_; 72 | 73 | IntProperty workGroupSize_; 74 | BoolProperty useGLSharing_; 75 | 76 | DirectionalLightSamplerCL lightSampler_; 77 | LightSampleMeshIntersectionCL lightSampleMeshIntersector_; 78 | std::shared_ptr< LightSamples > lightSamples_; 79 | }; 80 | 81 | } 82 | 83 | #endif // IVW_DIRECTIONAL_LIGHT_SAMPLER_CL_PROCESSOR_H 84 | -------------------------------------------------------------------------------- /modules/importancesamplingcl/uniformsamplegenerator2dcl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_UNIFORM_SAMPLE_GENERATOR_2D_CL_H 34 | #define IVW_UNIFORM_SAMPLE_GENERATOR_2D_CL_H 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | namespace inviwo { 49 | 50 | 51 | 52 | /** 53 | * \class UniformSampleGenerator2DCL 54 | * 55 | * \brief Generate samples uniformly spread in 2D. 56 | * 57 | * Sample will be: (x \in [0 1],y \in [0 1],z = 0, pdf=1) 58 | * 59 | * coord /in [0 nSamples-1] 60 | * 61 | * xy = (0.5 + coord)/nSamples; 62 | * 63 | */ 64 | class IVW_MODULE_IMPORTANCESAMPLINGCL_API UniformSampleGenerator2DCL : public SampleGenerator2DCL, public KernelOwner { 65 | 66 | public: 67 | 68 | UniformSampleGenerator2DCL(bool useGLSharing = true); 69 | virtual ~UniformSampleGenerator2DCL(); 70 | 71 | virtual void reset(); 72 | 73 | virtual void generateNextSamples(SampleBuffer& positionSamplesOut, const VECTOR_CLASS* waitForEvents = nullptr, cl::Event* event = nullptr); 74 | 75 | virtual void generateNextSamples(SampleBuffer& positionSamplesOut, SampleBuffer& directionSamplesOut, const VECTOR_CLASS* waitForEvents = nullptr, cl::Event* event = nullptr); 76 | 77 | private: 78 | void generateSamples(const size2_t& nSamples, size_t nElements, const BufferCLBase* samplesCL, const VECTOR_CLASS* waitForEvents = nullptr, cl::Event* event = nullptr); 79 | cl::Kernel* kernel_; 80 | }; 81 | 82 | } 83 | 84 | #endif // IVW_UNIFORM_SAMPLE_GENERATOR_2D_CL_H 85 | 86 | 87 | -------------------------------------------------------------------------------- /modules/lightcl/lightsourcesamplercl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_LIGHTSOURCESAMPLERCL_H 34 | #define IVW_LIGHTSOURCESAMPLERCL_H 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | 44 | namespace inviwo { 45 | 46 | /** 47 | * \class LightSourceSamplerCL 48 | * 49 | * \brief Interface for light source samplers 50 | * 51 | * DESCRIBE_THE_CLASS 52 | */ 53 | class IVW_MODULE_LIGHTCL_API LightSourceSamplerCL { 54 | public: 55 | LightSourceSamplerCL(std::shared_ptr lightSource, std::shared_ptr sampleGenerator); 56 | virtual ~LightSourceSamplerCL(); 57 | 58 | virtual void sampleLightSource(const Mesh* mesh, LightSamples& lightSamplesOut, const VECTOR_CLASS* waitForEvents = nullptr, cl::Event* event = nullptr) = 0; 59 | 60 | size2_t getWorkGroupSize() const { return workGroupSize_; } 61 | void setWorkGroupSize(size2_t val) { workGroupSize_ = val; } 62 | 63 | bool getUseGLSharing() const { return useGLSharing_; } 64 | void setUseGLSharing(bool val) { useGLSharing_ = val; } 65 | 66 | std::shared_ptr getLightSource() const { return lightSource_; } 67 | void setLightSource(std::shared_ptr val) { lightSource_ = val; } 68 | std::shared_ptr getSampleGenerator() const { return sampleGenerator_; } 69 | void setSampleGenerator(std::shared_ptr val) { sampleGenerator_ = val; } 70 | protected: 71 | std::shared_ptr sampleGenerator_; 72 | std::shared_ptr lightSource_; 73 | private: 74 | size2_t workGroupSize_; 75 | bool useGLSharing_; 76 | 77 | 78 | }; 79 | 80 | } // namespace 81 | 82 | #endif // IVW_LIGHTSOURCESAMPLERCL_H 83 | 84 | -------------------------------------------------------------------------------- /modules/uniformgridcl/processors/volumesequenceplayer.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2016 Daniel Jönsson 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #ifndef IVW_VOLUMESEQUENCEPLAYER_H 31 | #define IVW_VOLUMESEQUENCEPLAYER_H 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | #include 43 | #include 44 | 45 | namespace inviwo { 46 | 47 | /** \docpage{org.inviwo.VolumeSequencePlayer, Volume Sequence Player} 48 | * ![](org.inviwo.VolumeSequencePlayer.png?classIdentifier=org.inviwo.VolumeSequencePlayer) 49 | * Explanation of how to use the processor. 50 | * 51 | * ### Inports 52 | * * ____ . 53 | * 54 | * ### Outports 55 | * * ____ . 56 | * 57 | * ### Properties 58 | * * ____ . 59 | * * ____ 60 | */ 61 | 62 | 63 | /** 64 | * \class VolumeSequencePlayer 65 | * \brief Linearly interpolates between two volumes to create the output at time t. 66 | */ 67 | class IVW_MODULE_UNIFORMGRIDCL_API VolumeSequencePlayer : public Processor { 68 | public: 69 | VolumeSequencePlayer(); 70 | 71 | void onTimeStepChange(); 72 | 73 | virtual ~VolumeSequencePlayer() = default; 74 | 75 | virtual void process() override; 76 | 77 | virtual const ProcessorInfo getProcessorInfo() const override; 78 | static const ProcessorInfo processorInfo_; 79 | 80 | private: 81 | void onSequenceTimerEvent(); 82 | 83 | void updateVolumeIndex(); 84 | 85 | VolumeSequenceInport inport_; 86 | VolumeOutport outport_; 87 | 88 | std::shared_ptr outVolume_; 89 | Shader shader_; 90 | FrameBufferObject fbo_; 91 | 92 | FloatProperty time_; 93 | IntProperty index_; 94 | FloatProperty timePerVolume_; 95 | IntProperty volumesPerSecond_; 96 | BoolProperty playSequence_; 97 | 98 | Timer sequenceTimer_; 99 | }; 100 | 101 | } // namespace 102 | 103 | #endif // IVW_VOLUMESEQUENCEPLAYER_H 104 | 105 | -------------------------------------------------------------------------------- /modules/radixsortcl/radixsortclmodule.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2014-2019 Inviwo Foundation 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #include "radixsortcl/radixsortclmodule.h" 31 | #include "clogs/src/clhpp11.h" 32 | #include 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #if defined(__clang__) 39 | // Not available 40 | #elif defined(__GNUC__) 41 | // Not available 42 | #elif defined(_MSC_VER) 43 | # if (_MSC_FULL_VER >= 130000000) 44 | // Return conversion from size_t to cl_uint, possible loss of data 45 | # pragma warning(disable: 4267) 46 | # endif 47 | #endif 48 | #include 49 | #include 50 | 51 | namespace inviwo { 52 | 53 | RadixSortCLModule::RadixSortCLModule(InviwoApplication* app) : InviwoModule(app, "RadixSortCL") { 54 | registerProcessor(); 55 | 56 | OpenCL::getPtr()->addCommonIncludeDirectory(getPath() / "ext/clogs/kernels"); 57 | for (const auto& elem : OpenCL::getPtr()->getCommonIncludeDirectories()) { 58 | auto pathToKernels = elem; 59 | try { 60 | if (filesystem::fileExists(pathToKernels / "radixsort.cl")) 61 | addSourceToClogs(pathToKernels / "radixsort.cl", "431a3a83882a2497d57d49faafc95f3caceaeca4a42aca9623b3aae7dc6cf4ee"); 62 | if (filesystem::fileExists(pathToKernels / "reduce.cl")) 63 | addSourceToClogs(pathToKernels / "reduce.cl", "52c419ceb4263cc36ca2f9297b10fe98c21173aabde3c02609358d0834f51f91"); 64 | if (filesystem::fileExists(pathToKernels / "scan.cl")) 65 | addSourceToClogs(pathToKernels / "scan.cl", "dbf441df48411f177a18b899f9472737a4711c843b4c25907b756274a911a437"); 66 | } catch (std::ifstream::failure& ex) { 67 | LogError(ex.what()); 68 | } 69 | } 70 | } 71 | void RadixSortCLModule::addSourceToClogs(const std::filesystem::path& path, const std::string& hash) { 72 | TextFileReader fileReader(path); 73 | std::string prog; 74 | try { 75 | prog = fileReader.read(); 76 | clogs::detail::getSourceMap()[path.filename().string()] = clogs::detail::Source(prog, hash); 77 | } catch (std::ifstream::failure& ex) { 78 | throw ex; 79 | } 80 | 81 | } 82 | 83 | 84 | RadixSortCLModule::~RadixSortCLModule() 85 | { 86 | } 87 | 88 | } // namespace 89 | -------------------------------------------------------------------------------- /modules/rndgenmwc64x/mwc64xrandomnumbergenerator.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2015-2016 Inviwo Foundation 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #ifndef IVW_MWC64XRANDOMNUMBERGENERATOR_H 31 | #define IVW_MWC64XRANDOMNUMBERGENERATOR_H 32 | 33 | #include 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | namespace inviwo { 42 | 43 | /** 44 | * \class MWC64XRandomNumberGenerator 45 | * 46 | * \brief Generate N random numbers in parallel, each number stream will have its own seed. 47 | * 48 | */ 49 | class IVW_MODULE_RNDGENMWC64X_API MWC64XRandomNumberGenerator: public KernelOwner { 50 | public: 51 | MWC64XRandomNumberGenerator(bool useGLSharing = true); 52 | virtual ~MWC64XRandomNumberGenerator() = default; 53 | 54 | /** 55 | * \brief Fill randomNumbersOut with random numbers. 56 | * 57 | * [0 randomNumbersOut.getSize()-1] streams will be used, 58 | * each with its own seed. 59 | * 60 | * @param Buffer & randomNumbersOut Buffer to fill 61 | * @param const VECTOR_CLASS * waitForEvents Events to wait for 62 | * @param cl::Event * event 63 | */ 64 | void generate(Buffer& randomNumbersOut, const VECTOR_CLASS* waitForEvents = nullptr, cl::Event* event = nullptr); 65 | 66 | int getSeed() const { return seed_; } 67 | /** 68 | * \brief Seed to be used for srand to initiate each random stream. 69 | * 70 | * @see MWC64XSeedGenerator 71 | * @param int val Random seed. 72 | */ 73 | void setSeed(int val); 74 | 75 | bool getUseGLSharing() const { return useGLSharing_; } 76 | void setUseGLSharing(bool val) { useGLSharing_ = val; } 77 | size_t getWorkGroupSize() const { return workGroupSize_; } 78 | void setWorkGroupSize(size_t val) { workGroupSize_ = val; } 79 | private: 80 | void generateNumbers(BufferCL* rndState, BufferCLBase* data, const VECTOR_CLASS* waitForEvents = nullptr, cl::Event* event = nullptr); 81 | Buffer randomState_; 82 | size_t workGroupSize_ = 256; 83 | cl::Kernel* kernel_; 84 | int seed_ = 0; 85 | bool useGLSharing_; 86 | 87 | 88 | 89 | 90 | }; 91 | 92 | } // namespace 93 | 94 | #endif // IVW_MWC64XRANDOMNUMBERGENERATOR_H 95 | 96 | -------------------------------------------------------------------------------- /modules/importancesamplingcl/minmaxuniformgrid3dimportancecl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #ifndef IVW_MINMAXUNIFORMGRID3DIMPORTANCECL_H 34 | #define IVW_MINMAXUNIFORMGRID3DIMPORTANCECL_H 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | #include 50 | 51 | namespace inviwo { 52 | 53 | /** 54 | * \class MinMaxUniformGrid3DImportanceCL 55 | * 56 | * \brief Compute importance as seen from input directions 57 | * 58 | */ 59 | class IVW_MODULE_IMPORTANCESAMPLINGCL_API MinMaxUniformGrid3DImportanceCL : KernelOwner { 60 | public: 61 | MinMaxUniformGrid3DImportanceCL(); 62 | virtual ~MinMaxUniformGrid3DImportanceCL(){} 63 | bool computeImportance(const Volume* origVolume, const MinMaxUniformGrid3D* uniformGrid3D, const TransferFunction* transferFunction, const Image* entryPoints, const Image* exitPoints, const uvec2& workGroupSize, bool useGLSharing); 64 | Buffer* getImportance() { return &importance_; } 65 | 66 | protected: 67 | bool computeImportance(const Volume* origVolume, const MinMaxUniformGrid3D* uniformGrid3D, const BufferCLBase* uniformGridCL, const TransferFunction* transferFunction, const cl::Image& entryPoints, const cl::Image& exitPoints, BufferCLBase* importanceBuf, const size2_t& globalWorkGroupSize, const size2_t& localWorkgroupSize, cl::Event* event); 68 | private: 69 | 70 | Buffer importance_; 71 | 72 | cl::Kernel* tracerKernel_; 73 | 74 | }; 75 | 76 | } // namespace 77 | 78 | #endif // IVW_MINMAXUNIFORMGRID3DIMPORTANCECL_H 79 | 80 | -------------------------------------------------------------------------------- /modules/progressivephotonmapping/cl/densityestimationkernel.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | #ifndef DENSITY_ESTIMATION_KERNEL_CL 33 | #define DENSITY_ESTIMATION_KERNEL_CL 34 | 35 | /** 36 | * \brief Kernel for density estimate. Note that x in [0 1]. I.e abs(x), x in [-1 1] is expected as input. 37 | * The function integrates to 1 over the domain x in [-1 1]. 38 | * http://en.wikipedia.org/wiki/Uniform_kernel#Kernel_functions_in_common_use 39 | * 40 | * @param x Absolute value of parameter Value in range [0 1] 41 | * @return Kernel weight, 0 if x > 1 42 | */ 43 | float densityEstimationKernel(float x) { 44 | //if(x <= 1.f) { 45 | // return 0.5f; 46 | //}else { 47 | // return 0.f; 48 | //} 49 | //// Triangle 50 | //if(x <= 1.f) { 51 | // return 1.f-x; 52 | //}else { 53 | // return 0.f; 54 | //} 55 | // Epanechnikov 56 | if (x <= 1.f) { 57 | return (0.75f)*(1.f - x*x); 58 | } else { 59 | return 0.f; 60 | } 61 | // Quartic 62 | //(biweight) 63 | //if(x <= 1.f) { 64 | // return (15.f/16.f)*pown((1.f-x*x),2); 65 | //}else { 66 | // return 0.f; 67 | //} 68 | // Triweight 69 | //if(x <= 1.f) { 70 | // return (35.f/32.f)*pown((1.f-x*x),3); 71 | //}else { 72 | // return 0.f; 73 | //} 74 | // Tricube 75 | //if(x <= 1.f) { 76 | // return (70.f/81.f)*pown((1.f-fabs(x*x*x)),3); 77 | //}else { 78 | // return 0.f; 79 | //} 80 | // Gaussian 81 | //if(x <= 1.f) { 82 | // //return (1.f/(sqrt(M_PI*2.f)))*native_exp(-0.5f*x*x); 83 | // // Optimized 84 | // return 0.28209479177387814347403972578039f*native_exp(-0.5f*x*x); 85 | //}else return 0.f; 86 | // Chebyshev–Gauss 87 | //if (x <= 1.f) { 88 | // //return (1.f/(sqrt(M_PI*2.f)))*native_sqrt(1-x*x); 89 | // // Optimized 90 | // return 0.28209479177387814347403972578039f*native_sqrt(1.f-x*x); 91 | //} else return 0.f; 92 | // Cosine 93 | //if(x <= 1.f) { 94 | // return (M_PI/4.f)*cos((M_PI/2.f)*x); 95 | //}else return 0.f; 96 | } 97 | 98 | 99 | #endif -------------------------------------------------------------------------------- /modules/lightcl/processors/samplestoimageprocessor.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Copyright (c) 2016, Daniel Jönsson 4 | * All rights reserved. 5 | * 6 | * This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 7 | * http://creativecommons.org/licenses/by-nc/4.0/ 8 | * 9 | * You are free to: 10 | * 11 | * Share — copy and redistribute the material in any medium or format 12 | * Adapt — remix, transform, and build upon the material 13 | * The licensor cannot revoke these freedoms as long as you follow the license terms. 14 | * Under the following terms: 15 | * 16 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 17 | * NonCommercial — You may not use the material for commercial purposes. 18 | * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | *********************************************************************************/ 32 | 33 | #include "samplestoimageprocessor.h" 34 | 35 | namespace inviwo { 36 | 37 | // The Class Identifier has to be globally unique. Use a reverse DNS naming scheme 38 | const ProcessorInfo SamplesToImageProcessor::processorInfo_{ 39 | "org.inviwo.SamplesToImageProcessor", // Class identifier 40 | "Samples To Image Processor", // Display name 41 | "Image", // Category 42 | CodeState::Experimental, // Code state 43 | Tags::CPU, // Tags 44 | }; 45 | const ProcessorInfo SamplesToImageProcessor::getProcessorInfo() const { 46 | return processorInfo_; 47 | } 48 | 49 | SamplesToImageProcessor::SamplesToImageProcessor() 50 | : Processor() 51 | , samplesPort_("Samples") 52 | , outport_("outport", DataFloat32::get()) 53 | , sampleValue_("sampleVal", "Single sample value", 0.1f, 0.f, 1.f) 54 | , imageOut_{ std::make_shared(size2_t{ 0 }, DataFloat32::get()) } 55 | { 56 | addPort(samplesPort_); 57 | addPort(outport_); 58 | addProperty(sampleValue_); 59 | 60 | outport_.setData(imageOut_); 61 | } 62 | 63 | void SamplesToImageProcessor::process() { 64 | auto samples = samplesPort_.getData(); 65 | 66 | auto valuesRam = samples->getRAMRepresentation(); 67 | auto imageRam = imageOut_->getColorLayer()->getEditableRepresentation(); 68 | for (auto y = 0; y < imageRam->getDimensions().y; ++y) { 69 | for (auto x = 0; x < imageRam->getDimensions().x; ++x) { 70 | imageRam->setFromDouble(size2_t(x, y), 0); 71 | } 72 | } 73 | for (auto i = 0; i < samples->getSize(); ++i) { 74 | auto data = valuesRam->get(i); 75 | auto location = glm::clamp(size2_t(data.xy() * (vec2(imageOut_->getDimensions()))), size2_t{ 0 }, imageOut_->getDimensions() - size2_t{ 1 }); 76 | auto prevVal = imageRam->getAsNormalizedDouble(location); 77 | imageRam->setFromDouble(location, prevVal + sampleValue_); 78 | } 79 | 80 | } 81 | 82 | } // namespace 83 | 84 | 85 | -------------------------------------------------------------------------------- /modules/rndgenmwc64x/processors/randomnumbergenerator2dcl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | * 3 | * Inviwo - Interactive Visualization Workshop 4 | * 5 | * Copyright (c) 2014-2016 Inviwo Foundation 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, this 12 | * list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | *********************************************************************************/ 29 | 30 | #ifndef IVW_RANDOM_NUMBER_GENERATOR_2D_CL_H 31 | #define IVW_RANDOM_NUMBER_GENERATOR_2D_CL_H 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | 46 | #include 47 | 48 | 49 | namespace inviwo { 50 | 51 | /* 52 | * Generate random numbers and store them into an image (single 32-bit float 53 | */ 54 | /** \docpage{org.inviwo.RandomNumberGenerator2DCL, Random Number Generator 2D} 55 | * ![](org.inviwo.RandomNumberGenerator2DCL.png?classIdentifier=org.inviwo.RandomNumberGenerator2DCL) 56 | * 57 | * ... 58 | * 59 | * 60 | * ### Outports 61 | * * __samples__ ... 62 | * 63 | * ### Properties 64 | * * __Use OpenGL sharing__ ... 65 | * * __N samples__ ... 66 | * * __Regenerate__ ... 67 | * * __Seed number__ ... 68 | * * __Work group size__ ... 69 | * 70 | */ 71 | class IVW_MODULE_RNDGENMWC64X_API RandomNumberGenerator2DCL : public Processor, public ProcessorKernelOwner { 72 | 73 | public: 74 | RandomNumberGenerator2DCL(); 75 | ~RandomNumberGenerator2DCL() = default; 76 | 77 | virtual const ProcessorInfo getProcessorInfo() const override; 78 | static const ProcessorInfo processorInfo_; 79 | 80 | virtual void process() override; 81 | protected: 82 | void nRandomNumbersChanged(); 83 | void regenerate(); 84 | void generateNumbers(BufferCL* rndState, LayerCLBase* data, cl::Event* profilingEvent); 85 | private: 86 | ImageOutport randomNumbersPort_; 87 | 88 | IntVec2Property nRandomNumbers_; 89 | ButtonProperty regenerateNumbers_; 90 | IntProperty seed_; 91 | IntProperty workGroupSize_; 92 | BoolProperty useGLSharing_; 93 | 94 | Buffer randomState_; 95 | cl::Kernel* kernel_; 96 | }; 97 | 98 | } 99 | 100 | #endif // IVW_RANDOM_NUMBER_GENERATOR_2D_CL_H 101 | --------------------------------------------------------------------------------