Well,
changes done!
exe file with an example (really ugly one
) is located in:
http://www.astrohenares.org/upd/data/add_2.zip
I've added two new commands. setlinecolor, and setlabelcolor. Sintaxt is as Chris described:
setlinecolor { item "equatorialgrid" color [0 0 1] }
setlabelcolor { item "constellations" color [1 0 0] }
possible Lines items are:
"starorbits"
"planetorbits"
"moonorbits"
"asteroidorbits"
"cometorbits"
"spacecraftorbit"
"constellations"
"boundaries"
"equatorialgrid"
and possible Labels items are:
"stars"
"planets"
"moons"
"asteroids"
"comets"
"spacecraft"
"locations"
"galaxies"
"nebulae"
"openclusters"
"constellations"
"equatorialgrid"
My previous addon was modified to fit the Chris standards, so I do not post the new entire files (with previous add-on) be cuase this suppouse an extra work for merge. So code is posted here in plain text.
Chris, if you preffer other method to receive the code, please tell me.
Add to file cmdparser.cpp, just open a gap between two if--else if
Code: Select all
else if (commandName == "setlinecolor")
{
string item;
paramList->getString("item", item);
Vec3d colorv(1.0f, 0.0f, 0.0f);
paramList->getVector("color", colorv);
Color color((float) colorv.x, (float) colorv.y, (float) colorv.z);
cmd = new CommandSetLineColor(item, color);
}
else if (commandName == "setlabelcolor")
{
string item;
paramList->getString("item", item);
Vec3d colorv(1.0f, 0.0f, 0.0f);
paramList->getVector("color", colorv);
Color color((float) colorv.x, (float) colorv.y, (float) colorv.z);
cmd = new CommandSetLabelColor(item, color);
}
Two new clases to add to command.h
Code: Select all
class CommandSetLineColor : public InstantaneousCommand
{
public:
CommandSetLineColor(const std::string&, Color);
void process(ExecutionEnvironment&);
private:
std::string target;
Color color;
};
class CommandSetLabelColor : public InstantaneousCommand
{
public:
CommandSetLineColor(const std::string&, Color);
void process(ExecutionEnvironment&);
private:
std::string target;
Color color;
};
Implementation of the classes in command.cpp
Code: Select all
CommandSetLineColor::CommandSetLineColor(const string& _target, Color _color) :
target(_target),
color(_color)
{
}
void CommandSetLineColor::process(ExecutionEnvironment& env)
{
if(target=="starorbits")
Renderer::StarOrbitColor=color;
else if(target=="planetorbits")
Renderer::PlanetOrbitColor=color;
else if(target=="moonorbits")
Renderer::MoonOrbitColor=color;
else if(target=="asteroidorbits")
Renderer::AsteroidOrbitColor=color;
else if(target=="cometorbits")
Renderer::CometOrbitColor=color;
else if(target=="spacecraftorbits")
Renderer::SpacecraftOrbitColor=color;
else if(target=="constellations")
Renderer::ConstellationColor=color;
else if(target=="boundaries")
Renderer::BoundaryColor=color;
else if(target=="equatorialgrid")
Renderer::EquatorialGridColor=color;
}
CommandSetLabelColor::CommandSetLabelColor(const string& _target, Color _color) :
target(_target),
color(_color)
{
}
void CommandSetLabelColor::process(ExecutionEnvironment& env)
{
if(target=="stars")
Renderer::StarLabelColor=color;
else if(target=="planets")
Renderer::PlanetLabelColor=color;
else if(target=="moons")
Renderer::MoonLabelColor=color;
else if(target=="asteroids")
Renderer::AsteroidLabelColor=color;
else if(target=="comets")
Renderer::CometLabelColor=color;
else if(target=="spacecraft")
Renderer::SpacecraftLabelColor=color;
else if(target=="locations")
Renderer::LocationLabelColor=color;
else if(target=="galaxies")
Renderer::GalaxyLabelColor=color;
else if(target=="nebulae")
Renderer::NebulaLabelColor=color;
else if(target=="openclusters")
Renderer::OpenClusterLabelColor=color;
else if(target=="constellations")
Renderer::ConstellationLabelColor=color;
else if(target=="equatorialgrid")
Renderer::EquatorialGridLabelColor=color;
}
And that's all folks