main
Dominik Madarász 2023-12-04 09:10:39 +01:00
parent 67f60ac798
commit 4688b154e5
7 changed files with 16 additions and 11 deletions

View File

@ -343,6 +343,8 @@ if "%1"=="gwk" (
copy/y ..\fwk-mirror\engine\fwk.c _fwk\engine\fwk.c copy/y ..\fwk-mirror\engine\fwk.c _fwk\engine\fwk.c
copy/y ..\fwk-mirror\engine\fwk _fwk\engine\fwk copy/y ..\fwk-mirror\engine\fwk _fwk\engine\fwk
copy/y ..\fwk-mirror\engine\split\*.inl _fwk\engine\split\ copy/y ..\fwk-mirror\engine\split\*.inl _fwk\engine\split\
copy/y ..\fwk-mirror\engine\art\shaders\* _fwk\engine\art\shaders\
copy/y ..\fwk-mirror\tools\*.c _fwk\tools\
rem copy/y ..\fwk-mirror\engine\split\3rd_*.c _fwk\engine\split\ rem copy/y ..\fwk-mirror\engine\split\3rd_*.c _fwk\engine\split\
call MAKE.bat back call MAKE.bat back

View File

@ -109,4 +109,4 @@ struct light {
#endif #endif
return vec4(clamp(vec3(total_lighting), 0., 1.), 1.0); return vec4(clamp(vec3(total_lighting), 0., 1.), 1.0);
#endif #endif
} }

View File

@ -9,7 +9,7 @@ uniform vec4 u_diffuse = vec4(1.0,1.0,1.0,1.0);
// lightmapping // lightmapping
uniform sampler2D u_lightmap; uniform sampler2D u_lightmap;
uniform bool u_texlit; uniform bool u_texlit;
uniform bool u_texmod = false; uniform bool u_texmod = true;
uniform float u_litboost = 1.0; uniform float u_litboost = 1.0;
in vec3 v_position; in vec3 v_position;
@ -137,7 +137,7 @@ vec3 sh_lighting(vec3 n) {
void main() { void main() {
vec3 n = normalize(v_normal_ws); vec3 n = normalize(v_normal_ws);
vec4 diffuse; vec4 diffuse;
if(u_textured) { if(u_textured) {
diffuse = texture(u_texture2d, v_texcoord); diffuse = texture(u_texture2d, v_texcoord);
} else { } else {
@ -157,7 +157,7 @@ void main() {
vec4 lit = vec4(1.0, 1.0, 1.0, 1.0); vec4 lit = vec4(1.0, 1.0, 1.0, 1.0);
// SH lighting // SH lighting
/* if (!u_texlit) */ { if (!u_texlit) {
vec3 result = sh_lighting(n); vec3 result = sh_lighting(n);
if( (result.x*result.x+result.y*result.y+result.z*result.z) > 0.0 ) lit = vec4(result, 1.0); if( (result.x*result.x+result.y*result.y+result.z*result.z) > 0.0 ) lit = vec4(result, 1.0);
} }
@ -167,7 +167,7 @@ void main() {
// base // base
vec4 diffuse; vec4 diffuse;
if(u_matcaps) { if(u_matcaps) {
vec2 muv = vec2(view * vec4(v_normal_ws, 0))*0.5+vec2(0.5,0.5); // normal (model space) to view space vec2 muv = vec2(view * vec4(v_normal_ws, 0))*0.5+vec2(0.5,0.5); // normal (model space) to view space
diffuse = texture(u_texture2d, vec2(muv.x, 1.0-muv.y)); diffuse = texture(u_texture2d, vec2(muv.x, 1.0-muv.y));
@ -178,13 +178,15 @@ void main() {
} }
if (u_texlit) { if (u_texlit) {
vec4 litsample = texture(u_lightmap, v_texcoord2); vec4 litsample = texture(u_lightmap, v_texcoord);
if (u_texmod) { if (u_texmod) {
diffuse.rgb *= litsample.rgb; diffuse *= litsample;
} else { } else {
diffuse.rgb += litsample.rgb; diffuse += litsample;
} }
diffuse.rgb += sh_lighting(n);
} }
// lighting mix // lighting mix

View File

@ -16,4 +16,4 @@ void main() {
float dy = dFdy(depth); float dy = dFdy(depth);
moment2 += 0.25*(dx*dx+dy*dy); moment2 += 0.25*(dx*dx+dy*dy);
outColor = vec4( moment1, moment2, 0.0, 0.0); outColor = vec4( moment1, moment2, 0.0, 0.0);
} }

View File

@ -0,0 +1 @@
#version 150

View File

@ -56,8 +56,8 @@ in vec4 att_indexes; // @fixme: gles might use ivec4 instead?
in vec4 att_weights; // @todo: downgrade from float to byte in vec4 att_weights; // @todo: downgrade from float to byte
in float att_vertexindex; // for blendshapes in float att_vertexindex; // for blendshapes
in vec4 att_color; in vec4 att_color;
in vec2 att_texcoord2;
in vec3 att_bitangent; // @todo: remove? also, ass2iqe might output this in vec3 att_bitangent; // @todo: remove? also, ass2iqe might output this
in vec2 att_texcoord2;
out vec4 v_color; out vec4 v_color;
out vec3 v_position, v_position_ws; out vec3 v_position, v_position_ws;
out vec3 v_normal, v_normal_ws; out vec3 v_normal, v_normal_ws;

View File

@ -12,4 +12,4 @@ void main() {
#else #else
v_position = gl_Position; v_position = gl_Position;
#endif #endif
} }