| 96 | } |
| 97 | |
| 98 | void ForestWindMgr::processTick() |
| 99 | { |
| 100 | const F32 timeDelta = 0.032f; |
| 101 | |
| 102 | if ( mEmitters.empty() ) |
| 103 | return; |
| 104 | |
| 105 | PROFILE_SCOPE(ForestWindMgr_AdvanceTime); |
| 106 | |
| 107 | // Advance all ForestWinds. |
| 108 | { |
| 109 | PROFILE_SCOPE(ForestWindMgr_AdvanceTime_ForestWind_ProcessTick); |
| 110 | |
| 111 | ForestWindEmitterList::iterator iter = mEmitters.begin(); |
| 112 | for ( ; iter != mEmitters.end(); iter++ ) |
| 113 | { |
| 114 | if ( (*iter)->getWind() && |
| 115 | (*iter)->isEnabled() ) |
| 116 | { |
| 117 | (*iter)->updateMountPosition(); |
| 118 | |
| 119 | ForestWind *wind = (*iter)->getWind(); |
| 120 | if ( wind ) |
| 121 | wind->processTick(); |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | // Assign the new global wind value used by the particle system. |
| 127 | { |
| 128 | ForestWindEmitter *pWindEmitter = getGlobalWind(); |
| 129 | if ( pWindEmitter == NULL ) |
| 130 | ParticleEmitter::setWindVelocity( Point3F::Zero ); |
| 131 | else |
| 132 | { |
| 133 | ForestWind *pWind = pWindEmitter->getWind(); |
| 134 | ParticleEmitter::setWindVelocity( pWind->getDirection() * pWind->getStrength() ); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | // Get the game connection and camera object |
| 139 | // in order to retrieve the camera position. |
| 140 | GameConnection *conn = GameConnection::getConnectionToServer(); |
| 141 | if ( !conn ) |
| 142 | return; |
| 143 | |
| 144 | GameBase *cam = conn->getCameraObject(); |
| 145 | if ( !cam ) |
| 146 | return; |
| 147 | |
| 148 | const Point3F &camPos = cam->getPosition(); |
| 149 | |
| 150 | |
| 151 | |
| 152 | // Gather TreePlacementInfo for trees near the camera. |
| 153 | { |
| 154 | PROFILE_SCOPE( ForestWindMgr_AdvanceTime_GatherTreePlacementInfo ); |
| 155 |
nothing calls this directly
no test coverage detected