This commit is contained in:
Zemledelec 2025-11-07 13:33:26 +04:00
parent 934c1fe6ae
commit 40e6ccfdc5
2 changed files with 7 additions and 5 deletions

View File

@ -24,7 +24,8 @@ export function rayScreen(): Program {
a_endPosLow: "vec3",
a_thickness: "float",
a_rgba: "vec4",
a_texOffset: "float"
a_texOffset: "float",
a_strokeSize: "float"
},
vertexShader: ray_vert,
fragmentShader: ray_frag

View File

@ -9,6 +9,7 @@ attribute vec2 a_vertices;
attribute float a_thickness;
attribute vec4 a_texCoord;
attribute float a_texOffset;
attribute float a_strokeSize;
varying vec4 v_rgba;
varying vec4 v_texCoord;
@ -55,9 +56,6 @@ void main() {
mat4 viewMatrixRTE = viewMatrix;
viewMatrixRTE[3] = vec4(0.0, 0.0, 0.0, 1.0);
float imageSize = 100.0;
// repeat = (1.0 / imageSize) * length(v) / focalSize;
highDiff = a_startPosHigh - eyePositionHigh;
highDiff = highDiff * step(1.0, length(highDiff));
vec3 lowDiff = a_startPosLow - eyePositionLow;
@ -70,7 +68,10 @@ void main() {
vec4 vEnd = viewMatrixRTE * vec4(highDiff + lowDiff, 1.0);
vec2 nEnd = project(projectionMatrix * vEnd);
repeat = distance(nStart, nEnd) / imageSize;
repeat = distance(nStart, nEnd) / a_strokeSize;
// Could be optimization some times
//repeat = (1.0 / a_strokeSize) * length(v) / focalSize;
gl_Position = projectionMatrix * viewMatrixRTE * vec4(highDiff * step(1.0, length(highDiff)) + vert, 1.0);
}