X-Git-Url: http://git.tdb.fi/?p=r2c2.git;a=blobdiff_plain;f=source%2F3d%2Fallocation.cpp;h=cbf2f85e31d55ac72336f52c215c5d321a58cd80;hp=3835f8c8df2ba99ae70c0c597025c9cc189bac78;hb=9b8a32cf7371bc5fae8ce239a212469511c459e6;hpb=aa2c48c635ad0be4eb465a72861a8d5403647b0a diff --git a/source/3d/allocation.cpp b/source/3d/allocation.cpp index 3835f8c..cbf2f85 100644 --- a/source/3d/allocation.cpp +++ b/source/3d/allocation.cpp @@ -21,12 +21,18 @@ void Allocation3D::set_color(const GL::Color &c) color = c; for(PathMap::const_iterator i=paths.begin(); i!=paths.end(); ++i) { - float intensity = 0.5+train.get_block_allocator().is_block_current(*i->first)*0.5; + GL::Color block_color = get_color_for_block(*i->first); for(PathList::const_iterator j=i->second.begin(); j!=i->second.end(); ++j) - (*j)->set_color(color*intensity); + (*j)->set_color(block_color); } } +GL::Color Allocation3D::get_color_for_block(const Block &block) const +{ + float intensity = 0.25+train.get_block_allocator().is_block_current(block)*0.75; + return color*intensity; +} + void Allocation3D::block_reserved(Block &block, Train *t) { if(t==&train) @@ -35,14 +41,14 @@ void Allocation3D::block_reserved(Block &block, Train *t) return; PathList &bpaths = paths[&block]; + GL::Color block_color = get_color_for_block(block); const Block::TrackSet &tracks = block.get_tracks(); for(Block::TrackSet::const_iterator i=tracks.begin(); i!=tracks.end(); ++i) { Path3D *path = new Path3D(layout.get_3d(**i)); bpaths.push_back(path); path->set_layer(1); - float intensity = 0.5+train.get_block_allocator().is_block_current(block)*0.5; - path->set_color(color*intensity); + path->set_color(block_color); path->set_automatic(); } }