sphere is here

This commit is contained in:
2025-06-23 20:34:15 +01:00
parent 0f70ffad8d
commit dbb03623a7
2 changed files with 12 additions and 13 deletions
+4 -4
View File
@@ -3,10 +3,10 @@
layout(location = 0) in vec3 position;
layout(location=1)out vec4 pos;
layout(location = 0) out vec4 pos;
void main() {
mat4 worldview=camera_uniforms.view*pc.world;
pos = worldview*vec4(position,1.);
gl_Position=camera_uniforms.proj*pos;
pos = vec4(position, 1.);
vec4 worldview = camera_uniforms.view * pc.world * pos;
gl_Position = camera_uniforms.proj * worldview;
}
+4 -5
View File
@@ -4,7 +4,7 @@
#extension GL_GOOGLE_include_directive:require
#include "include.glsl"
layout(location = 1) in vec4 pos;
layout(location = 0) in vec4 pos;
layout(depth_greater) out float gl_FragDepth;
@@ -32,7 +32,7 @@ float scene(vec3 p) {
const float EPSILON = .0001;
const uint MAX_STEPS = 50;
#define NEARPLANE 0.
float FARPLANE;
float FARPLANE = 10;
#define gl_GlobalInvocationID uvec3(1)
vec3 getNormal(vec3 p, float dens) {
@@ -69,17 +69,16 @@ void main() {
if (td.y < EPSILON)
{
vec3 n = getNormal(p, td.y);
//f_color=vec4(1.);
f_color = vec4(shading(n, inverse(pc.world) * vec4(p, 1.)), 1.);
vec4 tpoint = camera_uniforms.proj * camera_uniforms.view * pc.world * vec4(p, 1);
gl_FragDepth = (tpoint.z / tpoint.w);
// gl_FragDepth = (tpoint.z / tpoint.w);
}
else
{
f_color = vec4(raydir, 1.0);
// discard;
}
f_color = vec4(1.0, 0.0, 1.0, 1.0);
return;
}