tmpRender
This commit is contained in:
parent
378ff3f568
commit
7f426ebc0d
3 changed files with 41 additions and 1 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ void RasterRender::render(const Scene& geometry, const Vec2<ualni>& size) {
|
|||
static auto origin = (GLint) mDefaultShader.getu("Origin");
|
||||
static auto basis = (GLint) mDefaultShader.getu("Basis");
|
||||
static auto camera = (GLint) mDefaultShader.getu("Camera");
|
||||
static auto screenSize = (GLint) mDefaultShader.getu("ScreenSize");
|
||||
|
||||
Mat4F basisMat;
|
||||
Vec4F originPoint;
|
||||
|
|
@ -49,6 +50,7 @@ void RasterRender::render(const Scene& geometry, const Vec2<ualni>& size) {
|
|||
glUniform4fv(origin, 1, &originPoint[0]);
|
||||
glUniformMatrix4fv(basis, 1, false, &basisMat[0][0]);
|
||||
glUniformMatrix4fv(camera, 1, true, &cameraMat[0][0]);
|
||||
glUniform2fv(screenSize, 1, &mRenderBuffer.getSize().x);
|
||||
|
||||
object->mGUPBuffers->drawCall();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue