Reply To: Attaching function keys to lava & ice script

Home Forums AR Sandbox Forum Attaching function keys to lava & ice script Reply To: Attaching function keys to lava & ice script

#115720
Oliver Kreylos
Keymaster

The first step is to create a shell script that will do the function you want, say copy a fragment program with lava over the standard fragment program:

#!/bin/bash

SHADERDIR=~/src/SARndbox-2.4/share/SARndbox-2.4/Shaders
cp SHADERDIR/Lava.fs SHADERDIR/SurfaceAddWaterColor.fs

You would call this “ToLava.sh” or something, store it in ~/src/SARndbox-2.4/bin, and make it executable:

chmod a+x ~/src/SARndbox-2.4/bin/ToLava.sh

Then you create a custom configuration file for SARndbox, as described in step 15 in the complete installation instructions. At the beginning of the “Tools” section, add “ScriptExecutorTool” to the tool class names, and bind a tool of that class to the key/button you want to use (L in this example):

section Vrui
    section Desktop
        ...
        section Tools
            toolClassNames += (ScriptExecutorTool)
            ...
            section DefaultTools
                ...
                section LavaTool
                    toolClass ScriptExecutorTool
                    bindings ((Mouse, l))
                    executablePathName /home/<username>/src/SARndbox-2.4/bin/ToLava.sh
                endsection
                ...
            endsection
            ...
        endsection
        ...
    endsection
    ...
endsection

Replace <username> with your actual user name.

You can create more of those tool binding section to bind other scripts to other keys/buttons, e.g., switching back to water.

Comments are closed.