From 34d5feaac8896026e544dd42498dba98dd41ade7 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 2 Feb 2013 15:25:31 +0000 Subject: [PATCH] build: fix all vector/scalar type mismatches such as "vec2 * double" instead of "vec2 * float". --- neercs/video/render.cpp | 28 ++++++++++++++-------------- neercs/video/text-render.cpp | 4 ++-- neercs/video/text-render.h | 3 ++- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/neercs/video/render.cpp b/neercs/video/render.cpp index 049acce..487dd4f 100644 --- a/neercs/video/render.cpp +++ b/neercs/video/render.cpp @@ -1546,7 +1546,7 @@ void Render::Draw3D() fbo_blur_h->Bind(); shader_blur_h->Bind(); shader_blur_h->SetUniform(shader_blur_h_texture, fbo_back->GetTexture(), 0); - shader_blur_h->SetUniform(shader_blur_h_radius, glow_large / screen_size.x); + shader_blur_h->SetUniform(shader_blur_h_radius, glow_large / (float)screen_size.x); TraceQuad(); shader_blur_h->Unbind(); fbo_blur_h->Unbind(); @@ -1554,7 +1554,7 @@ void Render::Draw3D() fbo_blur_v->Bind(); shader_blur_v->Bind(); shader_blur_v->SetUniform(shader_blur_v_texture, fbo_blur_h->GetTexture(), 0); - shader_blur_v->SetUniform(shader_blur_v_radius, glow_large / screen_size.y); + shader_blur_v->SetUniform(shader_blur_v_radius, glow_large / (float)screen_size.y); TraceQuad(); shader_blur_v->Unbind(); fbo_blur_v->Unbind(); @@ -1562,7 +1562,7 @@ void Render::Draw3D() fbo_blur_h->Bind(); shader_blur_h->Bind(); shader_blur_h->SetUniform(shader_blur_h_texture, fbo_blur_v->GetTexture(), 0); - shader_blur_h->SetUniform(shader_blur_h_radius, glow_small / screen_size.x); + shader_blur_h->SetUniform(shader_blur_h_radius, glow_small / (float)screen_size.x); TraceQuad(); shader_blur_h->Unbind(); fbo_blur_h->Unbind(); @@ -1570,7 +1570,7 @@ void Render::Draw3D() fbo_blur_v->Bind(); shader_blur_v->Bind(); shader_blur_v->SetUniform(shader_blur_v_texture, fbo_blur_h->GetTexture(), 0); - shader_blur_v->SetUniform(shader_blur_v_radius, glow_small / screen_size.y); + shader_blur_v->SetUniform(shader_blur_v_radius, glow_small / (float)screen_size.y); TraceQuad(); shader_blur_v->Unbind(); fbo_blur_v->Unbind(); @@ -1637,7 +1637,7 @@ void Render::Draw3D() fbo_tmp->Bind(); shader_blur_h->Bind(); shader_blur_h->SetUniform(shader_blur_h_texture, fbo_screen->GetTexture(), 0); - shader_blur_h->SetUniform(shader_blur_h_radius, blur / screen_size.x); + shader_blur_h->SetUniform(shader_blur_h_radius, blur / (float)screen_size.x); TraceQuad(); shader_blur_h->Unbind(); fbo_tmp->Unbind(); @@ -1645,7 +1645,7 @@ void Render::Draw3D() fbo_screen->Bind(); shader_blur_v->Bind(); shader_blur_v->SetUniform(shader_blur_v_texture, fbo_tmp->GetTexture(), 0); - shader_blur_v->SetUniform(shader_blur_v_radius, blur / screen_size.y); + shader_blur_v->SetUniform(shader_blur_v_radius, blur / (float)screen_size.y); TraceQuad(); shader_blur_v->Unbind(); fbo_screen->Unbind(); @@ -1658,20 +1658,20 @@ void Render::Draw3D() shader_postfx->Bind(); shader_postfx->SetUniform(shader_postfx_texture, fbo_screen->GetTexture(), 0); shader_postfx->SetUniform(shader_postfx_screen_size, (vec2)screen_size); - shader_postfx->SetUniform(shader_postfx_ratio_2d, (vec2)ratio_2d / 2); + shader_postfx->SetUniform(shader_postfx_ratio_2d, (vec2)ratio_2d * 0.5f); shader_postfx->SetUniform(shader_postfx_time, fx_angle); shader_postfx->SetUniform(shader_postfx_deform, postfx_deform); - shader_postfx->SetUniform(shader_postfx_ghost1, vec4(postfx_ghost1.xyz * 0.01, postfx_ghost1.w)); - shader_postfx->SetUniform(shader_postfx_ghost2, vec4(postfx_ghost2.xyz * 0.01, postfx_ghost2.w)); - shader_postfx->SetUniform(shader_postfx_glass, vec4(postfx_glass.xy * 0.01, postfx_glass.z * 0.1, postfx_glass.w)); + shader_postfx->SetUniform(shader_postfx_ghost1, vec4(postfx_ghost1.xyz * 0.01f, postfx_ghost1.w)); + shader_postfx->SetUniform(shader_postfx_ghost2, vec4(postfx_ghost2.xyz * 0.01f, postfx_ghost2.w)); + shader_postfx->SetUniform(shader_postfx_glass, vec4(postfx_glass.xy * 0.01f, postfx_glass.z * 0.1f, postfx_glass.w)); shader_postfx->SetUniform(shader_postfx_gradient, postfx_gradient); shader_postfx->SetUniform(shader_postfx_gradient_color, postfx_gradient_color); shader_postfx->SetUniform(shader_postfx_vignetting, postfx_vignetting); shader_postfx->SetUniform(shader_postfx_aberration, postfx_aberration); - shader_postfx->SetUniform(shader_postfx_moire_h, vec4(postfx_moire_h.xyz, postfx_moire_h.w * 2 * M_PI)); - shader_postfx->SetUniform(shader_postfx_moire_v, vec4(postfx_moire_v.xyz, postfx_moire_v.w * 2 * M_PI)); - shader_postfx->SetUniform(shader_postfx_scanline_h, vec4(postfx_scanline_h.xyz, postfx_scanline_h.w * 2 * M_PI)); - shader_postfx->SetUniform(shader_postfx_scanline_v, vec4(postfx_scanline_v.xyz, postfx_scanline_v.w * 2 * M_PI)); + shader_postfx->SetUniform(shader_postfx_moire_h, vec4(postfx_moire_h.xyz, postfx_moire_h.w * (float)(2 * M_PI))); + shader_postfx->SetUniform(shader_postfx_moire_v, vec4(postfx_moire_v.xyz, postfx_moire_v.w * (float)(2 * M_PI))); + shader_postfx->SetUniform(shader_postfx_scanline_h, vec4(postfx_scanline_h.xyz, postfx_scanline_h.w * (float)(2 * M_PI))); + shader_postfx->SetUniform(shader_postfx_scanline_v, vec4(postfx_scanline_v.xyz, postfx_scanline_v.w * (float)(2 * M_PI))); shader_postfx->SetUniform(shader_postfx_corner, postfx_corner); shader_postfx->SetUniform(shader_postfx_sync, (float)fabs(sync_value * cosf((main_angle - sync_angle) * 6.0f))); shader_postfx->SetUniform(shader_postfx_beat, (float)fabs(beat_value * cosf((main_angle - beat_angle) * 6.0f))); diff --git a/neercs/video/text-render.cpp b/neercs/video/text-render.cpp index 5c6c253..9e66d7e 100644 --- a/neercs/video/text-render.cpp +++ b/neercs/video/text-render.cpp @@ -115,8 +115,8 @@ void TextRender::Render() * - translate to the lower left corner */ mat4 xform = mat4::translate(-1.f, -1.f + 2.0f * m_font_size.y * m_canvas_size.y / m_fbo_size.y, 0.f) - * mat4::scale(vec3(2.f * m_font_size / m_fbo_size, 1.f) - * vec3(1.f, -1.f, 1.f)) + * mat4::scale(vec3((vec2)m_font_size / (vec2)m_fbo_size, 1.f) + * vec3(2.f, -2.f, 1.f)) * mat4::translate(0.5f, 0.5f, 0.f); /* Upload libcaca canvas contents to the vertex buffers */ diff --git a/neercs/video/text-render.h b/neercs/video/text-render.h index 69c7403..7e43fe5 100644 --- a/neercs/video/text-render.h +++ b/neercs/video/text-render.h @@ -5,8 +5,9 @@ #if !defined __TEXT_RENDER_H__ #define __TEXT_RENDER_H__ -struct TextRender +class TextRender { +public: TextRender(caca_canvas_t *caca, ivec2 font_size); void Init(); void Render();