Added setvisibilitylimit command.
This commit is contained in:
parent
0c256816ee
commit
d059746c02
|
@ -268,6 +268,12 @@ Command* CommandParser::parseCommand()
|
|||
|
||||
cmd = new CommandLabels(setFlags, clearFlags);
|
||||
}
|
||||
else if (commandName == "setvisibilitylimit")
|
||||
{
|
||||
double mag = 6.0;
|
||||
paramList->getNumber("magnitude", mag);
|
||||
cmd = new CommandSetVisibilityLimit(mag);
|
||||
}
|
||||
else
|
||||
{
|
||||
error("Unknown command name '" + commandName + "'");
|
||||
|
|
|
@ -297,3 +297,23 @@ void CommandLabels::process(ExecutionEnvironment& env)
|
|||
r->setLabelMode(r->getLabelMode() & ~clearFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////
|
||||
// Set limiting magnitude command
|
||||
|
||||
CommandSetVisibilityLimit::CommandSetVisibilityLimit(double mag) :
|
||||
magnitude(mag)
|
||||
{
|
||||
}
|
||||
|
||||
void CommandSetVisibilityLimit::process(ExecutionEnvironment& env)
|
||||
{
|
||||
Renderer* r = env.getRenderer();
|
||||
if (r != NULL)
|
||||
{
|
||||
r->setBrightnessBias(0.0f);
|
||||
r->setBrightnessScale(1.0f / (magnitude + 1.0f));
|
||||
}
|
||||
env.getSimulation()->setFaintestVisible(magnitude);
|
||||
}
|
||||
|
|
|
@ -255,4 +255,16 @@ class CommandLabels : public InstantaneousCommand
|
|||
};
|
||||
|
||||
|
||||
class CommandSetVisibilityLimit : public InstantaneousCommand
|
||||
{
|
||||
public:
|
||||
CommandSetVisibilityLimit(double);
|
||||
void process(ExecutionEnvironment&);
|
||||
|
||||
private:
|
||||
double magnitude;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // _COMMAND_H_
|
||||
|
|
Loading…
Reference in a new issue