...Liahim написал(а):У хирурга спросить нужно или он уже где-то выкладывал? )))
А на счёт жсона, я подумал, что лучше без него будет... В описанной выше программе как раз есть загрузка шейдера напрямую через GL20(бла-бла, программ)... Если, конечно, майн отнесётся к этому с пониманием )))
{
"targets": [
"swap"
],
"passes": [
{
"name": "invert",
"intarget": "minecraft:main",
"outtarget": "swap",
"uniforms": [
{
"name": "InverseAmount",
"values": [ 0.8 ]
}
]
},
{
"name": "blit",
"intarget": "swap",
"outtarget": "minecraft:main"
}
]
}
{
"blend": {
"func": "add",
"srcrgb": "one",
"dstrgb": "zero"
},
"vertex": "blit",
"fragment": "invert",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InverseAmount", "type": "float", "count": 1, "values": [ 0.0 ] }
]
}
#version 120
uniform sampler2D DiffuseSampler;
varying vec2 texCoord;
uniform float InverseAmount;
void main(){
vec4 diffuseColor = texture2D(DiffuseSampler, texCoord);
vec4 invertColor = 1.0 - diffuseColor;
vec4 outColor = mix(diffuseColor, invertColor, InverseAmount);
gl_FragColor = vec4(outColor.rgb, diffuseColor.a);
}
#version 120
attribute vec4 Position;
uniform mat4 ProjMat;
uniform vec2 InSize;
uniform vec2 OutSize;
varying vec2 texCoord;
void main(){
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
gl_Position = vec4(outPos.xy, 0.2, 1.0);
vec2 sizeRatio = OutSize / InSize;
texCoord = Position.xy / OutSize;
texCoord.x = texCoord.x * sizeRatio.x;
texCoord.y = texCoord.y * sizeRatio.y;
texCoord.y = sizeRatio.y - texCoord.y;
}
ShaderUniform uniform = shader.getUniform("Имя переменной");
uniform vec3 Имя переменной
Кстати, такая фишка не прокатила... Так же не может найти путь.nikita488 написал(а):Код:"/assets/examplemod/shaders/overl.fsh"
Could not find uniform named InSize in the specified shader program
{
"targets": [
"swap"
],
"passes": [
{
"name": "fog",
"intarget": "minecraft:main",
"outtarget": "swap"
},
{
"name": "fog",
"intarget": "swap",
"outtarget": "minecraft:main"
}
]
}