Added setambientlight command.

This commit is contained in:
Chris Laurel 2002-03-21 17:48:40 +00:00
parent 8fd644a4df
commit da1249cdbd
3 changed files with 80 additions and 0 deletions

View file

@ -321,6 +321,12 @@ Command* CommandParser::parseCommand()
paramList->getNumber("magnitude", mag);
cmd = new CommandSetVisibilityLimit(mag);
}
else if (commandName == "setambientlight")
{
double brightness = 0.0;
paramList->getNumber("brightness", brightness);
cmd = new CommandSetAmbientLight((float) brightness);
}
else
{
error("Unknown command name '" + commandName + "'");

View file

@ -148,6 +148,31 @@ void CommandSynchronous::process(ExecutionEnvironment& env)
}
////////////////
// Chase command:
CommandChase::CommandChase()
{
}
void CommandChase::process(ExecutionEnvironment& env)
{
env.getSimulation()->chase();
}
////////////////
// Lock command:
CommandLock::CommandLock()
{
}
void CommandLock::process(ExecutionEnvironment& env)
{
env.getSimulation()->follow();
}
////////////////
// Cancel command: cancel a follow or goto command
@ -364,3 +389,19 @@ void CommandSetVisibilityLimit::process(ExecutionEnvironment& env)
}
env.getSimulation()->setFaintestVisible(magnitude);
}
////////////////
// Set ambient light command
CommandSetAmbientLight::CommandSetAmbientLight(float level) :
lightLevel(level)
{
}
void CommandSetAmbientLight::process(ExecutionEnvironment& env)
{
Renderer* r = env.getRenderer();
if (r != NULL)
r->setAmbientLightLevel(lightLevel);
}

View file

@ -143,6 +143,28 @@ class CommandSynchronous : public InstantaneousCommand
};
class CommandLock : public InstantaneousCommand
{
public:
CommandLock();
void process(ExecutionEnvironment&);
private:
int dummy;
};
class CommandChase : public InstantaneousCommand
{
public:
CommandChase();
void process(ExecutionEnvironment&);
private:
int dummy;
};
class CommandCancel : public InstantaneousCommand
{
public:
@ -300,5 +322,16 @@ class CommandSetVisibilityLimit : public InstantaneousCommand
};
class CommandSetAmbientLight : public InstantaneousCommand
{
public:
CommandSetAmbientLight(float);
void process(ExecutionEnvironment&);
private:
float lightLevel;
};
#endif // _COMMAND_H_