void vtkRenderer::Render(void)
{
if(this->Delegate!=0 && this->Delegate->GetUsed())
{
this->Delegate->Render(this);
return;
}
double t1, t2;
int i;
vtkProp *aProp;
int *size;
// If Draw is not on, ignore the render.
if (!this->Draw)
{
vtkDebugMacro("Ignoring render because Draw is off.");
return;
}
以上是一些初始化及判断,不用细讲
t1 = vtkTimerLog::GetUniversalTime();
this->InvokeEvent(vtkCommand::StartEvent,NULL);
size = this->RenderWindow->GetSize();
ti为初始时间。代表渲染开始。
// if backing store is on and we have a stored image
if (this->BackingStore && this->BackingImage &&
this->MTime < this->RenderTime &&
this->ActiveCamera->GetMTime() < this->RenderTime &&
this->RenderWindow->GetMTime() < this->RenderTime &&
this->BackingStoreSize[0] == size[0] &&
this->BackingStoreSize[1] == size[1])
{
int mods = 0;
vtkLight *light;
如果有backing store并且有srored image那么执行下面的代码。
// now we just need to check the lights and actors
vtkCollectionSimpleIterator sit;
for(this->Lights->InitTraversal(sit);
(light = this->Lights->GetNextLight(sit)); )
{
if (light->GetSwitch() &&
light->GetMTime() > this->RenderTime)
{
mods = 1;
goto completed_mod_check;
}
}
vtkCollectionSimpleIterator pit;
for (this->Props->InitTraversal(pit);
(aProp = this->Props->GetNextProp(pit)); )
{
// if it's invisible, we can skip the rest
if (aProp->GetVisibility())
{
if (aProp->GetRedrawMTime() > this->RenderTime)
{
mods = 1;
goto completed_mod_check;
}
}
}
completed_mod_check:
这段代码非常简单,就是检查light和Prop如果有问题,也就是修改时间大于渲染命令发出的时间。说明不是最新的。则直接跳出,不执行下面的代码,如果过没有问题则执行下面的代码,使用到前面讲的backing的相关内容。
if (!mods)
{
int rx1, ry1, rx2, ry2;