--[[ Absolute Value Viewshader v1.01 Sep 3 2009 --]] --[[ Written by Chad Capeland (ccapeland[REMOVE-ME]@anatomicaltravel.com) Copyright (c) 2009 Anatomical Travelogue LLC (http://www.anatomicaltravel.com/research) The authors hereby grant permission to use, copy, and distribute this software and its documentation for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions. Additionally, the authors grant permission to modify this software and its documentation for any purpose, provided that such modifications are not distributed without the explicit consent of the authors and that existing copyright notices are retained in all copies. IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. --]] shader = [[ struct AbsVSFuse : ViewShader { ViewShader source; // need this line void ShadePixel(inout FuPixel f) { source.ShadePixel(f); // get source pixel f.Color.rgba = abs(f.Color.rgba); // absolute value } }; ]] -- regnode FuRegisterClass("AbsVSFuse", CT_ViewLUTPlugin, { -- ID must be unique REGS_Name = "Absolute Value ViewShader", }) -- Called on creation. Add any controls here. function Create() end -- This is called when the shader is created -- img may be nil function SetupShader(req, img) local vs = ViewShader("AbsVSFuse", shader); -- pass struct name and shader string return vs; end -- This is called every display refresh -- img may be nil function SetupParams(req, vs, img) return true; end