cuboid and cube pipeline working

This commit is contained in:
zomseffen 2024-09-15 14:02:00 +02:00
parent 4494b68c26
commit 912659bb52
13 changed files with 230 additions and 162 deletions

View file

@ -2,6 +2,7 @@
layout(location = 0) in vec3 fragColor;
layout(location = 1) in vec2 fragTexCoord;
layout(location = 2) in vec3 fragSize;
layout(location = 0) out vec4 outColor;
layout(binding = 1) uniform sampler2D texSampler;

View file

@ -27,22 +27,22 @@ void main () {
float scalar_back = dot(normal_back, vec4(1, 0, 0, 0));
if (scalar_back <= 0 || ignore_scalars){
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
@ -53,22 +53,22 @@ void main () {
vec4 normal_front = geom_rotation * vec4(0, 0, 1, 0);
float scalar_front = dot(normal_front, vec4(1, 0, 0, 0));
if (scalar_front <= 0 || ignore_scalars) {
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
@ -79,22 +79,22 @@ void main () {
float scalar_up = dot(normal_up, vec4(1, 0, 0, 0));
if (scalar_up <= 0 || ignore_scalars) {
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
@ -105,22 +105,22 @@ void main () {
float scalar_down = dot(normal_down, vec4(1, 0, 0, 0));
if (scalar_down <= 0 || ignore_scalars) {
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
@ -131,22 +131,22 @@ void main () {
float scalar_left = dot(normal_left, vec4(1, 0, 0, 0));
if (scalar_left <= 0 || ignore_scalars) {
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(-geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
@ -157,22 +157,22 @@ void main () {
float scalar_right = dot(normal_right, vec4(1, 0, 0, 0));
if (scalar_right <= 0 || ignore_scalars) {
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * vec4(geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
fragColor = geoColor[0];
fragTexCoord = geoTexCoord[0];
EmitVertex();

Binary file not shown.

Binary file not shown.