0
Im пытается получить шейдер, работающий в spritekit, используя быстрый. в затенении, у меня есть три формы объявлены правильно, насколько я могу сказать, но я получаю сообщение об ошибке: program_source: 8: 1: ошибка: неизвестный тип название «единообразный»Swift uniform typename не распознается
на
uniform vec4 info;
uniform vec4 pixelSize;
uniform sampler2D innerImage;
полный шейдер
uniform vec4 info; // x is time spent transitioning
// y is time it takes to transition
uniform vec4 pixelSize; // x is pixel size on the x
// y is pixel size on the y
uniform sampler2D innerImage;
void main()
{
vec4 sceneColor = texture2D(u_texture,v_tex_coord);
float radius = info.x/info.y;
float distance = length(v_tex_coord - info.zw);
vec2 innerGreyCircle = radius - pixelSize.xy * 25;
vec2 outerColorCircle = radius + pixelSize.xy * 25;
if(distance < radius)
{
//vec2 circle = radius - pixelSize.xy * 25;
if(distance > innerGreyCircle.x || distance > innerGreyCircle.y)
{
vec2 tc = v_tex_coord;
vec2 p = -1.0 + 2.0 * tc;
float len = length(p);
vec2 newTexCoord = tc + (p/len) * cos(len * 12.0f - info.x * 4.0f) * 1.0f;
sceneColor = texture2D(innerImage,newTexCoord);//.xyz;//filter, newTexCoord).xyz;
}
float grey = dot(sceneColor.rgb, 1)/3 * 1.5f;
sceneColor = vec4(grey, grey, grey, 1);
}
else if(distance < outerColorCircle.x || distance < outerColorCircle.y)
{
vec2 tc = v_tex_coord;
vec2 p = -1.0 + 2.0 * tc;
float len = length(p);
vec2 newTexCoord = tc + (p/len) * cos(len * 12.0f - info.x * 4.0f) * 1.0f;
sceneColor = texture2D(innerImage,newTexCoord);//.xyz;//filter, newTexCoord).xyz;
}
gl_FragColor = sceneColor;
}