diff --git a/src/operators/output/customRender.tox b/src/operators/output/customRender.tox index e0c9a16cd..1a6f4c6a5 100644 Binary files a/src/operators/output/customRender.tox and b/src/operators/output/customRender.tox differ diff --git a/src/operators/output/customRender.yaml b/src/operators/output/customRender.yaml index 0e0eca1b0..fcccfb3a4 100644 --- a/src/operators/output/customRender.yaml +++ b/src/operators/output/customRender.yaml @@ -1,7 +1,7 @@ !rop meta: !meta opType: raytk.operators.output.customRender - opVersion: '15' + opVersion: '16' opStatus: alpha paramPages: - !page @@ -183,45 +183,15 @@ opDef: !def enable: true typeSpec: !ropTypes coordType: !coordT - Allcoordtype: !expr - expr: parent().par.Coordtype == 'auto' - Coordtypefloat: !expr - expr: parent().par.Coordtype == 'float' - Coordtypevec2: !expr - expr: parent().par.Coordtype == 'vec2' - Coordtypevec3: !expr - expr: parent().par.Coordtype == 'vec3' + Allcoordtype: true contextType: !contextT - Allcontexttype: !expr - expr: parent().par.Contexttype == 'auto' - Contexttypecontext: !expr - expr: parent().par.Contexttype == 'Context' - Contexttypematerialcontext: !expr - expr: parent().par.Contexttype == 'MaterialContext' - Contexttypecameracontext: !expr - expr: parent().par.Contexttype == 'CameraContext' - Contexttypelightcontext: !expr - expr: parent().par.Contexttype == 'LightContext' - Contexttyperaycontext: !expr - expr: parent().par.Contexttype == 'RayContext' + Allcontexttype: true returnType: !returnT - Returntypesdf: !expr - expr: parent().par.Returntype == 'Sdf' - Returntypefloat: !expr - expr: parent().par.Returntype == 'float' - Returntypevec4: !expr - expr: parent().par.Returntype == 'vec4' - Returntyperay: !expr - expr: parent().par.Returntype == 'Ray' - Returntypelight: !expr - expr: parent().par.Returntype == 'Light' - function: !text - file: src/operators/output/customRender_function.glsl - name: functionTemplate + Allreturntype: true + function: functionTemplate displayCategory: Render inputs: - !input - Required: true coordType: !coordT Allcoordtype: true contextType: !contextT diff --git a/src/operators/output/customRender_body.glsl b/src/operators/output/customRender_body.glsl new file mode 100644 index 000000000..9b7435337 --- /dev/null +++ b/src/operators/output/customRender_body.glsl @@ -0,0 +1,17 @@ +void main() { + #ifdef RAYTK_HAS_INIT + init(); + #endif + initOutputs(); + + vec2 resolution = uTDOutputInfo.res.zw; + vec2 fragCoord = vUV.st;//*resolution; + fragCoord.x *= uTDOutputInfo.res.z/uTDOutputInfo.res.w; + vec2 p = fragCoord*2. - vec2(1.); + + pushStage(RAYTK_STAGE_PRIMARY); + + Context ctx = createDefaultContext(); + + customMain(fragCoord, p, ctx); +} \ No newline at end of file diff --git a/src/operators/output/customRender_defaultBodyTemplate.glsl b/src/operators/output/customRender_defaultBodyTemplate.glsl deleted file mode 100644 index 53c7f1b0a..000000000 --- a/src/operators/output/customRender_defaultBodyTemplate.glsl +++ /dev/null @@ -1,25 +0,0 @@ -void main() { - #ifdef RAYTK_HAS_INIT - init(); - #endif - initOutputs(); - - vec2 resolution = uTDOutputInfo.res.zw; - vec2 fragCoord = vUV.st;//*resolution; - fragCoord.x *= uTDOutputInfo.res.z/uTDOutputInfo.res.w; - vec2 p = fragCoord*2. - vec2(1.); - - pushStage(RAYTK_STAGE_PRIMARY); - - #if defined(THIS_RETURN_TYPE_float) - vec4 color = vec4(thismap(p, createDefaultContext())); - #elif defined(THIS_RETURN_TYPE_vec4) - vec4 color = thismap(p, createDefaultContext()); - #else - vec4 color = vec4(0.); - #endif - - #ifdef OUTPUT_COLOR - colorOut = TDOutputSwizzle(color); - #endif -} \ No newline at end of file diff --git a/src/operators/output/customRender_defaultMainCode.glsl b/src/operators/output/customRender_defaultMainCode.glsl new file mode 100644 index 000000000..05d6c4233 --- /dev/null +++ b/src/operators/output/customRender_defaultMainCode.glsl @@ -0,0 +1,6 @@ +void customMain(vec2 fragCoord, vec2 p, Context ctx) { + vec4 res1 = fillToVec4(thismap(p, ctx)); + #ifdef OUTPUT_COLOR + colorOut = TDOutputSwizzle(res1); + #endif +} diff --git a/src/operators/output/customRender_function.glsl b/src/operators/output/customRender_function.glsl index 12a24cb71..d31e262ce 100644 --- a/src/operators/output/customRender_function.glsl +++ b/src/operators/output/customRender_function.glsl @@ -1,3 +1,8 @@ ReturnT thismap(CoordT p, ContextT ctx) { - return inputOp1(p, ctx); + ReturnT res; + initDefVal(res); + #ifdef THIS_HAS_INPUT_1 + res = inputOp1(p, ctx); + #endif + return res; } \ No newline at end of file diff --git a/src/operators/output/customRender_utils.py b/src/operators/output/customRender_utils.py index 828580c1e..aaa14aa09 100644 --- a/src/operators/output/customRender_utils.py +++ b/src/operators/output/customRender_utils.py @@ -5,10 +5,10 @@ def onCreateParPulse(action: str): o = parent() - if action == 'Createbodytemplate': - par = o.par.Bodytemplate - template = op('default_body_template') - suffix = '_body' + if action == 'Createmaincode': + par = o.par.Maincode + template = op('defaultMainCode') + suffix = '_main' offsetX = 0 desc = 'shader body' opType = textDAT