|
23 | 23 |
|
24 | 24 | using namespace glm;
|
25 | 25 |
|
| 26 | +namespace { |
| 27 | + |
| 28 | + const char* vertexSource = R"( |
| 29 | +#version 140 |
| 30 | +#extension GL_ARB_explicit_attrib_location : require |
| 31 | +
|
| 32 | +uniform mat4 transform; |
| 33 | +
|
| 34 | +layout(location = 0) in vec4 vertex; |
| 35 | +
|
| 36 | +out float t; |
| 37 | +
|
| 38 | +void main() |
| 39 | +{ |
| 40 | + gl_Position = transform * vec4(vertex.xyz, 1.0); |
| 41 | + t = vertex.w; |
| 42 | +
|
| 43 | +} |
| 44 | +)"; |
| 45 | + |
| 46 | + const char* fragmentSource = R"( |
| 47 | +#version 140 |
| 48 | +#extension GL_ARB_explicit_attrib_location : require |
| 49 | +
|
| 50 | +layout(location=0) out vec4 fragColor; |
| 51 | +
|
| 52 | +in float t; |
| 53 | +
|
| 54 | +void main() |
| 55 | +{ |
| 56 | + fragColor = vec4(vec3(1.0, 0.2+t*0.8, t/2.0), 1.0); |
| 57 | +} |
| 58 | +)"; |
| 59 | + |
| 60 | +} |
| 61 | + |
26 | 62 | namespace glowutils
|
27 | 63 | {
|
28 | 64 |
|
@@ -86,51 +122,6 @@ void CameraPathPlayer::prepare()
|
86 | 122 | prepareControlPoints();
|
87 | 123 | }
|
88 | 124 |
|
89 |
| -namespace { |
90 |
| -vec3 intersection(const vec3& a, const vec3& r, const vec3& p, const vec3& n) |
91 |
| -{ |
92 |
| - float rDotN = dot(r, n); |
93 |
| - |
94 |
| - assert(std::abs(rDotN) < std::numeric_limits<float>::epsilon()); |
95 |
| - |
96 |
| - float t = dot(p - a, n) / rDotN; |
97 |
| - return a + r * t; |
98 |
| -} |
99 |
| - |
100 |
| -const char* vertexSource = R"( |
101 |
| -#version 140 |
102 |
| -#extension GL_ARB_explicit_attrib_location : require |
103 |
| -
|
104 |
| -uniform mat4 transform; |
105 |
| -
|
106 |
| -layout(location = 0) in vec4 vertex; |
107 |
| -
|
108 |
| -out float t; |
109 |
| -
|
110 |
| -void main() |
111 |
| -{ |
112 |
| - gl_Position = transform * vec4(vertex.xyz, 1.0); |
113 |
| - t = vertex.w; |
114 |
| -
|
115 |
| -} |
116 |
| -)"; |
117 |
| - |
118 |
| -const char* fragmentSource = R"( |
119 |
| -#version 140 |
120 |
| -#extension GL_ARB_explicit_attrib_location : require |
121 |
| -
|
122 |
| -layout(location=0) out vec4 fragColor; |
123 |
| -
|
124 |
| -in float t; |
125 |
| -
|
126 |
| -void main() |
127 |
| -{ |
128 |
| - fragColor = vec4(vec3(1.0, 0.2+t*0.8, t/2.0), 1.0); |
129 |
| -} |
130 |
| -)"; |
131 |
| - |
132 |
| -} |
133 |
| - |
134 | 125 | void CameraPathPlayer::prepareControlPoints()
|
135 | 126 | {
|
136 | 127 | const std::vector<CameraPathPoint>& points = m_path.points();
|
|
0 commit comments