diff options
author | Stijn Buys <ingar@osirion.org> | 2008-07-24 00:47:13 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-07-24 00:47:13 +0000 |
commit | aaa4ff61f7b17759c4f4ccb3ac9011dd5f8a93f5 (patch) | |
tree | fafec5ef0c99f28cfa6b5b652d98b63b7a4673de /src/render | |
parent | 11c122eb1cc86ca1a40c84eb411ccd97791dc47d (diff) |
primary, secondary, tertiary color rendering
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/draw.cc | 16 |
1 files changed, 14 insertions, 2 deletions
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 { |