本文整理汇总了C++中VisRenderContext_cl::SchedulePixelCounterTest方法的典型用法代码示例。如果您正苦于以下问题:C++ VisRenderContext_cl::SchedulePixelCounterTest方法的具体用法?C++ VisRenderContext_cl::SchedulePixelCounterTest怎么用?C++ VisRenderContext_cl::SchedulePixelCounterTest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisRenderContext_cl
的用法示例。
在下文中一共展示了VisRenderContext_cl::SchedulePixelCounterTest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateCoronas
//.........这里部分代码省略.........
bool bIsLightOnScreen = pComponent->IsValidCandidate(pContext);
if (bIsLightOnScreen)
{
state.SetBit(pComponent->m_iIndex);
pContext->SetPixelCounterResult(pComponent->m_CoronaPixelCounter.GetNumber(), 0);
state.m_Candidates.Append(pComponent);
}
}
}
}
}
// Forces the retrieval all pending queries.
pContext->FetchPixelCounterTestResults( (iCoronaUpdateFlags & VCUF_FORCE_FETCH) > 0 );
// Retrieve Queries and update status of lens flares
if ((iCoronaUpdateFlags & VCUF_UPDATE) > 0)
{
for (int i=0; i < state.m_Candidates.GetSize(); ++i)
{
VCoronaCandidate& coronaCandidate = state.m_Candidates.ElementAt(i);
VCoronaComponent* pCorona = coronaCandidate.m_pCorona;
if (!pCorona || !pCorona->IsEnabled())
continue;
if (pCorona->GetOwner())
{
// Retrieve occlusion results of the last query
unsigned int iElementIndex = pCorona->m_CoronaPixelCounter.GetNumber();
bool bRes = !pContext->IsPixelCounterQueryInProgress(iElementIndex);
// Reschedule query if the old on could be retrieved or if a teleport forces us to re-query everything.
if (bRes | ((iCoronaUpdateFlags & VCUF_FORCE_SCHEDULE) > 0) )
pContext->SchedulePixelCounterTest(iElementIndex);
unsigned int iDrawnPixels = pContext->GetPixelCounterResult(iElementIndex) / iTexelsPerPixel;
float fVisibility = (float)iDrawnPixels / ((int)pCorona->QueryRadius * (int)pCorona->QueryRadius * 4);
// ATI fix for random insanely high return values.
if (iDrawnPixels > ((unsigned int)pCorona->QueryRadius * 2 + 1) * ((unsigned int)pCorona->QueryRadius * 2 + 1))
{
fVisibility = coronaCandidate.m_fLastVisibilityQuery;
}
if ((iCoronaUpdateFlags & VCUF_FORCE_FETCH) > 0)
{
// Force lens flare visibility to the current query value.
coronaCandidate.m_fCurrentVisibility = fVisibility;
coronaCandidate.m_fLastVisibilityQuery = fVisibility;
pCorona->UpdateVisibility(coronaCandidate.m_fLastVisibilityQuery, coronaCandidate.m_fCurrentVisibility);
}
else if (!m_bTeleportedLastFrame)
{
coronaCandidate.m_fLastVisibilityQuery = fVisibility;
pCorona->UpdateVisibility(coronaCandidate.m_fLastVisibilityQuery, coronaCandidate.m_fCurrentVisibility);
}
else
{
// if we were teleported, the last frame's query results must be invalidated
coronaCandidate.m_fCurrentVisibility = 0.0f;
coronaCandidate.m_fLastVisibilityQuery = 0.0f;
}
}
}
}
// Removes coronas that are outside the frustum and no longer visible.
if ((iCoronaUpdateFlags & VCUF_REMOVE) > 0)
{
for (int i=0; i < state.m_Candidates.GetSize();)
{
VCoronaCandidate& coronaCandidate = state.m_Candidates.ElementAt(i);
VCoronaComponent* pCorona = coronaCandidate.m_pCorona;
unsigned int iElementIndex = pCorona->m_CoronaPixelCounter.GetNumber();
// If the visibility reached zero and the corona is no longer potentially visible it is removed from the list
if (!pCorona->IsEnabled() || !pCorona->GetOwner()
|| (pCorona->GetVisibleBitmask() & iRenderFilterMask) == 0
|| (((VisLightSource_cl*)pCorona->GetOwner())->GetVisibleBitmask() & iRenderFilterMask) == 0
|| ( coronaCandidate.m_fCurrentVisibility == 0.0f && !pCorona->IsValidCandidate(pContext) ) )
{
state.RemoveBit(pCorona->m_iIndex);
state.m_Candidates.SetAt(i, state.m_Candidates.GetAt(state.m_Candidates.GetSize()-1) );
state.m_Candidates.RemoveAt(state.m_Candidates.GetSize() -1);
// Reset cache to zero, so we don't see the lens flare once it enters the frustum again.
pContext->SetPixelCounterResult(iElementIndex, 0);
}
else
{
++i;
}
}
}
#endif
}