├── .appveyor.yml ├── .gitignore ├── .gitmodules ├── .travis.yml ├── README.md ├── addon_config.mk ├── example-chain ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ ├── auto color tune.fs │ │ ├── boxinator.fs │ │ └── settings.xml ├── example-chain.sln ├── example-chain.vcxproj ├── icon.rc └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example-fft ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ ├── Spectrogram.fs │ │ ├── Test-Audio.fs │ │ └── Test-AudioFFT.fs ├── example-fft.sln ├── example-fft.vcxproj ├── example-fft.vcxproj.filters ├── icon.rc └── src │ ├── Synchronized.h │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example-generator ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ └── checkerboard.fs ├── example-generator.sln ├── example-generator.vcxproj ├── icon.rc └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example-grabber ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ └── auto color tune.fs ├── example-grabber.sln ├── example-grabber.vcxproj ├── icon.rc └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example-mixer ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ ├── auto color tune.fs │ │ ├── boxinator.fs │ │ └── settings.xml ├── example-mixer.sln ├── example-mixer.vcxproj ├── icon.rc └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example-osc ├── addons.make ├── bin │ └── data │ │ └── .gitkeep ├── example-osc.sln ├── example-osc.vcxproj ├── icon.rc └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example-spout ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ ├── auto color tune.fs │ │ ├── boxinator.fs │ │ └── settings.xml ├── example-spout.sln ├── example-spout.vcxproj ├── example-spout.vcxproj.filters ├── icon.rc └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example-template ├── addons.make ├── bin │ └── data │ │ └── .gitkeep ├── example-template.sln ├── example-template.vcxproj ├── example-template.vcxproj.filters ├── icon.rc └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example-transitions ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ ├── auto color tune.fs │ │ ├── boxinator.fs │ │ └── wiperight.fs ├── example-transitions.sln ├── example-transitions.vcxproj ├── icon.rc └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── images ├── VVGL_SDK_GLFW.PNG ├── bigobj.PNG ├── example-chain.PNG ├── example-fft.PNG ├── example-generator.PNG ├── example-grabber.PNG ├── example-mixer.PNG └── example-transitions.PNG ├── license.md ├── src ├── ofxISFScene.cpp └── ofxISFScene.h └── tests └── bin └── data ├── Hexagon.tiff ├── Optical Flow Distort.fs ├── Optical Flow Distort.vs ├── Test-Audio.fs ├── Test-AudioFFT.fs ├── Test-Bool.fs ├── Test-Color.fs ├── Test-Event.fs ├── Test-Float.fs ├── Test-Functionality.fs ├── Test-IMG_NORM_PIXEL.fs ├── Test-IMG_PIXEL.fs ├── Test-IMG_THIS_NORM_PIXEL.fs ├── Test-IMG_THIS_PIXEL.fs ├── Test-ImportedImage.fs ├── Test-Long.fs ├── Test-MultiPassRendering.fs ├── Test-PersistentBuffer.fs ├── Test-PersistentBufferDifferingSizes.fs ├── Test-Point.fs ├── Test-Sampler.fs └── Test-TempBufferDifferingSizes.fs /.appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | 3 | environment: 4 | global: 5 | APPVEYOR_OS_NAME: windows 6 | matrix: 7 | #MSYS2 Building 8 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 9 | platform: x86 10 | BUILDER: MSYS2 11 | 12 | #VisualStudio Building 13 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 14 | platform: x86 15 | BUILDER : VS 16 | BITS: 32 17 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 18 | platform: x64 19 | BUILDER : VS 20 | BITS: 64 21 | 22 | configuration: Debug 23 | shallow_clone: true 24 | clone_depth: 10 25 | 26 | init: 27 | - set MSYS2_PATH=c:\msys64 28 | - set CHERE_INVOKING=1 29 | - if "%BUILDER%_%PLATFORM%"=="MSYS2_x86" set MSYSTEM=MINGW32 30 | - if "%BUILDER%_%PLATFORM%"=="MSYS2_x64" set MSYSTEM=MINGW64 31 | - '%MSYS2_PATH%\usr\bin\bash -lc "pacman --noconfirm -S --needed unzip rsync"' 32 | - if "%BUILDER%"=="VS" set PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin;%PATH% 33 | 34 | install: 35 | - cd .. 36 | - git clone --depth=1 --branch=master https://github.com/openframeworks/openFrameworks 37 | - call openFrameworks\scripts\ci\addons\install.cmd 38 | 39 | build_script: 40 | - cd %OF_PATH% 41 | - scripts\ci\addons\build.cmd 42 | 43 | 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ######################### 2 | # general patterns 3 | ######################### 4 | 5 | docs/html 6 | docs/tagfile.xml 7 | 8 | */bin/* 9 | !*/bin/data/ 10 | 11 | # for bin folder in root 12 | /bin/* 13 | !/bin/data/ 14 | 15 | [Bb]uild/ 16 | [Oo]bj/ 17 | *.o 18 | [Dd]ebug*/ 19 | [Rr]elease*/ 20 | *.mode* 21 | *.app/ 22 | *.pyc 23 | .svn/ 24 | 25 | ######################### 26 | # IDE 27 | ######################### 28 | 29 | # XCode 30 | *.pbxuser 31 | *.perspective 32 | *.perspectivev3 33 | *.mode1v3 34 | *.mode2v3 35 | #XCode 4 36 | xcuserdata 37 | *.xcworkspace 38 | 39 | # Code::Blocks 40 | *.depend 41 | *.layout 42 | *.cbTemp 43 | 44 | # Visual Studio 45 | *.sdf 46 | *.opensdf 47 | *.suo 48 | *.pdb 49 | *.ilk 50 | *.aps 51 | ipch/ 52 | 53 | # Eclipse 54 | .metadata 55 | local.properties 56 | .externalToolBuilders 57 | 58 | # Codelite 59 | *.session 60 | *.tags 61 | *.workspace.* 62 | 63 | ######################### 64 | # operating system 65 | ######################### 66 | 67 | # Linux 68 | *~ 69 | # KDE 70 | .directory 71 | .AppleDouble 72 | 73 | # OSX 74 | .DS_Store 75 | *.swp 76 | *~.nib 77 | # Thumbnails 78 | ._* 79 | 80 | # Windows 81 | # Windows image file caches 82 | Thumbs.db 83 | # Folder config file 84 | Desktop.ini 85 | 86 | #Android 87 | .csettings 88 | 89 | ######################### 90 | # packages 91 | ######################### 92 | 93 | # it's better to unpack these files and commit the raw source 94 | # git has its own built in compression methods 95 | *.7z 96 | *.dmg 97 | *.gz 98 | *.iso 99 | *.jar 100 | *.rar 101 | *.tar 102 | *.zip 103 | 104 | # Logs and databases 105 | *.log 106 | *.sql 107 | *.sqlite 108 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libs\\VVISF-GL"] 2 | path = libs/VVISF-GL 3 | url = https://github.com/mrRay/VVISF-GL.git 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # This file allows testing your addon using travis CI servers to use it you'll need to 2 | # create an account in travis.org and enable your addon there. 3 | # 4 | # By default it will test linux 64bit and osx against the master and stable OF branches. 5 | # Other platforms can be enabled by uncommenting the corresponding sections. 6 | # 7 | # If any extra install is needed to use the addon it can be included in the corresponding 8 | # install script in: 9 | # 10 | # scripts/ci/$TARGET/install.sh 11 | # 12 | 13 | 14 | language: c++ 15 | compiler: gcc 16 | sudo: true 17 | matrix: 18 | include: 19 | # fully specify builds, include can't dynamically expand matrix entries 20 | # relative order of sudo and env is important so that addons: is recognized 21 | 22 | # Linux 64bit, OF master 23 | - os: linux 24 | dist: trusty 25 | sudo: required 26 | env: TARGET="linux64" OF_BRANCH="master" 27 | addons: 28 | apt: 29 | sources: 30 | - ubuntu-toolchain-r-test 31 | packages: 32 | - gcc-4.9 33 | - g++-4.9 34 | - gdb 35 | 36 | # Linux 64bit, OF stable: Not supported yet 37 | # - os: linux 38 | # dist: trusty 39 | # sudo: required 40 | # env: TARGET="linux64" OF_BRANCH="stable" 41 | # addons: 42 | # apt: 43 | # sources: 44 | # - ubuntu-toolchain-r-test 45 | # packages: 46 | # - gcc-4.9 47 | # - g++-4.9 48 | # - gdb 49 | 50 | # OSX, OF master 51 | - os: osx 52 | osx_image: xcode8 53 | compiler: clang 54 | env: TARGET="osx" OF_BRANCH="master" 55 | 56 | # OSX, OF stable: Not supported yet 57 | # - os: osx 58 | # osx_image: xcode8 59 | # compiler: clang 60 | # env: TARGET="osx" OF_BRANCH="stable" 61 | 62 | # Linux ARM6, OF master: Uncomment following lines to enable 63 | # - os: linux 64 | # sudo: required 65 | # dist: trusty 66 | # env: TARGET="linuxarmv6l" OF_BRANCH="master" 67 | 68 | 69 | # Linux ARM6, OF stable: Not supported yet 70 | # - os: linux 71 | # sudo: required 72 | # dist: trusty 73 | # env: TARGET="linuxarmv6l" OF_BRANCH="stable" 74 | 75 | # Linux ARM7, OF master: Uncomment following lines to enable 76 | # - os: linux 77 | # sudo: false 78 | # env: TARGET="linuxarmv7l" OF_BRANCH="master" 79 | # cache: 80 | # directories: 81 | # - ~/rpi2_toolchain 82 | # - ~/firmware-master 83 | # - ~/archlinux 84 | 85 | # Linux ARM7, OF stable: Not supported yet 86 | # - os: linux 87 | # sudo: false 88 | # env: TARGET="linuxarmv7l" OF_BRANCH="stable" 89 | # cache: 90 | # directories: 91 | # - ~/rpi2_toolchain 92 | # - ~/firmware-master 93 | # - ~/archlinux 94 | 95 | 96 | # Emscripten, OF master: Uncomment following lines to enable 97 | # - os: linux 98 | # sudo: false 99 | # env: TARGET="emscripten" OF_BRANCH="master" 100 | # addons: 101 | # apt: 102 | # sources: 103 | # - ubuntu-toolchain-r-test 104 | # packages: 105 | # - libstdc++6 106 | 107 | 108 | # Emscripten, OF stable: Not supported yet 109 | # - os: linux 110 | # sudo: false 111 | # env: TARGET="emscripten" OF_BRANCH="stable" 112 | # addons: 113 | # apt: 114 | # sources: 115 | # - ubuntu-toolchain-r-test 116 | # packages: 117 | # - libstdc++6 118 | 119 | 120 | # iOS, OF master: Not supported yet 121 | # - os: osx 122 | # osx_image: xcode8 123 | # compiler: clang 124 | # env: TARGET="ios" OF_BRANCH="master" 125 | 126 | 127 | # iOS, OF stable: Not supported yet 128 | # - os: osx 129 | # osx_image: xcode8 130 | # compiler: clang 131 | # env: TARGET="ios" OF_BRANCH="stable" 132 | 133 | 134 | # tvOS, OF master: Not supported yet 135 | # - os: osx 136 | # osx_image: xcode8 137 | # compiler: clang 138 | # env: TARGET="tvos" OF_BRANCH="master" 139 | 140 | 141 | # tvOS, OF stable: Not supported yet 142 | # - os: osx 143 | # osx_image: xcode8 144 | # compiler: clang 145 | # env: TARGET="tvos" OF_BRANCH="stable" 146 | 147 | 148 | # Android armv7, OF master: Uncomment following lines to enable 149 | # - os: linux 150 | # sudo: false 151 | # env: TARGET="android" OPT="armv7" OF_BRANCH="master" 152 | # cache: 153 | # directories: 154 | # - ~/android-ndk-r12b 155 | 156 | 157 | # Android armv7, OF stable: Not supported yet 158 | # - os: linux 159 | # sudo: false 160 | # env: TARGET="android" OPT="armv7" OF_BRANCH="stable" 161 | # cache: 162 | # directories: 163 | # - ~/android-ndk-r12b 164 | 165 | 166 | # Android x86, OF master: Uncomment following lines to enable 167 | # - os: linux 168 | # sudo: false 169 | # env: TARGET="android" OPT="x86" OF_BRANCH="master" 170 | # cache: 171 | # directories: 172 | # - ~/android-ndk-r12b 173 | 174 | 175 | # Android x86, OF stable: Not supported yet 176 | # - os: linux 177 | # sudo: false 178 | # env: TARGET="android" OPT="x86" OF_BRANCH="stable" 179 | # cache: 180 | # directories: 181 | # - ~/android-ndk-r12b 182 | 183 | 184 | # Exclude the default build that would otherwise be generated 185 | # see https://github.com/travis-ci/travis-ci/issues/1228 186 | exclude: 187 | - compiler: gcc 188 | 189 | install: 190 | - cd ~ 191 | - git clone --depth=1 --branch=$OF_BRANCH https://github.com/openframeworks/openFrameworks 192 | - cd openFrameworks 193 | - scripts/ci/addons/install.sh 194 | 195 | script: 196 | - scripts/ci/addons/build.sh 197 | 198 | git: 199 | depth: 10 200 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ofxVVISF 2 | ===================================== 3 | 4 | 5 | Introduction 6 | ------------ 7 | This openFrameworks addon wraps the [VVISF-GL](https://github.com/mrRay/VVISF-GL) cpp library from [VIDVOX](http://vidvox.com). It allows you to use [ISF files](https://github.com/vidvox/ISF-FILES) inside openFrameworks with a simple setup. 8 | 9 | ### VVISF 10 | ISF stands for "Interactive Shader Format", and is a file format that describes a GLSL fragment shader, as well as how to execute and interact with it (the official specification can be found here). VVISF is a cross-platform c++ library that implements the ISF protocol with support for a number of common SDKs (OS X, iOS, GLFW, and Qt) and GL environments (most versions of GL- both ES and desktop- are supported). 11 | 12 | ### VVGL 13 | VVGL is a small library that performs rudimentary GL rendering, focusing mainly on texture generation/pooling and render-to-texture operations. Its primary purpose is to provide a simple consistent interface for performing these basic GL operations while obfuscating any platform-specific or environment-specific GL implementation details. VVISF is built on top of VVGL, but you don't need to be intimately familiar with VVGL to use VVISF. 14 | 15 | License 16 | ------- 17 | See [License](/license.md) 18 | 19 | Installation 20 | ------------ 21 | - clone the addon into the `openFrameworks/addons/` folder 22 | - setup the submodule by running 23 | 24 | ```git submodule init``` 25 | 26 | ```git submodule update``` 27 | - Create a project with the project generator or create a projects by copying the examples 28 | - When creating a project you need to add preprocessor defines to enable the `VVGL_SDK_GLFW` flag. 29 | 30 | ![](images/VVGL_SDK_GLFW.PNG) 31 | - Edit the command line options to add `/bigobj` 32 | ![](images/bigobj.PNG) 33 | - ESnjoy! 34 | Examples 35 | ------------ 36 | ### example-grabber 37 | ![](images/example-grabber.PNG) 38 | This example shows you how to use a ofVideoGrabber as a input source for an ISFScene. 39 | 40 | ### example-fft 41 | ![](images/example-fft.PNG) 42 | This example shows you how to use audio as an input source for an ISFScene. It uses [ofxFft](https://github.com/kylemcdonald/ofxFft) to generate the ```fftImage``` and the raw waveform to generate the ```waveImage```. See the comments in the code to follow along. 43 | 44 | ### example-chain 45 | ![](images/example-chain.PNG) 46 | This example shows you how to chain multiple ISFScenes together in a VFX chain. 47 | 48 | ### example-mixer 49 | ![](images/example-mixer.PNG) 50 | This example shows you how to simply mix between two ISFScenes 51 | 52 | ### example-generator 53 | ![](images/example-generator.PNG) 54 | This example shows you how to use an ISFScene with a generator. 55 | 56 | ### example-transitions 57 | ![](images/example-transitions.PNG) 58 | This example shows you how to use multiple ISFScenes to feed a transition. 59 | 60 | Compatibility 61 | ------------ 62 | tested with 0.10+ VS2017 63 | 64 | Known issues 65 | ------------ 66 | Project generator might not work on macOS. testers welcome! 67 | 68 | Version history 69 | ------------ 70 | 0.0.1 initial release 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /addon_config.mk: -------------------------------------------------------------------------------- 1 | # All variables and this file are optional, if they are not present the PG and the 2 | # makefiles will try to parse the correct values from the file system. 3 | # 4 | # Variables that specify exclusions can use % as a wildcard to specify that anything in 5 | # that position will match. A partial path can also be specified to, for example, exclude 6 | # a whole folder from the parsed paths from the file system 7 | # 8 | # Variables can be specified using = or += 9 | # = will clear the contents of that variable both specified from the file or the ones parsed 10 | # from the file system 11 | # += will add the values to the previous ones in the file or the ones parsed from the file 12 | # system 13 | # 14 | # The PG can be used to detect errors in this file, just create a new project with this addon 15 | # and the PG will write to the console the kind of error and in which line it is 16 | 17 | meta: 18 | ADDON_NAME = ofxVVISF 19 | ADDON_DESCRIPTION = ofxAddonTemplate is amazing! 20 | ADDON_AUTHOR = @danzeeeman 21 | ADDON_TAGS = "addon" "ISF" "shaders" 22 | ADDON_URL = http://github.com/danzeeeman/ofxVVISF 23 | 24 | common: 25 | # dependencies with other addons, a list of them separated by spaces 26 | # or use += in several lines 27 | # ADDON_DEPENDENCIES = 28 | 29 | # include search paths, this will be usually parsed from the file system 30 | # but if the addon or addon libraries need special search paths they can be 31 | # specified here separated by spaces or one per line using += 32 | ADDON_INCLUDES += libs/VVISF-GL/VVGL/include/ 33 | ADDON_INCLUDES += libs/VVISF-GL/VVISF/include 34 | 35 | # any special flag that should be passed to the compiler when using this 36 | # addon 37 | # ADDON_CFLAGS = 38 | 39 | # any special flag that should be passed to the compiler for c++ files when 40 | # using this addon 41 | # ADDON_CPPFLAGS = 42 | 43 | # any special flag that should be passed to the linker when using this 44 | # addon, also used for system libraries with -lname 45 | # ADDON_LDFLAGS = 46 | 47 | # source files, these will be usually parsed from the file system looking 48 | # in the src folders in libs and the root of the addon. if your addon needs 49 | # to include files in different places or a different set of files per platform 50 | # they can be specified here 51 | 52 | # source files that will be included as C files explicitly 53 | # ADDON_C_SOURCES = 54 | 55 | # source files that will be included as header files explicitly 56 | # ADDON_HEADER_SOURCES = 57 | 58 | # source files that will be included as c++ files explicitly 59 | # ADDON_CPP_SOURCES = 60 | 61 | # source files that will be included as objective c files explicitly 62 | # ADDON_OBJC_SOURCES = 63 | 64 | # derines that will be passed to the compiler when including this addon 65 | # 66 | 67 | ADDON_DEFINES = VVGL_SDK_GLFW 68 | 69 | # some addons need resources to be copied to the bin/data folder of the project 70 | # specify here any files that need to be copied, you can use wildcards like * and ? 71 | # ADDON_DATA = 72 | 73 | # when parsing the file system looking for libraries exclude this for all or 74 | # a specific platform 75 | # ADDON_LIBS_EXCLUDE = 76 | 77 | # binary libraries, these will be usually parsed from the file system but some 78 | # libraries need to passed to the linker in a specific order/ 79 | # 80 | # For example in the ofxOpenCV addon we do something like this: 81 | # 82 | # ADDON_LIBS = 83 | # ADDON_LIBS += libs/opencv/lib/linuxarmv6l/libopencv_legacy.a 84 | # ADDON_LIBS += libs/opencv/lib/linuxarmv6l/libopencv_calib3d.a 85 | # ... 86 | 87 | ADDON_INCLUDES_EXCLUDE = libs/VVISF-GL/examples/% 88 | ADDON_INCLUDES_EXCLUDE += libs/VVISF-GL/external/% 89 | ADDON_INCLUDES_EXCLUDE += libs/VVISF-GL/VVISF/include/VVISF_Qt_global.hpp 90 | ADDON_INCLUDES_EXCLUDE += libs/VVISF-GL/VVISF/include/VVISF_Win_global.hpp 91 | ADDON_INCLUDES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBuffer_Enums_Mac.h 92 | ADDON_INCLUDES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBuffer_Enums_Qt.h 93 | ADDON_INCLUDES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBuffer_Enums_RPI.h 94 | ADDON_INCLUDES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBuffer_Enums_Win.h 95 | ADDON_INCLUDES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBuffer_Enums_IOS.h 96 | ADDON_INCLUDES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBufferPool_CocoaAdditions.h 97 | ADDON_INCLUDES_EXCLUDE += libs/VVISF-GL/VVGL/include/vvgl_qt_global.h 98 | ADDON_INCLUDES_EXCLUDE += libs/VVISF-GL/VVGL/include/VVGL_Win_global.hpp 99 | 100 | ADDON_SOURCES_EXCLUDE = libs/VVISF-GL/external/% 101 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/examples/% 102 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVISF/src/VVISF_Base.mm 103 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVISF/include/VVISF_Qt_global.hpp 104 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVISF/include/VVISF_Win_global.hpp 105 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBuffer_Enums_Mac.h 106 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBuffer_Enums_IOS.h 107 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBuffer_Enums_Qt.h 108 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBuffer_Enums_RPI.h 109 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBuffer_Enums_Win.h 110 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVGL/include/GLBufferPool_CocoaAdditions.h 111 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVGL/include/vvgl_qt_global.h 112 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVGL/include/VVGL_Win_global.hpp 113 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVGL/src/GLBufferPool_CocoaAdditions.mm 114 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVGL/src/GLContext.mm 115 | ADDON_SOURCES_EXCLUDE += libs/VVISF-GL/VVGL/src/GLQtCtxWrapper.cpp 116 | 117 | 118 | 119 | 120 | 121 | linux64: 122 | # linux only, any library that should be included in the project using 123 | # pkg-config 124 | # ADDON_PKG_CONFIG_LIBRARIES = 125 | vs: 126 | # After compiling copy the following dynamic libraries to the executable directory 127 | # only windows visual studio 128 | # ADDON_DLLS_TO_COPY = 129 | 130 | 131 | 132 | 133 | linuxarmv6l: 134 | linuxarmv7l: 135 | android/armeabi: 136 | android/armeabi-v7a: 137 | osx: 138 | # osx/iOS only, any framework that should be included in the project 139 | # ADDON_FRAMEWORKS = 140 | ADDON_FRAMEWORKS_EXCLUDE = Syphon.framework 141 | ADDON_FRAMEWORKS_EXCLUDE += MGSFragaria.framework 142 | ios: 143 | tvos: 144 | 145 | -------------------------------------------------------------------------------- /example-chain/addons.make: -------------------------------------------------------------------------------- 1 | ofxGui 2 | ofxVVISF 3 | -------------------------------------------------------------------------------- /example-chain/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/example-chain/bin/data/.gitkeep -------------------------------------------------------------------------------- /example-chain/bin/data/auto color tune.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "CATEGORIES": [ 3 | "Color Effect" 4 | ], 5 | "CREDIT": "by VIDVOX", 6 | "DESCRIPTION": "Creates variations on a base color using a given algorithm.", 7 | "INPUTS": [ 8 | { 9 | "NAME": "inputImage", 10 | "TYPE": "image" 11 | }, 12 | { 13 | "DEFAULT": 0, 14 | "LABEL": "Sample Mode", 15 | "LABELS": [ 16 | "Base Color", 17 | "Pixel Follow", 18 | "Color Average" 19 | ], 20 | "NAME": "sampleMode", 21 | "TYPE": "long", 22 | "VALUES": [ 23 | 0, 24 | 1, 25 | 2 26 | ] 27 | }, 28 | { 29 | "DEFAULT": 1, 30 | "LABEL": "Color Mode", 31 | "LABELS": [ 32 | "Basic Complementary", 33 | "Split Complementary", 34 | "Compound Complementary", 35 | "Spectrum", 36 | "Shades", 37 | "Analogous", 38 | "Compound Analogous" 39 | ], 40 | "NAME": "colorModeOverride", 41 | "TYPE": "long", 42 | "VALUES": [ 43 | 0, 44 | 1, 45 | 2, 46 | 3, 47 | 4, 48 | 5, 49 | 6 50 | ] 51 | }, 52 | { 53 | "DEFAULT": 7, 54 | "LABEL": "Color Count", 55 | "LABELS": [ 56 | "2", 57 | "3", 58 | "4", 59 | "5", 60 | "6", 61 | "7", 62 | "8", 63 | "9", 64 | "10", 65 | "11", 66 | "12", 67 | "13", 68 | "14", 69 | "15", 70 | "16" 71 | ], 72 | "NAME": "colorCount", 73 | "TYPE": "long", 74 | "VALUES": [ 75 | 2, 76 | 3, 77 | 4, 78 | 5, 79 | 6, 80 | 7, 81 | 8, 82 | 9, 83 | 10, 84 | 11, 85 | 12, 86 | 13, 87 | 14, 88 | 15, 89 | 16 90 | ] 91 | }, 92 | { 93 | "DEFAULT": [ 94 | 0.25, 95 | 0.59, 96 | 0.9, 97 | 1 98 | ], 99 | "LABEL": "Base Color", 100 | "NAME": "baseColor", 101 | "TYPE": "color" 102 | }, 103 | { 104 | "DEFAULT": [ 105 | 0.5, 106 | 0.5 107 | ], 108 | "LABEL": "Pixel Point", 109 | "MAX": [ 110 | 1, 111 | 1 112 | ], 113 | "MIN": [ 114 | 0, 115 | 0 116 | ], 117 | "NAME": "pixelFollowLocation", 118 | "TYPE": "point2D" 119 | } 120 | ], 121 | "ISFVSN": "2", 122 | "PASSES": [ 123 | { 124 | "HEIGHT": "$HEIGHT / 100.0", 125 | "TARGET": "bufferPassA", 126 | "WIDTH": "$WIDTH / 100.0" 127 | }, 128 | { 129 | "HEIGHT": "1.0", 130 | "TARGET": "autoColorBuffer", 131 | "WIDTH": "1.0", 132 | "persistent": true 133 | }, 134 | { 135 | } 136 | ], 137 | "VSN": null 138 | } 139 | */ 140 | 141 | 142 | 143 | 144 | vec3 rgb2hsv(vec3 c) { 145 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 146 | //vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); 147 | //vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); 148 | vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); 149 | vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); 150 | 151 | float d = q.x - min(q.w, q.y); 152 | float e = 1.0e-10; 153 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); 154 | } 155 | 156 | vec3 hsv2rgb(vec3 c) { 157 | vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); 158 | vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); 159 | return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); 160 | } 161 | 162 | float gray(vec4 c) { 163 | return (c.r + c.g + c.b) * c.a / 3.0; 164 | } 165 | 166 | void main() 167 | { 168 | if (PASSINDEX == 0) { 169 | vec4 inputColor = IMG_NORM_PIXEL(inputImage, isf_FragNormCoord); 170 | gl_FragColor = inputColor; 171 | } 172 | else if (PASSINDEX == 1) { 173 | vec4 inputColor = IMG_NORM_PIXEL(bufferPassA, isf_FragNormCoord); 174 | vec4 oldColor = IMG_NORM_PIXEL(autoColorBuffer, vec2(0.5,0.5)); 175 | gl_FragColor = mix(inputColor, oldColor, 0.8); 176 | } 177 | else if (PASSINDEX == 2) { 178 | vec4 inputColor = IMG_THIS_PIXEL(inputImage); 179 | vec4 inColor = baseColor; 180 | float index = floor(gray(inputColor) * float(colorCount)); 181 | //float index = floor(isf_FragNormCoord.x * float(colorCount)); 182 | float variation = 0.3236; // 1/5 the golden ratio 183 | int colorMode = colorModeOverride; 184 | 185 | if (sampleMode == 0) { 186 | inColor = baseColor; 187 | inColor.rgb = rgb2hsv(inColor.rgb); 188 | } 189 | else if (sampleMode == 1) { 190 | inColor = IMG_NORM_PIXEL(inputImage, pixelFollowLocation); 191 | inColor.rgb = rgb2hsv(inColor.rgb); 192 | } 193 | else if (sampleMode == 2) { 194 | inColor = IMG_NORM_PIXEL(autoColorBuffer, vec2(0.5,0.5)); 195 | inColor.rgb = rgb2hsv(inColor.rgb); 196 | if (inColor.b < 0.1) { 197 | inColor = inColor * 1.5; 198 | } 199 | } 200 | 201 | vec4 outColor = inColor; 202 | 203 | // Basic complimentary saturation and brightness variations on two fixed 180 degree opposite hues 204 | if (colorMode == 0) { 205 | if (mod(index, 2.0) >= 1.0) { 206 | outColor.r = outColor.r + 0.5; 207 | outColor.r = outColor.r - floor(outColor.r); 208 | } 209 | 210 | outColor.g = outColor.g - variation * floor(index / 2.0); 211 | 212 | if (outColor.g < 0.1) { 213 | outColor.g = outColor.g + variation * floor(index / 2.0); 214 | outColor.g = outColor.g - floor(outColor.g); 215 | } 216 | 217 | outColor.b = outColor.b - variation * floor(index / 4.0); 218 | if (outColor.b < 0.2) { 219 | outColor.b = outColor.b + variation * floor(index / 4.0); 220 | outColor.b = outColor.b - floor(outColor.b); 221 | } 222 | } 223 | // Split complimentary saturation and brightness variations on a 3 fixed 120 degree hues 224 | else if (colorMode == 1) { 225 | float divisor = 3.0; 226 | float ratio = 0.45; 227 | if (mod(index, 3.0) >= 2.0) { 228 | outColor.r = outColor.r - ratio; 229 | } 230 | else if (mod(index, 3.0) >= 1.0) { 231 | outColor.r = outColor.r + ratio; 232 | } 233 | 234 | //outColor.g = outColor.g + variation * floor(index / divisor); 235 | 236 | if (mod(index, 5.0) >= 3.0) { 237 | outColor.g = outColor.g - variation; 238 | outColor.g = outColor.g - floor(outColor.g); 239 | } 240 | outColor.b = outColor.b - variation * floor(index / (divisor)); 241 | if (outColor.b < 0.1) { 242 | outColor.b = outColor.b + variation * floor(index / (divisor)); 243 | outColor.b = outColor.b - floor(outColor.b); 244 | } 245 | } 246 | // Compound complimentary a combination of shades, complimentary and analogous colors with slight shifts 247 | else if (colorMode == 2) { 248 | if (mod(index, 3.0) >= 2.0) { 249 | outColor.r = outColor.r + 0.5; 250 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1) / 4.0; 251 | } 252 | else { 253 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 254 | } 255 | outColor.r = outColor.r - floor(outColor.r); 256 | 257 | 258 | if (mod(index, 2.0) >= 1.0) { 259 | outColor.g = outColor.g + index * variation / 2.0; 260 | } 261 | else if (mod(index, 3.0) >= 2.0) { 262 | outColor.g = outColor.g - variation / 2.0; 263 | } 264 | else { 265 | outColor.g = outColor.g - index * variation / float(colorCount - 1); 266 | } 267 | if (outColor.g > 1.0) { 268 | outColor.g = outColor.g - floor(outColor.g); 269 | } 270 | } 271 | // Spectrum hue shifts based on number of colors with minor saturation shifts 272 | else if (colorMode == 3) { 273 | outColor.r = outColor.r + index * 1.0 / float(colorCount); 274 | if (mod(index, 3.0) >= 2.0) { 275 | outColor.g = outColor.g - variation / 2.0; 276 | outColor.g = outColor.g - floor(outColor.g); 277 | } 278 | else if (mod(index, 4.0) >= 3.0) { 279 | outColor.g = outColor.g + variation / 2.0; 280 | //outColor.g = outColor.g - floor(outColor.g); 281 | } 282 | } 283 | // Shades saturation and brightness variations on a single fixed hue 284 | else if (colorMode == 4) { 285 | if (mod(index, 2.0) >= 1.0) { 286 | outColor.b = outColor.b - (index * variation) / float(colorCount-1); 287 | } 288 | else { 289 | outColor.b = outColor.b + (index * variation) / float(colorCount-1); 290 | outColor.b = outColor.b - floor(outColor.b); 291 | } 292 | if (outColor.b < 0.075) { 293 | outColor.b = 1.0 - outColor.b * variation; 294 | } 295 | 296 | if (mod(index, 3.0) >= 2.0) { 297 | outColor.g = outColor.g - (index * variation) / 2.0; 298 | } 299 | else if (mod(index, 4.0) >= 3.0) { 300 | outColor.g = outColor.g + (index * variation) / 2.0; 301 | } 302 | 303 | if ((outColor.g > 1.0) || (outColor.g < 0.05)) { 304 | outColor.g = outColor.g - floor(outColor.g); 305 | } 306 | } 307 | // Analogous small hue and saturation shifts 308 | else if (colorMode == 5) { 309 | 310 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 311 | 312 | if (mod(index, 3.0) >= 1.0) { 313 | outColor.g = outColor.g - variation / 2.0; 314 | if (outColor.g < 0.0) { 315 | outColor.g = outColor.g + variation / 2.0; 316 | } 317 | if (outColor.g > 1.0) { 318 | outColor.g = outColor.g - floor(outColor.g); 319 | } 320 | } 321 | } 322 | // Compound Analogous similar to analogous but with negative hue shifts 323 | else if (colorMode == 6) { 324 | if (mod(index, 3.0) >= 1.0) { 325 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 326 | } 327 | else { 328 | outColor.r = outColor.r - variation * index * 0.5 / float(colorCount - 1); 329 | } 330 | if (mod(index, 3.0) >= 1.0) { 331 | outColor.g = outColor.g - variation / 2.0; 332 | if (outColor.g < 0.0) { 333 | outColor.g = outColor.g + variation; 334 | } 335 | if (outColor.g > 1.0) { 336 | outColor.g = outColor.g - floor(outColor.g); 337 | } 338 | } 339 | if (mod(index, 4.0) >= 2.0) { 340 | if (outColor.b < variation) { 341 | outColor.b = outColor.b + variation; 342 | } 343 | } 344 | } 345 | 346 | gl_FragColor = vec4(hsv2rgb(outColor.rgb), inColor.a); 347 | } 348 | } 349 | -------------------------------------------------------------------------------- /example-chain/bin/data/boxinator.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "CREDIT": "by mojovideotech", 3 | "ISFVSN": "2", 4 | "CATEGORIES": [ 5 | "Stylize" 6 | ], 7 | "INPUTS": [ 8 | { 9 | "NAME": "inputImage", 10 | "TYPE": "image" 11 | }, 12 | { 13 | "NAME": "rate", 14 | "TYPE": "float", 15 | "DEFAULT": 2.5, 16 | "MIN": 0.0, 17 | "MAX": 10.0 18 | }, 19 | { 20 | "NAME": "edge", 21 | "TYPE": "float", 22 | "DEFAULT": 0.001, 23 | "MIN": 0.0, 24 | "MAX": 0.01 25 | }, 26 | { 27 | "NAME": "blend", 28 | "TYPE": "float", 29 | "DEFAULT": 0.95, 30 | "MIN": -1.0, 31 | "MAX": 1.0 32 | }, 33 | { 34 | "NAME": "randomize", 35 | "TYPE": "float", 36 | "DEFAULT": 0.5, 37 | "MIN": 0.0, 38 | "MAX": 1.0 39 | }, 40 | { 41 | "NAME": "gamma", 42 | "TYPE": "float", 43 | "DEFAULT": -0.3, 44 | "MIN": -0.5, 45 | "MAX": 0.2 46 | }, 47 | { 48 | "NAME": "grid", 49 | "TYPE": "point2D", 50 | "DEFAULT": [ 64.0, 36.0 ], 51 | "MIN": [ 1.5, 1.5 ], 52 | "MAX": [ 900.0, 600.0 ] 53 | } 54 | ] 55 | }*/ 56 | 57 | //////////////////////////////////////////////////////////////////// 58 | // Boxinator by mojovideotech 59 | // 60 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 61 | //////////////////////////////////////////////////////////////////// 62 | 63 | 64 | #ifdef GL_ES 65 | precision mediump float; 66 | #endif 67 | 68 | 69 | //------------------------------------------------------------------ 70 | // simplex noise function 71 | // by : Ian McEwan, Ashima Arts 72 | // © 2011 Ashima Arts, MIT License 73 | 74 | vec4 permute(vec4 x) { return mod(((x*34.0)+1.0)*x, 289.0); } 75 | 76 | vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; } 77 | 78 | float snoise(vec3 v) { 79 | const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; 80 | const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); 81 | vec3 i = floor(v + dot(v, C.yyy) ); 82 | vec3 x0 = v - i + dot(i, C.xxx) ; 83 | vec3 g = step(x0.yzx, x0.xyz); 84 | vec3 l = 1.0 - g; 85 | vec3 i1 = min( g.xyz, l.zxy ); 86 | vec3 i2 = max( g.xyz, l.zxy ); 87 | vec3 x1 = x0 - i1 + 1.0 * C.xxx; 88 | vec3 x2 = x0 - i2 + 2.0 * C.xxx; 89 | vec3 x3 = x0 - 1. + 3.0 * C.xxx; 90 | i = mod(i, 289.0 ); 91 | vec4 p = permute( permute( permute( 92 | i.z + vec4(0.0, i1.z, i2.z, 1.0 )) 93 | + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 94 | + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); 95 | float n_ = 1.0/7.0; // N=7 96 | vec3 ns = n_ * D.wyz - D.xzx; 97 | vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N) 98 | vec4 x_ = floor(j * ns.z); 99 | vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) 100 | vec4 x = x_ *ns.x + ns.yyyy; 101 | vec4 y = y_ *ns.x + ns.yyyy; 102 | vec4 h = 1.0 - abs(x) - abs(y); 103 | vec4 b0 = vec4( x.xy, y.xy ); 104 | vec4 b1 = vec4( x.zw, y.zw ); 105 | vec4 s0 = floor(b0)*2.0 + 1.0; 106 | vec4 s1 = floor(b1)*2.0 + 1.0; 107 | vec4 sh = -step(h, vec4(0.0)); 108 | vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; 109 | vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; 110 | vec3 p0 = vec3(a0.xy,h.x); 111 | vec3 p1 = vec3(a0.zw,h.y); 112 | vec3 p2 = vec3(a1.xy,h.z); 113 | vec3 p3 = vec3(a1.zw,h.w); 114 | vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); 115 | p0 *= norm.x; 116 | p1 *= norm.y; 117 | p2 *= norm.z; 118 | p3 *= norm.w; 119 | vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); 120 | m = m * m; 121 | return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 122 | dot(p2,x2), dot(p3,x3) ) ); 123 | } 124 | //------------------------------------------------------------------ 125 | 126 | float hash(float h) { return fract(sin(h) * 43758.5453123); } 127 | 128 | vec2 tile(vec2 cell, vec2 size) { return fract(cell*size); } 129 | 130 | float box(vec2 a, vec2 b){ vec2 o = step(b,a); return o.x*o.y; } 131 | 132 | void main(void){ 133 | float T = TIME*rate; 134 | vec2 uv = gl_FragCoord.xy/RENDERSIZE.xy; 135 | vec2 g = floor(grid.xy); 136 | float C = g.x*g.y ; 137 | float I = 1.0 + floor(uv.x * g.x) + g.y * floor(uv.y * g.y) + g.x; 138 | vec2 st = tile(uv, g); 139 | float S = I / C * box(st, vec2(edge*g.xy)); 140 | S = mix(S,hash(S),randomize); 141 | vec3 color = vec3(S*T); 142 | float n = snoise(color+IMG_NORM_PIXEL(inputImage, uv.xy).xyz*blend); 143 | 144 | gl_FragColor = sqrt(max(vec4(vec3(n, n, n ),1.0)+IMG_NORM_PIXEL(inputImage, uv.xy),0.0)+gamma); 145 | } 146 | 147 | -------------------------------------------------------------------------------- /example-chain/bin/data/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 4 | 5 5 | 0, 0.311242, 1, 1 6 | 7 | 0.306122 8 | 0.01 9 | 0.780612 10 | 0.566327 11 | -0.5 12 | 1.5, 11.0969 13 | 14 | 15 | -------------------------------------------------------------------------------- /example-chain/example-chain.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example-chain", "example-chain.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Debug|x64 = Debug|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32 17 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64 18 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64 19 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32 20 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32 21 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64 22 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64 23 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 25 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64 26 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64 27 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 28 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 29 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64 30 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /example-chain/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /example-chain/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example-chain/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofDisableArbTex(); 6 | ofSetWindowShape(640*2, 480*2); 7 | grabber.setup(640, 480); 8 | autoColor.setup(ofToDataPath("auto color tune.fs"), 640, 480); 9 | boxinator.setup(ofToDataPath("boxinator.fs"), 640, 480); 10 | boxinatorTwo.setup(ofToDataPath("boxinator.fs"), 640, 480); 11 | autoColor.setInput("inputImage", boxinator.getTexture()); 12 | boxinator.setInput("inputImage", grabber.getTexture()); 13 | boxinatorTwo.setInput("inputImage", autoColor.getTexture()); 14 | autoColorGroup.setName("Auto Color Inputs"); 15 | autoColorGroup.add(colorMode.set("Color Mode", 0, 0, 6)); 16 | autoColorGroup.add(colorCount.set("Color Count", 3, 1, 16)); 17 | autoColorGroup.add(baseColor.set("Base Color", ofFloatColor(0.5, 0, 0.5, 1.0))); 18 | gui.setup(autoColorGroup); 19 | boxGroup.setName("Boxinator Inputs"); 20 | boxGroup.add(rate.set("Rate", 0.1, 0, 10)); 21 | boxGroup.add(edge.set("Edge", 0.001, 0.0, 0.01)); 22 | boxGroup.add(blend.set("Blend", 0.5, 0.0, 1.0)); 23 | boxGroup.add(randomize.set("Randomize", 0.5, 0.0, 1.0)); 24 | boxGroup.add(gamma.set("Gamma", -0.3, -0.5, 0.3)); 25 | boxGroup.add(grid.set("Grid Size", ofVec2f(64.5, 64.5), ofVec2f(1.5, 1.5), ofVec2f(900, 600))); 26 | 27 | gui.add(boxGroup); 28 | } 29 | 30 | //-------------------------------------------------------------- 31 | void ofApp::update(){ 32 | grabber.update(); 33 | autoColor.setInput("colorModeOverride",(long) colorMode.get()); 34 | autoColor.setInput("colorCount", (long)colorCount.get()); 35 | autoColor.setInput("baseColor", baseColor.get()); 36 | 37 | boxinator.setInput("rate", rate.get()); 38 | boxinator.setInput("edge", edge.get()); 39 | boxinator.setInput("blend", blend.get()); 40 | boxinator.setInput("randomize", randomize.get()); 41 | boxinator.setInput("gamma", gamma.get()); 42 | boxinator.setInput("grid", grid.get()); 43 | autoColor.update(); 44 | boxinator.update(); 45 | boxinatorTwo.update(); 46 | } 47 | 48 | //-------------------------------------------------------------- 49 | void ofApp::draw(){ 50 | boxinatorTwo.draw(0, 0); 51 | boxinator.draw(640, 0); 52 | autoColor.draw(640, 480); 53 | grabber.draw(0, 480); 54 | gui.draw(); 55 | } 56 | 57 | //-------------------------------------------------------------- 58 | void ofApp::keyPressed(int key){ 59 | 60 | } 61 | 62 | //-------------------------------------------------------------- 63 | void ofApp::keyReleased(int key){ 64 | 65 | } 66 | 67 | //-------------------------------------------------------------- 68 | void ofApp::mouseMoved(int x, int y ){ 69 | 70 | } 71 | 72 | //-------------------------------------------------------------- 73 | void ofApp::mouseDragged(int x, int y, int button){ 74 | 75 | } 76 | 77 | //-------------------------------------------------------------- 78 | void ofApp::mousePressed(int x, int y, int button){ 79 | 80 | } 81 | 82 | //-------------------------------------------------------------- 83 | void ofApp::mouseReleased(int x, int y, int button){ 84 | 85 | } 86 | 87 | //-------------------------------------------------------------- 88 | void ofApp::mouseEntered(int x, int y){ 89 | 90 | } 91 | 92 | //-------------------------------------------------------------- 93 | void ofApp::mouseExited(int x, int y){ 94 | 95 | } 96 | 97 | //-------------------------------------------------------------- 98 | void ofApp::windowResized(int w, int h){ 99 | 100 | } 101 | 102 | //-------------------------------------------------------------- 103 | void ofApp::gotMessage(ofMessage msg){ 104 | 105 | } 106 | 107 | //-------------------------------------------------------------- 108 | void ofApp::dragEvent(ofDragInfo dragInfo){ 109 | 110 | } 111 | -------------------------------------------------------------------------------- /example-chain/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxISFScene.h" 5 | #include "ofxGui.h" 6 | class ofApp : public ofBaseApp{ 7 | 8 | public: 9 | void setup(); 10 | void update(); 11 | void draw(); 12 | 13 | void keyPressed(int key); 14 | void keyReleased(int key); 15 | void mouseMoved(int x, int y ); 16 | void mouseDragged(int x, int y, int button); 17 | void mousePressed(int x, int y, int button); 18 | void mouseReleased(int x, int y, int button); 19 | void mouseEntered(int x, int y); 20 | void mouseExited(int x, int y); 21 | void windowResized(int w, int h); 22 | void dragEvent(ofDragInfo dragInfo); 23 | void gotMessage(ofMessage msg); 24 | 25 | ofxISFScene autoColor; 26 | ofxISFScene boxinator; 27 | ofxISFScene boxinatorTwo; 28 | ofVideoGrabber grabber; 29 | ofParameterGroup autoColorGroup; 30 | ofParameterGroup boxGroup; 31 | ofParameter colorMode; 32 | ofParameter colorCount; 33 | ofParameter rate; 34 | ofParameter edge; 35 | ofParameter blend; 36 | ofParameter randomize; 37 | ofParameter gamma; 38 | ofParameter grid; 39 | ofParameter baseColor; 40 | ofxPanel gui; 41 | 42 | }; 43 | -------------------------------------------------------------------------------- /example-fft/addons.make: -------------------------------------------------------------------------------- 1 | ofxFft 2 | ofxGui 3 | ofxVVISF 4 | -------------------------------------------------------------------------------- /example-fft/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/example-fft/bin/data/.gitkeep -------------------------------------------------------------------------------- /example-fft/bin/data/Spectrogram.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "Buffers the incoming FFTs for timed display", 3 | "CREDIT": "by VIDVOX", 4 | "ISFVSN": "2", 5 | "CATEGORIES": [ 6 | "Audio Visualizer" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "fftImage", 11 | "TYPE": "audioFFT" 12 | }, 13 | { 14 | "NAME": "clear", 15 | "TYPE": "event" 16 | }, 17 | { 18 | "NAME": "gain", 19 | "TYPE": "float", 20 | "MIN": 0.0, 21 | "MAX": 2.0, 22 | "DEFAULT":1.0 23 | }, 24 | { 25 | "NAME": "range", 26 | "TYPE": "float", 27 | "MIN": 0.0, 28 | "MAX": 1.0, 29 | "DEFAULT": 1.0 30 | }, 31 | { 32 | "NAME": "axis_scale", 33 | "TYPE": "float", 34 | "MIN": 1.0, 35 | "MAX": 6.0, 36 | "DEFAULT": 1.25 37 | }, 38 | { 39 | "NAME": "lumaMode", 40 | "TYPE": "bool", 41 | "DEFAULT": 0.0 42 | }, 43 | { 44 | "NAME": "color1", 45 | "TYPE": "color", 46 | "DEFAULT": [ 47 | 0.0, 48 | 0.5, 49 | 1.0, 50 | 1.0 51 | ] 52 | }, 53 | { 54 | "NAME": "color2", 55 | "TYPE": "color", 56 | "DEFAULT": [ 57 | 1.0, 58 | 0.0, 59 | 0.0, 60 | 1.0 61 | ] 62 | }, 63 | { 64 | "NAME": "color3", 65 | "TYPE": "color", 66 | "DEFAULT": [ 67 | 0.0, 68 | 1.0, 69 | 0.0, 70 | 1.0 71 | ] 72 | } 73 | ], 74 | "PASSES": [ 75 | { 76 | "TARGET": "fftValues", 77 | "DESCRIPTION": "This buffer stores all of the previous fft values", 78 | "HEIGHT": "512", 79 | "FLOAT": true, 80 | "PERSISTENT": true 81 | }, 82 | { 83 | 84 | } 85 | ] 86 | 87 | }*/ 88 | 89 | void main() 90 | { 91 | // first pass- read the value from the fft image, store it in the "fftValues" persistent buffer 92 | if (PASSINDEX==0) { 93 | // the first column of pixels is copied from the newly received fft image 94 | if (clear) { 95 | gl_FragColor = vec4(0.0); 96 | } 97 | else if (gl_FragCoord.x<1.0) { 98 | vec2 loc = vec2(isf_FragNormCoord.y, isf_FragNormCoord.x); 99 | vec4 rawColor = IMG_NORM_PIXEL(fftImage, loc); 100 | gl_FragColor = rawColor; 101 | } 102 | // all other columns of pixels come from the "fftValues" persistent buffer (we're scrolling) 103 | else { 104 | gl_FragColor = IMG_PIXEL(fftValues, vec2(gl_FragCoord.x-1.0, gl_FragCoord.y)); 105 | } 106 | } 107 | // second pass- read from the buffer of raw values, apply gain/range and colors 108 | else if (PASSINDEX==1) { 109 | vec2 loc = vec2(isf_FragNormCoord.x, pow(isf_FragNormCoord.y*range, axis_scale)); 110 | vec4 rawColor = IMG_NORM_PIXEL(fftValues, loc); 111 | 112 | rawColor = rawColor * vec4(gain); 113 | 114 | float mixVal = 0.0; 115 | 116 | if (lumaMode) { 117 | float locus_1 = 0.20; 118 | float locus_2 = 0.50; 119 | float locus_3 = 0.75; 120 | 121 | if (rawColor.r < locus_1) { 122 | mixVal = (rawColor.r)/(locus_1); 123 | gl_FragColor = mix(vec4(0,0,0,0), color1, mixVal); 124 | } 125 | else if (rawColor.r>=locus_1 && rawColor.r=locus_2 && rawColor.r=locus_3) { 134 | mixVal = (rawColor.r - locus_3); 135 | gl_FragColor = mix(color3, vec4(1,1,1,1), mixVal); 136 | } 137 | } 138 | else { 139 | float locus_1 = 0.25; 140 | float locus_2 = 0.5; 141 | float locus_3 = 0.75; 142 | 143 | if (loc.y < locus_1) { 144 | gl_FragColor = rawColor.r * color1; 145 | } 146 | else if (loc.y>=locus_1 && loc.y=locus_2 && loc.y locus_3) { 155 | gl_FragColor = rawColor.r * color3; 156 | } 157 | } 158 | } 159 | } -------------------------------------------------------------------------------- /example-fft/bin/data/Test-Audio.fs: -------------------------------------------------------------------------------- 1 | /* 2 | { 3 | "CATEGORIES" : [ 4 | "Generator" 5 | ], 6 | "DESCRIPTION" : "Visualizes an FFT analysis image with custom set colors for frequency domain", 7 | "INPUTS" : [ 8 | { 9 | "NAME" : "waveImage", 10 | "TYPE" : "audio" 11 | }, 12 | { 13 | "NAME" : "waveSize", 14 | "TYPE" : "float", 15 | "MAX" : 0.5, 16 | "DEFAULT" : 0.15, 17 | "MIN" : 0 18 | }, 19 | { 20 | "NAME" : "stereo", 21 | "TYPE" : "bool", 22 | "DEFAULT" : 1 23 | } 24 | ], 25 | "CREDIT" : "by VIDVOX" 26 | } 27 | */ 28 | 29 | 30 | 31 | void main() { 32 | 33 | vec2 loc = vec2(vv_FragNormCoord[1], vv_FragNormCoord[0]); 34 | 35 | vec2 rawSize = IMG_SIZE(waveImage); 36 | float channel = 0.5; 37 | float offset = 0.0; 38 | if (stereo == true) { 39 | channel = (loc.x > 0.5) ? 0.0 : 1.0; 40 | offset = (loc.x > 0.5) ? 0.25 : -0.25; 41 | } 42 | 43 | vec2 waveLoc = vec2(loc.y,channel); 44 | vec4 wave = IMG_NORM_PIXEL(waveImage, waveLoc)+offset; 45 | vec4 waveAdd = (1.0 - smoothstep(0.0, waveSize, abs(wave - loc.x))); 46 | waveAdd.a = 1.0; 47 | gl_FragColor = waveAdd; 48 | } -------------------------------------------------------------------------------- /example-fft/bin/data/Test-AudioFFT.fs: -------------------------------------------------------------------------------- 1 | /* 2 | { 3 | "CATEGORIES" : [ 4 | "Audio Visualizer" 5 | ], 6 | "ISFVSN": "2", 7 | "DESCRIPTION" : "Visualizes an FFT analysis image with custom set colors for frequency domain", 8 | "INPUTS" : [ 9 | { 10 | "NAME" : "fftImage", 11 | "TYPE" : "audioFFT" 12 | }, 13 | { 14 | "NAME" : "waveImage", 15 | "TYPE" : "audio" 16 | }, 17 | { 18 | "NAME" : "gainFFT", 19 | "TYPE" : "float", 20 | "MAX" : 5, 21 | "DEFAULT" : 1, 22 | "MIN" : 0 23 | }, 24 | { 25 | "NAME" : "rangeFFT", 26 | "TYPE" : "float", 27 | "MAX" : 1, 28 | "DEFAULT" : 0.5, 29 | "MIN" : 0 30 | }, 31 | { 32 | "NAME" : "waveSize", 33 | "TYPE" : "float", 34 | "MAX" : 0.5, 35 | "DEFAULT" : 0.025, 36 | "MIN" : 0 37 | }, 38 | { 39 | "NAME" : "vertical", 40 | "TYPE" : "bool", 41 | "DEFAULT" : 1 42 | }, 43 | { 44 | "NAME" : "stereo", 45 | "TYPE" : "bool", 46 | "DEFAULT" : 1 47 | }, 48 | { 49 | "NAME" : "color1", 50 | "TYPE" : "color", 51 | "DEFAULT" : [ 52 | 0.2087394440714313, 53 | 0.9861069917678833, 54 | 0.1871179742814854, 55 | 1 56 | ] 57 | }, 58 | { 59 | "NAME" : "color2", 60 | "TYPE" : "color", 61 | "DEFAULT" : [ 62 | 0, 63 | 0.5, 64 | 1, 65 | 1 66 | ] 67 | }, 68 | { 69 | "NAME" : "color3", 70 | "TYPE" : "color", 71 | "DEFAULT" : [ 72 | 0, 73 | 1, 74 | 0, 75 | 1 76 | ] 77 | }, 78 | { 79 | "NAME" : "wavecolor", 80 | "TYPE" : "color", 81 | "DEFAULT" : [ 82 | 1, 83 | 1, 84 | 1, 85 | 1 86 | ] 87 | } 88 | ], 89 | "CREDIT" : "by VIDVOX" 90 | } 91 | */ 92 | 93 | 94 | 95 | void main() { 96 | 97 | vec2 loc = isf_FragNormCoord; 98 | 99 | if (vertical) { 100 | loc.x = isf_FragNormCoord[1]; 101 | loc.y = isf_FragNormCoord[0]; 102 | } 103 | 104 | vec4 mixColor = color1; 105 | 106 | if (loc.y > 0.5) { 107 | mixColor = mix (color2,color3,(loc.y-0.5)*2.0); 108 | } 109 | else { 110 | mixColor = mix (color1,color2,(loc.y*2.0)); 111 | } 112 | 113 | loc.y = loc.y * rangeFFT; 114 | 115 | vec2 fftSize = IMG_SIZE(fftImage); 116 | vec2 rawSize = IMG_SIZE(waveImage); 117 | float channel = 0.5; 118 | float offset = 0.0; 119 | if (stereo == true) { 120 | channel = (loc.x > 0.5) ? 0.0 : 1.0; 121 | offset = (loc.x > 0.5) ? 0.25 : -0.25; 122 | } 123 | 124 | vec4 fft = IMG_NORM_PIXEL(fftImage, vec2(loc.y,channel)); 125 | fft = mixColor * fft.r * 3.0; 126 | fft.rgb = gainFFT * fft.rgb; 127 | vec2 waveLoc = vec2(loc.y,channel); 128 | vec4 wave = IMG_NORM_PIXEL(waveImage, waveLoc)+offset; 129 | //wave = vec4(wave.r); 130 | vec4 waveAdd = ((1.0 - smoothstep(0.0, waveSize, abs(wave - loc.x))) * wavecolor) * wavecolor.a; 131 | fft += waveAdd; 132 | fft.a = mixColor.a + clamp((waveAdd.r + waveAdd.g + waveAdd.b) * wavecolor.a,0.0,1.0); 133 | 134 | gl_FragColor = fft; 135 | } -------------------------------------------------------------------------------- /example-fft/example-fft.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example-fft", "example-fft.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Debug|x64 = Debug|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32 17 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64 18 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64 19 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32 20 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32 21 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64 22 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64 23 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 25 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64 26 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64 27 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 28 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 29 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64 30 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /example-fft/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /example-fft/src/Synchronized.h: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | 3 | template 4 | class Synchronized : public ofMutex { 5 | private: 6 | T back, middle, front; 7 | bool newData; 8 | public: 9 | Synchronized() 10 | :newData(false) { 11 | } 12 | void setup(const T& prototype) { 13 | back = prototype; 14 | middle = prototype; 15 | front = prototype; 16 | } 17 | T& getBack() { 18 | return back; 19 | } 20 | T& getFront() { 21 | return front; 22 | } 23 | void swapBack() { 24 | lock(); 25 | swap(back, middle); 26 | newData = true; 27 | unlock(); 28 | } 29 | bool swapFront() { 30 | lock(); 31 | bool curNewData = newData; 32 | if (newData) { 33 | swap(front, middle); 34 | newData = false; 35 | } 36 | unlock(); 37 | return curNewData; 38 | } 39 | }; -------------------------------------------------------------------------------- /example-fft/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1920,1080,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example-fft/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup() { 5 | ofDisableArbTex(); 6 | ofSetVerticalSync(true); 7 | ofSetCircleResolution(80); 8 | ofBackground(54, 54, 54); 9 | 10 | bufferSize = 512; 11 | 12 | ofSoundStreamSettings settings; 13 | 14 | // if you want to set the device id to be different than the default 15 | //auto devices = soundStream.getDeviceList(); 16 | 17 | // settings.device = devices[4]; 18 | 19 | // you can also get devices for an specific api 20 | // auto devices = soundStream.getDevicesByApi(ofSoundDevice::Api::PULSE); 21 | // settings.device = devices[0]; 22 | 23 | // or get the default device for an specific api: 24 | // this is a work around for windows 25 | settings.setApi(ofSoundDevice::Api::MS_DS); 26 | 27 | settings.setInListener(this); 28 | settings.sampleRate = 44100; 29 | settings.numOutputChannels = 0; 30 | settings.numInputChannels = 2; 31 | settings.bufferSize = bufferSize; 32 | soundStream.setup(settings); 33 | 34 | fft = ofxFft::create(bufferSize, OF_FFT_WINDOW_HAMMING); 35 | 36 | rawAudioLeft.setup(vector(bufferSize)); 37 | rawAudioRight.setup(vector(bufferSize)); 38 | rawFft.setup(vector(fft->getBinSize())); 39 | 40 | ofLog() << fft->getBinSize() << endl; 41 | 42 | mAudio.allocate(bufferSize, 2, GL_RGBA); 43 | mFft.allocate(fft->getBinSize(), 1, GL_RGBA); 44 | 45 | 46 | 47 | // 48 | // This example is really 3 examples. It shows how to use audio 49 | // as a source. 50 | // 51 | 52 | scene.setup(ofToDataPath("Test-Audio.fs"), 1920, 1080); 53 | // 54 | // Comment out line 51 uncomment the line 54 and line 95 to see how the FFT works 55 | // scene.setup(ofToDataPath("Test-AudioFFT.fs"), 1920, 1080); 56 | // 57 | // Comment out line 51 and line 54 and unomment line 57 and line 95 to use the Spectrogram ISF 58 | // scene.setup(ofToDataPath("Spectrogram.fs"), 1920, 1080); 59 | // 60 | } 61 | 62 | //-------------------------------------------------------------- 63 | void ofApp::update() { 64 | if (rawAudioLeft.swapFront() && rawAudioRight.swapFront()) { 65 | // 66 | // This generates a stereo waveImage texture for the ISFScene 67 | // 68 | vector sum; 69 | vector& dataLeft = rawAudioLeft.getFront(); 70 | vector& dataRight = rawAudioRight.getFront(); 71 | sum.insert(sum.end(), dataLeft.begin(), dataLeft.end()); 72 | sum.insert(sum.end(), dataRight.begin(), dataRight.end()); 73 | vector colorImage; 74 | colorImage.assign(sum.size() * 4, 0); 75 | int k = 0; 76 | for (int i = 0; i < sum.size(); i++) { 77 | // center around 0.5 78 | colorImage[k++] = (4.0 * sum[i] + 4.0) / 8.0 ; 79 | colorImage[k++] = (4.0 * sum[i] + 4.0) / 8.0 ; 80 | colorImage[k++] = (4.0 * sum[i] + 4.0) / 8.0 ; 81 | colorImage[k++] = (4.0 * sum[i] + 4.0) / 8.0 ; 82 | 83 | } 84 | mAudio.loadData(&colorImage[0], sum.size() / 2.0, 2, GL_RGBA); 85 | 86 | } 87 | if (rawFft.swapFront()) { 88 | // 89 | // This generates the fftImage texture for the ISFScene 90 | // 91 | vector& data = rawFft.getFront(); 92 | vector colorImage; 93 | colorImage.assign(data.size() * 4, 0); 94 | int k = 0; 95 | for (int i = 0; i < data.size(); i++) { 96 | //scale 97 | colorImage[k++] = (data[i])*255; 98 | colorImage[k++] = (data[i])*255; 99 | colorImage[k++] = (data[i])*255; 100 | colorImage[k++] = (data[i])*255; 101 | } 102 | 103 | mFft.loadData(&colorImage[0], data.size(), 1, GL_RGBA); 104 | } 105 | 106 | //scene.setInput("fftImage", mFft); 107 | scene.setInput("waveImage", mAudio); 108 | scene.update(); 109 | } 110 | 111 | //-------------------------------------------------------------- 112 | void ofApp::draw() { 113 | 114 | mAudio.draw(0, 0, 1920, 10); 115 | mFft.draw(0, 10, 1920, 20); 116 | scene.draw(0, 30); 117 | 118 | } 119 | 120 | //-------------------------------------------------------------- 121 | void ofApp::audioIn(ofSoundBuffer & input) { 122 | 123 | vector& rawAudioBackLeft = rawAudioLeft.getBack(); 124 | vector& rawAudioBackRight = rawAudioRight.getBack(); 125 | rawAudioBackLeft.assign(input.getNumFrames(), 0); 126 | rawAudioBackRight.assign(input.getNumFrames(), 0); 127 | 128 | for (int j = 0; j < input.getNumFrames(); j++) { 129 | rawAudioBackLeft[j] = input[j * input.getNumChannels()]; 130 | rawAudioBackRight[j] = input[j * input.getNumChannels() + 1]; 131 | } 132 | 133 | fft->setSignal(&rawAudioBackLeft[0]); 134 | float* curFft = fft->getAmplitude(); 135 | rawFft.getBack().assign(curFft, curFft + fft->getBinSize()); 136 | 137 | rawAudioLeft.swapBack(); 138 | rawAudioRight.swapBack(); 139 | rawFft.swapBack(); 140 | 141 | } 142 | 143 | void ofApp::plot(vector& buffer, float scale, float offset) { 144 | ofNoFill(); 145 | int n = buffer.size(); 146 | ofDrawRectangle(0, 0, n, 100); 147 | glPushMatrix(); 148 | glTranslatef(0, 100 / 2 + offset, 0); 149 | ofBeginShape(); 150 | for (int i = 0; i < n; i++) { 151 | ofVertex(i, sqrt(buffer[i]) * scale); 152 | } 153 | ofEndShape(); 154 | glPopMatrix(); 155 | } 156 | 157 | //-------------------------------------------------------------- 158 | void ofApp::keyPressed(int key) { 159 | if (key == 's') { 160 | soundStream.start(); 161 | } 162 | 163 | if (key == 'e') { 164 | soundStream.stop(); 165 | } 166 | } 167 | 168 | //-------------------------------------------------------------- 169 | void ofApp::keyReleased(int key) { 170 | 171 | } 172 | 173 | //-------------------------------------------------------------- 174 | void ofApp::mouseMoved(int x, int y) { 175 | 176 | } 177 | 178 | //-------------------------------------------------------------- 179 | void ofApp::mouseDragged(int x, int y, int button) { 180 | 181 | } 182 | 183 | //-------------------------------------------------------------- 184 | void ofApp::mousePressed(int x, int y, int button) { 185 | 186 | } 187 | 188 | //-------------------------------------------------------------- 189 | void ofApp::mouseReleased(int x, int y, int button) { 190 | 191 | } 192 | 193 | //-------------------------------------------------------------- 194 | void ofApp::mouseEntered(int x, int y) { 195 | 196 | } 197 | 198 | //-------------------------------------------------------------- 199 | void ofApp::mouseExited(int x, int y) { 200 | 201 | } 202 | 203 | //-------------------------------------------------------------- 204 | void ofApp::windowResized(int w, int h) { 205 | 206 | } 207 | 208 | //-------------------------------------------------------------- 209 | void ofApp::gotMessage(ofMessage msg) { 210 | 211 | } 212 | 213 | //-------------------------------------------------------------- 214 | void ofApp::dragEvent(ofDragInfo dragInfo) { 215 | 216 | } 217 | 218 | -------------------------------------------------------------------------------- /example-fft/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxFft.h" 5 | #include "Synchronized.h" 6 | #include "ofxISFScene.h" 7 | class ofApp : public ofBaseApp { 8 | 9 | public: 10 | 11 | void setup(); 12 | void update(); 13 | void draw(); 14 | 15 | void keyPressed(int key); 16 | void keyReleased(int key); 17 | void mouseMoved(int x, int y); 18 | void mouseDragged(int x, int y, int button); 19 | void mousePressed(int x, int y, int button); 20 | void mouseReleased(int x, int y, int button); 21 | void mouseEntered(int x, int y); 22 | void mouseExited(int x, int y); 23 | void windowResized(int w, int h); 24 | void dragEvent(ofDragInfo dragInfo); 25 | void gotMessage(ofMessage msg); 26 | void plot(vector& buffer, float scale, float offset); 27 | void audioIn(ofSoundBuffer & input); 28 | 29 | Synchronized< vector > rawAudioLeft; 30 | Synchronized< vector > rawAudioRight; 31 | Synchronized< vector > rawFft; 32 | 33 | int bufferSize; 34 | ofxISFScene scene; 35 | ofTexture mAudio; 36 | ofTexture mFft; 37 | ofSoundStream soundStream; 38 | ofxFft* fft; 39 | }; 40 | -------------------------------------------------------------------------------- /example-generator/addons.make: -------------------------------------------------------------------------------- 1 | ofxGui 2 | ofxVVISF 3 | -------------------------------------------------------------------------------- /example-generator/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/example-generator/bin/data/.gitkeep -------------------------------------------------------------------------------- /example-generator/bin/data/checkerboard.fs: -------------------------------------------------------------------------------- 1 | /* 2 | { 3 | "CATEGORIES" : [ 4 | "XXX" 5 | ], 6 | "CREDIT": "", 7 | "ISFVSN" : "2", 8 | "INPUTS" : [ 9 | { 10 | "NAME" : "width", 11 | "TYPE" : "float", 12 | "DEFAULT" : 0.25 13 | }, 14 | { 15 | "NAME" : "offset", 16 | "TYPE" : "point2D", 17 | "DEFAULT" : [ 18 | 0, 19 | 0 20 | ], 21 | "MIN" : [ 22 | 0, 23 | 0 24 | ], 25 | "MAX" : [ 26 | 1, 27 | 1 28 | ] 29 | }, 30 | { 31 | "NAME" : "color1", 32 | "TYPE" : "color", 33 | "DEFAULT" : [ 34 | 1, 35 | 1, 36 | 1, 37 | 1 38 | ] 39 | }, 40 | { 41 | "NAME" : "color2", 42 | "TYPE" : "color", 43 | "DEFAULT" : [ 44 | 0, 45 | 0, 46 | 0, 47 | 1 48 | ] 49 | }, 50 | { 51 | "NAME" : "splitPos", 52 | "TYPE" : "point2D", 53 | "MAX" : [ 54 | 1, 55 | 1 56 | ], 57 | "DEFAULT" : [ 58 | 0.5, 59 | 0.5 60 | ], 61 | "MIN" : [ 62 | 0, 63 | 0 64 | ] 65 | } 66 | ] 67 | } 68 | */ 69 | 70 | 71 | 72 | void main() { 73 | // determine if we are on an even or odd line 74 | // math goes like.. 75 | // mod(((coord+offset) / width),2) 76 | 77 | 78 | vec4 out_color = color2; 79 | float size = width * RENDERSIZE.x; 80 | 81 | if (size == 0.0) { 82 | out_color = color1; 83 | } 84 | else if ((mod(((gl_FragCoord.x+(offset.x*RENDERSIZE.x)) / size),2.0) < 2.0 * splitPos.x)&&(mod(((gl_FragCoord.y+(offset.y*RENDERSIZE.y)) / size),2.0) > 2.0 * splitPos.y)) { 85 | out_color = color1; 86 | } 87 | else if ((mod(((gl_FragCoord.x+(offset.x*RENDERSIZE.x)) / size),2.0) > 2.0 * splitPos.x)&&(mod(((gl_FragCoord.y+(offset.y*RENDERSIZE.y)) / size),2.0) < 2.0 * splitPos.y)) { 88 | out_color = color1; 89 | } 90 | 91 | gl_FragColor = out_color; 92 | } -------------------------------------------------------------------------------- /example-generator/example-generator.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example-generator", "example-generator.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Debug|x64 = Debug|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32 17 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64 18 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64 19 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32 20 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32 21 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64 22 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64 23 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 25 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64 26 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64 27 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 28 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 29 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64 30 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /example-generator/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /example-generator/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1280,720,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example-generator/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | generator.setup(ofToDataPath("checkerboard.fs"), 1280, 720); 6 | group.setName("Checkerboard"); 7 | group.add(width.set("Width", 0.5, 0, 1)); 8 | group.add(offset.set("Offset", ofVec2f(0.5, 0.5), ofVec2f(0, 0), ofVec2f(1, 1))); 9 | group.add(splitPos.set("Split Pos", ofVec2f(0.5, 0.5), ofVec2f(0, 0), ofVec2f(1, 1))); 10 | group.add(colorOne.set("Color One", ofColor(0, 0, 0))); 11 | group.add(colorTwo.set("Color Two", ofColor(255, 255, 255))); 12 | gui.setup(group); 13 | } 14 | 15 | //-------------------------------------------------------------- 16 | void ofApp::update(){ 17 | generator.update(); 18 | generator.setInput("width", width.get()); 19 | generator.setInput("offset", offset.get()); 20 | generator.setInput("splitPos", splitPos.get()); 21 | generator.setInput("color1", colorOne.get()); 22 | generator.setInput("color2", colorTwo.get()); 23 | } 24 | 25 | //-------------------------------------------------------------- 26 | void ofApp::draw(){ 27 | generator.draw(0, 0); 28 | gui.draw(); 29 | } 30 | 31 | //-------------------------------------------------------------- 32 | void ofApp::keyPressed(int key){ 33 | 34 | } 35 | 36 | //-------------------------------------------------------------- 37 | void ofApp::keyReleased(int key){ 38 | 39 | } 40 | 41 | //-------------------------------------------------------------- 42 | void ofApp::mouseMoved(int x, int y ){ 43 | 44 | } 45 | 46 | //-------------------------------------------------------------- 47 | void ofApp::mouseDragged(int x, int y, int button){ 48 | 49 | } 50 | 51 | //-------------------------------------------------------------- 52 | void ofApp::mousePressed(int x, int y, int button){ 53 | 54 | } 55 | 56 | //-------------------------------------------------------------- 57 | void ofApp::mouseReleased(int x, int y, int button){ 58 | 59 | } 60 | 61 | //-------------------------------------------------------------- 62 | void ofApp::mouseEntered(int x, int y){ 63 | 64 | } 65 | 66 | //-------------------------------------------------------------- 67 | void ofApp::mouseExited(int x, int y){ 68 | 69 | } 70 | 71 | //-------------------------------------------------------------- 72 | void ofApp::windowResized(int w, int h){ 73 | 74 | } 75 | 76 | //-------------------------------------------------------------- 77 | void ofApp::gotMessage(ofMessage msg){ 78 | 79 | } 80 | 81 | //-------------------------------------------------------------- 82 | void ofApp::dragEvent(ofDragInfo dragInfo){ 83 | 84 | } 85 | -------------------------------------------------------------------------------- /example-generator/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxGui.h" 5 | #include "ofxISFScene.h" 6 | class ofApp : public ofBaseApp{ 7 | 8 | public: 9 | void setup(); 10 | void update(); 11 | void draw(); 12 | 13 | void keyPressed(int key); 14 | void keyReleased(int key); 15 | void mouseMoved(int x, int y ); 16 | void mouseDragged(int x, int y, int button); 17 | void mousePressed(int x, int y, int button); 18 | void mouseReleased(int x, int y, int button); 19 | void mouseEntered(int x, int y); 20 | void mouseExited(int x, int y); 21 | void windowResized(int w, int h); 22 | void dragEvent(ofDragInfo dragInfo); 23 | void gotMessage(ofMessage msg); 24 | 25 | 26 | ofxPanel gui; 27 | ofxISFScene generator; 28 | ofParameterGroup group; 29 | ofParameter width; 30 | ofParameter offset; 31 | ofParameter splitPos; 32 | ofParameter colorOne; 33 | ofParameter colorTwo; 34 | 35 | }; 36 | -------------------------------------------------------------------------------- /example-grabber/addons.make: -------------------------------------------------------------------------------- 1 | ofxGui 2 | ofxVVISF 3 | -------------------------------------------------------------------------------- /example-grabber/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/example-grabber/bin/data/.gitkeep -------------------------------------------------------------------------------- /example-grabber/bin/data/auto color tune.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "CATEGORIES": [ 3 | "Color Effect" 4 | ], 5 | "CREDIT": "by VIDVOX", 6 | "DESCRIPTION": "Creates variations on a base color using a given algorithm.", 7 | "INPUTS": [ 8 | { 9 | "NAME": "inputImage", 10 | "TYPE": "image" 11 | }, 12 | { 13 | "DEFAULT": 0, 14 | "LABEL": "Sample Mode", 15 | "LABELS": [ 16 | "Base Color", 17 | "Pixel Follow", 18 | "Color Average" 19 | ], 20 | "NAME": "sampleMode", 21 | "TYPE": "long", 22 | "VALUES": [ 23 | 0, 24 | 1, 25 | 2 26 | ] 27 | }, 28 | { 29 | "DEFAULT": 1, 30 | "LABEL": "Color Mode", 31 | "LABELS": [ 32 | "Basic Complementary", 33 | "Split Complementary", 34 | "Compound Complementary", 35 | "Spectrum", 36 | "Shades", 37 | "Analogous", 38 | "Compound Analogous" 39 | ], 40 | "NAME": "colorModeOverride", 41 | "TYPE": "long", 42 | "VALUES": [ 43 | 0, 44 | 1, 45 | 2, 46 | 3, 47 | 4, 48 | 5, 49 | 6 50 | ] 51 | }, 52 | { 53 | "DEFAULT": 7, 54 | "LABEL": "Color Count", 55 | "LABELS": [ 56 | "2", 57 | "3", 58 | "4", 59 | "5", 60 | "6", 61 | "7", 62 | "8", 63 | "9", 64 | "10", 65 | "11", 66 | "12", 67 | "13", 68 | "14", 69 | "15", 70 | "16" 71 | ], 72 | "NAME": "colorCount", 73 | "TYPE": "long", 74 | "VALUES": [ 75 | 2, 76 | 3, 77 | 4, 78 | 5, 79 | 6, 80 | 7, 81 | 8, 82 | 9, 83 | 10, 84 | 11, 85 | 12, 86 | 13, 87 | 14, 88 | 15, 89 | 16 90 | ] 91 | }, 92 | { 93 | "DEFAULT": [ 94 | 0.25, 95 | 0.59, 96 | 0.9, 97 | 1 98 | ], 99 | "LABEL": "Base Color", 100 | "NAME": "baseColor", 101 | "TYPE": "color" 102 | }, 103 | { 104 | "DEFAULT": [ 105 | 0.5, 106 | 0.5 107 | ], 108 | "LABEL": "Pixel Point", 109 | "MAX": [ 110 | 1, 111 | 1 112 | ], 113 | "MIN": [ 114 | 0, 115 | 0 116 | ], 117 | "NAME": "pixelFollowLocation", 118 | "TYPE": "point2D" 119 | } 120 | ], 121 | "ISFVSN": "2", 122 | "PASSES": [ 123 | { 124 | "HEIGHT": "$HEIGHT / 100.0", 125 | "TARGET": "bufferPassA", 126 | "WIDTH": "$WIDTH / 100.0" 127 | }, 128 | { 129 | "HEIGHT": "1.0", 130 | "TARGET": "autoColorBuffer", 131 | "WIDTH": "1.0", 132 | "persistent": true 133 | }, 134 | { 135 | } 136 | ], 137 | "VSN": null 138 | } 139 | */ 140 | 141 | 142 | 143 | 144 | vec3 rgb2hsv(vec3 c) { 145 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 146 | //vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); 147 | //vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); 148 | vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); 149 | vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); 150 | 151 | float d = q.x - min(q.w, q.y); 152 | float e = 1.0e-10; 153 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); 154 | } 155 | 156 | vec3 hsv2rgb(vec3 c) { 157 | vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); 158 | vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); 159 | return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); 160 | } 161 | 162 | float gray(vec4 c) { 163 | return (c.r + c.g + c.b) * c.a / 3.0; 164 | } 165 | 166 | void main() 167 | { 168 | if (PASSINDEX == 0) { 169 | vec4 inputColor = IMG_NORM_PIXEL(inputImage, isf_FragNormCoord); 170 | gl_FragColor = inputColor; 171 | } 172 | else if (PASSINDEX == 1) { 173 | vec4 inputColor = IMG_NORM_PIXEL(bufferPassA, isf_FragNormCoord); 174 | vec4 oldColor = IMG_NORM_PIXEL(autoColorBuffer, vec2(0.5,0.5)); 175 | gl_FragColor = mix(inputColor, oldColor, 0.8); 176 | } 177 | else if (PASSINDEX == 2) { 178 | vec4 inputColor = IMG_THIS_PIXEL(inputImage); 179 | vec4 inColor = baseColor; 180 | float index = floor(gray(inputColor) * float(colorCount)); 181 | //float index = floor(isf_FragNormCoord.x * float(colorCount)); 182 | float variation = 0.3236; // 1/5 the golden ratio 183 | int colorMode = colorModeOverride; 184 | 185 | if (sampleMode == 0) { 186 | inColor = baseColor; 187 | inColor.rgb = rgb2hsv(inColor.rgb); 188 | } 189 | else if (sampleMode == 1) { 190 | inColor = IMG_NORM_PIXEL(inputImage, pixelFollowLocation); 191 | inColor.rgb = rgb2hsv(inColor.rgb); 192 | } 193 | else if (sampleMode == 2) { 194 | inColor = IMG_NORM_PIXEL(autoColorBuffer, vec2(0.5,0.5)); 195 | inColor.rgb = rgb2hsv(inColor.rgb); 196 | if (inColor.b < 0.1) { 197 | inColor = inColor * 1.5; 198 | } 199 | } 200 | 201 | vec4 outColor = inColor; 202 | 203 | // Basic complimentary saturation and brightness variations on two fixed 180 degree opposite hues 204 | if (colorMode == 0) { 205 | if (mod(index, 2.0) >= 1.0) { 206 | outColor.r = outColor.r + 0.5; 207 | outColor.r = outColor.r - floor(outColor.r); 208 | } 209 | 210 | outColor.g = outColor.g - variation * floor(index / 2.0); 211 | 212 | if (outColor.g < 0.1) { 213 | outColor.g = outColor.g + variation * floor(index / 2.0); 214 | outColor.g = outColor.g - floor(outColor.g); 215 | } 216 | 217 | outColor.b = outColor.b - variation * floor(index / 4.0); 218 | if (outColor.b < 0.2) { 219 | outColor.b = outColor.b + variation * floor(index / 4.0); 220 | outColor.b = outColor.b - floor(outColor.b); 221 | } 222 | } 223 | // Split complimentary saturation and brightness variations on a 3 fixed 120 degree hues 224 | else if (colorMode == 1) { 225 | float divisor = 3.0; 226 | float ratio = 0.45; 227 | if (mod(index, 3.0) >= 2.0) { 228 | outColor.r = outColor.r - ratio; 229 | } 230 | else if (mod(index, 3.0) >= 1.0) { 231 | outColor.r = outColor.r + ratio; 232 | } 233 | 234 | //outColor.g = outColor.g + variation * floor(index / divisor); 235 | 236 | if (mod(index, 5.0) >= 3.0) { 237 | outColor.g = outColor.g - variation; 238 | outColor.g = outColor.g - floor(outColor.g); 239 | } 240 | outColor.b = outColor.b - variation * floor(index / (divisor)); 241 | if (outColor.b < 0.1) { 242 | outColor.b = outColor.b + variation * floor(index / (divisor)); 243 | outColor.b = outColor.b - floor(outColor.b); 244 | } 245 | } 246 | // Compound complimentary a combination of shades, complimentary and analogous colors with slight shifts 247 | else if (colorMode == 2) { 248 | if (mod(index, 3.0) >= 2.0) { 249 | outColor.r = outColor.r + 0.5; 250 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1) / 4.0; 251 | } 252 | else { 253 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 254 | } 255 | outColor.r = outColor.r - floor(outColor.r); 256 | 257 | 258 | if (mod(index, 2.0) >= 1.0) { 259 | outColor.g = outColor.g + index * variation / 2.0; 260 | } 261 | else if (mod(index, 3.0) >= 2.0) { 262 | outColor.g = outColor.g - variation / 2.0; 263 | } 264 | else { 265 | outColor.g = outColor.g - index * variation / float(colorCount - 1); 266 | } 267 | if (outColor.g > 1.0) { 268 | outColor.g = outColor.g - floor(outColor.g); 269 | } 270 | } 271 | // Spectrum hue shifts based on number of colors with minor saturation shifts 272 | else if (colorMode == 3) { 273 | outColor.r = outColor.r + index * 1.0 / float(colorCount); 274 | if (mod(index, 3.0) >= 2.0) { 275 | outColor.g = outColor.g - variation / 2.0; 276 | outColor.g = outColor.g - floor(outColor.g); 277 | } 278 | else if (mod(index, 4.0) >= 3.0) { 279 | outColor.g = outColor.g + variation / 2.0; 280 | //outColor.g = outColor.g - floor(outColor.g); 281 | } 282 | } 283 | // Shades saturation and brightness variations on a single fixed hue 284 | else if (colorMode == 4) { 285 | if (mod(index, 2.0) >= 1.0) { 286 | outColor.b = outColor.b - (index * variation) / float(colorCount-1); 287 | } 288 | else { 289 | outColor.b = outColor.b + (index * variation) / float(colorCount-1); 290 | outColor.b = outColor.b - floor(outColor.b); 291 | } 292 | if (outColor.b < 0.075) { 293 | outColor.b = 1.0 - outColor.b * variation; 294 | } 295 | 296 | if (mod(index, 3.0) >= 2.0) { 297 | outColor.g = outColor.g - (index * variation) / 2.0; 298 | } 299 | else if (mod(index, 4.0) >= 3.0) { 300 | outColor.g = outColor.g + (index * variation) / 2.0; 301 | } 302 | 303 | if ((outColor.g > 1.0) || (outColor.g < 0.05)) { 304 | outColor.g = outColor.g - floor(outColor.g); 305 | } 306 | } 307 | // Analogous small hue and saturation shifts 308 | else if (colorMode == 5) { 309 | 310 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 311 | 312 | if (mod(index, 3.0) >= 1.0) { 313 | outColor.g = outColor.g - variation / 2.0; 314 | if (outColor.g < 0.0) { 315 | outColor.g = outColor.g + variation / 2.0; 316 | } 317 | if (outColor.g > 1.0) { 318 | outColor.g = outColor.g - floor(outColor.g); 319 | } 320 | } 321 | } 322 | // Compound Analogous similar to analogous but with negative hue shifts 323 | else if (colorMode == 6) { 324 | if (mod(index, 3.0) >= 1.0) { 325 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 326 | } 327 | else { 328 | outColor.r = outColor.r - variation * index * 0.5 / float(colorCount - 1); 329 | } 330 | if (mod(index, 3.0) >= 1.0) { 331 | outColor.g = outColor.g - variation / 2.0; 332 | if (outColor.g < 0.0) { 333 | outColor.g = outColor.g + variation; 334 | } 335 | if (outColor.g > 1.0) { 336 | outColor.g = outColor.g - floor(outColor.g); 337 | } 338 | } 339 | if (mod(index, 4.0) >= 2.0) { 340 | if (outColor.b < variation) { 341 | outColor.b = outColor.b + variation; 342 | } 343 | } 344 | } 345 | 346 | gl_FragColor = vec4(hsv2rgb(outColor.rgb), inColor.a); 347 | } 348 | } 349 | -------------------------------------------------------------------------------- /example-grabber/example-grabber.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example-grabber", "example-grabber.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Debug|x64 = Debug|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32 17 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64 18 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64 19 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32 20 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32 21 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64 22 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64 23 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 25 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64 26 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64 27 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 28 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 29 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64 30 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /example-grabber/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /example-grabber/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example-grabber/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofDisableArbTex(); 6 | ofSetWindowShape(1280, 720); 7 | grabber.setup(1280, 720); 8 | scene.setup(ofToDataPath("auto color tune.fs"), 1280, 720); 9 | scene.setInput("inputImage", grabber.getTexture()); 10 | group.setName("Auto Color Inputs"); 11 | group.add(colorMode.set("Color Mode", 0, 0, 6)); 12 | group.add(colorCount.set("Color Count", 3, 1, 16)); 13 | group.add(baseColor.set("Base Color", ofFloatColor(0.5, 0, 0.5, 1.0))); 14 | gui.setup(group); 15 | } 16 | 17 | //-------------------------------------------------------------- 18 | void ofApp::update(){ 19 | grabber.update(); 20 | scene.setInput("colorModeOverride",(long) colorMode.get()); 21 | scene.setInput("colorCount", (long)colorCount.get()); 22 | scene.setInput("baseColor", baseColor.get()); 23 | scene.update(); 24 | } 25 | 26 | //-------------------------------------------------------------- 27 | void ofApp::draw(){ 28 | scene.draw(0, 0); 29 | gui.draw(); 30 | } 31 | 32 | //-------------------------------------------------------------- 33 | void ofApp::keyPressed(int key){ 34 | 35 | } 36 | 37 | //-------------------------------------------------------------- 38 | void ofApp::keyReleased(int key){ 39 | 40 | } 41 | 42 | //-------------------------------------------------------------- 43 | void ofApp::mouseMoved(int x, int y ){ 44 | 45 | } 46 | 47 | //-------------------------------------------------------------- 48 | void ofApp::mouseDragged(int x, int y, int button){ 49 | 50 | } 51 | 52 | //-------------------------------------------------------------- 53 | void ofApp::mousePressed(int x, int y, int button){ 54 | 55 | } 56 | 57 | //-------------------------------------------------------------- 58 | void ofApp::mouseReleased(int x, int y, int button){ 59 | 60 | } 61 | 62 | //-------------------------------------------------------------- 63 | void ofApp::mouseEntered(int x, int y){ 64 | 65 | } 66 | 67 | //-------------------------------------------------------------- 68 | void ofApp::mouseExited(int x, int y){ 69 | 70 | } 71 | 72 | //-------------------------------------------------------------- 73 | void ofApp::windowResized(int w, int h){ 74 | 75 | } 76 | 77 | //-------------------------------------------------------------- 78 | void ofApp::gotMessage(ofMessage msg){ 79 | 80 | } 81 | 82 | //-------------------------------------------------------------- 83 | void ofApp::dragEvent(ofDragInfo dragInfo){ 84 | 85 | } 86 | -------------------------------------------------------------------------------- /example-grabber/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxISFScene.h" 5 | #include "ofxGui.h" 6 | class ofApp : public ofBaseApp{ 7 | 8 | public: 9 | void setup(); 10 | void update(); 11 | void draw(); 12 | 13 | void keyPressed(int key); 14 | void keyReleased(int key); 15 | void mouseMoved(int x, int y ); 16 | void mouseDragged(int x, int y, int button); 17 | void mousePressed(int x, int y, int button); 18 | void mouseReleased(int x, int y, int button); 19 | void mouseEntered(int x, int y); 20 | void mouseExited(int x, int y); 21 | void windowResized(int w, int h); 22 | void dragEvent(ofDragInfo dragInfo); 23 | void gotMessage(ofMessage msg); 24 | 25 | ofxISFScene scene; 26 | ofVideoGrabber grabber; 27 | ofParameterGroup group; 28 | ofParameter colorMode; 29 | ofParameter colorCount; 30 | ofParameter baseColor; 31 | ofxPanel gui; 32 | 33 | }; 34 | -------------------------------------------------------------------------------- /example-mixer/addons.make: -------------------------------------------------------------------------------- 1 | ofxGui 2 | ofxVVISF 3 | -------------------------------------------------------------------------------- /example-mixer/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/example-mixer/bin/data/.gitkeep -------------------------------------------------------------------------------- /example-mixer/bin/data/auto color tune.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "CATEGORIES": [ 3 | "Color Effect" 4 | ], 5 | "CREDIT": "by VIDVOX", 6 | "DESCRIPTION": "Creates variations on a base color using a given algorithm.", 7 | "INPUTS": [ 8 | { 9 | "NAME": "inputImage", 10 | "TYPE": "image" 11 | }, 12 | { 13 | "DEFAULT": 0, 14 | "LABEL": "Sample Mode", 15 | "LABELS": [ 16 | "Base Color", 17 | "Pixel Follow", 18 | "Color Average" 19 | ], 20 | "NAME": "sampleMode", 21 | "TYPE": "long", 22 | "VALUES": [ 23 | 0, 24 | 1, 25 | 2 26 | ] 27 | }, 28 | { 29 | "DEFAULT": 1, 30 | "LABEL": "Color Mode", 31 | "LABELS": [ 32 | "Basic Complementary", 33 | "Split Complementary", 34 | "Compound Complementary", 35 | "Spectrum", 36 | "Shades", 37 | "Analogous", 38 | "Compound Analogous" 39 | ], 40 | "NAME": "colorModeOverride", 41 | "TYPE": "long", 42 | "VALUES": [ 43 | 0, 44 | 1, 45 | 2, 46 | 3, 47 | 4, 48 | 5, 49 | 6 50 | ] 51 | }, 52 | { 53 | "DEFAULT": 7, 54 | "LABEL": "Color Count", 55 | "LABELS": [ 56 | "2", 57 | "3", 58 | "4", 59 | "5", 60 | "6", 61 | "7", 62 | "8", 63 | "9", 64 | "10", 65 | "11", 66 | "12", 67 | "13", 68 | "14", 69 | "15", 70 | "16" 71 | ], 72 | "NAME": "colorCount", 73 | "TYPE": "long", 74 | "VALUES": [ 75 | 2, 76 | 3, 77 | 4, 78 | 5, 79 | 6, 80 | 7, 81 | 8, 82 | 9, 83 | 10, 84 | 11, 85 | 12, 86 | 13, 87 | 14, 88 | 15, 89 | 16 90 | ] 91 | }, 92 | { 93 | "DEFAULT": [ 94 | 0.25, 95 | 0.59, 96 | 0.9, 97 | 1 98 | ], 99 | "LABEL": "Base Color", 100 | "NAME": "baseColor", 101 | "TYPE": "color" 102 | }, 103 | { 104 | "DEFAULT": [ 105 | 0.5, 106 | 0.5 107 | ], 108 | "LABEL": "Pixel Point", 109 | "MAX": [ 110 | 1, 111 | 1 112 | ], 113 | "MIN": [ 114 | 0, 115 | 0 116 | ], 117 | "NAME": "pixelFollowLocation", 118 | "TYPE": "point2D" 119 | } 120 | ], 121 | "ISFVSN": "2", 122 | "PASSES": [ 123 | { 124 | "HEIGHT": "$HEIGHT / 100.0", 125 | "TARGET": "bufferPassA", 126 | "WIDTH": "$WIDTH / 100.0" 127 | }, 128 | { 129 | "HEIGHT": "1.0", 130 | "TARGET": "autoColorBuffer", 131 | "WIDTH": "1.0", 132 | "persistent": true 133 | }, 134 | { 135 | } 136 | ], 137 | "VSN": null 138 | } 139 | */ 140 | 141 | 142 | 143 | 144 | vec3 rgb2hsv(vec3 c) { 145 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 146 | //vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); 147 | //vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); 148 | vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); 149 | vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); 150 | 151 | float d = q.x - min(q.w, q.y); 152 | float e = 1.0e-10; 153 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); 154 | } 155 | 156 | vec3 hsv2rgb(vec3 c) { 157 | vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); 158 | vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); 159 | return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); 160 | } 161 | 162 | float gray(vec4 c) { 163 | return (c.r + c.g + c.b) * c.a / 3.0; 164 | } 165 | 166 | void main() 167 | { 168 | if (PASSINDEX == 0) { 169 | vec4 inputColor = IMG_NORM_PIXEL(inputImage, isf_FragNormCoord); 170 | gl_FragColor = inputColor; 171 | } 172 | else if (PASSINDEX == 1) { 173 | vec4 inputColor = IMG_NORM_PIXEL(bufferPassA, isf_FragNormCoord); 174 | vec4 oldColor = IMG_NORM_PIXEL(autoColorBuffer, vec2(0.5,0.5)); 175 | gl_FragColor = mix(inputColor, oldColor, 0.8); 176 | } 177 | else if (PASSINDEX == 2) { 178 | vec4 inputColor = IMG_THIS_PIXEL(inputImage); 179 | vec4 inColor = baseColor; 180 | float index = floor(gray(inputColor) * float(colorCount)); 181 | //float index = floor(isf_FragNormCoord.x * float(colorCount)); 182 | float variation = 0.3236; // 1/5 the golden ratio 183 | int colorMode = colorModeOverride; 184 | 185 | if (sampleMode == 0) { 186 | inColor = baseColor; 187 | inColor.rgb = rgb2hsv(inColor.rgb); 188 | } 189 | else if (sampleMode == 1) { 190 | inColor = IMG_NORM_PIXEL(inputImage, pixelFollowLocation); 191 | inColor.rgb = rgb2hsv(inColor.rgb); 192 | } 193 | else if (sampleMode == 2) { 194 | inColor = IMG_NORM_PIXEL(autoColorBuffer, vec2(0.5,0.5)); 195 | inColor.rgb = rgb2hsv(inColor.rgb); 196 | if (inColor.b < 0.1) { 197 | inColor = inColor * 1.5; 198 | } 199 | } 200 | 201 | vec4 outColor = inColor; 202 | 203 | // Basic complimentary saturation and brightness variations on two fixed 180 degree opposite hues 204 | if (colorMode == 0) { 205 | if (mod(index, 2.0) >= 1.0) { 206 | outColor.r = outColor.r + 0.5; 207 | outColor.r = outColor.r - floor(outColor.r); 208 | } 209 | 210 | outColor.g = outColor.g - variation * floor(index / 2.0); 211 | 212 | if (outColor.g < 0.1) { 213 | outColor.g = outColor.g + variation * floor(index / 2.0); 214 | outColor.g = outColor.g - floor(outColor.g); 215 | } 216 | 217 | outColor.b = outColor.b - variation * floor(index / 4.0); 218 | if (outColor.b < 0.2) { 219 | outColor.b = outColor.b + variation * floor(index / 4.0); 220 | outColor.b = outColor.b - floor(outColor.b); 221 | } 222 | } 223 | // Split complimentary saturation and brightness variations on a 3 fixed 120 degree hues 224 | else if (colorMode == 1) { 225 | float divisor = 3.0; 226 | float ratio = 0.45; 227 | if (mod(index, 3.0) >= 2.0) { 228 | outColor.r = outColor.r - ratio; 229 | } 230 | else if (mod(index, 3.0) >= 1.0) { 231 | outColor.r = outColor.r + ratio; 232 | } 233 | 234 | //outColor.g = outColor.g + variation * floor(index / divisor); 235 | 236 | if (mod(index, 5.0) >= 3.0) { 237 | outColor.g = outColor.g - variation; 238 | outColor.g = outColor.g - floor(outColor.g); 239 | } 240 | outColor.b = outColor.b - variation * floor(index / (divisor)); 241 | if (outColor.b < 0.1) { 242 | outColor.b = outColor.b + variation * floor(index / (divisor)); 243 | outColor.b = outColor.b - floor(outColor.b); 244 | } 245 | } 246 | // Compound complimentary a combination of shades, complimentary and analogous colors with slight shifts 247 | else if (colorMode == 2) { 248 | if (mod(index, 3.0) >= 2.0) { 249 | outColor.r = outColor.r + 0.5; 250 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1) / 4.0; 251 | } 252 | else { 253 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 254 | } 255 | outColor.r = outColor.r - floor(outColor.r); 256 | 257 | 258 | if (mod(index, 2.0) >= 1.0) { 259 | outColor.g = outColor.g + index * variation / 2.0; 260 | } 261 | else if (mod(index, 3.0) >= 2.0) { 262 | outColor.g = outColor.g - variation / 2.0; 263 | } 264 | else { 265 | outColor.g = outColor.g - index * variation / float(colorCount - 1); 266 | } 267 | if (outColor.g > 1.0) { 268 | outColor.g = outColor.g - floor(outColor.g); 269 | } 270 | } 271 | // Spectrum hue shifts based on number of colors with minor saturation shifts 272 | else if (colorMode == 3) { 273 | outColor.r = outColor.r + index * 1.0 / float(colorCount); 274 | if (mod(index, 3.0) >= 2.0) { 275 | outColor.g = outColor.g - variation / 2.0; 276 | outColor.g = outColor.g - floor(outColor.g); 277 | } 278 | else if (mod(index, 4.0) >= 3.0) { 279 | outColor.g = outColor.g + variation / 2.0; 280 | //outColor.g = outColor.g - floor(outColor.g); 281 | } 282 | } 283 | // Shades saturation and brightness variations on a single fixed hue 284 | else if (colorMode == 4) { 285 | if (mod(index, 2.0) >= 1.0) { 286 | outColor.b = outColor.b - (index * variation) / float(colorCount-1); 287 | } 288 | else { 289 | outColor.b = outColor.b + (index * variation) / float(colorCount-1); 290 | outColor.b = outColor.b - floor(outColor.b); 291 | } 292 | if (outColor.b < 0.075) { 293 | outColor.b = 1.0 - outColor.b * variation; 294 | } 295 | 296 | if (mod(index, 3.0) >= 2.0) { 297 | outColor.g = outColor.g - (index * variation) / 2.0; 298 | } 299 | else if (mod(index, 4.0) >= 3.0) { 300 | outColor.g = outColor.g + (index * variation) / 2.0; 301 | } 302 | 303 | if ((outColor.g > 1.0) || (outColor.g < 0.05)) { 304 | outColor.g = outColor.g - floor(outColor.g); 305 | } 306 | } 307 | // Analogous small hue and saturation shifts 308 | else if (colorMode == 5) { 309 | 310 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 311 | 312 | if (mod(index, 3.0) >= 1.0) { 313 | outColor.g = outColor.g - variation / 2.0; 314 | if (outColor.g < 0.0) { 315 | outColor.g = outColor.g + variation / 2.0; 316 | } 317 | if (outColor.g > 1.0) { 318 | outColor.g = outColor.g - floor(outColor.g); 319 | } 320 | } 321 | } 322 | // Compound Analogous similar to analogous but with negative hue shifts 323 | else if (colorMode == 6) { 324 | if (mod(index, 3.0) >= 1.0) { 325 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 326 | } 327 | else { 328 | outColor.r = outColor.r - variation * index * 0.5 / float(colorCount - 1); 329 | } 330 | if (mod(index, 3.0) >= 1.0) { 331 | outColor.g = outColor.g - variation / 2.0; 332 | if (outColor.g < 0.0) { 333 | outColor.g = outColor.g + variation; 334 | } 335 | if (outColor.g > 1.0) { 336 | outColor.g = outColor.g - floor(outColor.g); 337 | } 338 | } 339 | if (mod(index, 4.0) >= 2.0) { 340 | if (outColor.b < variation) { 341 | outColor.b = outColor.b + variation; 342 | } 343 | } 344 | } 345 | 346 | gl_FragColor = vec4(hsv2rgb(outColor.rgb), inColor.a); 347 | } 348 | } 349 | -------------------------------------------------------------------------------- /example-mixer/bin/data/boxinator.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "CREDIT": "by mojovideotech", 3 | "ISFVSN": "2", 4 | "CATEGORIES": [ 5 | "Stylize" 6 | ], 7 | "INPUTS": [ 8 | { 9 | "NAME": "inputImage", 10 | "TYPE": "image" 11 | }, 12 | { 13 | "NAME": "rate", 14 | "TYPE": "float", 15 | "DEFAULT": 2.5, 16 | "MIN": 0.0, 17 | "MAX": 10.0 18 | }, 19 | { 20 | "NAME": "edge", 21 | "TYPE": "float", 22 | "DEFAULT": 0.001, 23 | "MIN": 0.0, 24 | "MAX": 0.01 25 | }, 26 | { 27 | "NAME": "blend", 28 | "TYPE": "float", 29 | "DEFAULT": 0.95, 30 | "MIN": -1.0, 31 | "MAX": 1.0 32 | }, 33 | { 34 | "NAME": "randomize", 35 | "TYPE": "float", 36 | "DEFAULT": 0.5, 37 | "MIN": 0.0, 38 | "MAX": 1.0 39 | }, 40 | { 41 | "NAME": "gamma", 42 | "TYPE": "float", 43 | "DEFAULT": -0.3, 44 | "MIN": -0.5, 45 | "MAX": 0.2 46 | }, 47 | { 48 | "NAME": "grid", 49 | "TYPE": "point2D", 50 | "DEFAULT": [ 64.0, 36.0 ], 51 | "MIN": [ 1.5, 1.5 ], 52 | "MAX": [ 900.0, 600.0 ] 53 | } 54 | ] 55 | }*/ 56 | 57 | //////////////////////////////////////////////////////////////////// 58 | // Boxinator by mojovideotech 59 | // 60 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 61 | //////////////////////////////////////////////////////////////////// 62 | 63 | 64 | #ifdef GL_ES 65 | precision mediump float; 66 | #endif 67 | 68 | 69 | //------------------------------------------------------------------ 70 | // simplex noise function 71 | // by : Ian McEwan, Ashima Arts 72 | // © 2011 Ashima Arts, MIT License 73 | 74 | vec4 permute(vec4 x) { return mod(((x*34.0)+1.0)*x, 289.0); } 75 | 76 | vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; } 77 | 78 | float snoise(vec3 v) { 79 | const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; 80 | const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); 81 | vec3 i = floor(v + dot(v, C.yyy) ); 82 | vec3 x0 = v - i + dot(i, C.xxx) ; 83 | vec3 g = step(x0.yzx, x0.xyz); 84 | vec3 l = 1.0 - g; 85 | vec3 i1 = min( g.xyz, l.zxy ); 86 | vec3 i2 = max( g.xyz, l.zxy ); 87 | vec3 x1 = x0 - i1 + 1.0 * C.xxx; 88 | vec3 x2 = x0 - i2 + 2.0 * C.xxx; 89 | vec3 x3 = x0 - 1. + 3.0 * C.xxx; 90 | i = mod(i, 289.0 ); 91 | vec4 p = permute( permute( permute( 92 | i.z + vec4(0.0, i1.z, i2.z, 1.0 )) 93 | + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 94 | + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); 95 | float n_ = 1.0/7.0; // N=7 96 | vec3 ns = n_ * D.wyz - D.xzx; 97 | vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N) 98 | vec4 x_ = floor(j * ns.z); 99 | vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) 100 | vec4 x = x_ *ns.x + ns.yyyy; 101 | vec4 y = y_ *ns.x + ns.yyyy; 102 | vec4 h = 1.0 - abs(x) - abs(y); 103 | vec4 b0 = vec4( x.xy, y.xy ); 104 | vec4 b1 = vec4( x.zw, y.zw ); 105 | vec4 s0 = floor(b0)*2.0 + 1.0; 106 | vec4 s1 = floor(b1)*2.0 + 1.0; 107 | vec4 sh = -step(h, vec4(0.0)); 108 | vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; 109 | vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; 110 | vec3 p0 = vec3(a0.xy,h.x); 111 | vec3 p1 = vec3(a0.zw,h.y); 112 | vec3 p2 = vec3(a1.xy,h.z); 113 | vec3 p3 = vec3(a1.zw,h.w); 114 | vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); 115 | p0 *= norm.x; 116 | p1 *= norm.y; 117 | p2 *= norm.z; 118 | p3 *= norm.w; 119 | vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); 120 | m = m * m; 121 | return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 122 | dot(p2,x2), dot(p3,x3) ) ); 123 | } 124 | //------------------------------------------------------------------ 125 | 126 | float hash(float h) { return fract(sin(h) * 43758.5453123); } 127 | 128 | vec2 tile(vec2 cell, vec2 size) { return fract(cell*size); } 129 | 130 | float box(vec2 a, vec2 b){ vec2 o = step(b,a); return o.x*o.y; } 131 | 132 | void main(void){ 133 | float T = TIME*rate; 134 | vec2 uv = gl_FragCoord.xy/RENDERSIZE.xy; 135 | vec2 g = floor(grid.xy); 136 | float C = g.x*g.y ; 137 | float I = 1.0 + floor(uv.x * g.x) + g.y * floor(uv.y * g.y) + g.x; 138 | vec2 st = tile(uv, g); 139 | float S = I / C * box(st, vec2(edge*g.xy)); 140 | S = mix(S,hash(S),randomize); 141 | vec3 color = vec3(S*T); 142 | float n = snoise(color+IMG_NORM_PIXEL(inputImage, uv.xy).xyz*blend); 143 | 144 | gl_FragColor = sqrt(max(vec4(vec3(n, n, n ),1.0)+IMG_NORM_PIXEL(inputImage, uv.xy),0.0)+gamma); 145 | } 146 | 147 | -------------------------------------------------------------------------------- /example-mixer/bin/data/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3 4 | 15 5 | 0.394808, 0.5, 0.104634, 1 6 | 7 | 0.408163 8 | 0 9 | 0.591837 10 | 0.295918 11 | -0.5 12 | 4, 4 13 | 14 | 1 15 | 16 | -------------------------------------------------------------------------------- /example-mixer/example-mixer.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example-mixer", "example-mixer.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Debug|x64 = Debug|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32 17 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64 18 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64 19 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32 20 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32 21 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64 22 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64 23 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 25 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64 26 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64 27 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 28 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 29 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64 30 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /example-mixer/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /example-mixer/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example-mixer/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofDisableArbTex(); 6 | ofSetWindowShape(640, 480); 7 | grabber.setup(640, 480); 8 | autoColor.setup(ofToDataPath("auto color tune.fs"), 640, 480); 9 | boxinator.setup(ofToDataPath("boxinator.fs"), 640, 480); 10 | autoColor.setInput("inputImage", grabber.getTexture()); 11 | boxinator.setInput("inputImage", grabber.getTexture()); 12 | 13 | autoColorGroup.setName("Auto Color Inputs"); 14 | autoColorGroup.add(colorMode.set("Color Mode", 0, 0, 6)); 15 | autoColorGroup.add(colorCount.set("Color Count", 3, 1, 16)); 16 | autoColorGroup.add(baseColor.set("Base Color", ofFloatColor(0.5, 0, 0.5, 1.0))); 17 | 18 | gui.setup(autoColorGroup); 19 | 20 | boxGroup.setName("Boxinator Inputs"); 21 | boxGroup.add(rate.set("Rate", 0.1, 0, 10)); 22 | boxGroup.add(edge.set("Edge", 0.001, 0.0, 0.01)); 23 | boxGroup.add(blend.set("Blend", 0.5, 0.0, 1.0)); 24 | boxGroup.add(randomize.set("Randomize", 0.5, 0.0, 1.0)); 25 | boxGroup.add(gamma.set("Gamma", -0.3, -0.5, 0.3)); 26 | boxGroup.add(grid.set("Grid Size", ofVec2f(64.5, 64.5), ofVec2f(1.5, 1.5), ofVec2f(900, 600))); 27 | 28 | gui.add(boxGroup); 29 | gui.add(mix.set("Mix", 0, 0, 1)); 30 | } 31 | 32 | //-------------------------------------------------------------- 33 | void ofApp::update(){ 34 | grabber.update(); 35 | autoColor.setInput("colorModeOverride",(long) colorMode.get()); 36 | autoColor.setInput("colorCount", (long)colorCount.get()); 37 | autoColor.setInput("baseColor", baseColor.get()); 38 | 39 | boxinator.setInput("rate", rate.get()); 40 | boxinator.setInput("edge", edge.get()); 41 | boxinator.setInput("blend", blend.get()); 42 | boxinator.setInput("randomize", randomize.get()); 43 | boxinator.setInput("gamma", gamma.get()); 44 | boxinator.setInput("grid", grid.get()); 45 | autoColor.update(); 46 | boxinator.update(); 47 | } 48 | 49 | //-------------------------------------------------------------- 50 | void ofApp::draw(){ 51 | 52 | ofSetColor(255, 255, 255, min((int)floor(mix.get() * 256), 255)); 53 | boxinator.draw(0, 0); 54 | ofSetColor(255, 255, 255, min((int)floor((1.0-mix.get()) * 256), 255)); 55 | autoColor.draw(0, 0); 56 | 57 | gui.draw(); 58 | } 59 | 60 | //-------------------------------------------------------------- 61 | void ofApp::keyPressed(int key){ 62 | 63 | } 64 | 65 | //-------------------------------------------------------------- 66 | void ofApp::keyReleased(int key){ 67 | 68 | } 69 | 70 | //-------------------------------------------------------------- 71 | void ofApp::mouseMoved(int x, int y ){ 72 | 73 | } 74 | 75 | //-------------------------------------------------------------- 76 | void ofApp::mouseDragged(int x, int y, int button){ 77 | 78 | } 79 | 80 | //-------------------------------------------------------------- 81 | void ofApp::mousePressed(int x, int y, int button){ 82 | 83 | } 84 | 85 | //-------------------------------------------------------------- 86 | void ofApp::mouseReleased(int x, int y, int button){ 87 | 88 | } 89 | 90 | //-------------------------------------------------------------- 91 | void ofApp::mouseEntered(int x, int y){ 92 | 93 | } 94 | 95 | //-------------------------------------------------------------- 96 | void ofApp::mouseExited(int x, int y){ 97 | 98 | } 99 | 100 | //-------------------------------------------------------------- 101 | void ofApp::windowResized(int w, int h){ 102 | 103 | } 104 | 105 | //-------------------------------------------------------------- 106 | void ofApp::gotMessage(ofMessage msg){ 107 | 108 | } 109 | 110 | //-------------------------------------------------------------- 111 | void ofApp::dragEvent(ofDragInfo dragInfo){ 112 | 113 | } 114 | -------------------------------------------------------------------------------- /example-mixer/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxISFScene.h" 5 | #include "ofxGui.h" 6 | class ofApp : public ofBaseApp{ 7 | 8 | public: 9 | void setup(); 10 | void update(); 11 | void draw(); 12 | 13 | void keyPressed(int key); 14 | void keyReleased(int key); 15 | void mouseMoved(int x, int y ); 16 | void mouseDragged(int x, int y, int button); 17 | void mousePressed(int x, int y, int button); 18 | void mouseReleased(int x, int y, int button); 19 | void mouseEntered(int x, int y); 20 | void mouseExited(int x, int y); 21 | void windowResized(int w, int h); 22 | void dragEvent(ofDragInfo dragInfo); 23 | void gotMessage(ofMessage msg); 24 | 25 | ofxISFScene autoColor; 26 | ofxISFScene boxinator; 27 | ofVideoGrabber grabber; 28 | ofParameterGroup autoColorGroup; 29 | ofParameterGroup boxGroup; 30 | ofParameter colorMode; 31 | ofParameter colorCount; 32 | ofParameter rate; 33 | ofParameter edge; 34 | ofParameter blend; 35 | ofParameter randomize; 36 | ofParameter gamma; 37 | ofParameter grid; 38 | ofParameter baseColor; 39 | 40 | ofParameter mix; 41 | ofxPanel gui; 42 | 43 | }; 44 | -------------------------------------------------------------------------------- /example-osc/addons.make: -------------------------------------------------------------------------------- 1 | ofxOsc 2 | ofxVVISF 3 | -------------------------------------------------------------------------------- /example-osc/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/example-osc/bin/data/.gitkeep -------------------------------------------------------------------------------- /example-osc/example-osc.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example-osc", "example-osc.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Debug|x64 = Debug|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32 17 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64 18 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64 19 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32 20 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32 21 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64 22 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64 23 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 25 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64 26 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64 27 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 28 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 29 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64 30 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /example-osc/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /example-osc/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example-osc/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofDisableArbTex(); 6 | ofSetWindowShape(640, 480); 7 | grabber.setup(640, 480); 8 | autoColor.setup("auto color tune.fs", 640, 480); 9 | boxinator.setup("boxinator.fs", 640, 480); 10 | autoColor.setInput("inputImage", grabber.getTexture()); 11 | boxinator.setInput("inputImage", autoColor.getTexture()); 12 | autoColorGroup.setName("Auto Color Inputs"); 13 | autoColorGroup.add(colorMode.set("Color Mode", 0, 0, 6)); 14 | autoColorGroup.add(colorCount.set("Color Count", 3, 1, 16)); 15 | autoColorGroup.add(baseColor.set("Base Color", ofFloatColor(0.5, 0, 0.5, 1.0))); 16 | gui.setup(autoColorGroup); 17 | boxGroup.setName("Boxinator Inputs"); 18 | boxGroup.add(rate.set("Rate", 0.1, 0, 10)); 19 | boxGroup.add(edge.set("Edge", 0.001, 0.0, 0.01)); 20 | boxGroup.add(blend.set("Blend", 0.5, 0.0, 1.0)); 21 | boxGroup.add(randomize.set("Randomize", 0.5, 0.0, 1.0)); 22 | boxGroup.add(gamma.set("Gamma", -0.3, -0.5, 0.3)); 23 | boxGroup.add(grid.set("Grid Size", ofVec2f(64.5, 64.5), ofVec2f(1.5, 1.5), ofVec2f(900, 600))); 24 | 25 | gui.add(boxGroup); 26 | } 27 | 28 | //-------------------------------------------------------------- 29 | void ofApp::update(){ 30 | grabber.update(); 31 | autoColor.setInput("colorModeOverride",(long) colorMode.get()); 32 | autoColor.setInput("colorCount", (long)colorCount.get()); 33 | autoColor.setInput("baseColor", baseColor.get()); 34 | 35 | boxinator.setInput("rate", rate.get()); 36 | boxinator.setInput("edge", edge.get()); 37 | boxinator.setInput("blend", blend.get()); 38 | boxinator.setInput("randomize", randomize.get()); 39 | boxinator.setInput("gamma", gamma.get()); 40 | boxinator.setInput("grid", grid.get()); 41 | autoColor.update(); 42 | boxinator.update(); 43 | } 44 | 45 | //-------------------------------------------------------------- 46 | void ofApp::draw(){ 47 | boxinator.draw(0, 0); 48 | gui.draw(); 49 | } 50 | 51 | //-------------------------------------------------------------- 52 | void ofApp::keyPressed(int key){ 53 | 54 | } 55 | 56 | //-------------------------------------------------------------- 57 | void ofApp::keyReleased(int key){ 58 | 59 | } 60 | 61 | //-------------------------------------------------------------- 62 | void ofApp::mouseMoved(int x, int y ){ 63 | 64 | } 65 | 66 | //-------------------------------------------------------------- 67 | void ofApp::mouseDragged(int x, int y, int button){ 68 | 69 | } 70 | 71 | //-------------------------------------------------------------- 72 | void ofApp::mousePressed(int x, int y, int button){ 73 | 74 | } 75 | 76 | //-------------------------------------------------------------- 77 | void ofApp::mouseReleased(int x, int y, int button){ 78 | 79 | } 80 | 81 | //-------------------------------------------------------------- 82 | void ofApp::mouseEntered(int x, int y){ 83 | 84 | } 85 | 86 | //-------------------------------------------------------------- 87 | void ofApp::mouseExited(int x, int y){ 88 | 89 | } 90 | 91 | //-------------------------------------------------------------- 92 | void ofApp::windowResized(int w, int h){ 93 | 94 | } 95 | 96 | //-------------------------------------------------------------- 97 | void ofApp::gotMessage(ofMessage msg){ 98 | 99 | } 100 | 101 | //-------------------------------------------------------------- 102 | void ofApp::dragEvent(ofDragInfo dragInfo){ 103 | 104 | } 105 | -------------------------------------------------------------------------------- /example-osc/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxISFScene.h" 5 | #include "ofxGui.h" 6 | class ofApp : public ofBaseApp{ 7 | 8 | public: 9 | void setup(); 10 | void update(); 11 | void draw(); 12 | 13 | void keyPressed(int key); 14 | void keyReleased(int key); 15 | void mouseMoved(int x, int y ); 16 | void mouseDragged(int x, int y, int button); 17 | void mousePressed(int x, int y, int button); 18 | void mouseReleased(int x, int y, int button); 19 | void mouseEntered(int x, int y); 20 | void mouseExited(int x, int y); 21 | void windowResized(int w, int h); 22 | void dragEvent(ofDragInfo dragInfo); 23 | void gotMessage(ofMessage msg); 24 | 25 | ofxISFScene autoColor; 26 | ofxISFScene boxinator; 27 | ofVideoGrabber grabber; 28 | ofParameterGroup autoColorGroup; 29 | ofParameterGroup boxGroup; 30 | ofParameter colorMode; 31 | ofParameter colorCount; 32 | ofParameter rate; 33 | ofParameter edge; 34 | ofParameter blend; 35 | ofParameter randomize; 36 | ofParameter gamma; 37 | ofParameter grid; 38 | ofParameter baseColor; 39 | ofxPanel gui; 40 | 41 | }; 42 | -------------------------------------------------------------------------------- /example-spout/addons.make: -------------------------------------------------------------------------------- 1 | ofxGui 2 | ofxSpout 3 | ofxVVISF 4 | -------------------------------------------------------------------------------- /example-spout/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/example-spout/bin/data/.gitkeep -------------------------------------------------------------------------------- /example-spout/bin/data/auto color tune.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "CATEGORIES": [ 3 | "Color Effect" 4 | ], 5 | "CREDIT": "by VIDVOX", 6 | "DESCRIPTION": "Creates variations on a base color using a given algorithm.", 7 | "INPUTS": [ 8 | { 9 | "NAME": "inputImage", 10 | "TYPE": "image" 11 | }, 12 | { 13 | "DEFAULT": 0, 14 | "LABEL": "Sample Mode", 15 | "LABELS": [ 16 | "Base Color", 17 | "Pixel Follow", 18 | "Color Average" 19 | ], 20 | "NAME": "sampleMode", 21 | "TYPE": "long", 22 | "VALUES": [ 23 | 0, 24 | 1, 25 | 2 26 | ] 27 | }, 28 | { 29 | "DEFAULT": 1, 30 | "LABEL": "Color Mode", 31 | "LABELS": [ 32 | "Basic Complementary", 33 | "Split Complementary", 34 | "Compound Complementary", 35 | "Spectrum", 36 | "Shades", 37 | "Analogous", 38 | "Compound Analogous" 39 | ], 40 | "NAME": "colorModeOverride", 41 | "TYPE": "long", 42 | "VALUES": [ 43 | 0, 44 | 1, 45 | 2, 46 | 3, 47 | 4, 48 | 5, 49 | 6 50 | ] 51 | }, 52 | { 53 | "DEFAULT": 7, 54 | "LABEL": "Color Count", 55 | "LABELS": [ 56 | "2", 57 | "3", 58 | "4", 59 | "5", 60 | "6", 61 | "7", 62 | "8", 63 | "9", 64 | "10", 65 | "11", 66 | "12", 67 | "13", 68 | "14", 69 | "15", 70 | "16" 71 | ], 72 | "NAME": "colorCount", 73 | "TYPE": "long", 74 | "VALUES": [ 75 | 2, 76 | 3, 77 | 4, 78 | 5, 79 | 6, 80 | 7, 81 | 8, 82 | 9, 83 | 10, 84 | 11, 85 | 12, 86 | 13, 87 | 14, 88 | 15, 89 | 16 90 | ] 91 | }, 92 | { 93 | "DEFAULT": [ 94 | 0.25, 95 | 0.59, 96 | 0.9, 97 | 1 98 | ], 99 | "LABEL": "Base Color", 100 | "NAME": "baseColor", 101 | "TYPE": "color" 102 | }, 103 | { 104 | "DEFAULT": [ 105 | 0.5, 106 | 0.5 107 | ], 108 | "LABEL": "Pixel Point", 109 | "MAX": [ 110 | 1, 111 | 1 112 | ], 113 | "MIN": [ 114 | 0, 115 | 0 116 | ], 117 | "NAME": "pixelFollowLocation", 118 | "TYPE": "point2D" 119 | } 120 | ], 121 | "ISFVSN": "2", 122 | "PASSES": [ 123 | { 124 | "HEIGHT": "$HEIGHT / 100.0", 125 | "TARGET": "bufferPassA", 126 | "WIDTH": "$WIDTH / 100.0" 127 | }, 128 | { 129 | "HEIGHT": "1.0", 130 | "TARGET": "autoColorBuffer", 131 | "WIDTH": "1.0", 132 | "persistent": true 133 | }, 134 | { 135 | } 136 | ], 137 | "VSN": null 138 | } 139 | */ 140 | 141 | 142 | 143 | 144 | vec3 rgb2hsv(vec3 c) { 145 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 146 | //vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); 147 | //vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); 148 | vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); 149 | vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); 150 | 151 | float d = q.x - min(q.w, q.y); 152 | float e = 1.0e-10; 153 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); 154 | } 155 | 156 | vec3 hsv2rgb(vec3 c) { 157 | vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); 158 | vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); 159 | return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); 160 | } 161 | 162 | float gray(vec4 c) { 163 | return (c.r + c.g + c.b) * c.a / 3.0; 164 | } 165 | 166 | void main() 167 | { 168 | if (PASSINDEX == 0) { 169 | vec4 inputColor = IMG_NORM_PIXEL(inputImage, isf_FragNormCoord); 170 | gl_FragColor = inputColor; 171 | } 172 | else if (PASSINDEX == 1) { 173 | vec4 inputColor = IMG_NORM_PIXEL(bufferPassA, isf_FragNormCoord); 174 | vec4 oldColor = IMG_NORM_PIXEL(autoColorBuffer, vec2(0.5,0.5)); 175 | gl_FragColor = mix(inputColor, oldColor, 0.8); 176 | } 177 | else if (PASSINDEX == 2) { 178 | vec4 inputColor = IMG_THIS_PIXEL(inputImage); 179 | vec4 inColor = baseColor; 180 | float index = floor(gray(inputColor) * float(colorCount)); 181 | //float index = floor(isf_FragNormCoord.x * float(colorCount)); 182 | float variation = 0.3236; // 1/5 the golden ratio 183 | int colorMode = colorModeOverride; 184 | 185 | if (sampleMode == 0) { 186 | inColor = baseColor; 187 | inColor.rgb = rgb2hsv(inColor.rgb); 188 | } 189 | else if (sampleMode == 1) { 190 | inColor = IMG_NORM_PIXEL(inputImage, pixelFollowLocation); 191 | inColor.rgb = rgb2hsv(inColor.rgb); 192 | } 193 | else if (sampleMode == 2) { 194 | inColor = IMG_NORM_PIXEL(autoColorBuffer, vec2(0.5,0.5)); 195 | inColor.rgb = rgb2hsv(inColor.rgb); 196 | if (inColor.b < 0.1) { 197 | inColor = inColor * 1.5; 198 | } 199 | } 200 | 201 | vec4 outColor = inColor; 202 | 203 | // Basic complimentary saturation and brightness variations on two fixed 180 degree opposite hues 204 | if (colorMode == 0) { 205 | if (mod(index, 2.0) >= 1.0) { 206 | outColor.r = outColor.r + 0.5; 207 | outColor.r = outColor.r - floor(outColor.r); 208 | } 209 | 210 | outColor.g = outColor.g - variation * floor(index / 2.0); 211 | 212 | if (outColor.g < 0.1) { 213 | outColor.g = outColor.g + variation * floor(index / 2.0); 214 | outColor.g = outColor.g - floor(outColor.g); 215 | } 216 | 217 | outColor.b = outColor.b - variation * floor(index / 4.0); 218 | if (outColor.b < 0.2) { 219 | outColor.b = outColor.b + variation * floor(index / 4.0); 220 | outColor.b = outColor.b - floor(outColor.b); 221 | } 222 | } 223 | // Split complimentary saturation and brightness variations on a 3 fixed 120 degree hues 224 | else if (colorMode == 1) { 225 | float divisor = 3.0; 226 | float ratio = 0.45; 227 | if (mod(index, 3.0) >= 2.0) { 228 | outColor.r = outColor.r - ratio; 229 | } 230 | else if (mod(index, 3.0) >= 1.0) { 231 | outColor.r = outColor.r + ratio; 232 | } 233 | 234 | //outColor.g = outColor.g + variation * floor(index / divisor); 235 | 236 | if (mod(index, 5.0) >= 3.0) { 237 | outColor.g = outColor.g - variation; 238 | outColor.g = outColor.g - floor(outColor.g); 239 | } 240 | outColor.b = outColor.b - variation * floor(index / (divisor)); 241 | if (outColor.b < 0.1) { 242 | outColor.b = outColor.b + variation * floor(index / (divisor)); 243 | outColor.b = outColor.b - floor(outColor.b); 244 | } 245 | } 246 | // Compound complimentary a combination of shades, complimentary and analogous colors with slight shifts 247 | else if (colorMode == 2) { 248 | if (mod(index, 3.0) >= 2.0) { 249 | outColor.r = outColor.r + 0.5; 250 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1) / 4.0; 251 | } 252 | else { 253 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 254 | } 255 | outColor.r = outColor.r - floor(outColor.r); 256 | 257 | 258 | if (mod(index, 2.0) >= 1.0) { 259 | outColor.g = outColor.g + index * variation / 2.0; 260 | } 261 | else if (mod(index, 3.0) >= 2.0) { 262 | outColor.g = outColor.g - variation / 2.0; 263 | } 264 | else { 265 | outColor.g = outColor.g - index * variation / float(colorCount - 1); 266 | } 267 | if (outColor.g > 1.0) { 268 | outColor.g = outColor.g - floor(outColor.g); 269 | } 270 | } 271 | // Spectrum hue shifts based on number of colors with minor saturation shifts 272 | else if (colorMode == 3) { 273 | outColor.r = outColor.r + index * 1.0 / float(colorCount); 274 | if (mod(index, 3.0) >= 2.0) { 275 | outColor.g = outColor.g - variation / 2.0; 276 | outColor.g = outColor.g - floor(outColor.g); 277 | } 278 | else if (mod(index, 4.0) >= 3.0) { 279 | outColor.g = outColor.g + variation / 2.0; 280 | //outColor.g = outColor.g - floor(outColor.g); 281 | } 282 | } 283 | // Shades saturation and brightness variations on a single fixed hue 284 | else if (colorMode == 4) { 285 | if (mod(index, 2.0) >= 1.0) { 286 | outColor.b = outColor.b - (index * variation) / float(colorCount-1); 287 | } 288 | else { 289 | outColor.b = outColor.b + (index * variation) / float(colorCount-1); 290 | outColor.b = outColor.b - floor(outColor.b); 291 | } 292 | if (outColor.b < 0.075) { 293 | outColor.b = 1.0 - outColor.b * variation; 294 | } 295 | 296 | if (mod(index, 3.0) >= 2.0) { 297 | outColor.g = outColor.g - (index * variation) / 2.0; 298 | } 299 | else if (mod(index, 4.0) >= 3.0) { 300 | outColor.g = outColor.g + (index * variation) / 2.0; 301 | } 302 | 303 | if ((outColor.g > 1.0) || (outColor.g < 0.05)) { 304 | outColor.g = outColor.g - floor(outColor.g); 305 | } 306 | } 307 | // Analogous small hue and saturation shifts 308 | else if (colorMode == 5) { 309 | 310 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 311 | 312 | if (mod(index, 3.0) >= 1.0) { 313 | outColor.g = outColor.g - variation / 2.0; 314 | if (outColor.g < 0.0) { 315 | outColor.g = outColor.g + variation / 2.0; 316 | } 317 | if (outColor.g > 1.0) { 318 | outColor.g = outColor.g - floor(outColor.g); 319 | } 320 | } 321 | } 322 | // Compound Analogous similar to analogous but with negative hue shifts 323 | else if (colorMode == 6) { 324 | if (mod(index, 3.0) >= 1.0) { 325 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 326 | } 327 | else { 328 | outColor.r = outColor.r - variation * index * 0.5 / float(colorCount - 1); 329 | } 330 | if (mod(index, 3.0) >= 1.0) { 331 | outColor.g = outColor.g - variation / 2.0; 332 | if (outColor.g < 0.0) { 333 | outColor.g = outColor.g + variation; 334 | } 335 | if (outColor.g > 1.0) { 336 | outColor.g = outColor.g - floor(outColor.g); 337 | } 338 | } 339 | if (mod(index, 4.0) >= 2.0) { 340 | if (outColor.b < variation) { 341 | outColor.b = outColor.b + variation; 342 | } 343 | } 344 | } 345 | 346 | gl_FragColor = vec4(hsv2rgb(outColor.rgb), inColor.a); 347 | } 348 | } 349 | -------------------------------------------------------------------------------- /example-spout/bin/data/boxinator.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "CREDIT": "by mojovideotech", 3 | "ISFVSN": "2", 4 | "CATEGORIES": [ 5 | "Stylize" 6 | ], 7 | "INPUTS": [ 8 | { 9 | "NAME": "inputImage", 10 | "TYPE": "image" 11 | }, 12 | { 13 | "NAME": "rate", 14 | "TYPE": "float", 15 | "DEFAULT": 2.5, 16 | "MIN": 0.0, 17 | "MAX": 10.0 18 | }, 19 | { 20 | "NAME": "edge", 21 | "TYPE": "float", 22 | "DEFAULT": 0.001, 23 | "MIN": 0.0, 24 | "MAX": 0.01 25 | }, 26 | { 27 | "NAME": "blend", 28 | "TYPE": "float", 29 | "DEFAULT": 0.95, 30 | "MIN": -1.0, 31 | "MAX": 1.0 32 | }, 33 | { 34 | "NAME": "randomize", 35 | "TYPE": "float", 36 | "DEFAULT": 0.5, 37 | "MIN": 0.0, 38 | "MAX": 1.0 39 | }, 40 | { 41 | "NAME": "gamma", 42 | "TYPE": "float", 43 | "DEFAULT": -0.3, 44 | "MIN": -0.5, 45 | "MAX": 0.2 46 | }, 47 | { 48 | "NAME": "grid", 49 | "TYPE": "point2D", 50 | "DEFAULT": [ 64.0, 36.0 ], 51 | "MIN": [ 1.5, 1.5 ], 52 | "MAX": [ 900.0, 600.0 ] 53 | } 54 | ] 55 | }*/ 56 | 57 | //////////////////////////////////////////////////////////////////// 58 | // Boxinator by mojovideotech 59 | // 60 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 61 | //////////////////////////////////////////////////////////////////// 62 | 63 | 64 | #ifdef GL_ES 65 | precision mediump float; 66 | #endif 67 | 68 | 69 | //------------------------------------------------------------------ 70 | // simplex noise function 71 | // by : Ian McEwan, Ashima Arts 72 | // © 2011 Ashima Arts, MIT License 73 | 74 | vec4 permute(vec4 x) { return mod(((x*34.0)+1.0)*x, 289.0); } 75 | 76 | vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; } 77 | 78 | float snoise(vec3 v) { 79 | const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; 80 | const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); 81 | vec3 i = floor(v + dot(v, C.yyy) ); 82 | vec3 x0 = v - i + dot(i, C.xxx) ; 83 | vec3 g = step(x0.yzx, x0.xyz); 84 | vec3 l = 1.0 - g; 85 | vec3 i1 = min( g.xyz, l.zxy ); 86 | vec3 i2 = max( g.xyz, l.zxy ); 87 | vec3 x1 = x0 - i1 + 1.0 * C.xxx; 88 | vec3 x2 = x0 - i2 + 2.0 * C.xxx; 89 | vec3 x3 = x0 - 1. + 3.0 * C.xxx; 90 | i = mod(i, 289.0 ); 91 | vec4 p = permute( permute( permute( 92 | i.z + vec4(0.0, i1.z, i2.z, 1.0 )) 93 | + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 94 | + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); 95 | float n_ = 1.0/7.0; // N=7 96 | vec3 ns = n_ * D.wyz - D.xzx; 97 | vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N) 98 | vec4 x_ = floor(j * ns.z); 99 | vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) 100 | vec4 x = x_ *ns.x + ns.yyyy; 101 | vec4 y = y_ *ns.x + ns.yyyy; 102 | vec4 h = 1.0 - abs(x) - abs(y); 103 | vec4 b0 = vec4( x.xy, y.xy ); 104 | vec4 b1 = vec4( x.zw, y.zw ); 105 | vec4 s0 = floor(b0)*2.0 + 1.0; 106 | vec4 s1 = floor(b1)*2.0 + 1.0; 107 | vec4 sh = -step(h, vec4(0.0)); 108 | vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; 109 | vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; 110 | vec3 p0 = vec3(a0.xy,h.x); 111 | vec3 p1 = vec3(a0.zw,h.y); 112 | vec3 p2 = vec3(a1.xy,h.z); 113 | vec3 p3 = vec3(a1.zw,h.w); 114 | vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); 115 | p0 *= norm.x; 116 | p1 *= norm.y; 117 | p2 *= norm.z; 118 | p3 *= norm.w; 119 | vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); 120 | m = m * m; 121 | return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 122 | dot(p2,x2), dot(p3,x3) ) ); 123 | } 124 | //------------------------------------------------------------------ 125 | 126 | float hash(float h) { return fract(sin(h) * 43758.5453123); } 127 | 128 | vec2 tile(vec2 cell, vec2 size) { return fract(cell*size); } 129 | 130 | float box(vec2 a, vec2 b){ vec2 o = step(b,a); return o.x*o.y; } 131 | 132 | void main(void){ 133 | float T = TIME*rate; 134 | vec2 uv = gl_FragCoord.xy/RENDERSIZE.xy; 135 | vec2 g = floor(grid.xy); 136 | float C = g.x*g.y ; 137 | float I = 1.0 + floor(uv.x * g.x) + g.y * floor(uv.y * g.y) + g.x; 138 | vec2 st = tile(uv, g); 139 | float S = I / C * box(st, vec2(edge*g.xy)); 140 | S = mix(S,hash(S),randomize); 141 | vec3 color = vec3(S*T); 142 | float n = snoise(color+IMG_NORM_PIXEL(inputImage, uv.xy).xyz*blend); 143 | 144 | gl_FragColor = sqrt(max(vec4(vec3(n, n, n ),1.0)+IMG_NORM_PIXEL(inputImage, uv.xy),0.0)+gamma); 145 | } 146 | 147 | -------------------------------------------------------------------------------- /example-spout/bin/data/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 4 | 5 5 | 0, 0.311242, 1, 1 6 | 7 | 0.306122 8 | 0.01 9 | 0.780612 10 | 0.566327 11 | -0.5 12 | 1.5, 11.0969 13 | 14 | 15 | -------------------------------------------------------------------------------- /example-spout/example-spout.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example-spout", "example-spout.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Debug|x64 = Debug|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32 17 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64 18 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64 19 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32 20 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32 21 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64 22 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64 23 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 25 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64 26 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64 27 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 28 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 29 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64 30 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /example-spout/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /example-spout/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example-spout/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofDisableArbTex(); 6 | ofSetWindowShape(640, 480); 7 | grabber.setup(640, 480); 8 | autoColor.setup("auto color tune.fs", 640, 480); 9 | boxinator.setup("boxinator.fs", 640, 480); 10 | autoColor.setInput("inputImage", grabber.getTexture()); 11 | boxinator.setInput("inputImage", autoColor.getTexture()); 12 | autoColorGroup.setName("Auto Color Inputs"); 13 | autoColorGroup.add(colorMode.set("Color Mode", 5, 0, 6)); 14 | autoColorGroup.add(colorCount.set("Color Count", 16, 1, 16)); 15 | autoColorGroup.add(baseColor.set("Base Color", ofFloatColor(1, 0, 1, 1.0))); 16 | gui.setup(autoColorGroup); 17 | boxGroup.setName("Boxinator Inputs"); 18 | boxGroup.add(rate.set("Rate", 0.71, 0, 10)); 19 | boxGroup.add(edge.set("Edge", 0.001, 0.0, 0.01)); 20 | boxGroup.add(blend.set("Blend", 0.5, 0.0, 1.0)); 21 | boxGroup.add(randomize.set("Randomize", 0.15, 0.0, 1.0)); 22 | boxGroup.add(gamma.set("Gamma", -0.3, -0.5, 0.3)); 23 | boxGroup.add(grid.set("Grid Size", ofVec2f(64.5, 64.5), ofVec2f(1.5, 1.5), ofVec2f(900, 600))); 24 | gui.add(boxGroup); 25 | 26 | 27 | 28 | sender.init("VVISF"); 29 | } 30 | 31 | //-------------------------------------------------------------- 32 | void ofApp::update(){ 33 | grabber.update(); 34 | autoColor.setInput("colorModeOverride",(long) colorMode.get()); 35 | autoColor.setInput("colorCount", (long)colorCount.get()); 36 | autoColor.setInput("baseColor", baseColor.get()); 37 | 38 | boxinator.setInput("rate", rate.get()); 39 | boxinator.setInput("edge", edge.get()); 40 | boxinator.setInput("blend", blend.get()); 41 | boxinator.setInput("randomize", randomize.get()); 42 | boxinator.setInput("gamma", gamma.get()); 43 | boxinator.setInput("grid", grid.get()); 44 | autoColor.update(); 45 | boxinator.update(); 46 | } 47 | 48 | //-------------------------------------------------------------- 49 | void ofApp::draw(){ 50 | boxinator.draw(0, 0); 51 | gui.draw(); 52 | sender.send(boxinator.getTexture()); 53 | } 54 | 55 | 56 | //-------------------------------------------------------------- 57 | void ofApp::keyPressed(int key){ 58 | 59 | } 60 | 61 | //-------------------------------------------------------------- 62 | void ofApp::keyReleased(int key){ 63 | 64 | } 65 | 66 | //-------------------------------------------------------------- 67 | void ofApp::mouseMoved(int x, int y ){ 68 | 69 | } 70 | 71 | //-------------------------------------------------------------- 72 | void ofApp::mouseDragged(int x, int y, int button){ 73 | 74 | } 75 | 76 | //-------------------------------------------------------------- 77 | void ofApp::mousePressed(int x, int y, int button){ 78 | 79 | } 80 | 81 | //-------------------------------------------------------------- 82 | void ofApp::mouseReleased(int x, int y, int button){ 83 | 84 | } 85 | 86 | //-------------------------------------------------------------- 87 | void ofApp::mouseEntered(int x, int y){ 88 | 89 | } 90 | 91 | //-------------------------------------------------------------- 92 | void ofApp::mouseExited(int x, int y){ 93 | 94 | } 95 | 96 | //-------------------------------------------------------------- 97 | void ofApp::windowResized(int w, int h){ 98 | 99 | } 100 | 101 | //-------------------------------------------------------------- 102 | void ofApp::gotMessage(ofMessage msg){ 103 | 104 | } 105 | 106 | //-------------------------------------------------------------- 107 | void ofApp::dragEvent(ofDragInfo dragInfo){ 108 | 109 | } 110 | -------------------------------------------------------------------------------- /example-spout/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxISFScene.h" 5 | #include "ofxSpout.h" 6 | #include "ofxGui.h" 7 | 8 | class ofApp : public ofBaseApp{ 9 | 10 | public: 11 | void setup(); 12 | void update(); 13 | void draw(); 14 | 15 | void keyPressed(int key); 16 | void keyReleased(int key); 17 | void mouseMoved(int x, int y ); 18 | void mouseDragged(int x, int y, int button); 19 | void mousePressed(int x, int y, int button); 20 | void mouseReleased(int x, int y, int button); 21 | void mouseEntered(int x, int y); 22 | void mouseExited(int x, int y); 23 | void windowResized(int w, int h); 24 | void dragEvent(ofDragInfo dragInfo); 25 | void gotMessage(ofMessage msg); 26 | ofxSpout::Sender sender; 27 | ofxPanel gui; 28 | ofxISFScene autoColor; 29 | ofxISFScene boxinator; 30 | ofVideoGrabber grabber; 31 | ofParameterGroup autoColorGroup; 32 | ofParameterGroup boxGroup; 33 | ofParameter colorMode; 34 | ofParameter colorCount; 35 | ofParameter rate; 36 | ofParameter edge; 37 | ofParameter blend; 38 | ofParameter randomize; 39 | ofParameter gamma; 40 | ofParameter grid; 41 | ofParameter baseColor; 42 | }; 43 | -------------------------------------------------------------------------------- /example-template/addons.make: -------------------------------------------------------------------------------- 1 | ofxVVISF 2 | -------------------------------------------------------------------------------- /example-template/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/example-template/bin/data/.gitkeep -------------------------------------------------------------------------------- /example-template/example-template.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example-template", "example-template.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Debug|x64 = Debug|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32 17 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64 18 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64 19 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32 20 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32 21 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64 22 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64 23 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 25 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64 26 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64 27 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 28 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 29 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64 30 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /example-template/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /example-template/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example-template/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | 6 | } 7 | 8 | //-------------------------------------------------------------- 9 | void ofApp::update(){ 10 | 11 | } 12 | 13 | //-------------------------------------------------------------- 14 | void ofApp::draw(){ 15 | 16 | } 17 | 18 | //-------------------------------------------------------------- 19 | void ofApp::keyPressed(int key){ 20 | 21 | } 22 | 23 | //-------------------------------------------------------------- 24 | void ofApp::keyReleased(int key){ 25 | 26 | } 27 | 28 | //-------------------------------------------------------------- 29 | void ofApp::mouseMoved(int x, int y ){ 30 | 31 | } 32 | 33 | //-------------------------------------------------------------- 34 | void ofApp::mouseDragged(int x, int y, int button){ 35 | 36 | } 37 | 38 | //-------------------------------------------------------------- 39 | void ofApp::mousePressed(int x, int y, int button){ 40 | 41 | } 42 | 43 | //-------------------------------------------------------------- 44 | void ofApp::mouseReleased(int x, int y, int button){ 45 | 46 | } 47 | 48 | //-------------------------------------------------------------- 49 | void ofApp::mouseEntered(int x, int y){ 50 | 51 | } 52 | 53 | //-------------------------------------------------------------- 54 | void ofApp::mouseExited(int x, int y){ 55 | 56 | } 57 | 58 | //-------------------------------------------------------------- 59 | void ofApp::windowResized(int w, int h){ 60 | 61 | } 62 | 63 | //-------------------------------------------------------------- 64 | void ofApp::gotMessage(ofMessage msg){ 65 | 66 | } 67 | 68 | //-------------------------------------------------------------- 69 | void ofApp::dragEvent(ofDragInfo dragInfo){ 70 | 71 | } 72 | -------------------------------------------------------------------------------- /example-template/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | 5 | class ofApp : public ofBaseApp{ 6 | 7 | public: 8 | void setup(); 9 | void update(); 10 | void draw(); 11 | 12 | void keyPressed(int key); 13 | void keyReleased(int key); 14 | void mouseMoved(int x, int y ); 15 | void mouseDragged(int x, int y, int button); 16 | void mousePressed(int x, int y, int button); 17 | void mouseReleased(int x, int y, int button); 18 | void mouseEntered(int x, int y); 19 | void mouseExited(int x, int y); 20 | void windowResized(int w, int h); 21 | void dragEvent(ofDragInfo dragInfo); 22 | void gotMessage(ofMessage msg); 23 | 24 | }; 25 | -------------------------------------------------------------------------------- /example-transitions/addons.make: -------------------------------------------------------------------------------- 1 | ofxGui 2 | ofxVVISF 3 | -------------------------------------------------------------------------------- /example-transitions/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/example-transitions/bin/data/.gitkeep -------------------------------------------------------------------------------- /example-transitions/bin/data/auto color tune.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "CATEGORIES": [ 3 | "Color Effect" 4 | ], 5 | "CREDIT": "by VIDVOX", 6 | "DESCRIPTION": "Creates variations on a base color using a given algorithm.", 7 | "INPUTS": [ 8 | { 9 | "NAME": "inputImage", 10 | "TYPE": "image" 11 | }, 12 | { 13 | "DEFAULT": 0, 14 | "LABEL": "Sample Mode", 15 | "LABELS": [ 16 | "Base Color", 17 | "Pixel Follow", 18 | "Color Average" 19 | ], 20 | "NAME": "sampleMode", 21 | "TYPE": "long", 22 | "VALUES": [ 23 | 0, 24 | 1, 25 | 2 26 | ] 27 | }, 28 | { 29 | "DEFAULT": 1, 30 | "LABEL": "Color Mode", 31 | "LABELS": [ 32 | "Basic Complementary", 33 | "Split Complementary", 34 | "Compound Complementary", 35 | "Spectrum", 36 | "Shades", 37 | "Analogous", 38 | "Compound Analogous" 39 | ], 40 | "NAME": "colorModeOverride", 41 | "TYPE": "long", 42 | "VALUES": [ 43 | 0, 44 | 1, 45 | 2, 46 | 3, 47 | 4, 48 | 5, 49 | 6 50 | ] 51 | }, 52 | { 53 | "DEFAULT": 7, 54 | "LABEL": "Color Count", 55 | "LABELS": [ 56 | "2", 57 | "3", 58 | "4", 59 | "5", 60 | "6", 61 | "7", 62 | "8", 63 | "9", 64 | "10", 65 | "11", 66 | "12", 67 | "13", 68 | "14", 69 | "15", 70 | "16" 71 | ], 72 | "NAME": "colorCount", 73 | "TYPE": "long", 74 | "VALUES": [ 75 | 2, 76 | 3, 77 | 4, 78 | 5, 79 | 6, 80 | 7, 81 | 8, 82 | 9, 83 | 10, 84 | 11, 85 | 12, 86 | 13, 87 | 14, 88 | 15, 89 | 16 90 | ] 91 | }, 92 | { 93 | "DEFAULT": [ 94 | 0.25, 95 | 0.59, 96 | 0.9, 97 | 1 98 | ], 99 | "LABEL": "Base Color", 100 | "NAME": "baseColor", 101 | "TYPE": "color" 102 | }, 103 | { 104 | "DEFAULT": [ 105 | 0.5, 106 | 0.5 107 | ], 108 | "LABEL": "Pixel Point", 109 | "MAX": [ 110 | 1, 111 | 1 112 | ], 113 | "MIN": [ 114 | 0, 115 | 0 116 | ], 117 | "NAME": "pixelFollowLocation", 118 | "TYPE": "point2D" 119 | } 120 | ], 121 | "ISFVSN": "2", 122 | "PASSES": [ 123 | { 124 | "HEIGHT": "$HEIGHT / 100.0", 125 | "TARGET": "bufferPassA", 126 | "WIDTH": "$WIDTH / 100.0" 127 | }, 128 | { 129 | "HEIGHT": "1.0", 130 | "TARGET": "autoColorBuffer", 131 | "WIDTH": "1.0", 132 | "persistent": true 133 | }, 134 | { 135 | } 136 | ], 137 | "VSN": null 138 | } 139 | */ 140 | 141 | 142 | 143 | 144 | vec3 rgb2hsv(vec3 c) { 145 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 146 | //vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); 147 | //vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); 148 | vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); 149 | vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); 150 | 151 | float d = q.x - min(q.w, q.y); 152 | float e = 1.0e-10; 153 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); 154 | } 155 | 156 | vec3 hsv2rgb(vec3 c) { 157 | vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); 158 | vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); 159 | return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); 160 | } 161 | 162 | float gray(vec4 c) { 163 | return (c.r + c.g + c.b) * c.a / 3.0; 164 | } 165 | 166 | void main() 167 | { 168 | if (PASSINDEX == 0) { 169 | vec4 inputColor = IMG_NORM_PIXEL(inputImage, isf_FragNormCoord); 170 | gl_FragColor = inputColor; 171 | } 172 | else if (PASSINDEX == 1) { 173 | vec4 inputColor = IMG_NORM_PIXEL(bufferPassA, isf_FragNormCoord); 174 | vec4 oldColor = IMG_NORM_PIXEL(autoColorBuffer, vec2(0.5,0.5)); 175 | gl_FragColor = mix(inputColor, oldColor, 0.8); 176 | } 177 | else if (PASSINDEX == 2) { 178 | vec4 inputColor = IMG_THIS_PIXEL(inputImage); 179 | vec4 inColor = baseColor; 180 | float index = floor(gray(inputColor) * float(colorCount)); 181 | //float index = floor(isf_FragNormCoord.x * float(colorCount)); 182 | float variation = 0.3236; // 1/5 the golden ratio 183 | int colorMode = colorModeOverride; 184 | 185 | if (sampleMode == 0) { 186 | inColor = baseColor; 187 | inColor.rgb = rgb2hsv(inColor.rgb); 188 | } 189 | else if (sampleMode == 1) { 190 | inColor = IMG_NORM_PIXEL(inputImage, pixelFollowLocation); 191 | inColor.rgb = rgb2hsv(inColor.rgb); 192 | } 193 | else if (sampleMode == 2) { 194 | inColor = IMG_NORM_PIXEL(autoColorBuffer, vec2(0.5,0.5)); 195 | inColor.rgb = rgb2hsv(inColor.rgb); 196 | if (inColor.b < 0.1) { 197 | inColor = inColor * 1.5; 198 | } 199 | } 200 | 201 | vec4 outColor = inColor; 202 | 203 | // Basic complimentary saturation and brightness variations on two fixed 180 degree opposite hues 204 | if (colorMode == 0) { 205 | if (mod(index, 2.0) >= 1.0) { 206 | outColor.r = outColor.r + 0.5; 207 | outColor.r = outColor.r - floor(outColor.r); 208 | } 209 | 210 | outColor.g = outColor.g - variation * floor(index / 2.0); 211 | 212 | if (outColor.g < 0.1) { 213 | outColor.g = outColor.g + variation * floor(index / 2.0); 214 | outColor.g = outColor.g - floor(outColor.g); 215 | } 216 | 217 | outColor.b = outColor.b - variation * floor(index / 4.0); 218 | if (outColor.b < 0.2) { 219 | outColor.b = outColor.b + variation * floor(index / 4.0); 220 | outColor.b = outColor.b - floor(outColor.b); 221 | } 222 | } 223 | // Split complimentary saturation and brightness variations on a 3 fixed 120 degree hues 224 | else if (colorMode == 1) { 225 | float divisor = 3.0; 226 | float ratio = 0.45; 227 | if (mod(index, 3.0) >= 2.0) { 228 | outColor.r = outColor.r - ratio; 229 | } 230 | else if (mod(index, 3.0) >= 1.0) { 231 | outColor.r = outColor.r + ratio; 232 | } 233 | 234 | //outColor.g = outColor.g + variation * floor(index / divisor); 235 | 236 | if (mod(index, 5.0) >= 3.0) { 237 | outColor.g = outColor.g - variation; 238 | outColor.g = outColor.g - floor(outColor.g); 239 | } 240 | outColor.b = outColor.b - variation * floor(index / (divisor)); 241 | if (outColor.b < 0.1) { 242 | outColor.b = outColor.b + variation * floor(index / (divisor)); 243 | outColor.b = outColor.b - floor(outColor.b); 244 | } 245 | } 246 | // Compound complimentary a combination of shades, complimentary and analogous colors with slight shifts 247 | else if (colorMode == 2) { 248 | if (mod(index, 3.0) >= 2.0) { 249 | outColor.r = outColor.r + 0.5; 250 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1) / 4.0; 251 | } 252 | else { 253 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 254 | } 255 | outColor.r = outColor.r - floor(outColor.r); 256 | 257 | 258 | if (mod(index, 2.0) >= 1.0) { 259 | outColor.g = outColor.g + index * variation / 2.0; 260 | } 261 | else if (mod(index, 3.0) >= 2.0) { 262 | outColor.g = outColor.g - variation / 2.0; 263 | } 264 | else { 265 | outColor.g = outColor.g - index * variation / float(colorCount - 1); 266 | } 267 | if (outColor.g > 1.0) { 268 | outColor.g = outColor.g - floor(outColor.g); 269 | } 270 | } 271 | // Spectrum hue shifts based on number of colors with minor saturation shifts 272 | else if (colorMode == 3) { 273 | outColor.r = outColor.r + index * 1.0 / float(colorCount); 274 | if (mod(index, 3.0) >= 2.0) { 275 | outColor.g = outColor.g - variation / 2.0; 276 | outColor.g = outColor.g - floor(outColor.g); 277 | } 278 | else if (mod(index, 4.0) >= 3.0) { 279 | outColor.g = outColor.g + variation / 2.0; 280 | //outColor.g = outColor.g - floor(outColor.g); 281 | } 282 | } 283 | // Shades saturation and brightness variations on a single fixed hue 284 | else if (colorMode == 4) { 285 | if (mod(index, 2.0) >= 1.0) { 286 | outColor.b = outColor.b - (index * variation) / float(colorCount-1); 287 | } 288 | else { 289 | outColor.b = outColor.b + (index * variation) / float(colorCount-1); 290 | outColor.b = outColor.b - floor(outColor.b); 291 | } 292 | if (outColor.b < 0.075) { 293 | outColor.b = 1.0 - outColor.b * variation; 294 | } 295 | 296 | if (mod(index, 3.0) >= 2.0) { 297 | outColor.g = outColor.g - (index * variation) / 2.0; 298 | } 299 | else if (mod(index, 4.0) >= 3.0) { 300 | outColor.g = outColor.g + (index * variation) / 2.0; 301 | } 302 | 303 | if ((outColor.g > 1.0) || (outColor.g < 0.05)) { 304 | outColor.g = outColor.g - floor(outColor.g); 305 | } 306 | } 307 | // Analogous small hue and saturation shifts 308 | else if (colorMode == 5) { 309 | 310 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 311 | 312 | if (mod(index, 3.0) >= 1.0) { 313 | outColor.g = outColor.g - variation / 2.0; 314 | if (outColor.g < 0.0) { 315 | outColor.g = outColor.g + variation / 2.0; 316 | } 317 | if (outColor.g > 1.0) { 318 | outColor.g = outColor.g - floor(outColor.g); 319 | } 320 | } 321 | } 322 | // Compound Analogous similar to analogous but with negative hue shifts 323 | else if (colorMode == 6) { 324 | if (mod(index, 3.0) >= 1.0) { 325 | outColor.r = outColor.r + variation * index * 1.0 / float(colorCount - 1); 326 | } 327 | else { 328 | outColor.r = outColor.r - variation * index * 0.5 / float(colorCount - 1); 329 | } 330 | if (mod(index, 3.0) >= 1.0) { 331 | outColor.g = outColor.g - variation / 2.0; 332 | if (outColor.g < 0.0) { 333 | outColor.g = outColor.g + variation; 334 | } 335 | if (outColor.g > 1.0) { 336 | outColor.g = outColor.g - floor(outColor.g); 337 | } 338 | } 339 | if (mod(index, 4.0) >= 2.0) { 340 | if (outColor.b < variation) { 341 | outColor.b = outColor.b + variation; 342 | } 343 | } 344 | } 345 | 346 | gl_FragColor = vec4(hsv2rgb(outColor.rgb), inColor.a); 347 | } 348 | } 349 | -------------------------------------------------------------------------------- /example-transitions/bin/data/boxinator.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "CREDIT": "by mojovideotech", 3 | "ISFVSN": "2", 4 | "CATEGORIES": [ 5 | "Stylize" 6 | ], 7 | "INPUTS": [ 8 | { 9 | "NAME": "inputImage", 10 | "TYPE": "image" 11 | }, 12 | { 13 | "NAME": "rate", 14 | "TYPE": "float", 15 | "DEFAULT": 2.5, 16 | "MIN": 0.0, 17 | "MAX": 10.0 18 | }, 19 | { 20 | "NAME": "edge", 21 | "TYPE": "float", 22 | "DEFAULT": 0.001, 23 | "MIN": 0.0, 24 | "MAX": 0.01 25 | }, 26 | { 27 | "NAME": "blend", 28 | "TYPE": "float", 29 | "DEFAULT": 0.95, 30 | "MIN": -1.0, 31 | "MAX": 1.0 32 | }, 33 | { 34 | "NAME": "randomize", 35 | "TYPE": "float", 36 | "DEFAULT": 0.5, 37 | "MIN": 0.0, 38 | "MAX": 1.0 39 | }, 40 | { 41 | "NAME": "gamma", 42 | "TYPE": "float", 43 | "DEFAULT": -0.3, 44 | "MIN": -0.5, 45 | "MAX": 0.2 46 | }, 47 | { 48 | "NAME": "grid", 49 | "TYPE": "point2D", 50 | "DEFAULT": [ 64.0, 36.0 ], 51 | "MIN": [ 1.5, 1.5 ], 52 | "MAX": [ 900.0, 600.0 ] 53 | } 54 | ] 55 | }*/ 56 | 57 | //////////////////////////////////////////////////////////////////// 58 | // Boxinator by mojovideotech 59 | // 60 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 61 | //////////////////////////////////////////////////////////////////// 62 | 63 | 64 | #ifdef GL_ES 65 | precision mediump float; 66 | #endif 67 | 68 | 69 | //------------------------------------------------------------------ 70 | // simplex noise function 71 | // by : Ian McEwan, Ashima Arts 72 | // © 2011 Ashima Arts, MIT License 73 | 74 | vec4 permute(vec4 x) { return mod(((x*34.0)+1.0)*x, 289.0); } 75 | 76 | vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; } 77 | 78 | float snoise(vec3 v) { 79 | const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; 80 | const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); 81 | vec3 i = floor(v + dot(v, C.yyy) ); 82 | vec3 x0 = v - i + dot(i, C.xxx) ; 83 | vec3 g = step(x0.yzx, x0.xyz); 84 | vec3 l = 1.0 - g; 85 | vec3 i1 = min( g.xyz, l.zxy ); 86 | vec3 i2 = max( g.xyz, l.zxy ); 87 | vec3 x1 = x0 - i1 + 1.0 * C.xxx; 88 | vec3 x2 = x0 - i2 + 2.0 * C.xxx; 89 | vec3 x3 = x0 - 1. + 3.0 * C.xxx; 90 | i = mod(i, 289.0 ); 91 | vec4 p = permute( permute( permute( 92 | i.z + vec4(0.0, i1.z, i2.z, 1.0 )) 93 | + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 94 | + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); 95 | float n_ = 1.0/7.0; // N=7 96 | vec3 ns = n_ * D.wyz - D.xzx; 97 | vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N) 98 | vec4 x_ = floor(j * ns.z); 99 | vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) 100 | vec4 x = x_ *ns.x + ns.yyyy; 101 | vec4 y = y_ *ns.x + ns.yyyy; 102 | vec4 h = 1.0 - abs(x) - abs(y); 103 | vec4 b0 = vec4( x.xy, y.xy ); 104 | vec4 b1 = vec4( x.zw, y.zw ); 105 | vec4 s0 = floor(b0)*2.0 + 1.0; 106 | vec4 s1 = floor(b1)*2.0 + 1.0; 107 | vec4 sh = -step(h, vec4(0.0)); 108 | vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; 109 | vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; 110 | vec3 p0 = vec3(a0.xy,h.x); 111 | vec3 p1 = vec3(a0.zw,h.y); 112 | vec3 p2 = vec3(a1.xy,h.z); 113 | vec3 p3 = vec3(a1.zw,h.w); 114 | vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); 115 | p0 *= norm.x; 116 | p1 *= norm.y; 117 | p2 *= norm.z; 118 | p3 *= norm.w; 119 | vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); 120 | m = m * m; 121 | return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 122 | dot(p2,x2), dot(p3,x3) ) ); 123 | } 124 | //------------------------------------------------------------------ 125 | 126 | float hash(float h) { return fract(sin(h) * 43758.5453123); } 127 | 128 | vec2 tile(vec2 cell, vec2 size) { return fract(cell*size); } 129 | 130 | float box(vec2 a, vec2 b){ vec2 o = step(b,a); return o.x*o.y; } 131 | 132 | void main(void){ 133 | float T = TIME*rate; 134 | vec2 uv = gl_FragCoord.xy/RENDERSIZE.xy; 135 | vec2 g = floor(grid.xy); 136 | float C = g.x*g.y ; 137 | float I = 1.0 + floor(uv.x * g.x) + g.y * floor(uv.y * g.y) + g.x; 138 | vec2 st = tile(uv, g); 139 | float S = I / C * box(st, vec2(edge*g.xy)); 140 | S = mix(S,hash(S),randomize); 141 | vec3 color = vec3(S*T); 142 | float n = snoise(color+IMG_NORM_PIXEL(inputImage, uv.xy).xyz*blend); 143 | 144 | gl_FragColor = sqrt(max(vec4(vec3(n, n, n ),1.0)+IMG_NORM_PIXEL(inputImage, uv.xy),0.0)+gamma); 145 | } 146 | 147 | -------------------------------------------------------------------------------- /example-transitions/bin/data/wiperight.fs: -------------------------------------------------------------------------------- 1 | /* 2 | { 3 | "CATEGORIES" : [ 4 | "Dissolve" 5 | ], 6 | "INPUTS" : [ 7 | { 8 | "TYPE" : "image", 9 | "NAME" : "startImage" 10 | }, 11 | { 12 | "NAME" : "endImage", 13 | "TYPE" : "image" 14 | }, 15 | { 16 | "NAME" : "progress", 17 | "MIN" : 0, 18 | "TYPE" : "float", 19 | "MAX" : 1, 20 | "DEFAULT" : 0 21 | } 22 | ], 23 | "CREDIT": "Automatically converted from https://www.github.com/gl-transitions/gl-transitions/tree/master/windowblinds.glsl", 24 | "DESCRIPTION": "", 25 | "ISFVSN" : "2" 26 | } 27 | */ 28 | 29 | 30 | 31 | vec4 getFromColor(vec2 inUV) { 32 | return IMG_NORM_PIXEL(startImage, inUV); 33 | } 34 | vec4 getToColor(vec2 inUV) { 35 | return IMG_NORM_PIXEL(endImage, inUV); 36 | } 37 | 38 | 39 | 40 | // Author: Fabien Benetou 41 | // License: MIT 42 | 43 | vec4 transition (vec2 uv) { 44 | float t = progress; 45 | 46 | if (mod(floor(uv.y*100.*progress),2.)==0.) 47 | t*=2.-.5; 48 | 49 | return mix( 50 | getFromColor(uv), 51 | getToColor(uv), 52 | mix(t, progress, smoothstep(0.8, 1.0, progress)) 53 | ); 54 | } 55 | 56 | 57 | 58 | void main() { 59 | gl_FragColor = transition(isf_FragNormCoord.xy); 60 | } -------------------------------------------------------------------------------- /example-transitions/example-transitions.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example-transitions", "example-transitions.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Debug|x64 = Debug|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32 17 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64 18 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64 19 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32 20 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32 21 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64 22 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64 23 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 25 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64 26 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64 27 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 28 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 29 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64 30 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /example-transitions/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /example-transitions/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example-transitions/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup() { 5 | ofSetVerticalSync(true); 6 | ofSetFrameRate(60); 7 | ofDisableArbTex(); 8 | ofSetWindowShape(640*2, 480*2); 9 | grabber.setup(640, 480); 10 | autoColor.setup(ofToDataPath("auto color tune.fs"), 640, 480); 11 | boxinator.setup(ofToDataPath("boxinator.fs"), 640, 480); 12 | transition.setup(ofToDataPath("wiperight.fs"), 640, 480); 13 | transitionTwo.setup(ofToDataPath("wiperight.fs"), 640, 480); 14 | 15 | autoColor.setInput("inputImage", grabber.getTexture()); 16 | boxinator.setInput("inputImage", grabber.getTexture()); 17 | 18 | transition.setInput("startImage", boxinator.getTexture()); 19 | transition.setInput("endImage", grabber.getTexture()); 20 | 21 | transitionTwo.setInput("startImage", grabber.getTexture()); 22 | transitionTwo.setInput("endImage", autoColor.getTexture()); 23 | 24 | 25 | 26 | autoColorGroup.setName("Auto Color Inputs"); 27 | autoColorGroup.add(colorMode.set("Color Mode", 0, 0, 6)); 28 | autoColorGroup.add(colorCount.set("Color Count", 3, 1, 16)); 29 | autoColorGroup.add(baseColor.set("Base Color", ofFloatColor(0.5, 0, 0.5, 1.0))); 30 | 31 | gui.setup(autoColorGroup); 32 | 33 | boxGroup.setName("Boxinator Inputs"); 34 | boxGroup.add(rate.set("Rate", 0.1, 0, 10)); 35 | boxGroup.add(edge.set("Edge", 0.001, 0.0, 0.01)); 36 | boxGroup.add(blend.set("Blend", 0.5, 0.0, 1.0)); 37 | boxGroup.add(randomize.set("Randomize", 0.5, 0.0, 1.0)); 38 | boxGroup.add(gamma.set("Gamma", -0.3, -0.5, 0.3)); 39 | boxGroup.add(grid.set("Grid Size", ofVec2f(64.5, 64.5), ofVec2f(1.5, 1.5), ofVec2f(900, 600))); 40 | 41 | gui.add(boxGroup); 42 | 43 | transitionGroup.setName("Transition"); 44 | transitionGroup.add(progress.set("progress", 0.75, 0, 1)); 45 | gui.add(transitionGroup); 46 | 47 | 48 | 49 | } 50 | 51 | //-------------------------------------------------------------- 52 | void ofApp::update() { 53 | grabber.update(); 54 | autoColor.setInput("colorModeOverride", (long)colorMode.get()); 55 | autoColor.setInput("colorCount", (long)colorCount.get()); 56 | autoColor.setInput("baseColor", baseColor.get()); 57 | 58 | boxinator.setInput("rate", rate.get()); 59 | boxinator.setInput("edge", edge.get()); 60 | boxinator.setInput("blend", blend.get()); 61 | boxinator.setInput("randomize", randomize.get()); 62 | boxinator.setInput("gamma", gamma.get()); 63 | boxinator.setInput("grid", grid.get()); 64 | 65 | transition.setInput("progress", progress.get()); 66 | transitionTwo.setInput("progress", progress.get()); 67 | 68 | autoColor.update(); 69 | boxinator.update(); 70 | transition.update(); 71 | transitionTwo.update(); 72 | 73 | } 74 | 75 | //-------------------------------------------------------------- 76 | void ofApp::draw() { 77 | gui.draw(); 78 | autoColor.draw(0, 0); 79 | boxinator.draw(640, 0); 80 | transition.draw(0, 480); 81 | transitionTwo.draw(640, 480); 82 | 83 | gui.draw(); 84 | } 85 | 86 | //-------------------------------------------------------------- 87 | void ofApp::keyPressed(int key) { 88 | 89 | } 90 | 91 | //-------------------------------------------------------------- 92 | void ofApp::keyReleased(int key) { 93 | 94 | } 95 | 96 | //-------------------------------------------------------------- 97 | void ofApp::mouseMoved(int x, int y) { 98 | 99 | } 100 | 101 | //-------------------------------------------------------------- 102 | void ofApp::mouseDragged(int x, int y, int button) { 103 | 104 | } 105 | 106 | //-------------------------------------------------------------- 107 | void ofApp::mousePressed(int x, int y, int button) { 108 | 109 | } 110 | 111 | //-------------------------------------------------------------- 112 | void ofApp::mouseReleased(int x, int y, int button) { 113 | 114 | } 115 | 116 | //-------------------------------------------------------------- 117 | void ofApp::mouseEntered(int x, int y) { 118 | 119 | } 120 | 121 | //-------------------------------------------------------------- 122 | void ofApp::mouseExited(int x, int y) { 123 | 124 | } 125 | 126 | //-------------------------------------------------------------- 127 | void ofApp::windowResized(int w, int h) { 128 | 129 | } 130 | 131 | //-------------------------------------------------------------- 132 | void ofApp::gotMessage(ofMessage msg) { 133 | 134 | } 135 | 136 | //-------------------------------------------------------------- 137 | void ofApp::dragEvent(ofDragInfo dragInfo) { 138 | 139 | } 140 | -------------------------------------------------------------------------------- /example-transitions/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxGui.h" 5 | #include "ofxISFScene.h" 6 | 7 | class ofApp : public ofBaseApp{ 8 | 9 | public: 10 | void setup(); 11 | void update(); 12 | void draw(); 13 | 14 | void keyPressed(int key); 15 | void keyReleased(int key); 16 | void mouseMoved(int x, int y ); 17 | void mouseDragged(int x, int y, int button); 18 | void mousePressed(int x, int y, int button); 19 | void mouseReleased(int x, int y, int button); 20 | void mouseEntered(int x, int y); 21 | void mouseExited(int x, int y); 22 | void windowResized(int w, int h); 23 | void dragEvent(ofDragInfo dragInfo); 24 | void gotMessage(ofMessage msg); 25 | 26 | ofxPanel gui; 27 | ofParameterGroup transitionGroup; 28 | ofParameter progress; 29 | 30 | ofxISFScene transition; 31 | ofxISFScene transitionTwo; 32 | ofxISFScene autoColor; 33 | ofxISFScene boxinator; 34 | 35 | ofVideoGrabber grabber; 36 | ofParameterGroup autoColorGroup; 37 | ofParameterGroup boxGroup; 38 | ofParameter colorMode; 39 | ofParameter colorCount; 40 | ofParameter rate; 41 | ofParameter edge; 42 | ofParameter blend; 43 | ofParameter randomize; 44 | ofParameter gamma; 45 | ofParameter grid; 46 | ofParameter baseColor; 47 | }; 48 | -------------------------------------------------------------------------------- /images/VVGL_SDK_GLFW.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/images/VVGL_SDK_GLFW.PNG -------------------------------------------------------------------------------- /images/bigobj.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/images/bigobj.PNG -------------------------------------------------------------------------------- /images/example-chain.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/images/example-chain.PNG -------------------------------------------------------------------------------- /images/example-fft.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/images/example-fft.PNG -------------------------------------------------------------------------------- /images/example-generator.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/images/example-generator.PNG -------------------------------------------------------------------------------- /images/example-grabber.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/images/example-grabber.PNG -------------------------------------------------------------------------------- /images/example-mixer.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/images/example-mixer.PNG -------------------------------------------------------------------------------- /images/example-transitions.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/images/example-transitions.PNG -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | The code in this repository is available under the [MIT License](https://secure.wikimedia.org/wikipedia/en/wiki/Mit_license). 2 | 3 | Copyright (c) 2019 Daniel Moore 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /src/ofxISFScene.cpp: -------------------------------------------------------------------------------- 1 | #include "ofxISFScene.h" 2 | using namespace VVGL; 3 | using namespace VVISF; 4 | 5 | void ofxISFScene::setup(string path, float width, float height){ 6 | GLContextRef ctxRef = CreateGLContextRefUsing((GLFWwindow*)((ofAppGLFWWindow*)ofGetWindowPtr())->getWindowContext()); 7 | bp = CreateGlobalBufferPool(ctxRef->newContextSharingMe()); 8 | renderScene = CreateISFSceneRefUsing(ctxRef->newContextSharingMe()); 9 | renderScene->useFile(path); 10 | mDoc = renderScene->doc(); 11 | mGLBuff = CreateRGBATex(VVGL::Size(width, height), true, GetGlobalBufferPool()); 12 | mTex.setUseExternalTextureID(mGLBuff->name); 13 | mTex.texData.textureTarget = mGLBuff->desc.target; 14 | mTex.texData.width = mGLBuff->size.width; 15 | mTex.texData.height = mGLBuff->size.height; 16 | mTex.texData.tex_w = mGLBuff->size.width; 17 | mTex.texData.tex_h = mGLBuff->size.height; 18 | mTex.texData.tex_t = 1.0; 19 | mTex.texData.tex_u = 1.0; 20 | mTex.texData.glInternalFormat = mGLBuff->desc.internalFormat; 21 | mTex.texData.bFlipTexture = mGLBuff->flipped; 22 | mTex.texData.bAllocated = TRUE; 23 | } 24 | 25 | void ofxISFScene::setInput(string name, bool val) { 26 | ISFAttrRef intVal = mDoc->input(name); 27 | if (intVal == nullptr || intVal->type() != ISFValType_Bool) { 28 | ofLogError() << "INPUT NOT FOUND OR MISMATCHED TYPE" << endl; 29 | return; 30 | } 31 | ISFVal value = ISFBoolVal(val); 32 | intVal->setCurrentVal(value); 33 | } 34 | 35 | ofTexture ofxISFScene::getTexture() { 36 | return mTex; 37 | } 38 | 39 | void ofxISFScene::setInput(string name, long val) { 40 | ISFAttrRef intVal = mDoc->input(name); 41 | if (intVal == nullptr || intVal->type() != ISFValType_Long) { 42 | ofLogError() << "INPUT NOT FOUND OR MISMATCHED TYPE" << endl; 43 | return; 44 | } 45 | ISFVal value = ISFLongVal(val); 46 | intVal->setCurrentVal(value); 47 | } 48 | void ofxISFScene::setInput(string name, float val) { 49 | ISFAttrRef floatAttr = mDoc->input(name); 50 | if (floatAttr == nullptr || floatAttr->type() != ISFValType_Float) { 51 | ofLogError() << "INPUT NOT FOUND OR MISMATCHED TYPE" << endl; 52 | return; 53 | } 54 | ISFVal value = ISFFloatVal(val); 55 | floatAttr->setCurrentVal(value); 56 | } 57 | void ofxISFScene::setInput(string name, ofVec2f val) { 58 | ISFAttrRef point2DAttr = mDoc->input(name); 59 | if (point2DAttr == nullptr || point2DAttr->type() != ISFValType_Point2D){ 60 | ofLogError() << "INPUT NOT FOUND OR MISMATCHED TYPE" << endl; 61 | return; 62 | } 63 | ISFVal value = ISFPoint2DVal(val.x, val.y); 64 | point2DAttr->setCurrentVal(value); 65 | } 66 | void ofxISFScene::setInput(string name, ofFloatColor val) { 67 | ISFAttrRef colorAttr = mDoc->input(name); 68 | if (colorAttr == nullptr || colorAttr->type() != ISFValType_Color){ 69 | ofLogError() << "INPUT NOT FOUND OR MISMATCHED TYPE" << endl; 70 | return; 71 | } 72 | ISFVal value = ISFColorVal(val.r, val.g, val.b, val.a); 73 | colorAttr->setCurrentVal(value); 74 | } 75 | void ofxISFScene::setInput(string name, ofTexture val) { 76 | ISFAttrRef imageAttr = mDoc->input(name); 77 | if (imageAttr == nullptr && (imageAttr->type() == ISFValType_Image || imageAttr->type() == ISFValType_AudioFFT || imageAttr->type() == ISFValType_Audio)) { 78 | ofLogError() << "INPUT NOT FOUND OR MISMATCHED TYPE" << endl; 79 | return; 80 | } 81 | //todo copy ofTexture to GLBufferRef 82 | GLBufferRef ref = CreateFromExistingGLTexture( 83 | val.texData.textureID, 84 | (GLBuffer::Target) val.texData.textureTarget, 85 | (GLBuffer::InternalFormat) val.texData.glInternalFormat, 86 | (GLBuffer::PixelFormat) val.texData.glInternalFormat, 87 | GLBuffer::PT_UByte, 88 | VVGL::Size(val.texData.width, val.texData.height), 89 | val.texData.bFlipTexture, 90 | VVGL::Rect(0, 0, val.texData.width, val.texData.height), 91 | NULL, 92 | NULL); 93 | 94 | ISFVal value = ISFImageVal(ref); 95 | imageAttr->setCurrentVal(value); 96 | } 97 | 98 | 99 | void ofxISFScene::update(){ 100 | ofPushView(); 101 | ofViewport(ofRectangle(0, 0, getWidth(), getHeight())); 102 | renderScene->renderToBuffer(mGLBuff, mGLBuff->size); 103 | ofPopView(); 104 | } 105 | //-------------------------------------------------------------- 106 | void ofxISFScene::draw(float x, float y){ 107 | mTex.draw(x, y); 108 | } 109 | -------------------------------------------------------------------------------- /src/ofxISFScene.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ofMain.h" 3 | #include "VVISF.hpp" 4 | 5 | class ofxISFScene{ 6 | public: 7 | void setup(string path, float width, float height); 8 | void update(); 9 | void setInput(string name, bool val); 10 | void setInput(string name, long val); 11 | void setInput(string name, float val); 12 | void setInput(string name, ofVec2f val); 13 | void setInput(string name, ofFloatColor val); 14 | void setInput(string name, ofTexture val); 15 | 16 | void draw(float x, float y); 17 | 18 | int getHeight() { 19 | return mTex.getHeight(); 20 | } 21 | int getWidth() { 22 | return mTex.getWidth(); 23 | } 24 | 25 | ofTexture getTexture(); 26 | 27 | protected: 28 | VVISF::ISFDocRef mDoc; 29 | VVISF::ISFSceneRef renderScene; 30 | VVGL::GLBufferPoolRef bp; 31 | VVGL::GLBufferRef mGLBuff; 32 | ofTexture mTex; 33 | }; 34 | -------------------------------------------------------------------------------- /tests/bin/data/Hexagon.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danzeeeman/ofxVVISF/ddefade36ab248d7b2ee99cd5bbe088fa3006bb2/tests/bin/data/Hexagon.tiff -------------------------------------------------------------------------------- /tests/bin/data/Optical Flow Distort.fs: -------------------------------------------------------------------------------- 1 | /* 2 | { 3 | "CATEGORIES" : [ 4 | "Distortion Effect" 5 | ], 6 | "DESCRIPTION" : "Uses an optical flow mask to create a distortion", 7 | "ISFVSN" : "2", 8 | "INPUTS" : [ 9 | { 10 | "NAME" : "inputImage", 11 | "TYPE" : "image" 12 | }, 13 | { 14 | "NAME" : "amt", 15 | "TYPE" : "float", 16 | "MAX" : 1, 17 | "DEFAULT" : 0.5, 18 | "LABEL" : "Distortion Amount", 19 | "MIN" : 0 20 | }, 21 | { 22 | "NAME" : "maskHold", 23 | "TYPE" : "float", 24 | "MAX" : 1, 25 | "DEFAULT" : 0.98, 26 | "LABEL" : "Flow Persistence", 27 | "MIN" : 0 28 | }, 29 | { 30 | "NAME" : "inputScale", 31 | "TYPE" : "float", 32 | "MAX" : 10, 33 | "DEFAULT" : 2, 34 | "LABEL" : "Scale", 35 | "MIN" : 0 36 | }, 37 | { 38 | "NAME" : "inputOffset", 39 | "TYPE" : "float", 40 | "MAX" : 1, 41 | "DEFAULT" : 0.1, 42 | "LABEL" : "Offset", 43 | "MIN" : 0 44 | }, 45 | { 46 | "NAME" : "inputLambda", 47 | "TYPE" : "float", 48 | "MAX" : 1, 49 | "DEFAULT" : 1, 50 | "LABEL" : "Noise Removal", 51 | "MIN" : 0 52 | }, 53 | { 54 | "NAME" : "resetNow", 55 | "TYPE" : "event", 56 | "LABEL" : "Restart" 57 | } 58 | ], 59 | "PASSES" : [ 60 | { 61 | "TARGET" : "maskBuffer", 62 | "PERSISTENT" : true 63 | }, 64 | { 65 | "TARGET" : "delayBuffer", 66 | "PERSISTENT" : true 67 | }, 68 | { 69 | 70 | } 71 | ], 72 | "CREDIT" : "by VIDVOX, based on original implementation by Andrew Benson and v002" 73 | } 74 | */ 75 | 76 | 77 | varying vec2 left_coord; 78 | varying vec2 right_coord; 79 | varying vec2 above_coord; 80 | varying vec2 below_coord; 81 | 82 | varying vec2 lefta_coord; 83 | varying vec2 righta_coord; 84 | varying vec2 leftb_coord; 85 | varying vec2 rightb_coord; 86 | 87 | 88 | // based on v002 Optical Flow which is itself a port of Andrew Bensons HS Flow implementation on the GPU. 89 | // https://github.com/v002/v002-Optical-Flow 90 | 91 | 92 | const vec4 coeffs = vec4(0.2126, 0.7152, 0.0722, 1.0); 93 | 94 | float gray(vec4 n) 95 | { 96 | return (n.r + n.g + n.b)/3.0; 97 | } 98 | 99 | void main() 100 | { 101 | // on the first pass generate the mask using the previous delayBuffer and inputImage 102 | // on the 2nd pass update the delayBuffer to hold inputImage 103 | // on the 3rd pass output the new mask 104 | if (PASSINDEX == 0) { 105 | if ((FRAMEINDEX == 0)||(resetNow)) { 106 | gl_FragColor = vec4(0.5); 107 | } 108 | else { 109 | // convert to grayscale 110 | vec4 a = IMG_THIS_PIXEL(inputImage) * coeffs; 111 | float brightness = gray(a); 112 | a = vec4(brightness); 113 | vec4 b = IMG_THIS_PIXEL(delayBuffer) * coeffs; 114 | brightness = gray(b); 115 | b = vec4(brightness); 116 | 117 | vec2 x1 = vec2(inputOffset * RENDERSIZE.x, 0.0); 118 | vec2 y1 = vec2(0.0,inputOffset * RENDERSIZE.y); 119 | vec2 texcoord0 = isf_FragNormCoord.xy * RENDERSIZE; 120 | vec2 texcoord1 = isf_FragNormCoord.xy * RENDERSIZE; 121 | 122 | //get the difference 123 | vec4 curdif = b-a; 124 | 125 | //calculate the gradient 126 | vec4 gradx = IMG_PIXEL(delayBuffer, texcoord1+x1)-IMG_PIXEL(delayBuffer, texcoord1-x1); 127 | gradx += IMG_PIXEL(inputImage, texcoord0+x1)-IMG_PIXEL(inputImage, texcoord0-x1); 128 | 129 | vec4 grady = IMG_PIXEL(delayBuffer, texcoord1+y1)-IMG_PIXEL(delayBuffer, texcoord1-y1); 130 | grady += IMG_PIXEL(inputImage, texcoord0+y1)-IMG_PIXEL(inputImage, texcoord0-y1); 131 | 132 | vec4 gradmag = sqrt((gradx*gradx)+(grady*grady)+vec4(inputLambda)); 133 | 134 | vec4 vx = curdif*(gradx/gradmag); 135 | float vxd = gray(vx);//assumes greyscale 136 | //format output for flowrepos, out(-x,+x,-y,+y) 137 | vec2 xout = vec2(max(vxd,0.),abs(min(vxd,0.)))*inputScale; 138 | 139 | vec4 vy = curdif*(grady/gradmag); 140 | float vyd = gray(vy);//assumes greyscale 141 | //format output for flowrepos, out(-x,+x,-y,+y) 142 | vec2 yout = vec2(max(vyd,0.),abs(min(vyd,0.)))*inputScale; 143 | 144 | //gl_FragColor = clamp(vec4(xout.xy,yout.xy), 0.0, 1.0); 145 | 146 | vec4 mask = clamp(vec4(xout.xy,yout.xy), 0.0, 1.0); 147 | 148 | vec4 color = IMG_THIS_NORM_PIXEL(maskBuffer); 149 | vec4 colorL = IMG_NORM_PIXEL(maskBuffer, left_coord); 150 | vec4 colorR = IMG_NORM_PIXEL(maskBuffer, right_coord); 151 | vec4 colorA = IMG_NORM_PIXEL(maskBuffer, above_coord); 152 | vec4 colorB = IMG_NORM_PIXEL(maskBuffer, below_coord); 153 | 154 | vec4 colorLA = IMG_NORM_PIXEL(maskBuffer, lefta_coord); 155 | vec4 colorRA = IMG_NORM_PIXEL(maskBuffer, righta_coord); 156 | vec4 colorLB = IMG_NORM_PIXEL(maskBuffer, leftb_coord); 157 | vec4 colorRB = IMG_NORM_PIXEL(maskBuffer, rightb_coord); 158 | 159 | // blur then sharpen the feedback buffer 160 | vec4 blurVector = (color + colorL + colorR + colorA + colorB + colorLA + colorRA + colorLB + colorRB) / 9.0; 161 | gl_FragColor = mask + maskHold * blurVector; 162 | } 163 | } 164 | else if (PASSINDEX == 1) { 165 | // here we just buffer the current frame for next TIME 166 | gl_FragColor = IMG_THIS_PIXEL(inputImage); 167 | } 168 | else { 169 | // NOW DO SOMETHING WITH THE MASK - BLUR THE IMAGE AND THE MASK IMAGE 170 | 171 | // blur the mask image 172 | vec2 texcoord0 = isf_FragNormCoord.xy; 173 | 174 | vec4 color = IMG_THIS_NORM_PIXEL(maskBuffer); 175 | vec4 colorL = IMG_NORM_PIXEL(maskBuffer, left_coord); 176 | vec4 colorR = IMG_NORM_PIXEL(maskBuffer, right_coord); 177 | vec4 colorA = IMG_NORM_PIXEL(maskBuffer, above_coord); 178 | vec4 colorB = IMG_NORM_PIXEL(maskBuffer, below_coord); 179 | 180 | vec4 colorLA = IMG_NORM_PIXEL(maskBuffer, lefta_coord); 181 | vec4 colorRA = IMG_NORM_PIXEL(maskBuffer, righta_coord); 182 | vec4 colorLB = IMG_NORM_PIXEL(maskBuffer, leftb_coord); 183 | vec4 colorRB = IMG_NORM_PIXEL(maskBuffer, rightb_coord); 184 | 185 | vec4 blurVector = (color + colorL + colorR + colorA + colorB + colorLA + colorRA + colorLB + colorRB) / 9.0; 186 | //vec4 blurVector = IMG_THIS_PIXEL(maskBuffer); 187 | 188 | vec2 blurAmount = vec2(blurVector.y-blurVector.x, blurVector.w-blurVector.z); 189 | vec2 tmp = texcoord0 + blurAmount * amt; 190 | tmp.x = clamp(tmp.x,0.0,1.0); 191 | tmp.y = clamp(tmp.y,0.0,1.0); 192 | vec4 sample0 = IMG_NORM_PIXEL(inputImage, tmp); 193 | tmp = (1.02 + texcoord0) + blurAmount * amt * amt; 194 | tmp.x = clamp(tmp.x,0.0,1.0); 195 | tmp.y = clamp(tmp.y,0.0,1.0); 196 | vec4 sample1 = IMG_NORM_PIXEL(inputImage, tmp); 197 | gl_FragColor = (sample0 * 3.0 + sample1) / 4.0; 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /tests/bin/data/Optical Flow Distort.vs: -------------------------------------------------------------------------------- 1 | varying vec2 left_coord; 2 | varying vec2 right_coord; 3 | varying vec2 above_coord; 4 | varying vec2 below_coord; 5 | 6 | varying vec2 lefta_coord; 7 | varying vec2 righta_coord; 8 | varying vec2 leftb_coord; 9 | varying vec2 rightb_coord; 10 | 11 | 12 | void main() 13 | { 14 | isf_vertShaderInit(); 15 | vec2 texc = vec2(isf_FragNormCoord[0],isf_FragNormCoord[1]); 16 | vec2 d = 4.0/RENDERSIZE; 17 | 18 | left_coord = clamp(vec2(texc.xy + vec2(-d.x , 0)),0.0,1.0); 19 | right_coord = clamp(vec2(texc.xy + vec2(d.x , 0)),0.0,1.0); 20 | above_coord = clamp(vec2(texc.xy + vec2(0,d.y)),0.0,1.0); 21 | below_coord = clamp(vec2(texc.xy + vec2(0,-d.y)),0.0,1.0); 22 | 23 | lefta_coord = clamp(vec2(texc.xy + vec2(-d.x , d.x)),0.0,1.0); 24 | righta_coord = clamp(vec2(texc.xy + vec2(d.x , d.x)),0.0,1.0); 25 | leftb_coord = clamp(vec2(texc.xy + vec2(-d.x , -d.x)),0.0,1.0); 26 | rightb_coord = clamp(vec2(texc.xy + vec2(d.x , -d.x)),0.0,1.0); 27 | } -------------------------------------------------------------------------------- /tests/bin/data/Test-Audio.fs: -------------------------------------------------------------------------------- 1 | /* 2 | { 3 | "CATEGORIES" : [ 4 | "Generator" 5 | ], 6 | "DESCRIPTION" : "Visualizes an FFT analysis image with custom set colors for frequency domain", 7 | "INPUTS" : [ 8 | { 9 | "NAME" : "waveImage", 10 | "TYPE" : "audio" 11 | }, 12 | { 13 | "NAME" : "waveSize", 14 | "TYPE" : "float", 15 | "MAX" : 0.5, 16 | "DEFAULT" : 0.05, 17 | "MIN" : 0 18 | }, 19 | { 20 | "NAME" : "stereo", 21 | "TYPE" : "bool", 22 | "DEFAULT" : 1 23 | } 24 | ], 25 | "CREDIT" : "by VIDVOX" 26 | } 27 | */ 28 | 29 | 30 | 31 | void main() { 32 | 33 | vec2 loc = vec2(vv_FragNormCoord[1], vv_FragNormCoord[0]); 34 | 35 | vec2 rawSize = IMG_SIZE(waveImage); 36 | float channel = 0.5; 37 | float offset = 0.0; 38 | if (stereo == true) { 39 | channel = (loc.x > 0.5) ? 0.0 : 1.0; 40 | offset = (loc.x > 0.5) ? 0.25 : -0.25; 41 | } 42 | 43 | vec2 waveLoc = vec2(loc.y,channel); 44 | vec4 wave = IMG_NORM_PIXEL(waveImage, waveLoc)+offset; 45 | vec4 waveAdd = (1.0 - smoothstep(0.0, waveSize, abs(wave - loc.x))); 46 | waveAdd.a = 1.0; 47 | gl_FragColor = waveAdd; 48 | } -------------------------------------------------------------------------------- /tests/bin/data/Test-AudioFFT.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "Visualizes an FFT analysis image with custom set colors for frequency domain", 3 | "CREDIT": "by VIDVOX", 4 | "ISFVSN": "2", 5 | "CATEGORIES": [ 6 | "Generator" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "fftImage", 11 | "TYPE": "audioFFT" 12 | }, 13 | { 14 | "NAME": "strokeSize", 15 | "TYPE": "float", 16 | "MIN": 0.0, 17 | "MAX": 0.25, 18 | "DEFAULT": 0.01 19 | }, 20 | { 21 | "NAME": "gain", 22 | "TYPE": "float", 23 | "MIN": 1.0, 24 | "MAX": 5.0, 25 | "DEFAULT": 1.0 26 | }, 27 | { 28 | "NAME": "minRange", 29 | "TYPE": "float", 30 | "MIN": 0.0, 31 | "MAX": 1.0, 32 | "DEFAULT": 0.0 33 | }, 34 | { 35 | "NAME": "maxRange", 36 | "TYPE": "float", 37 | "MIN": 0.0, 38 | "MAX": 1.0, 39 | "DEFAULT": 0.9 40 | }, 41 | { 42 | "NAME": "topColor", 43 | "TYPE": "color", 44 | "DEFAULT": [ 45 | 0.0, 46 | 0.0, 47 | 0.0, 48 | 0.0 49 | ] 50 | }, 51 | { 52 | "NAME": "bottomColor", 53 | "TYPE": "color", 54 | "DEFAULT": [ 55 | 0.0, 56 | 0.5, 57 | 0.9, 58 | 1.0 59 | ] 60 | }, 61 | { 62 | "NAME": "strokeColor", 63 | "TYPE": "color", 64 | "DEFAULT": [ 65 | 0.25, 66 | 0.25, 67 | 0.25, 68 | 1.0 69 | ] 70 | } 71 | ] 72 | }*/ 73 | 74 | 75 | 76 | void main() { 77 | 78 | vec2 loc = isf_FragNormCoord; 79 | 80 | // the fftImage is 256 steps 81 | loc.x = loc.x * abs(maxRange - minRange) + minRange; 82 | 83 | vec4 fft = IMG_NORM_PIXEL(fftImage, vec2(loc.x,0.5)); 84 | float fftVal = gain * (fft.r + fft.g + fft.b) / 3.0; 85 | if (loc.y > fftVal) 86 | fft = topColor; 87 | else 88 | fft = bottomColor; 89 | if ((strokeSize > 0.0) && (abs(fftVal - loc.y) < strokeSize)) { 90 | fft = mix(strokeColor, fft, abs(fftVal - loc.y) / strokeSize); 91 | } 92 | 93 | //(smoothstep(0.0, stroke, abs(fftVal - loc.y))) * strokeColor); 94 | gl_FragColor = fft; 95 | } -------------------------------------------------------------------------------- /tests/bin/data/Test-Bool.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates a BOOL-type input on an image filter", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | }, 13 | { 14 | "NAME": "flashToggle", 15 | "TYPE": "bool", 16 | "DEFAULT": 1.0 17 | } 18 | ] 19 | }*/ 20 | 21 | void main() 22 | { 23 | vec4 srcPixel = IMG_THIS_PIXEL(inputImage); 24 | gl_FragColor = (flashToggle==true) ? vec4(1.0,1.0,1.0,1.0) : srcPixel; 25 | } 26 | -------------------------------------------------------------------------------- /tests/bin/data/Test-Color.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of color-type image inputs", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | }, 13 | { 14 | "NAME": "level", 15 | "TYPE": "float", 16 | "DEFAULT": 0.5, 17 | "MIN": 0.0, 18 | "MAX": 1.0 19 | }, 20 | { 21 | "NAME": "lowColor", 22 | "TYPE": "color", 23 | "DEFAULT": [ 24 | 0.0, 25 | 0.0, 26 | 1.0, 27 | 1.0 28 | ] 29 | }, 30 | { 31 | "NAME": "highColor", 32 | "TYPE": "color", 33 | "DEFAULT": [ 34 | 1.0, 35 | 1.0, 36 | 1.0, 37 | 1.0 38 | ] 39 | } 40 | ] 41 | }*/ 42 | 43 | void main() 44 | { 45 | vec4 srcPixel = IMG_THIS_PIXEL(inputImage); 46 | vec4 dstPixel = ((srcPixel.r+srcPixel.g+srcPixel.b)/3.0>level) ? lowColor : highColor; 47 | gl_FragColor = dstPixel; 48 | } 49 | -------------------------------------------------------------------------------- /tests/bin/data/Test-Event.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of an event-type input", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | }, 13 | { 14 | "NAME": "flashEvent", 15 | "TYPE": "event" 16 | } 17 | ] 18 | }*/ 19 | 20 | void main() 21 | { 22 | vec4 srcPixel = IMG_THIS_PIXEL(inputImage); 23 | gl_FragColor = (flashEvent==true) ? vec4(1.0,1.0,1.0,1.0) : srcPixel; 24 | } 25 | -------------------------------------------------------------------------------- /tests/bin/data/Test-Float.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of float-type inputs", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | }, 13 | { 14 | "NAME": "level", 15 | "TYPE": "float", 16 | "DEFAULT": 0.5, 17 | "MIN": 0.0, 18 | "MAX": 1.0 19 | } 20 | ] 21 | }*/ 22 | 23 | void main() 24 | { 25 | vec4 srcPixel = IMG_THIS_PIXEL(inputImage); 26 | float luma = (srcPixel.r+srcPixel.g+srcPixel.b)/3.0; 27 | vec4 dstPixel = (luma>level) ? srcPixel : vec4(0,0,0,1); 28 | gl_FragColor = dstPixel; 29 | } 30 | -------------------------------------------------------------------------------- /tests/bin/data/Test-Functionality.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "just colors the passed image opaque red, tests basic rendering functionality", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | } 13 | ] 14 | }*/ 15 | 16 | void main() 17 | { 18 | gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); 19 | } -------------------------------------------------------------------------------- /tests/bin/data/Test-IMG_NORM_PIXEL.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of IMG_NORM_PIXEL to fetch a pixel color from an input", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | } 13 | ] 14 | }*/ 15 | 16 | void main() 17 | { 18 | vec4 test = IMG_NORM_PIXEL(inputImage, isf_FragNormCoord); 19 | gl_FragColor = test; 20 | } 21 | -------------------------------------------------------------------------------- /tests/bin/data/Test-IMG_PIXEL.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of IMG_PIXEL to fetch a pixel color from an input", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | } 13 | ] 14 | }*/ 15 | 16 | void main() 17 | { 18 | vec4 test = IMG_PIXEL(inputImage, gl_FragCoord.xy); 19 | gl_FragColor = test; 20 | } 21 | -------------------------------------------------------------------------------- /tests/bin/data/Test-IMG_THIS_NORM_PIXEL.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of IMG_THIS_NORM_PIXEL to fetch a pixel color from an input", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | } 13 | ] 14 | }*/ 15 | 16 | void main() 17 | { 18 | vec4 test = IMG_THIS_NORM_PIXEL(inputImage); 19 | gl_FragColor = test; 20 | } 21 | -------------------------------------------------------------------------------- /tests/bin/data/Test-IMG_THIS_PIXEL.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of IMG_THIS_PIXEL to fetch a pixel color from an input", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | } 13 | ] 14 | }*/ 15 | 16 | void main() 17 | { 18 | vec4 test = IMG_THIS_PIXEL(inputImage); 19 | gl_FragColor = test; 20 | } 21 | -------------------------------------------------------------------------------- /tests/bin/data/Test-ImportedImage.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of multiple image-type inputs", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | } 13 | ], 14 | "IMPORTED": { 15 | "blendImage": { 16 | "PATH": "Hexagon.tiff" 17 | } 18 | } 19 | }*/ 20 | 21 | void main() 22 | { 23 | vec4 srcPixel = IMG_NORM_PIXEL(inputImage, isf_FragNormCoord); 24 | vec4 blendPixel = IMG_NORM_PIXEL(blendImage, isf_FragNormCoord); 25 | 26 | gl_FragColor = (srcPixel + blendPixel)/2.0; 27 | } 28 | -------------------------------------------------------------------------------- /tests/bin/data/Test-Long.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of long-type inputs as pop-up buttons to display either the red, green, or blue channel of an image", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | }, 13 | { 14 | "NAME": "longInputIsPopUpButton", 15 | "VALUES": [ 16 | 0, 17 | 1, 18 | 2 19 | ], 20 | "LABELS": [ 21 | "red", 22 | "green", 23 | "blue" 24 | ], 25 | "DEFAULT": 1, 26 | "TYPE": "long" 27 | } 28 | ] 29 | }*/ 30 | 31 | void main() 32 | { 33 | vec4 srcPixel = IMG_THIS_PIXEL(inputImage); 34 | if (longInputIsPopUpButton == 0) 35 | gl_FragColor = srcPixel.rrra; 36 | else if (longInputIsPopUpButton == 1) 37 | gl_FragColor = srcPixel.ggga; 38 | else if (longInputIsPopUpButton == 2) 39 | gl_FragColor = srcPixel.bbba; 40 | } 41 | -------------------------------------------------------------------------------- /tests/bin/data/Test-MultiPassRendering.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of two-pass rendering- the first pass renders to a persistent buffer which is substantially smaller than the res of the image being drawn. the second pass renders at the default requested size and scales up the image from the first pass", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | } 13 | ], 14 | "PASSES": [ 15 | { 16 | "TARGET":"bufferVariableNameA", 17 | "PERSISTENT": true, 18 | "WIDTH": "$WIDTH/16.0", 19 | "HEIGHT": "$HEIGHT/16.0" 20 | }, 21 | { 22 | 23 | } 24 | ] 25 | 26 | }*/ 27 | 28 | void main() 29 | { 30 | // first pass: read the "inputImage"- remember, we're drawing to the persistent buffer "bufferVariableNameA" on the first pass 31 | if (PASSINDEX == 0) { 32 | gl_FragColor = IMG_THIS_NORM_PIXEL(inputImage); 33 | } 34 | // second pass: read from "bufferVariableNameA". output looks chunky and low-res. 35 | else if (PASSINDEX == 1) { 36 | gl_FragColor = IMG_THIS_NORM_PIXEL(bufferVariableNameA); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/bin/data/Test-PersistentBuffer.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of a persistent buffer to create a motion-blur type effect. also demonstrates the simplest use of steps: a one-step rendering pass", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | }, 13 | { 14 | "NAME": "blurAmount", 15 | "TYPE": "float" 16 | } 17 | ], 18 | "PASSES": [ 19 | { 20 | "TARGET": "bufferVariableNameA", 21 | "PERSISTENT": true, 22 | "FLOAT": true 23 | } 24 | ] 25 | 26 | }*/ 27 | 28 | void main() 29 | { 30 | vec4 freshPixel = IMG_THIS_PIXEL(inputImage); 31 | vec4 stalePixel = IMG_THIS_PIXEL(bufferVariableNameA); 32 | gl_FragColor = mix(freshPixel,stalePixel,blurAmount); 33 | } 34 | -------------------------------------------------------------------------------- /tests/bin/data/Test-PersistentBufferDifferingSizes.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of two-pass rendering- the first pass renders to a persistent buffer which is substantially smaller than the res of the image being drawn. the second pass renders at the default requested size and scales up the image from the first pass", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | } 13 | ], 14 | "PASSES": [ 15 | { 16 | "TARGET":"bufferVariableNameA", 17 | "PERSISTENT": true, 18 | "FLOAT": true, 19 | "WIDTH": "$WIDTH/16.0", 20 | "HEIGHT": "$HEIGHT/16.0" 21 | }, 22 | { 23 | 24 | } 25 | ] 26 | 27 | }*/ 28 | 29 | void main() 30 | { 31 | // first pass: read the "inputImage"- remember, we're drawing to the persistent buffer "bufferVariableNameA" on the first pass 32 | if (PASSINDEX == 0) { 33 | gl_FragColor = IMG_THIS_NORM_PIXEL(inputImage); 34 | } 35 | // second pass: read from "bufferVariableNameA". output looks chunky and low-res. 36 | else if (PASSINDEX == 1) { 37 | gl_FragColor = IMG_THIS_NORM_PIXEL(bufferVariableNameA); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/bin/data/Test-Point.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of a 2d point-type input", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | }, 13 | { 14 | "NAME": "location", 15 | "TYPE": "point2D", 16 | "DEFAULT": [ 17 | 0, 18 | 0 19 | ] 20 | }, 21 | { 22 | "NAME": "locationB", 23 | "TYPE": "point2D", 24 | "DEFAULT": [ 25 | 0, 26 | 0 27 | ], 28 | "MIN": [ 29 | 0, 30 | 0 31 | ], 32 | "MAX": [ 33 | 1920, 34 | 1080 35 | ] 36 | } 37 | ] 38 | }*/ 39 | 40 | void main() 41 | { 42 | vec4 srcPixel = IMG_THIS_PIXEL(inputImage); 43 | if (abs(gl_FragCoord.xy.x-location.x)<10.0 && abs(gl_FragCoord.xy.y-location.y)<10.0) 44 | gl_FragColor = vec4(1,1,1,1); 45 | else 46 | gl_FragColor = srcPixel; 47 | } 48 | -------------------------------------------------------------------------------- /tests/bin/data/Test-Sampler.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "demonstrates the use of multiple image-type inputs", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | }, 13 | { 14 | "NAME": "blendImage", 15 | "TYPE": "image" 16 | } 17 | ] 18 | }*/ 19 | 20 | void main() 21 | { 22 | // these two variable declarations are functionally identical (the only difference is that THIS_PIXEL is a non-dependent texture lookup) 23 | //vec4 srcPixel = IMG_PIXEL(inputImage, gl_FragCoord.xy); // returns a vec4 with the colors of the pixel in sampler "inputImage" at (non-normalized) texture coordinates "srcCoord" 24 | //vec4 srcPixel = IMG_THIS_PIXEL(inputImage); 25 | 26 | // these two variable declarations are also identical. though they behave similarly to the above declarations in this specific filter, NORM and non-NORM pixel lookups are fundamentally different and behave differently under other circumstances. 27 | //vec4 srcPixel = IMG_NORM_PIXEL(inputImage, isf_FragNormCoord); 28 | vec4 srcPixel = IMG_THIS_NORM_PIXEL(inputImage); 29 | 30 | vec4 blendPixel = IMG_THIS_NORM_PIXEL(blendImage); // returns a vec4 with the colors of the pixel in sampler "inputImage" at (normalized) texture coordinates "blendCoord". 31 | gl_FragColor = srcPixel/2.0 + blendPixel/2.0; 32 | } 33 | -------------------------------------------------------------------------------- /tests/bin/data/Test-TempBufferDifferingSizes.fs: -------------------------------------------------------------------------------- 1 | /*{ 2 | "DESCRIPTION": "same as TestPersistentBufferDifferingSizes, but uses a temp buffer instead of a persistent buffer", 3 | "CREDIT": "by zoidberg", 4 | "ISFVSN": "2.0", 5 | "CATEGORIES": [ 6 | "TEST-GLSL FX" 7 | ], 8 | "INPUTS": [ 9 | { 10 | "NAME": "inputImage", 11 | "TYPE": "image" 12 | } 13 | ], 14 | "PASSES": [ 15 | { 16 | "TARGET":"bufferVariableNameA", 17 | "WIDTH": "$WIDTH/16.0", 18 | "HEIGHT": "$HEIGHT/16.0" 19 | }, 20 | { 21 | "DESCRIPTION": "this empty pass is rendered at the same rez as whatever you are running the ISF filter at- the previous step rendered an image at one-sixteenth the res, so this step ensures that the output is full-size" 22 | } 23 | ] 24 | 25 | }*/ 26 | 27 | void main() 28 | { 29 | // first pass: read the "inputImage"- remember, we're drawing to the persistent buffer "bufferVariableNameA" on the first pass 30 | if (PASSINDEX == 0) { 31 | gl_FragColor = IMG_THIS_NORM_PIXEL(inputImage); 32 | } 33 | // second pass: read from "bufferVariableNameA". output looks chunky and low-res. 34 | else if (PASSINDEX == 1) { 35 | gl_FragColor = IMG_THIS_NORM_PIXEL(bufferVariableNameA); 36 | } 37 | } 38 | --------------------------------------------------------------------------------