tmpRender

This commit is contained in:
IlyaShurupov 2024-06-23 10:32:22 +03:00
parent 378ff3f568
commit 7f426ebc0d
3 changed files with 41 additions and 1 deletions

View file

@ -1,7 +1,39 @@
#version 330 core
in vec2 FragPos;
in vec2 screenSize;
out vec4 FragColor;
void main() {
void drawDepth() {
FragColor = vec4(gl_FragCoord.z, gl_FragCoord.z, gl_FragCoord.z, 1.f);
}
void drawPoints()
{
// Define the point size
float pointSize = 15.0;
// Get the current fragment position in screen coordinates
vec2 fragCoord = gl_FragCoord.xy;
// Calculate the distance from the fragment to the vertex position
float dist = length(fragCoord - FragPos);
// If the distance is within the point size, draw the point
if (true || dist < pointSize)
{
FragColor = vec4(1.0, 0.0, 0.0, 1.0); // Red color for the point
}
else
{
FragColor = vec4(1.0, 1.0, 1.0, 1.0);
}
FragColor = vec4(FragPos.x, FragPos.y, 0, 1);
}
void main() {
drawPoints();
// drawDepth();
}

View file

@ -2,10 +2,16 @@
layout(location = 0) in vec3 Point;
uniform vec2 ScreenSize;
uniform vec4 Origin;
uniform mat4 Basis;
uniform mat4 Camera;
out vec2 FragPos;
out vec2 screenSize;
void main() {
gl_Position = Camera * vec4(Point.xyz, 1.0);
FragPos = gl_Position.xy;
screenSize = ScreenSize;
}