Failed to compile #: 0:63(50): error: syntax error, unexpected NEW_IDENTIFIER, expecting '{' Shader source: 1 #version 330 core 2 struct Light{ 3 int type; 4 vec2 position; 5 vec4 dimensions; 6 vec3 color; 7 float intensity; 8 }; 9 ; 10 layout(shared) uniform Lights{ 11 Light[16] lights; 12 int count; 13 } lights; 14 uniform float global_illumination = 0.3; 15 16 vec3 add(vec3 a, vec3 b){ 17 return (a + b); 18 } 19 20 vec3 screen(vec3 a, vec3 b){ 21 return (1 - ((1 - a) * (1 - b))); 22 } 23 24 vec3 overlay(vec3 a, vec3 b){ 25 return (length(a) < 0.5)? (2 * (a * b)) :(1 - (2 * ((1 - a) * (1 - b)))); 26 } 27 28 vec3 soft_light(vec3 a, vec3 b){ 29 return (((1 - (2 * b)) * (a * a)) + (2 * (b * a))); 30 } 31 32 float point_light_sdf(vec2 position, vec4 dimensions){ 33 return (length(position) - dimensions.x); 34 } 35 36 float trapezoid_light_sdf(vec2 p, vec4 dimensions){ 37 vec2 c = vec2(sin((dimensions.x / 2)), cos((dimensions.x / 2))); 38 float t = dimensions.y; 39 float b = dimensions.z; 40 float theta = dimensions.w; 41 float h = p.y; 42 mat2 rot; 43 rot[0] = vec2(cos(theta), -sin(theta)); 44 rot[1] = vec2(sin(theta), cos(theta)); 45 p = (rot * p); 46 p.x = abs(p.x); 47 p.y += t; 48 float m = length((p - (c * max(dot(p, c), 0.0)))); 49 return max(max((m * sign(((c.y * p.x) - (c.x * p.y)))), -h), -(b + -h)); 50 } 51 52 float cone_light_sdf(vec2 p, vec4 dimensions){ 53 vec2 c = vec2(sin((dimensions.x / 2)), cos((dimensions.x / 2))); 54 float r = (dimensions.y + dimensions.z); 55 float t = dimensions.z; 56 p.x = abs(p.x); 57 p.y += t; 58 float l = (length(p) - r); 59 float m = length((p - (c * clamp(dot(p, c), 0.0, r)))); 60 return max(max(l, (m * sign(((c.y * p.x) - (c.x * p.y))))), (t - p.y)); 61 } 62 63 float evaluate_light(vec2 position, struct Light light){ 64 switch(light.type){ 65 case 1: 66 return point_light_sdf(position, light.dimensions); 67 case 2: 68 return trapezoid_light_sdf(position, light.dimensions); 69 case 3: 70 return cone_light_sdf(position, light.dimensions); 71 default: 72 return 1; 73 }; 74 ; 75 } 76 77 vec3 shade_lights(vec3 albedo, vec2 position){ 78 vec3 color = vec3(0); 79 for(int i = 0; (i < lights.count); ++i){ 80 Light light = lights.lights[i]; 81 vec2 relative_position = (light.position - position); 82 float sdf = evaluate_light(relative_position, light); 83 if((sdf <= 0)){ 84 color += (add(albedo.rgb, light.color) * (light.intensity * clamp((-sdf / 2), 0, 1))); 85 }; 86 ; 87 }; 88 ; 89 color += (global_illumination * albedo); 90 return color; 91 } 92 uniform usampler2DArray tilemap; 93 uniform sampler2D tileset; 94 uniform vec2 map_size; 95 uniform vec2 map_position; 96 uniform int tile_size; 97 uniform int layer; 98 in vec2 map_coord; 99 out vec4 color; 100 101 void _GLSLTK_main_1(){ 102 ivec2 map_wh = (ivec2(map_size) * tile_size); 103 ivec2 map_xy = ((ivec2(map_coord) + (map_wh / 2)) - 1); 104 if(((map_xy.x < 0) || ((map_xy.y < 0) || ((map_wh.x <= map_xy.x) || (map_wh.y <= map_xy.y))))){ 105 color = vec4(0); 106 return; 107 }; 108 ; 109 ivec2 tile_xy = ivec2((map_xy.x / tile_size), (map_xy.y / tile_size)); 110 ivec2 pixel_xy = ivec2((map_xy.x % tile_size), (map_xy.y % tile_size)); 111 uvec2 tile = texelFetch(tilemap, ivec3(tile_xy, layer), 0).rg; 112 color = texelFetch(tileset, ((ivec2(tile) * tile_size) + pixel_xy), 0); 113 color.rgb = shade_lights(color.rgb, ((map_xy + map_position) - (map_wh / 2))); 114 } 115 116 void _GLSLTK_main_2(){ 117 _GLSLTK_main_1(); 118 } 119 120 void _GLSLTK_main_3(){ 121 } 122 123 void main(){ 124 _GLSLTK_main_2(); 125 _GLSLTK_main_3(); 126 } [Condition of type SIMPLE-ERROR]