Skip to content

Commit 742bd27

Browse files
authored
style fixes and change cameraPassCountPerGpuFlush to 0 (#367)
Signed-off-by: Ian Chen <[email protected]>
1 parent b7d7d63 commit 742bd27

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

include/ignition/rendering/Scene.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,9 +1089,9 @@ namespace ignition
10891089
///
10901090
/// \code
10911091
/// scene->PreRender();
1092-
/// for( auto& camera in cameras )
1092+
/// for (auto &camera in cameras)
10931093
/// camera->Render();
1094-
/// for( auto& camera in cameras )
1094+
/// for (auto &camera in cameras)
10951095
/// camera->PostRender();
10961096
/// scene->PostRender();
10971097
/// \endcode

ogre2/src/Ogre2Scene.cc

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class ignition::rendering::Ogre2ScenePrivate
8585
public: uint32_t currNumCameraPasses = 0u;
8686

8787
/// \brief Flag to indicate if we should flush GPU very often (per camera)
88-
public: uint8_t cameraPassCountPerGpuFlush = 6u;
88+
public: uint8_t cameraPassCountPerGpuFlush = 0u;
8989

9090
/// \brief Name of shadow compositor node
9191
public: const std::string kShadowNodeName = "PbsMaterialsShadowNode";
@@ -191,12 +191,12 @@ void Ogre2Scene::PreRender()
191191
}
192192
}
193193

194-
UpdateShadowNode();
194+
this->UpdateShadowNode();
195195
}
196196

197197
BaseScene::PreRender();
198198

199-
if (!LegacyAutoGpuFlush())
199+
if (!this->LegacyAutoGpuFlush())
200200
{
201201
auto engine = Ogre2RenderEngine::Instance();
202202
engine->OgreRoot()->_fireFrameStarted();
@@ -224,16 +224,18 @@ void Ogre2Scene::PostRender()
224224
}
225225
else
226226
{
227-
if (dataPtr->currNumCameraPasses > 0u)
228-
FlushGpuCommandsAndStartNewFrame(0u, true);
227+
if (this->dataPtr->currNumCameraPasses > 0u)
228+
{
229+
this->FlushGpuCommandsAndStartNewFrame(0u, true);
230+
}
229231
else
230232
{
231233
// Every camera already calls FlushGpuCommandsAndStartNewFrame(false)
232234
// right after rendering. So likely commands are already flushed.
233235
//
234236
// If we're here then we are only missing to perform the last step of
235237
// FlushGpuCommandsAndStartNewFrame in order to start a new frame
236-
EndFrame();
238+
this->EndFrame();
237239
}
238240
}
239241
}
@@ -250,8 +252,8 @@ void Ogre2Scene::StartForcedRender()
250252
//////////////////////////////////////////////////
251253
void Ogre2Scene::EndForcedRender()
252254
{
253-
dataPtr->currNumCameraPasses = 0;
254-
FlushGpuCommandsOnly();
255+
this->dataPtr->currNumCameraPasses = 0u;
256+
this->FlushGpuCommandsOnly();
255257

256258
if (this->LegacyAutoGpuFlush() || !this->dataPtr->frameUpdateStarted)
257259
{
@@ -279,27 +281,27 @@ void Ogre2Scene::StartRendering()
279281
}
280282
else
281283
{
282-
IGN_ASSERT( this->dataPtr->frameUpdateStarted == true,
283-
"Started rendering without first calling Scene::PreRender. "
284-
"See Scene::SetCameraPassCountPerGpuFlush for details");
284+
IGN_ASSERT(this->dataPtr->frameUpdateStarted == true,
285+
"Started rendering without first calling Scene::PreRender. "
286+
"See Scene::SetCameraPassCountPerGpuFlush for details");
285287
}
286288
}
287289

288290
//////////////////////////////////////////////////
289291
void Ogre2Scene::FlushGpuCommandsAndStartNewFrame(uint8_t _numPasses,
290292
bool _startNewFrame)
291293
{
292-
dataPtr->currNumCameraPasses += _numPasses;
294+
this->dataPtr->currNumCameraPasses += _numPasses;
293295

294-
if (dataPtr->currNumCameraPasses >= dataPtr->cameraPassCountPerGpuFlush ||
295-
_startNewFrame)
296+
if (this->dataPtr->currNumCameraPasses >= dataPtr->cameraPassCountPerGpuFlush
297+
|| _startNewFrame)
296298
{
297-
dataPtr->currNumCameraPasses = 0;
298-
FlushGpuCommandsOnly();
299+
this->dataPtr->currNumCameraPasses = 0u;
300+
this->FlushGpuCommandsOnly();
299301

300302
// Legacy mode requires to do EndFrame here every time
301303
if (dataPtr->cameraPassCountPerGpuFlush == 0u || _startNewFrame)
302-
EndFrame();
304+
this->EndFrame();
303305
}
304306
}
305307

@@ -341,8 +343,8 @@ void Ogre2Scene::EndFrame()
341343
auto itor = ogreRoot->getSceneManagerIterator();
342344
while (itor.hasMoreElements())
343345
{
344-
Ogre::SceneManager *sceneManager = itor.getNext();
345-
sceneManager->clearFrameData();
346+
Ogre::SceneManager *sceneManager = itor.getNext();
347+
sceneManager->clearFrameData();
346348
}
347349

348350
ogreRoot->_fireFrameEnded();
@@ -1158,7 +1160,7 @@ void Ogre2Scene::CreateContext()
11581160

11591161
// See ogre doxygen documentation regarding culling methods.
11601162
// In some cases you may still want to use single thread.
1161-
// if( numThreads > 1 )
1163+
// if (numThreads > 1)
11621164
// threadedCullingMethod = Ogre::INSTANCING_CULLING_THREADED;
11631165
// Create the SceneManager, in this case a generic one
11641166
this->ogreSceneManager = root->createSceneManager(Ogre::ST_GENERIC,

0 commit comments

Comments
 (0)