OneAvargeCoder193 9181b31a6d
Add stars and a simple skybox (#1043)
* really bad and inefficient star code i think

* add stars that dont work during the day but look cool

* remove galaxy shape and replace it with a simple sphere

* add broken background

* make stars affected by fog

* make the stars additive

* remove commented code in shaders

* remove unused variables in the shader

* make the stars spin

* make stars not have bloom

* fix formatting

* temp changes

* fix formatting (still temp changes)

* switch to cubyz random numbers

* multiply star matrix in cpu instead of gpu

* changed star to be twice as big, not affect by resolution as much, and also be loaded from a texture

* remove trailing whitespaces

* remove unused constants

* simplify the code by removing a log and power

* optimizing the stars

* remove debug code

* make stars triangles instead of points

* simplify the math more

* give star ssbo unique id

* fix formatting issues

* make array multiline

* fix formatting

* remove files i accidentally added

* remove random obj file

* fix some issues

* use square distance

* fix formatting

* small change

* fix some stuff

* fix other things

* comp error

* more stuff

* fix some stuff with the stars

* test

* fix formatting

* fix more formatting

* test 2

* fixes

* changes

* changes

* fix formatting

* fixes

* remove patch
2025-04-27 20:29:19 +02:00

30 lines
563 B
GLSL

#version 430
struct star {
vec4 vertexPositions[3];
vec3 pos;
float padding1;
vec3 color;
float padding2;
};
layout (std430, binding = 12) buffer _starBuffer {
star starData[];
};
uniform mat4 mvp;
uniform float starOpacity;
out vec3 pos;
out flat vec3 centerPos;
out flat vec3 color;
void main() {
gl_Position = mvp*vec4(starData[gl_VertexID/3].vertexPositions[gl_VertexID%3].xyz, 1);
pos = starData[gl_VertexID/3].vertexPositions[gl_VertexID%3].xyz;
centerPos = starData[gl_VertexID/3].pos;
color = starData[gl_VertexID/3].color*starOpacity;
}