Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-07-30 21:41:47 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2008-07-30 21:41:47 +0400
commit8a8a12ed846dc86b2f9b21582fd34d941beed7ed (patch)
tree3d080dee853afcfdb5fd43ea48b441b3128c0583 /source/gameengine/GameLogic/SCA_ISensor.h
parentd05363627bee12bd9e5af8b1114b68f73eeb3e5f (diff)
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.
Diffstat (limited to 'source/gameengine/GameLogic/SCA_ISensor.h')
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h
index 51837755ba4..d5dabbce3ee 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.h
+++ b/source/gameengine/GameLogic/SCA_ISensor.h
@@ -115,6 +115,8 @@ public:
void SetLevel(bool lvl);
void RegisterToManager();
+ void UnregisterToManager();
+
virtual float GetNumber();
/** Stop sensing for a while. */
@@ -129,7 +131,7 @@ public:
void ClrLink()
{ m_links = 0; }
void IncLink()
- { m_links++; }
+ { if (!m_links++) RegisterToManager(); }
void DecLink();
bool IsNoLink() const
{ return !m_links; }