本文整理汇总了C++中VisRenderContext_cl::GetLastRenderedFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ VisRenderContext_cl::GetLastRenderedFrame方法的具体用法?C++ VisRenderContext_cl::GetLastRenderedFrame怎么用?C++ VisRenderContext_cl::GetLastRenderedFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisRenderContext_cl
的用法示例。
在下文中一共展示了VisRenderContext_cl::GetLastRenderedFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunTick
void VFmodManager::RunTick(float fTimeDelta)
{
VISION_PROFILE_FUNCTION(PROFILING_FMOD_OVERALL);
if (!IsInitialized())
{
if (!IsOutputDevicePresent())
InitDevice();
return;
}
// profiling scope
{
VISION_PROFILE_FUNCTION(PROFILING_FMOD_PUREUPDATE);
VASSERT(m_pEventSystem!=NULL);
// update Fmod listener attributes
VisObject3D_cl *pListener = m_pListenerObject;
if (pListener == NULL)
{
// The listener is the main camera. Check for teleportation since the last Fmod update, in
// which case we won't use the position difference to calculate the listener speed.
VisContextCamera_cl* pCamera = Vision::Camera.GetMainCamera();
VisRenderContext_cl* pContext = VisRenderContext_cl::GetMainRenderContext();
if (pCamera != NULL && pContext != NULL)
{
if (m_bLastListenerPositionValid && pCamera->GetLastTeleported() > m_iFrameOfLastUpdate)
m_bLastListenerPositionValid = false;
m_iFrameOfLastUpdate = pContext->GetLastRenderedFrame();
pListener = pCamera;
}
}
if (!pListener)
return;
hkvVec3 vCamPos = pListener->GetPosition();
hkvVec3 vDir(pListener->GetObjDir()),
vRight(pListener->GetObjDir_Right()),
vUp(pListener->GetObjDir_Up());
// Determine the camera velocity based on the previous known position
hkvVec3 vCamVel(m_bLastListenerPositionValid && (fTimeDelta > 0.f) ? (vCamPos - m_vLastListenerPosition) * (1.f / fTimeDelta) : hkvVec3::ZeroVector());
m_vLastListenerPosition = vCamPos;
m_bLastListenerPositionValid = true;
vUp = -vUp; // compensate for coordinate system
m_pEventSystem->set3DListenerAttributes(0, (FMOD_VECTOR *)&vCamPos, (FMOD_VECTOR *)&vCamVel, (FMOD_VECTOR *)&vDir, (FMOD_VECTOR *)&vUp);
// update all sound objects
SoundInstances().Update(fTimeDelta);
// update all events
Events().Update(fTimeDelta);
// update Fmod event system
m_fTimeLeftOver += fTimeDelta;
if (m_fTimeLeftOver > m_config.fTimeStep)
{
m_pEventSystem->update();
#ifdef VFMOD_SUPPORTS_NETWORK
if (m_config.bUseNetworkSystem)
FMOD::NetEventSystem_Update();
#endif
m_fTimeLeftOver = hkvMath::mod (m_fTimeLeftOver, m_config.fTimeStep);
}
}
// do not purge sounds/ events in vForge, in order to allow toggling playback via hotspot button
if (Vision::Editor.IsInEditor())
return;
if (m_bAnyStopped)
{
VISION_PROFILE_FUNCTION(PROFILING_FMOD_PURGE);
// all sounds/ events that have finished playing are removed from handling
SoundInstances().PurgeNotPlaying();
Events().PurgeNotPlaying();
m_bAnyStopped = false; // reset any stopped flag
}
}
示例2: RenderAllVisibleCoronas
void VCoronaManager::RenderAllVisibleCoronas()
{
#ifdef SUPPORTS_CORONAS
VisRenderContext_cl* pContext = VisRenderContext_cl::GetCurrentContext();
// Determine relevant render context and visibility collector
IVisVisibilityCollector_cl *pVisCollector = pContext->GetVisibilityCollector();
if (!pVisCollector)
return;
VisRenderContext_cl *pOQContext = pVisCollector->GetOcclusionQueryRenderContext();
if (pOQContext != NULL)
pContext = pOQContext;
if ((pContext->GetRenderFlags() & VIS_RENDERCONTEXT_FLAG_USE_PIXELCOUNTER) == 0)
return;
if ((pContext->GetRenderFlags() & VIS_RENDERCONTEXT_FLAG_RENDER_CORONAS) == 0)
return;
INSERT_PERF_MARKER_SCOPE("VCoronaManager::RenderAllVisibleCoronas");
VISION_PROFILE_FUNCTION(PROFILING_CORONA_RENDER);
// Force for the queries to finish so they are available in this frame.
if (m_bTeleportedLastFrame && m_bForceQueryOnTeleport)
{
UpdateCoronas(VCUF_UPDATE | VCUF_FORCE_FETCH | VCUF_USE_OC_CONTEXT);
}
// Ensure size of corona state structure.
int iContextIndex = pContext->GetNumber();
if (iContextIndex + 1 > m_State.GetSize())
m_State.SetSize(iContextIndex + 1, -1);
VCoronaRenderContextState& state = m_State[iContextIndex];
int iCapacity = m_Instances.GetCapacity();
state.EnsureSize(iCapacity);
const int iCoronasToRender = state.m_Candidates.GetSize();
// Sort candidates by texture?
VTextureObject* pTexture = NULL;
// Render all corona components
Vision::RenderLoopHelper.BeginMeshRendering();
Vision::RenderLoopHelper.AddMeshStreams(m_spBillboardMesh,VERTEX_STREAM_POSITION);
for (int i=0; i < iCoronasToRender; ++i)
{
VCoronaCandidate& coronaCandidate = state.m_Candidates.ElementAt(i);
if (coronaCandidate.m_fCurrentVisibility > 0.0f)
{
RenderCorona (coronaCandidate, pTexture);
}
}
Vision::RenderLoopHelper.EndMeshRendering();
m_bTeleportedLastFrame = (pContext->GetCamera()->GetLastTeleported() >= pContext->GetLastRenderedFrame());
#endif
}