1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-07 08:44:55 +00:00

more fixes to librw stuff

This commit is contained in:
aap 2020-11-18 11:15:27 +01:00
parent 8c70c2a136
commit acb29e0dad
14 changed files with 4 additions and 385 deletions

View file

@ -1,28 +0,0 @@
const char *colourfilterVC_frag_src =
"uniform sampler2D tex0;\n"
"uniform vec4 u_blurcolor;\n"
"in vec4 v_color;\n"
"in vec2 v_tex0;\n"
"in float v_fog;\n"
"out vec4 color;\n"
"void\n"
"main(void)\n"
"{\n"
" float a = u_blurcolor.a;\n"
" vec4 doublec = clamp(u_blurcolor*2, 0.0, 1.0);\n"
" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
" vec4 prev = dst;\n"
" for(int i = 0; i < 5; i++){\n"
" vec4 tmp = dst*(1.0-a) + prev*doublec*a;\n"
" tmp += prev*u_blurcolor;\n"
" tmp += prev*u_blurcolor;\n"
" prev = clamp(tmp, 0.0, 1.0);\n"
" }\n"
" color.rgb = prev.rgb;\n"
" color.a = 1.0f;\n"
"}\n"
;

View file

@ -1,20 +0,0 @@
const char *contrast_frag_src =
"uniform sampler2D tex0;\n"
"uniform vec3 u_contrastAdd;\n"
"uniform vec3 u_contrastMult;\n"
"in vec4 v_color;\n"
"in vec2 v_tex0;\n"
"in float v_fog;\n"
"out vec4 color;\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
" color.rgb = dst.rgb*u_contrastMult + u_contrastAdd;\n"
" color.a = 1.0f;\n"
"}\n"
;

View file

@ -1,31 +0,0 @@
const char *default_UV2_vert_src =
"layout(location = 0) in vec3 in_pos;\n"
"layout(location = 1) in vec3 in_normal;\n"
"layout(location = 2) in vec4 in_color;\n"
"layout(location = 3) in vec2 in_tex0;\n"
"layout(location = 4) in vec2 in_tex1;\n"
"out vec4 v_color;\n"
"out vec2 v_tex0;\n"
"out vec2 v_tex1;\n"
"out float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * in_normal;\n"
" v_tex0 = in_tex0;\n"
" v_tex1 = in_tex1;\n"
" v_color = in_color;\n"
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
" v_color = clamp(v_color, 0.0, 1.0);\n"
" v_color *= u_matColor;\n"
" v_fog = DoFog(gl_Position.w);\n"
"}\n"
;

View file

@ -1,23 +0,0 @@
const char *im2d_vert_src =
"uniform vec4 u_xform;\n"
"layout(location = 0) in vec4 in_pos;\n"
"layout(location = 2) in vec4 in_color;\n"
"layout(location = 3) in vec2 in_tex0;\n"
"out vec4 v_color;\n"
"out vec2 v_tex0;\n"
"out float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
" gl_Position = in_pos;\n"
" gl_Position.w = 1.0;\n"
" gl_Position.xy = gl_Position.xy * u_xform.xy + u_xform.zw;\n"
" v_fog = DoFog(gl_Position.z);\n"
" gl_Position.xyz *= gl_Position.w;\n"
" v_color = in_color;\n"
" v_tex0 = in_tex0;\n"
"}\n"
;

View file

@ -1,28 +0,0 @@
const char *neoGloss_frag_src =
"uniform sampler2D tex0;\n"
"uniform vec4 u_reflProps;\n"
"#define glossMult (u_reflProps.x)\n"
"in vec3 v_normal;\n"
"in vec3 v_light;\n"
"in vec2 v_tex0;\n"
"in float v_fog;\n"
"out vec4 color;\n"
"void\n"
"main(void)\n"
"{\n"
" color = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
" vec3 n = 2.0*v_normal-1.0; // unpack\n"
" vec3 v = 2.0*v_light-1.0; //\n"
" float s = dot(n, v);\n"
" color = s*s*s*s*s*s*s*s*color*v_fog*glossMult;\n"
" DoAlphaTest(color.a);\n"
"}\n"
;

View file

@ -1,31 +0,0 @@
const char *neoGloss_vert_src =
"uniform vec3 u_eye;\n"
"layout(location = 0) in vec3 in_pos;\n"
"layout(location = 1) in vec3 in_normal;\n"
"layout(location = 2) in vec4 in_color;\n"
"layout(location = 3) in vec2 in_tex0;\n"
"out vec3 v_normal;\n"
"out vec3 v_light;\n"
"out vec2 v_tex0;\n"
"out float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * in_normal;\n"
" v_tex0 = in_tex0;\n"
" vec3 viewVec = normalize(u_eye - Vertex.xyz);\n"
" vec3 Light = normalize(viewVec - u_lightDirection[0].xyz);\n"
" v_normal = 0.5*(1.0 + vec3(0.0, 0.0, 1.0)); // compress\n"
" v_light = 0.5*(1.0 + Light); //\n"
" v_fog = DoFog(gl_Position.w);\n"
"}\n"
;

View file

@ -1,50 +0,0 @@
const char *neoRimSkin_vert_src =
"uniform mat4 u_boneMatrices[64];\n"
"uniform vec3 u_viewVec;\n"
"uniform vec4 u_rampStart;\n"
"uniform vec4 u_rampEnd;\n"
"uniform vec3 u_rimData;\n"
"layout(location = 0) in vec3 in_pos;\n"
"layout(location = 1) in vec3 in_normal;\n"
"layout(location = 2) in vec4 in_color;\n"
"layout(location = 3) in vec2 in_tex0;\n"
"layout(location = 11) in vec4 in_weights;\n"
"layout(location = 12) in vec4 in_indices;\n"
"out vec4 v_color;\n"
"out vec2 v_tex0;\n"
"out float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
" vec3 SkinVertex = vec3(0.0, 0.0, 0.0);\n"
" vec3 SkinNormal = vec3(0.0, 0.0, 0.0);\n"
" for(int i = 0; i < 4; i++){\n"
" SkinVertex += (u_boneMatrices[int(in_indices[i])] * vec4(in_pos, 1.0)).xyz * in_weights[i];\n"
" SkinNormal += (mat3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];\n"
" }\n"
" vec4 Vertex = u_world * vec4(SkinVertex, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * SkinNormal;\n"
" v_tex0 = in_tex0;\n"
" v_color = in_color;\n"
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
" // rim light\n"
" float f = u_rimData.x - u_rimData.y*dot(Normal, u_viewVec);\n"
" vec4 rimlight = clamp(mix(u_rampEnd, u_rampStart, f)*u_rimData.z, 0.0, 1.0);\n"
" v_color.rgb += rimlight.rgb;\n"
" v_color = clamp(v_color, 0.0, 1.0);\n"
" v_color *= u_matColor;\n"
" v_fog = DoFog(gl_Position.z);\n"
"}\n"
;

View file

@ -1,39 +0,0 @@
const char *neoRim_vert_src =
"uniform vec3 u_viewVec;\n"
"uniform vec4 u_rampStart;\n"
"uniform vec4 u_rampEnd;\n"
"uniform vec3 u_rimData;\n"
"layout(location = 0) in vec3 in_pos;\n"
"layout(location = 1) in vec3 in_normal;\n"
"layout(location = 2) in vec4 in_color;\n"
"layout(location = 3) in vec2 in_tex0;\n"
"out vec4 v_color;\n"
"out vec2 v_tex0;\n"
"out float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * in_normal;\n"
" v_tex0 = in_tex0;\n"
" v_color = in_color;\n"
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
" // rim light\n"
" float f = u_rimData.x - u_rimData.y*dot(Normal, u_viewVec);\n"
" vec4 rimlight = clamp(mix(u_rampEnd, u_rampStart, f)*u_rimData.z, 0.0, 1.0);\n"
" v_color.rgb += rimlight.rgb;\n"
" v_color = clamp(v_color, 0.0, 1.0);\n"
" v_color *= u_matColor;\n"
" v_fog = DoFog(gl_Position.w);\n"
"}\n"
;

View file

@ -1,30 +0,0 @@
const char *neoVehicle_frag_src =
"uniform sampler2D tex0;\n"
"uniform sampler2D tex1;\n"
"in vec4 v_color;\n"
"in vec4 v_reflcolor;\n"
"in vec2 v_tex0;\n"
"in vec2 v_tex1;\n"
"in float v_fog;\n"
"out vec4 color;\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
" vec3 envmap = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y)).rgb;\n"
" pass1.rgb = mix(pass1.rgb, envmap, v_reflcolor.a);\n"
" pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);\n"
"// pass1.rgb += v_reflcolor.rgb * v_fog;\n"
" vec3 pass2 = v_reflcolor.rgb * v_fog;\n"
" color.rgb = pass1.rgb*pass1.a + pass2;\n"
" color.a = pass1.a;\n"
"// color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);\n"
" DoAlphaTest(color.a);\n"
"}\n"
;

View file

@ -1,56 +0,0 @@
const char *neoVehicle_vert_src =
"uniform vec3 u_eye;\n"
"uniform vec4 u_reflProps;\n"
"uniform vec4 u_specDir[5];\n"
"uniform vec4 u_specColor[5];\n"
"#define fresnel (u_reflProps.x)\n"
"#define lightStrength (u_reflProps.y) // speclight alpha\n"
"#define shininess (u_reflProps.z)\n"
"#define specularity (u_reflProps.w)\n"
"layout(location = 0) in vec3 in_pos;\n"
"layout(location = 1) in vec3 in_normal;\n"
"layout(location = 2) in vec4 in_color;\n"
"layout(location = 3) in vec2 in_tex0;\n"
"out vec4 v_color;\n"
"out vec4 v_reflcolor;\n"
"out vec2 v_tex0;\n"
"out vec2 v_tex1;\n"
"out float v_fog;\n"
"vec3 DoDirLightSpec(vec3 Ldir, vec3 Lcol, vec3 N, vec3 V, float power)\n"
"{\n"
" return pow(clamp(dot(N, normalize(V + -Ldir)), 0.0, 1.0), power)*Lcol;\n"
"}\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * in_normal;\n"
" vec3 viewVec = normalize(u_eye - Vertex.xyz);\n"
" v_tex0 = in_tex0;\n"
" v_color = in_color;\n"
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse*lightStrength;\n"
" v_color = clamp(v_color, 0.0, 1.0);\n"
" v_color *= u_matColor;\n"
" // reflect V along Normal\n"
" vec3 uv2 = Normal*dot(viewVec, Normal)*2.0 - viewVec;\n"
" v_tex1 = uv2.xy*0.5 + 0.5;\n"
" float b = 1.0 - clamp(dot(viewVec, Normal), 0.0, 1.0);\n"
" v_reflcolor = vec4(0.0, 0.0, 0.0, 1.0);\n"
" v_reflcolor.a = mix(b*b*b*b*b, 1.0f, fresnel)*shininess;\n"
" for(int i = 0; i < 5; i++)\n"
" v_reflcolor.rgb += DoDirLightSpec(u_specDir[i].xyz, u_specColor[i].rgb, Normal, viewVec, u_specDir[i].w)*specularity*lightStrength;\n"
" v_fog = DoFog(gl_Position.w);\n"
"}\n"
;

View file

@ -1,27 +0,0 @@
const char *neoWorldVC_frag_src =
"uniform sampler2D tex0;\n"
"uniform sampler2D tex1;\n"
"uniform vec4 u_lightMap;\n"
"in vec4 v_color;\n"
"in vec2 v_tex0;\n"
"in vec2 v_tex1;\n"
"in float v_fog;\n"
"out vec4 color;\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 t0 = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
" vec4 t1 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n"
" color = t0*v_color*(1 + u_lightMap*(t1-1));\n"
" color.a = v_color.a*t0.a*u_lightMap.a;\n"
" color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);\n"
" DoAlphaTest(color.a);\n"
"}\n"
;

View file

@ -1,18 +0,0 @@
const char *simple_frag_src =
"uniform sampler2D tex0;\n"
"in vec4 v_color;\n"
"in vec2 v_tex0;\n"
"in float v_fog;\n"
"out vec4 color;\n"
"void\n"
"main(void)\n"
"{\n"
" color = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
" color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);\n"
" DoAlphaTest(color.a);\n"
"}\n"
;

View file

@ -384,7 +384,7 @@ CreateTxdImageForVideoCard()
return false;
}
#ifdef LIBRW
#ifdef RW_GL3
// so we can read back DXT with GLES
// only works for textures that are not yet loaded
// so let's hope that is the case for all
@ -418,7 +418,7 @@ CreateTxdImageForVideoCard()
delete []buf;
delete pDir;
CStreaming::RemoveTxd(i);
#ifdef LIBRW
#ifdef RW_GL3
rw::gl3::needToReadBackTextures = false;
#endif
return false;
@ -447,7 +447,7 @@ CreateTxdImageForVideoCard()
RwStreamClose(img, nil);
delete []buf;
#ifdef LIBRW
#ifdef RW_GL3
rw::gl3::needToReadBackTextures = false;
#endif

2
vendor/librw vendored

@ -1 +1 @@
Subproject commit 4ac67e5df87da7d94725789cedad2b69e8687007
Subproject commit d9def88c46a742c6bc74bf79021c0f8838480df4