Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp

This commit is contained in:
Jonathan 2023-06-08 22:23:16 -04:00
commit cd27dae7e1
1 changed files with 11 additions and 5 deletions

View File

@ -182,7 +182,7 @@ void main() {
static const char *s_skyboxFragShader = R"(
#version 330 core
in vec3 uv;
in vec3 fragment_world_pos;
in vec2 lightmap_uv;
in vec3 normal;
flat in vec3 flat_color;
@ -198,6 +198,8 @@ uniform bool drawnormals;
uniform bool drawflat;
uniform float style_scalars[256];
uniform vec3 eye_origin;
void main() {
if (drawnormals) {
// remap -1..+1 to 0..1
@ -223,7 +225,11 @@ void main() {
color = vec4(lmcolor * 2.0, 1.0);
}
else
color = vec4(texture(texture_sampler, uv).rgb, 1.0);
{
// cubemap case
vec3 dir = normalize(fragment_world_pos - eye_origin);
color = vec4(texture(texture_sampler, dir).rgb, 1.0);
}
}
}
)";
@ -238,7 +244,7 @@ layout (location = 3) in vec3 vertex_normal;
layout (location = 4) in vec3 vertex_flat_color;
layout (location = 5) in uint vertex_styles;
smooth out vec3 uv;
out vec3 fragment_world_pos;
out vec2 lightmap_uv;
out vec3 normal;
flat out vec3 flat_color;
@ -248,9 +254,9 @@ uniform mat4 MVP;
uniform vec3 eye_origin;
void main() {
gl_Position = MVP * vec4(position.x, position.y, position.z, 1.0);
gl_Position = MVP * vec4(position, 1.0);
fragment_world_pos = position;
uv = normalize(position - eye_origin);
lightmap_uv = vertex_lightmap_uv;
normal = vertex_normal;
flat_color = vertex_flat_color;