--[[--/* Lunchbreak.fuse Based on https://www.shadertoy.com/view/flGyWc a WebGL shader created by nabr. Converted to DCTL and embeddet into a Lua Fuse by JiPi (https://www.youtube.com/c/JiPi_YT). Place this file in your Fusion's and/or DaVinci Resolve's 'Fuses/' folder to use it. */--]]-- -- /* local ShaderFuse = require("Shaderfuse/ShaderFuse") ShaderFuse.init() -- // ------------------------------------------------------------------------ -- // Registry declaration -- // ------------------------------------------------------------------------ FuRegisterClass(ShaderFuse.FuRegister.Name, CT_SourceTool, { ShaderFuse.FuRegister.Attributes, REG_NoObjMatCtrls = true, REG_NoMotionBlurCtrls = true, REG_Source_GlobalCtrls = false, REG_Source_SizeCtrls = true, REG_Source_AspectCtrls = true, REG_Source_DepthCtrls = true, REG_OpNoMask = true, REG_TimeVariant = true, }) -- // ------------------------------------------------------------------------ -- // DCTL kernel parameters -- // ------------------------------------------------------------------------ -- */ ShaderParameters = [[ float iResolution[2]; float iTime; float iMouse[4]; float ColorOut[4]; float ViewDXY[2]; float ViewDZ; float ViewXY[2]; float ViewZ; float crtfct; int width,height; int compOrder; ]] -- /* -- // ------------------------------------------------------------------------ -- DCTL kernel compatibility code -- // ------------------------------------------------------------------------ -- */ ShaderCompatibilityCode = [[ #if defined(DEVICE_IS_METAL) #define in #define out thread #define inout thread #else #define in #define out #define inout #endif #undef USE_NATIVE_METAL_IMPL #undef USE_NATIVE_CUDA_IMPL #undef USE_NATIVE_OPENCL_IMPL // 0 to use the generic implementations; 1 for Metal, OpenCL, Cuda specific code if existing #if 1 #if defined(DEVICE_IS_METAL) #define USE_NATIVE_METAL_IMPL 1 #elif defined(DEVICE_IS_CUDA) #define USE_NATIVE_CUDA_IMPL 1 #elif defined(DEVICE_IS_OPENCL) #define USE_NATIVE_OPENCL_IMPL 1 #endif #endif #if defined(USE_NATIVE_METAL_IMPL) #define swi2(A,a,b) (A).a##b #define swi3(A,a,b,c) (A).a##b##c #define swi2S(a,b,c,d) a.b##c = d #else #define swi2(A,a,b) to_float2((A).a,(A).b) #define swi3(A,a,b,c) to_float3((A).a,(A).b,(A).c) #define swi2S(a,b,c,d) {float2 tmp = d; (a).b = tmp.x; (a).c = tmp.y;} #endif // ---------------------------------------------------------------------------------------------------------- // mat3 implementation // ---------------------------------------------------------------------------------------------------------- #if defined(USE_NATIVE_METAL_IMPL) typedef float3x3 mat3; __DEVICE__ inline mat3 to_mat3( float a, float b, float c, float d, float e, float f, float g, float h, float i) { return mat3(a,b,c,d,e,f,g,h,i); } __DEVICE__ inline float3 mul_mat3_f3( mat3 B, float3 A) { return (B*A); } __DEVICE__ inline mat3 mul_mat3_mat3( mat3 A, mat3 B) { return (A*B); } #else typedef struct { float3 r0; float3 r1; float3 r2; } mat3; __DEVICE__ inline mat3 to_mat3( float a, float b, float c, float d, float e, float f, float g, float h, float i) { mat3 t; t.r0.x = a; t.r0.y = b; t.r0.z = c; t.r1.x = d; t.r1.y = e; t.r1.z = f; t.r2.x = g; t.r2.y = h; t.r2.z = i; return t; } __DEVICE__ inline float3 mul_mat3_f3( mat3 B, float3 A) { float3 C; C.x = A.x * B.r0.x + A.y * B.r1.x + A.z * B.r2.x; C.y = A.x * B.r0.y + A.y * B.r1.y + A.z * B.r2.y; C.z = A.x * B.r0.z + A.y * B.r1.z + A.z * B.r2.z; return C; } __DEVICE__ mat3 mul_mat3_mat3( mat3 B, mat3 A) { float r[3][3]; float a[3][3] = {{A.r0.x, A.r0.y, A.r0.z}, {A.r1.x, A.r1.y, A.r1.z}, {A.r2.x, A.r2.y, A.r2.z}}; float b[3][3] = {{B.r0.x, B.r0.y, B.r0.z}, {B.r1.x, B.r1.y, B.r1.z}, {B.r2.x, B.r2.y, B.r2.z}}; for( int i = 0; i < 3; ++i) { for( int j = 0; j < 3; ++j) { r[i][j] = 0.0f; for( int k = 0; k < 3; ++k) { r[i][j] = r[i][j] + a[i][k] * b[k][j]; } } } mat3 R = to_mat3(r[0][0], r[0][1], r[0][2], r[1][0], r[1][1], r[1][2], r[2][0], r[2][1], r[2][2]); return R; } #endif // end of mat3 implementation #if defined(USE_NATIVE_METAL_IMPL) #define fract_f2(A) fract(A) #define mod_f(a,b) fmod((a),(b)) #define abs_f3(a) _fabs(a) #define pow_f3(a,b) pow(a,b) #else #if defined(USE_NATIVE_OPENCL_IMPL) #define reflect(I,N) (I-2.0f*dot(N,I)*N) #define fract(a) ((a)-_floor(a)) // oder Pointer bauen: gentype fract(gentype x, gentype *itpr) #define fract_f2(A) to_float2(fract((A).x),fract((A).y)) #define mod_f(a,b) _fmod(a,b) #define abs_f3(a) fabs(a) #define pow_f3(a,b) pow(a,b) #else // Generic #if defined(DEVICE_IS_OPENCL) __DEVICE__ float3 reflect(float3 I, float3 N) {return I - 2.0f * dot(N, I) * N;} #endif #define fract(a) ((a)-_floor(a)) #define fract_f2(A) to_float2(fract((A).x),fract((A).y)) #define mod_f(a,b) ((a)-(b)*_floor((a)/(b))) #define abs_f3(a) to_float3(_fabs((a).x), _fabs((a).y),_fabs((a).z)) #define pow_f3(a,b) to_float3(_powf((a).x,(b).x),_powf((a).y,(b).y),_powf((a).z,(b).z)) #endif #endif ]] -- /* -- // ------------------------------------------------------------------------ -- DCTL kernel implementation -- // ------------------------------------------------------------------------ -- */ ShaderKernelCode = [[ // ---------------------------------------------------------------------------------- // - Common - // ---------------------------------------------------------------------------------- #define texture(ch,uv) _tex2DVecN(ch, (uv).x, (uv).y, 15) // ---------------------------------------------------------------------------------- // - Image - // ---------------------------------------------------------------------------------- // Connect Image 'Texture: Font 1' to iChannel3 #define pi 3.1415926535897f #define dmin(a, b) ((a.x < b.x) ? a : b) #define minkowski(v, m) _powf(dot(pow_f3(v, v * 0.0f + m), v * 0.0f + 1.0f), 1.0f / m) //#define _char(p,C)(((p.x<0.0f||p.x>1.0f||p.y<0.0f||p.y>1.0f))?to_float4(0,0,0,1e5f):textureGrad(iChannel3,p/16.0f+fract_f2(to_float2(C,15-C/16)/16.0f),dFdx(p/16.0f),dFdy(p/16.0f))) #define _char(p,C)(((p.x<0.0f||p.x>1.0f||p.y<0.0f||p.y>1.0f))?to_float4(0,0,0,1e5f):texture(iChannel0,p/16.0f+fract_f2(to_float2(C,15-C/16)/16.0f))) __DEVICE__ float2 pR(in float2 p, float a) { p = _cosf(a) * p + _sinf(a) * to_float2(p.y, -p.x); return (swi2(p,x,y)); } __DEVICE__ float3 crt( in float3 p, float crtfct) { float r = 0.5f * 6.2831f / 6.0f * crtfct; float pa = r - _atan2f(p.x, p.y); pa += mod_f( pa, -2.0f * r ); return to_float3_aw(pR(swi2(p,x,y), pa ), p.z); } __DEVICE__ float2 f(float3 p, float iTime, float crtfct) { float3 v_bb = p; swi2S(v_bb,x,z, pR(swi2(v_bb,x,z), iTime)); return dmin(to_float2(minkowski(abs_f3(abs_f3(crt(abs_f3(p) - to_float3(1, 0.1f, 3.0f + mod_f(_floor(2.0f * iTime), 3.0f)), crtfct)) - to_float3(0.7f + mod_f(_floor(iTime), 3.0f), 4.2f, 1.3f)), 1.55f) - 1.25f, 3.0f), to_float2(minkowski(abs_f3(v_bb), 3.05f) - (0.9f + fract(0.2f * _floor(iTime))), 5)); } __DEVICE__ float3 N(in float3 pos, float iTime, float crtfct) { const float3 eps = to_float3(0.001f, 0, 0); return normalize(to_float3(f(pos + swi3(eps,x,y,y), iTime, crtfct).x - f(pos - swi3(eps,x,y,y), iTime, crtfct).x, f(pos + swi3(eps,y,x,y), iTime, crtfct).x - f(pos - swi3(eps,y,x,y), iTime, crtfct).x, f(pos + swi3(eps,y,y,x), iTime, crtfct).x - f(pos - swi3(eps,y,y,x), iTime, crtfct).x)); } __KERNEL__ void LunchbreakFuse(__CONSTANTREF__ Params* params, __TEXTURE2D__ iChannel0, __TEXTURE2D_WRITE__ destinationTexture) { DEFINE_KERNEL_ITERATORS_XY(fusion_x, fusion_y); if (fusion_x >= params->width || fusion_y >= params->height) return; float2 iResolution = to_float2(params->iResolution[0], params->iResolution[1]); float iTime = params->iTime; float4 iMouse = to_float4(params->iMouse[0],params->iMouse[1],params->iMouse[2],params->iMouse[3]); float4 fragColor = to_float4_s(0.0f); float2 fragCoord = to_float2(fusion_x,fusion_y); float4 ColorOut = to_float4(params->ColorOut[0], params->ColorOut[1], params->ColorOut[2], params->ColorOut[3]); float2 ViewDXY = to_float2(params->ViewDXY[0], params->ViewDXY[1]); float ViewDZ = params->ViewDZ; float2 ViewXY = to_float2(params->ViewXY[0], params->ViewXY[1]); float ViewZ = params->ViewZ; float crtfct = params->crtfct; // -------- float2 d = to_float2_s(0.0f), R = iResolution, st = -1.0f + 2.0f * fragCoord / R, U = st; U.x*=R.x/R.y; float y = 0.0f; for(int i = 0;i<12;i++){ // s o u n d d e m o //int par[] = {115,111,117, 110, 100, 32, 100, 101, 109, 111}; // Originaltext // n o s o u n d 58, 42, 41} int par[] = {110,111,32,115,111,117,110,100, 32, 58, 45, 41}; y += (_char(12.0f*to_float2(U.x+1.75f , U.y+0.85f), par[(int)(i)]).x); U.x-=0.0549f; } float h = 0.0f,aspct = _fmaxf(R.x / R.y, R.y / R.x); float3 rd = to_float3_s(0.0f), p = to_float3_s(0.0f), c = to_float3_s(0.0f), ro = to_float3(fract(iTime) , fract(iTime) , 7.0f) + to_float3_aw(ViewXY, ViewZ), gc = normalize( - ro ), u = normalize(cross(gc, to_float3(0, 1, 0))), v = normalize(cross(u, gc)); u *= _tanf(1.2f); v *= _tanf(1.2f) / aspct; rd = normalize(gc + st.x * u + st.y * v + to_float3_aw(ViewDXY, ViewDZ)); //############### 3D Mouse-Rotation des Objektes ############## float crz = (iMouse.x - iResolution.x / 2.0f) / iResolution.x * pi; float crx = (iMouse.y - iResolution.y / 2.0f) / iResolution.y * pi; mat3 m = mul_mat3_mat3(to_mat3(_cosf(crz), 0.0f, _sinf(crz), 0.0f, 1.0f, 0.0f, -_sinf(crz), 0.0f, _cosf(crz)) , to_mat3(1.0f, 0.0f, 0.0f, 0.0f, _cosf(crx), _sinf(crx), 0.0f, -_sinf(crx), _cosf(crx))); if(iMouse.z > 0.0f) { ro = mul_mat3_f3(m , ro); rd = mul_mat3_f3(m , rd); } //############################################################# p = ro; c = (1.0f-y)*to_float3_s(1); h = 1.0f; d = to_float2(0.0f, 0.0f); for (int i = 0; i < 32; ++i) { p = ro + rd * h; d = f(p, iTime, crtfct); if (_fabs(d.x) < 0.001f) { float fr = 1e-3f; float3 n = N(p, iTime, crtfct); if (d.y == 3.0f) { fr = _sqrtf(1.0f - dot(-rd, n)); c *= fr; ro = p + n * 0.01f; rd = reflect(rd, n); h = 0.0f; } if (d.y == 5.0f) { fr = 1.0f - dot(-rd, n); c *= fr; ro = p + n * 0.001f; rd = reflect(rd, n); h = 0.0f; } } h += d.x; } fragColor = to_float4_aw(c, 1); fragColor = to_float4_aw(swi3(fragColor,x,y,z) * (swi3(ColorOut,x,y,z) + 0.5f), ColorOut.w == 0.0 ? fragColor.w : ColorOut.w); _tex2DVec4Write(destinationTexture, fusion_x, fusion_y, fragColor); } ]] -- /* -- // ------------------------------------------------------------------------ -- // Create -- // ------------------------------------------------------------------------ function Create() ShaderFuse.begin_create() ----- Inspector Panel Controls -- Speed Slider InFrequency = self:AddInput("Speedup", "speed", { LINKID_DataType = "Number", INPID_InputControl = "SliderControl", INP_Default = 1.0, INP_MinScale = 0.0, INP_MaxScale = 5.0, SLCS_LowName = "stop", SLCS_HighName = "5x", }) -- iMouse Controls InMouseXY = self:AddInput("iMouse.xy", "iMouseXY", { LINKID_DataType = "Point", INPID_InputControl = "OffsetControl", INP_DoNotifyChanged = false, --INP_Passive = true, INPID_PreviewControl = "CrosshairControl", }) InMouseZW = self:AddInput("iMouse.zw", "iMouseZW", { LINKID_DataType = "Point", INPID_InputControl = "OffsetControl", INP_DoNotifyChanged = false, --INP_Passive = true, INPID_PreviewControl = "CrosshairControl", INP_Disabled = true, }) InMouseDrag = self:AddInput("Mouse Button Pressed", "iMouseClick", { LINKID_DataType = "Number", INPID_InputControl = "CheckboxControl", INP_DoNotifyChanged = false, --INP_Passive = true, INP_MinScale = 0, INP_MaxScale = 1, INP_Default = 0, }) self:BeginControlNest("ColorOut", "ColorOut", true, {}) ctrl_grp_cnt = (ctrl_grp_cnt==nil) and 1 or (ctrl_grp_cnt+1) attrs = { ICS_Name = "ColorOut", LINKID_DataType = "Number", INPID_InputControl = "ColorControl", INP_MinScale = 0.0, INP_MaxScale = 1.0, IC_ControlGroup = ctrl_grp_cnt, } InColorOutColorR = self:AddInput("Red", "ColorOutRed", { INP_Default = 0.5, IC_ControlID = 0, attrs}) InColorOutColorG = self:AddInput("Green", "ColorOutGreen", { INP_Default = 0.5, IC_ControlID = 1, attrs}) InColorOutColorB = self:AddInput("Blue", "ColorOutBlue", { INP_Default = 0.5, IC_ControlID = 2, attrs}) InColorOutColorA = self:AddInput("Alpha", "ColorOutAlpha", { INP_Default = 1.0, IC_ControlID = 3, attrs}) self:EndControlNest() InViewDXYPoint = self:AddInput("ViewDXY", "ViewDXY", { LINKID_DataType = "Point", INPID_InputControl = "OffsetControl", INPID_PreviewControl = "CrosshairControl", INP_DefaultX = 0.0, INP_DefaultY = 0.0, }) InViewDZSlider = self:AddInput("ViewDZ", "ViewDZ", { LINKID_DataType = "Number", INPID_InputControl = "SliderControl", INP_MinScale = -10.0, INP_MaxScale = 10.0, INP_Default = 0.0, }) InViewXYPoint = self:AddInput("ViewXY", "ViewXY", { LINKID_DataType = "Point", INPID_InputControl = "OffsetControl", INPID_PreviewControl = "CrosshairControl", INP_DefaultX = 0.0, INP_DefaultY = 0.0, }) InViewZSlider = self:AddInput("ViewZ", "ViewZ", { LINKID_DataType = "Number", INPID_InputControl = "SliderControl", INP_MinScale = -10.0, INP_MaxScale = 10.0, INP_Default = 0.0, }) IncrtfctSlider = self:AddInput("crtfct", "crtfct", { LINKID_DataType = "Number", INPID_InputControl = "SliderControl", INP_MinScale = -2.0, INP_MaxScale = 2.0, INP_Default = 1.0, }) Sep3 = self:AddInput(string.rep("_", 152), "Separator3", { LINKID_DataType = "Text", INPID_InputControl = "LabelControl", INP_External = false, INP_Passive = true, IC_Visible = true, INP_DoNotifyChanged = true, IC_NoLabel = true, }) InEdges = self:AddInput("Edges", "Edges", { LINKID_DataType = "Number", INPID_InputControl = "MultiButtonControl", INP_Default = 3.0, INP_Integer = true, INP_DoNotifyChanged = true, INP_External = false, MBTNC_ForceButtons = true, INP_MinScale = 0, INP_MaxScale = 3, INP_MinAllowed = 0, INP_MaxAllowed = 3, MBTNC_ShowBasicButton = true, MBTNC_StretchToFit = false, --true, MBTNC_ShowToolTip = true, { MBTNC_AddButton = "Canvas", MBTNCD_ButtonWidth = 4/16, }, { MBTNC_AddButton = "Wrap",MBTNCD_ButtonWidth = 3/16, }, { MBTNC_AddButton = "Duplicate", MBTNCD_ButtonWidth = 5/16, }, { MBTNC_AddButton = "Mirror", MBTNCD_ButtonWidth = 4/16, }, }) ----- Size & Depth InSize = self:AddInput("Size", "Size_Fuse", { LINKID_DataType = "Number", INPID_InputControl = "ComboControl", INP_DoNotifyChanged = true, INP_Default = 0, INP_Integer = true, ICD_Width = 1, { CCS_AddString = "Default", }, { CCS_AddString = "Manually", }, { CCS_AddString = "Image0", }, { CCS_AddString = "1920x1080", }, { CCS_AddString = "1200x675", }, { CCS_AddString = "800x450", }, { CCS_AddString = "640x360", }, CC_LabelPosition = "Horizontal", ICS_ControlPage = "Image", }) InWidth = self:AddInput("Width", "_Width", { LINKID_DataType = "Number", INPID_InputControl = "SliderControl", INP_Default = 1920, INP_Integer = true, INP_MinScale = 0, INP_MaxScale = 4096, }) InHeight = self:AddInput("Height", "_Height", { LINKID_DataType = "Number", INPID_InputControl = "SliderControl", INP_Default = 1080, INP_Integer = true, INP_MinScale = 0, INP_MaxScale = 4096, }) InDepth = self:AddInput("Depth_Fuse", "Depth_Fuse", { LINKID_DataType = "Number", INPID_InputControl = "ComboControl", INP_DoNotifyChanged = true, INP_Default = 0, INP_Integer = true, ICD_Width = 1, { CCS_AddString = "Default", }, { CCS_AddString = "int8", }, { CCS_AddString = "int16", }, { CCS_AddString = "float16", }, { CCS_AddString = "float32", }, CC_LabelPosition = "Horizontal", ICS_ControlPage = "Image", }) InMyWidth = self:FindInput("Width") InMyWidth:SetAttrs({ IC_Visible = false }) InMyHeight = self:FindInput("Height") InMyHeight:SetAttrs({ IC_Visible = false }) InMyDepth = self:FindInput("Depth") InMyDepth:SetAttrs({ IC_Visible = false }) ----- In/Out InChannel0 = self:AddInput( "iChannel0", "iChannel0", { LINKID_DataType = "Image", LINK_Main = 1, INP_Required = false }) OutImage = self:AddOutput("Output", "Output", { LINKID_DataType = "Image", LINK_Main = 1, }) ShaderFuse.end_create() end -- // ------------------------------------------------------------------------ -- // Process -- // ------------------------------------------------------------------------ function DefineEdges(edges, nodeX) --This gets the value of our input image for us to modify inside the kernel if edges == 0 then nodeX:AddSampler("RowSampler", TEX_FILTER_MODE_LINEAR,TEX_ADDRESS_MODE_BORDER, TEX_NORMALIZED_COORDS_TRUE) elseif edges == 1 then nodeX:AddSampler("RowSampler", TEX_FILTER_MODE_LINEAR,TEX_ADDRESS_MODE_WRAP, TEX_NORMALIZED_COORDS_TRUE) elseif edges == 2 then nodeX:AddSampler("RowSampler", TEX_FILTER_MODE_LINEAR,TEX_ADDRESS_MODE_DUPLICATE, TEX_NORMALIZED_COORDS_TRUE) elseif edges == 3 then nodeX:AddSampler("RowSampler", TEX_FILTER_MODE_LINEAR,TEX_ADDRESS_MODE_MIRROR, TEX_NORMALIZED_COORDS_TRUE) elseif edges == 4 then --print("Sampler 4") end end function Process(req) -- Imagesize and Depth if (InSize:GetValue(req).Value >= 1) then if (InSize:GetValue(req).Value == 2) then if (InChannel0:GetValue(req) ~= nil) then Width = InChannel0:GetValue(req).Width Height = InChannel0:GetValue(req).Height end else Width = InWidth:GetValue(req).Value Height = InHeight:GetValue(req).Value end end -- Alle ( int und float ) if (InDepth:GetValue(req).Value > 0) then if InDepth:GetValue(req).Value == 1 then SourceDepth = 5 else if InDepth:GetValue(req).Value == 2 then SourceDepth = 6 else if InDepth:GetValue(req).Value == 3 then SourceDepth = 7 else SourceDepth = 8 end end end end local imgattrs = { IMG_Document = self.Comp, { IMG_Channel = "Red", }, { IMG_Channel = "Green", }, { IMG_Channel = "Blue", }, { IMG_Channel = "Alpha", }, IMG_Width = Width, IMG_Height = Height, IMG_XScale = XAspect, IMG_YScale = YAspect, IMAT_OriginalWidth = realwidth, -- nil !?! IMAT_OriginalHeight = realheight, -- nil !?! IMG_Quality = not req:IsQuick(), IMG_MotionBlurQuality = not req:IsNoMotionBlur(), IMG_DeferAlloc = true, IMG_ProxyScale = ( (not req:IsStampOnly()) and 1 or nil), IMG_Depth = ( (SourceDepth~=0) and SourceDepth or nil ) } local dst = Image(imgattrs) local black = Pixel({R=0,G=0,B=0,A=0}) dst:Fill(black) if req:IsPreCalc() then local out = Image({IMG_Like = dst, IMG_NoData = true}) OutImage:Set(req, out) return end node = DVIPComputeNode(req, "LunchbreakFuse", ShaderCompatibilityCode..ShaderKernelCode, "Params", ShaderParameters ) -- Extern texture or create a new one iChannel0 = InChannel0:GetValue(req) if iChannel0==nil then iChannel0 = Image(imgattrs) iChannel0:Fill(black) end -- DCTL parameters local framerate = self.Comp:GetPrefs("Comp.FrameFormat.Rate") local params = {} params = node:GetParamBlock(ShaderParameters) params.iResolution[0] = dst.Width params.iResolution[1] = dst.Height params.iTime = (req.Time / framerate) * InFrequency:GetValue(req).Value -- iMouse local mouse_xy = InMouseXY:GetValue(req) local mouse_zw = InMouseZW:GetValue(req) params.iMouse[0] = mouse_xy.X params.iMouse[1] = mouse_xy.Y params.iMouse[2] = mouse_zw.X params.iMouse[3] = mouse_zw.Y if InMouseDrag:GetValue(req).Value ~= 0 then if params.iMouse[2]==-1 and params.iMouse[3]==-1 then params.iMouse[2]=params.iMouse[0] params.iMouse[3]=params.iMouse[1] end else params.iMouse[2] = -1 params.iMouse[3] = -1 end if mouse_zw.X ~= params.iMouse[2] or mouse_zw.Y ~= params.iMouse[3] then InMouseZW:SetAttrs({INP_Disabled=false}) InMouseZW:SetSource(Point(params.iMouse[2],params.iMouse[3]),0,0) InMouseZW:SetAttrs({INP_Disabled=true}) end params.iMouse[0] = params.iMouse[0] * Width params.iMouse[1] = params.iMouse[1] * Height if params.iMouse[2] == -1 and params.iMouse[3] == -1 then params.iMouse[2] = 0 params.iMouse[3] = 0 else params.iMouse[2] = params.iMouse[2] * Width params.iMouse[3] = params.iMouse[3] * Height end params.ColorOut = { InColorOutColorR:GetValue(req).Value, InColorOutColorG:GetValue(req).Value, InColorOutColorB:GetValue(req).Value,InColorOutColorA:GetValue(req).Value } params.ViewDXY = {InViewDXYPoint:GetValue(req).X,InViewDXYPoint:GetValue(req).Y} params.ViewDZ = InViewDZSlider:GetValue(req).Value params.ViewXY = {InViewXYPoint:GetValue(req).X,InViewXYPoint:GetValue(req).Y} params.ViewZ = InViewZSlider:GetValue(req).Value params.crtfct = IncrtfctSlider:GetValue(req).Value -- Resolution params.width = dst.Width params.height = dst.Height -- Per channel time and resolution local edges = InEdges:GetValue(req).Value -- Set parameters and add I/O node:SetParamBlock(params) --node:AddSampler("RowSampler", TEX_FILTER_MODE_LINEAR,TEX_ADDRESS_MODE_MIRROR, TEX_NORMALIZED_COORDS_TRUE) DefineEdges(edges, node) node:AddInput("iChannel0",iChannel0) -- TODO: add a better channel name node:AddOutput("dst", dst) local ok = node:RunSession(req) if (not ok) then dst = nil dump(node:GetErrorLog()) end OutImage:Set(req,dst) collectgarbage(); end -- // ------------------------------------------------------------------------ -- // Callback -- // ------------------------------------------------------------------------ function NotifyChanged(inp, param, time) if (param ~= nil) then if inp == InSize then if param.Value == 1 then InWidth:SetAttrs({ IC_Visible = true }) InHeight:SetAttrs({ IC_Visible = true }) else InWidth:SetAttrs({ IC_Visible = false }) InHeight:SetAttrs({ IC_Visible = false }) end if param.Value == 3 then --1920x1080 InWidth:SetSource(Number(1920),0,0) InHeight:SetSource(Number(1080),0,0) end if param.Value == 4 then --1200x675 InWidth:SetSource(Number(1200),0,0) InHeight:SetSource(Number(675),0,0) end if param.Value == 5 then --800x450 InWidth:SetSource(Number(800),0,0) InHeight:SetSource(Number(450),0,0) end if param.Value == 6 then --640x360 InWidth:SetSource(Number(640),0,0) InHeight:SetSource(Number(360),0,0) end end end end -- */