From 2fef60708d30b56906e20e249e9fa674e9e056b9 Mon Sep 17 00:00:00 2001 From: Japa Date: Mon, 24 Jun 2013 00:14:06 +0530 Subject: [PATCH] Added some more operators to the cell color class. --- plugins/rendermax/renderer_light.cpp | 6 +++--- plugins/rendermax/renderer_opengl.hpp | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/rendermax/renderer_light.cpp b/plugins/rendermax/renderer_light.cpp index 27b5e188e..7cd1d5164 100644 --- a/plugins/rendermax/renderer_light.cpp +++ b/plugins/rendermax/renderer_light.cpp @@ -234,15 +234,15 @@ void lightingEngineViewscreen::doOcupancyAndLights() { if(bld->mat_type == 3)//green glass { - curCell=lightCell(0.1f,0.9f,0.5f); + curCell*=lightCell(0.1f,0.9f,0.5f); } else if(bld->mat_type == 4)//clear glass { - curCell=lightCell(0.5f,0.95f,0.9f); + curCell*=lightCell(0.5f,0.95f,0.9f); } else if(bld->mat_type == 5)//crystal glass { - curCell=lightCell(0.75f,0.95f,0.95f); + curCell*=lightCell(0.75f,0.95f,0.95f); } } } diff --git a/plugins/rendermax/renderer_opengl.hpp b/plugins/rendermax/renderer_opengl.hpp index 6b9e5ebed..7c3819c57 100644 --- a/plugins/rendermax/renderer_opengl.hpp +++ b/plugins/rendermax/renderer_opengl.hpp @@ -199,6 +199,17 @@ struct lightCell { return lightCell(r*val,g*val,b*val); } + lightCell operator*(lightCell cell) + { + return lightCell(r*cell.r,g*cell.g,b*cell.b); + } + lightCell operator*=(lightCell cell) + { + r*=cell.r; + g*=cell.g; + b*=cell.b; + return lightCell(r,g,b); + } lightCell operator+(const lightCell& other) { return lightCell(r+other.r,g+other.g,b+other.b);