BGE patch: logic optimization part 2: remove inactive sensors from logic manager.
With this patch, only sensors that are connected to active states are actually registered in the logic manager. Inactive sensors won't take any CPU, especially the Radar and Near sensors that use a physical object for the detection: these objects are removed from the physics engine. To take advantage of this optimization patch, you need to define very light idle state when the objects are inactive: make them transparent, suspend the physics, keep few sensors active (e,g a message sensor to wake up), etc.
This commit is contained in:
@@ -62,23 +62,14 @@ void SCA_KeyboardManager::NextFrame()
|
||||
{
|
||||
//const SCA_InputEvent& event = GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
|
||||
// cerr << "SCA_KeyboardManager::NextFrame"<< endl;
|
||||
for (unsigned int i=0;i<m_sensors.size();i++)
|
||||
set<SCA_ISensor*>::iterator it;
|
||||
for (it=m_sensors.begin(); it != m_sensors.end(); it++)
|
||||
{
|
||||
SCA_KeyboardSensor* keysensor = (SCA_KeyboardSensor*)m_sensors[i];
|
||||
keysensor->Activate(m_logicmanager,NULL);
|
||||
(*it)->Activate(m_logicmanager,NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SCA_KeyboardManager::RegisterSensor(SCA_ISensor* keysensor)
|
||||
{
|
||||
m_sensors.push_back(keysensor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SCA_KeyboardManager::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
|
||||
{
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user