diff --git a/tutorial/08_fbo.cpp b/tutorial/08_fbo.cpp index ec06d70b..baadf84b 100644 --- a/tutorial/08_fbo.cpp +++ b/tutorial/08_fbo.cpp @@ -47,9 +47,12 @@ public: m_hotspot = 0.4f * vec3(lol::cos(m_time * 2.f) + lol::cos(m_time * 3.3f), lol::sin(m_time * 4.4f) + lol::sin(m_time * 3.2f), lol::sin(m_time * 5.f)); - m_color = 0.25f * vec3(3.f + lol::sin(m_time * 4.5f + 1.f), - 3.f + lol::sin(m_time * 2.8f + 1.3f), - 3.f + lol::sin(m_time * 3.7f)); + m_color = 0.25f * vec3(1.1f + lol::sin(m_time * 1.5f + 1.f), + 1.1f + lol::sin(m_time * 1.8f + 1.3f), + 1.1f + lol::sin(m_time * 1.7f)); + /* Saturate dot color */ + float x = std::max(m_color.x, std::max(m_color.y, m_color.z)); + m_color /= x; } virtual void TickDraw(float seconds) @@ -60,9 +63,9 @@ public: { m_shader = Shader::Create(lolfx_08_fbo); m_coord = m_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0); + m_uni_flag = m_shader->GetUniformLocation("in_Flag"); m_uni_point = m_shader->GetUniformLocation("in_Point"); m_uni_color = m_shader->GetUniformLocation("in_Color"); - m_uni_flag = m_shader->GetUniformLocation("in_Flag"); m_uni_texture = m_shader->GetUniformLocation("in_Texture"); m_vdecl = new VertexDeclaration(VertexStream(VertexUsage::Position)); diff --git a/tutorial/08_fbo.lolfx b/tutorial/08_fbo.lolfx index 5d407a33..644ccd5f 100644 --- a/tutorial/08_fbo.lolfx +++ b/tutorial/08_fbo.lolfx @@ -31,11 +31,17 @@ void main(void) { if (in_Flag == 0.0) { - float s = 4.0 + 4.0 * in_Point.z; - vec2 p = pass_Position - in_Point.xy * 0.8; - float f = clamp(1.0 - dot(s * p, s * p), 0.0, 1.0); - f = sqrt(f); - gl_FragColor = vec4(f * in_Color, f + 0.1); + float tc = 0.0, ta = 0.0; + { + float s = 4.0 + 3.0 * in_Point.z; + vec2 p = pass_Position - in_Point.xy * 0.8; + float t = clamp(1.2 - dot(s * p, s * p), 0.0, 1.0); + float u = t * t; + tc += 3.0 * t * t - 2.0 * t * t * t; + ta += 3.0 * u * u - 2.0 * u * u * u; + } + + gl_FragColor = vec4(tc * in_Color, ta + 0.1); } else {