orx icon indicating copy to clipboard operation
orx copied to clipboard

[orx-shadestyle] Combining two gradients produces GLSL conflicts

Open hamoid opened this issue 5 months ago • 2 comments

Operating System

Linux

OPENRNDR version

b02ca0a

ORX version

af8c5e2

Java version (if applicable)

No response

Describe the bug

Error:

GLSL compilation problems in
 0(134) : error C1038: declaration of "g_fill" conflicts with previous declaration at 0(81)
0(178) : error C1013: function "gradientFunction" is already defined at 0(125)
0(184) : error C1013: function "domainWarp" is already defined at 0(131)
0(185) : error C1013: function "levelWarp" is already defined at 0(132)

Part of the gradient GLSL is already guarded by #ifndef blocks, but not these lines:

float gradientFunction(vec2 coord) {
     vec2 d0 = coord - p_center;
     float d0l = length(d0);
     float f = d0l / p_radius;
     return f;
}
vec2 domainWarp(vec2 coord) { return coord; }
float levelWarp(vec2 coord, float level) { return level; }

vec4 g_fill;

Steps to reproduce the bug

Example code:

        val g2 = gradient<ColorRGBa> {
            stops[0.0] = ColorRGBa.TRANSPARENT
            stops[1.0] = ColorRGBa.WHITE
            radial {
                center = Vector2(0.5)
            }
        } + gradient<ColorRGBa> {
            stops[0.0] = ColorRGBa.YELLOW
            stops[1.0] = ColorRGBa.BLUE_STEEL
            radial {
                center = Vector2(0.5)
            }
        }

hamoid avatar Aug 08 '25 14:08 hamoid