space-game001/shaders/defaultAtmosphere.vertex
Vladislav Khorev af550f56a7 Cool working
2025-12-13 23:17:03 +03:00

20 lines
712 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

attribute vec3 vPosition;
attribute vec3 vColor;
uniform mat4 ProjectionModelViewMatrix;
uniform mat4 ModelViewMatrix;
varying vec3 color;
varying vec3 vViewPosition; // Новая переменная: позиция вершины в пространстве вида
void main()
{
// Расчет позиции в пространстве отсечения (как у вас)
gl_Position = ProjectionModelViewMatrix * vec4(vPosition.xyz, 1.0);
// Передача позиции в пространстве вида во фрагментный шейдер
vViewPosition = vec3(ModelViewMatrix * vec4(vPosition.xyz, 1.0));
//vViewPosition = vPosition.xyz;
color = vColor;
}