Commit cb2a3b67 authored by Charles Law's avatar Charles Law
Browse files

Never use an lod if we do not have to

parent 830c27ad
...@@ -146,37 +146,38 @@ void vtkLODActor::Render(vtkRenderer *ren) ...@@ -146,37 +146,38 @@ void vtkLODActor::Render(vtkRenderer *ren)
bestMapper = this->Mapper; bestMapper = this->Mapper;
bestTime = bestMapper->GetRenderTime(); bestTime = bestMapper->GetRenderTime();
// cerr << " Start (" << bestMapper << ") with time: " << bestTime << endl; if (bestTime > myTime)
this->Mappers->InitTraversal();
while ((mapper = this->Mappers->GetNextItem()) != NULL && bestTime != 0.0)
{ {
tempTime = mapper->GetRenderTime(); this->Mappers->InitTraversal();
// cerr << " Mapper (" << mapper << ") RenderTime: " << tempTime <<endl; while ((mapper = this->Mappers->GetNextItem()) != NULL && bestTime != 0.0)
// If the LOD has never been rendered, select it!
if (tempTime == 0.0)
{
// cerr << " Has never been rendererd\n";
bestMapper = mapper;
bestTime = 0.0;
}
else
{ {
if (bestTime > myTime && tempTime < bestTime) tempTime = mapper->GetRenderTime();
{
// cerr << " Less than best in violation\n"; // If the LOD has never been rendered, select it!
bestMapper = mapper; if (tempTime == 0.0)
bestTime = tempTime;
}
if (tempTime > bestTime && tempTime < myTime)
{ {
// cerr << " Larger than best\n"; // cerr << " Has never been rendererd\n";
bestMapper = mapper; bestMapper = mapper;
bestTime = tempTime; bestTime = 0.0;
}
else
{
if (bestTime > myTime && tempTime < bestTime)
{
// cerr << " Less than best in violation\n";
bestMapper = mapper;
bestTime = tempTime;
}
if (tempTime > bestTime && tempTime < myTime)
{
// cerr << " Larger than best\n";
bestMapper = mapper;
bestTime = tempTime;
}
} }
} }
} }
// record start rendering time // record start rendering time
aTime = vtkTimerLog::GetCurrentTime(); aTime = vtkTimerLog::GetCurrentTime();
...@@ -194,10 +195,10 @@ void vtkLODActor::Render(vtkRenderer *ren) ...@@ -194,10 +195,10 @@ void vtkLODActor::Render(vtkRenderer *ren)
} }
this->Device->SetProperty(this->Property); this->Device->SetProperty(this->Property);
/* render the texture */ /* render the texture */
if (this->Texture) this->Texture->Render(ren); if (this->Texture) this->Texture->Render(ren);
// make sure the device has the same matrix // make sure the device has the same matrix
this->GetMatrix(*matrix); this->GetMatrix(*matrix);
this->Device->SetUserMatrix(matrix); this->Device->SetUserMatrix(matrix);
...@@ -213,7 +214,6 @@ void vtkLODActor::Render(vtkRenderer *ren) ...@@ -213,7 +214,6 @@ void vtkLODActor::Render(vtkRenderer *ren)
if (bestTime == 0.0) if (bestTime == 0.0)
{ // This is the first render. { // This is the first render.
bestMapper->SetRenderTime(myTime); bestMapper->SetRenderTime(myTime);
// cerr << " SETTING (" << bestMapper << ") RenderTime to " << myTime << endl;
} }
else else
{ // Running average of render time as a temporary fix for { // Running average of render time as a temporary fix for
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment