From aaa4ff61f7b17759c4f4ccb3ac9011dd5f8a93f5 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 24 Jul 2008 00:47:13 +0000 Subject: primary, secondary, tertiary color rendering --- src/render/draw.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/render') diff --git a/src/render/draw.cc b/src/render/draw.cc index 54a56a0..47f0d7a 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -296,11 +296,23 @@ void draw_model_fragments(core::Entity *entity) use_color_array = false; glDisableClientState(GL_COLOR_ARRAY); } - // FIXME Primary, Secondary Tertiary color - math::Color color(entity->color()); + + math::Color color; + + if ((material & Material::Tertiary) == Material::Tertiary) { + for (size_t i = 0; i < 3; i++) + color[i] = (entity->color()[i] + entity->color_second()[i]) / 2; + + } else if ((material & Material::Secondary) == Material::Secondary) { + color.assign(entity->color_second()); + + } if ((material & Material::Primary) == Material::Primary) { + color.assign(entity->color()); + } if (material & Material::Dark) color *= 0.5f; + gl::color(color); } else { -- cgit v1.2.3