diff --git a/bin/Models/Ownship/Alkmini/radar.ini b/bin/Models/Ownship/Alkmini/radar.ini
index 050ceab13..b0c7900eb 100644
--- a/bin/Models/Ownship/Alkmini/radar.ini
+++ b/bin/Models/Ownship/Alkmini/radar.ini
@@ -26,10 +26,16 @@ radar1_blue(1)=0
radar_bg_red(1)=0
radar_bg_green(1)=0
radar_bg_blue(1)=255
+radar_surround_red(1)=128
+radar_surround_green(1)=128
+radar_surround_blue(1)=128
radar1_red(2)=128
radar1_green(2)=0
radar1_blue(2)=0
radar_bg_red(2)=0
radar_bg_green(2)=0
-radar_bg_blue(2)=0
\ No newline at end of file
+radar_bg_blue(2)=0
+radar_surround_red(2)=64
+radar_surround_green(2)=64
+radar_surround_blue(2)=64
\ No newline at end of file
diff --git a/doc/newmodels.html b/doc/newmodels.html
index 227496415..a0997c6bd 100644
--- a/doc/newmodels.html
+++ b/doc/newmodels.html
@@ -364,6 +364,9 @@
Radar.ini
radar_bg_red(1)=0
radar_bg_green(1)=0
radar_bg_blue(1)=255
+radar_surround_red(1)=128
+radar_surround_green(1)=128
+radar_surround_blue(1)=128
radar1_red(2)=128
radar1_green(2)=0
@@ -371,6 +374,9 @@ Radar.ini
radar_bg_red(2)=0
radar_bg_green(2)=0
radar_bg_blue(2)=0
+radar_surround_red(2)=64
+radar_surround_green(2)=64
+radar_surround_blue(2)=64
NumberOfRadarColourSets: How many sets of colours are available on the radar (e.g. 2 if there is a daytime and a nighttime colour scheme)
-For each radar colour set, where # is the set number (1 to NumberOfRadarColourSets):
- - radar1_red(#), radar1_green(#), radar1_blue(#): The colour for the radar plot, in red green and blue components, each in the range 0-255.
- - radar_bg_red(#), radar_bg_green(#), radar_bg_blue(#): The colour for the radar background, in red green and blue components, each in the range 0-255.
+
+ For each radar colour set, where # is the set number (1 to NumberOfRadarColourSets):
+ - radar1_red(#), radar1_green(#), radar1_blue(#): The colour for the radar plot, in red green and blue components, each in the range 0-255.
+ - radar_bg_red(#), radar_bg_green(#), radar_bg_blue(#): The colour for the radar background, in red green and blue components, each in the range 0-255.
+ - radar_surround_red(#), radar_surround_green(#), radar_surround_blue(#): The colour for the radar surround (also used as the general background colour), in red green and blue components, each in the range 0-255.
diff --git a/src/RadarCalculation.cpp b/src/RadarCalculation.cpp
index a6ca53d83..cdfb7049d 100644
--- a/src/RadarCalculation.cpp
+++ b/src/RadarCalculation.cpp
@@ -130,6 +130,7 @@ void RadarCalculation::load(std::string radarConfigFile, irr::IrrlichtDevice* de
irr::video::SColor radarBackgroundColour;
irr::video::SColor radarForegroundColour;
+ irr::video::SColor radarSurroundColour;
radarBackgroundColour.setAlpha(255);
radarBackgroundColour.setRed(0);
@@ -140,6 +141,12 @@ void RadarCalculation::load(std::string radarConfigFile, irr::IrrlichtDevice* de
radarForegroundColour.setRed(255);
radarForegroundColour.setGreen(220);
radarForegroundColour.setBlue(0);
+
+ radarSurroundColour.setAlpha(255);
+ radarSurroundColour.setRed(128);
+ radarSurroundColour.setGreen(128);
+ radarSurroundColour.setBlue(128);
+
radarBackgroundColours.push_back(radarBackgroundColour);
radarForegroundColours.push_back(radarForegroundColour);
@@ -187,6 +194,7 @@ void RadarCalculation::load(std::string radarConfigFile, irr::IrrlichtDevice* de
//legacy loading
irr::video::SColor radarBackgroundColour;
irr::video::SColor radarForegroundColour;
+ irr::video::SColor radarSurroundColour;
radarBackgroundColour.setAlpha(255);
radarBackgroundColour.setRed(IniFile::iniFileTou32(radarConfigFile,"radar_bg_red"));
@@ -198,12 +206,19 @@ void RadarCalculation::load(std::string radarConfigFile, irr::IrrlichtDevice* de
radarForegroundColour.setGreen(IniFile::iniFileTou32(radarConfigFile,"radar1_green"));
radarForegroundColour.setBlue(IniFile::iniFileTou32(radarConfigFile,"radar1_blue"));
+ radarSurroundColour.setAlpha(255);
+ radarSurroundColour.setRed(IniFile::iniFileTou32(radarConfigFile, "radar_surround_red", 128));
+ radarSurroundColour.setGreen(IniFile::iniFileTou32(radarConfigFile, "radar1_green", 128));
+ radarSurroundColour.setBlue(IniFile::iniFileTou32(radarConfigFile, "radar1_blue", 128));
+
radarBackgroundColours.push_back(radarBackgroundColour);
radarForegroundColours.push_back(radarForegroundColour);
+ radarSurroundColours.push_back(radarSurroundColour);
} else {
for (unsigned int i = 1; i <= numberOfRadarColourSets; i++) {
irr::video::SColor radarBackgroundColour;
irr::video::SColor radarForegroundColour;
+ irr::video::SColor radarSurroundColour;
radarBackgroundColour.setAlpha(255);
radarBackgroundColour.setRed(IniFile::iniFileTou32(radarConfigFile,IniFile::enumerate1("radar_bg_red",i)));
@@ -215,8 +230,14 @@ void RadarCalculation::load(std::string radarConfigFile, irr::IrrlichtDevice* de
radarForegroundColour.setGreen(IniFile::iniFileTou32(radarConfigFile,IniFile::enumerate1("radar1_green",i)));
radarForegroundColour.setBlue(IniFile::iniFileTou32(radarConfigFile,IniFile::enumerate1("radar1_blue",i)));
+ radarSurroundColour.setAlpha(255);
+ radarSurroundColour.setRed(IniFile::iniFileTou32(radarConfigFile, IniFile::enumerate1("radar_surround_red", i), 128));
+ radarSurroundColour.setGreen(IniFile::iniFileTou32(radarConfigFile, IniFile::enumerate1("radar_surround_green", i), 128));
+ radarSurroundColour.setBlue(IniFile::iniFileTou32(radarConfigFile, IniFile::enumerate1("radar_surround_blue", i), 128));
+
radarBackgroundColours.push_back(radarBackgroundColour);
radarForegroundColours.push_back(radarForegroundColour);
+ radarSurroundColours.push_back(radarSurroundColour);
}
}
@@ -645,7 +666,7 @@ void RadarCalculation::update(irr::video::IImage * radarImage, irr::video::IImag
//Reset screen if needed
if(radarScreenStale) {
- radarImage->fill(irr::video::SColor(255, 128, 128, 128)); //Fill with background colour
+ radarImage->fill(getRadarSurroundColour());
//Reset 'previous' array so it will all get re-drawn
for(irr::u32 i = 0; i1.0) {pixelColour = 1.0;}
if (pixelColour<0) {pixelColour = 0;}
- if (currentRadarColourChoice < radarForegroundColours.size() && currentRadarColourChoice < radarBackgroundColours.size()) {
- //Interpolate colour between foreground and background
- irr::video::SColor thisColour = radarForegroundColours.at(currentRadarColourChoice).getInterpolated(radarBackgroundColours.at(currentRadarColourChoice), pixelColour);
- drawSector(radarImage,
- centrePixel,
- centrePixel,
- cellMinRange[currentStep],
- cellMaxRange[currentStep],
- cellMinAngle,
- cellMaxAngle,
- thisColour.getAlpha(),
- thisColour.getRed(),
- thisColour.getGreen(),
- thisColour.getBlue(),
- ownShipHeading);
- }
+ //Interpolate colour between foreground and background
+ irr::video::SColor thisColour = getRadarForegroundColour().getInterpolated(getRadarBackgroundColour(), pixelColour);
+ drawSector(radarImage,
+ centrePixel,
+ centrePixel,
+ cellMinRange[currentStep],
+ cellMaxRange[currentStep],
+ cellMinAngle,
+ cellMaxAngle,
+ thisColour.getAlpha(),
+ thisColour.getRed(),
+ thisColour.getGreen(),
+ thisColour.getBlue(),
+ ownShipHeading);
scanArrayToPlotPrevious[scanLine][currentStep] = scanArrayToPlot[scanLine][currentStep]; //Record what we have plotted
}
@@ -1847,4 +1866,35 @@ bool RadarCalculation::isPointInEllipse(irr::f32 pointX, irr::f32 pointZ, irr::f
} else {
return false;
}
+
+}
+
+irr::video::SColor RadarCalculation::getRadarForegroundColour() const
+{
+ if (currentRadarColourChoice < radarForegroundColours.size()) {
+ return radarForegroundColours.at(currentRadarColourChoice);
+ }
+ else {
+ return irr::video::SColor(255, 255, 220, 0);
+ }
+}
+
+irr::video::SColor RadarCalculation::getRadarBackgroundColour() const
+{
+ if (currentRadarColourChoice < radarBackgroundColours.size()) {
+ return radarBackgroundColours.at(currentRadarColourChoice);
+ }
+ else {
+ return irr::video::SColor(255, 0, 0, 200);
+ }
+}
+
+irr::video::SColor RadarCalculation::getRadarSurroundColour() const
+{
+ if (currentRadarColourChoice < radarSurroundColours.size()) {
+ return radarSurroundColours.at(currentRadarColourChoice);
+ }
+ else {
+ return irr::video::SColor(255, 128, 128, 128);
+ }
}
\ No newline at end of file
diff --git a/src/RadarCalculation.hpp b/src/RadarCalculation.hpp
index 8feaf3fdd..5c89de721 100644
--- a/src/RadarCalculation.hpp
+++ b/src/RadarCalculation.hpp
@@ -160,6 +160,9 @@ class RadarCalculation
void clearManualPoints();
void trackTargetFromCursor();
void clearTargetFromCursor();
+ irr::video::SColor getRadarForegroundColour() const;
+ irr::video::SColor getRadarBackgroundColour() const;
+ irr::video::SColor getRadarSurroundColour() const;
void update(irr::video::IImage * radarImage, irr::video::IImage * radarImageOverlaid, irr::core::vector3d offsetPosition, const Terrain& terrain, const OwnShip& ownShip, const Buoys& buoys, const OtherShips& otherShips, irr::f32 weather, irr::f32 rain, irr::f32 tideHeight, irr::f32 deltaTime, uint64_t absoluteTime, irr::core::vector2di mouseRelPosition, bool isMouseDown);
private:
@@ -212,6 +215,7 @@ class RadarCalculation
//colours
std::vector radarBackgroundColours;
std::vector radarForegroundColours;
+ std::vector radarSurroundColours;
irr::u32 currentRadarColourChoice;
std::vector radarRangeNm;
diff --git a/src/SimulationModel.cpp b/src/SimulationModel.cpp
index fc2631dd2..18fa2fe1f 100644
--- a/src/SimulationModel.cpp
+++ b/src/SimulationModel.cpp
@@ -229,11 +229,7 @@ SimulationModel::SimulationModel(irr::IrrlichtDevice* dev,
radarImageOverlaid = driver->createImage (irr::video::ECF_A8R8G8B8, irr::core::dimension2d(radarTextureSize, radarTextureSize)); //Create image for radar calculation to work on
radarImageLarge = driver->createImage (irr::video::ECF_A8R8G8B8, irr::core::dimension2d(largeRadarTextureSize, largeRadarTextureSize)); //Create image for radar calculation to work on
radarImageOverlaidLarge = driver->createImage (irr::video::ECF_A8R8G8B8, irr::core::dimension2d(largeRadarTextureSize, largeRadarTextureSize)); //Create image for radar calculation to work on
- //fill with bg colour
- radarImage->fill(irr::video::SColor(255, 128, 128, 128)); //Fill with background colour
- radarImageOverlaid->fill(irr::video::SColor(255, 128, 128, 128)); //Fill with background colour
- radarImageLarge->fill(irr::video::SColor(255, 128, 128, 128)); //Fill with background colour
- radarImageOverlaidLarge->fill(irr::video::SColor(255, 128, 128, 128)); //Fill with background colour
+ //Images will be filled with background colour in RadarCalculation
//make radar camera
std::vector radarViews; //Get the initial camera offset from the radar screen
@@ -1201,6 +1197,11 @@ SimulationModel::~SimulationModel()
return radarCalculation.isRadarOn();
}
+ irr::video::SColor SimulationModel::getRadarSurroundColour() const
+ {
+ return radarCalculation.getRadarSurroundColour();
+ }
+
void SimulationModel::increaseRadarRange()
{
radarCalculation.increaseRange();
diff --git a/src/SimulationModel.hpp b/src/SimulationModel.hpp
index 4cabce936..f4e13532f 100644
--- a/src/SimulationModel.hpp
+++ b/src/SimulationModel.hpp
@@ -252,6 +252,7 @@ class SimulationModel //Start of the 'Model' part of MVC
void setAlarm(bool alarmState);
void toggleRadarOn();
bool isRadarOn() const;
+ irr::video::SColor getRadarSurroundColour() const;
void increaseRadarRange();
void decreaseRadarRange();
void setRadarGain(irr::f32 value);
diff --git a/src/main.cpp b/src/main.cpp
index d863f6a6a..76f1eaf7e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1126,7 +1126,7 @@ int main(int argc, char ** argv)
// modelProfile.tic();
}{ IPROF("Render setup");
driver->setViewPort(irr::core::rect(0,0,graphicsWidth,graphicsHeight)); //Full screen before beginScene
- driver->beginScene(irr::video::ECBF_COLOR|irr::video::ECBF_DEPTH, irr::video::SColor(0,128,128,128));
+ driver->beginScene(irr::video::ECBF_COLOR|irr::video::ECBF_DEPTH, model.getRadarSurroundColour());
// renderSetupProfile.toc();
// renderRadarProfile.tic();