void VSectorVisibilityZone::OnTagVisible(IVisVisibilityCollector_cl *pCollector, VisFrustum_cl *pFrustum) { #if !defined(_VISION_MOBILE) if (VISION_UNLIKELY(m_pSector==NULL)) // this only happens when the scene has been accidentally exported without terrain return; VASSERT(m_pTerrain); VTerrainVisibilityCollectorComponent *pComponent = m_pTerrain->FindTerrainComponent(pCollector); if (VISION_UNLIKELY(pComponent==NULL)) { m_pTerrain->EnsureCollectorComponentAdded(pCollector); pComponent = m_pTerrain->FindTerrainComponent(pCollector); } VTerrainVisibilityInfo &info(pComponent->m_VisibilityInfo); info.m_pCamFrustum = pFrustum; if (!info.m_bVisibleInContext || (m_pSector->GetVisibleBitmask()&info.m_iContextFilterMask)==0) return; if (!m_pSector->m_bPrepared || !m_pSector->IsLoaded()) // the sector will be loaded while rendering, but then the decoration isn't visible { pComponent->AddPendingSector(m_pSector); return; } m_pSector->PerformVisibility(*pComponent); #endif }
// called by sectors: inline void AddVisibleDecorationInstance(VTerrainDecorationInstance *pInstance) { IVTerrainDecorationModel *pModel = pInstance->m_spModel; VASSERT(pModel!=NULL); if (VISION_UNLIKELY(!pModel->IsLoaded())) { if (pModel->IsMissing()) return; pModel->EnsureLoaded(); if (pModel->IsMissing() || !pModel->IsValid()) return; } pModel->UpdateTimeStamp(); // for resource management m_VisibleDecoration[m_iVisibleDecorationCount++] = pInstance; }
void TriggerDoorEntity_cl::MessageFunction(int iID, INT_PTR iParamA, INT_PTR iParamB) { VisObject3D_cl::MessageFunction(iID,iParamA,iParamB); if (iID==VIS_MSG_TRIGGER) { // cache IDs to avoid string comparisons during runtime if (VISION_UNLIKELY(TRIGGERDOOR_ID_OPEN == -1)) { // name to integer ID conversion: TRIGGERDOOR_ID_OPEN = IVObjectComponent::RegisterStringID(TRIGGERDOOR_OPEN); TRIGGERDOOR_ID_CLOSE = IVObjectComponent::RegisterStringID(TRIGGERDOOR_CLOSE); } VisTriggerTargetComponent_cl *pTarget = (VisTriggerTargetComponent_cl *)iParamB; if (pTarget->m_iComponentID == TRIGGERDOOR_ID_OPEN && (m_state == DOOR_CLOSED || m_state == DOOR_CLOSING)) m_state = DOOR_OPENING; else if (pTarget->m_iComponentID == TRIGGERDOOR_ID_CLOSE && (m_state == DOOR_OPEN || m_state == DOOR_OPENING)) m_state = DOOR_CLOSING; return; } }
VCompiledTechnique* VBlobShadowManager::GetDefaultTechnique(VisStaticGeometryType_e eGeomType) { if (VISION_UNLIKELY(m_spDefaultFX==NULL)) { if (m_bFailedLoading) return NULL; // load the shader library with the projection effect BOOL bResult = Vision::Shaders.LoadShaderLibrary("\\Shaders\\BlobShadow.ShaderLib",SHADERLIBFLAG_HIDDEN)!=NULL; VASSERT(bResult); // create the effect m_spDefaultFX = Vision::Shaders.CreateEffect("BlobShadow",NULL); m_bFailedLoading = m_spDefaultFX==NULL; VASSERT(m_spDefaultFX); if (!m_spDefaultFX) return NULL; VTechniqueConfig *pGlobalConfig = Vision::Shaders.GetGlobalTechniqueConfig(); VTechniqueConfig terrainConfig("Terrain",NULL); m_spDefaultTech[0] = m_spDefaultFX->FindCompatibleTechnique(pGlobalConfig); m_spDefaultTech[1] = m_spDefaultFX->FindCompatibleTechnique(&terrainConfig, pGlobalConfig); } return m_spDefaultTech[eGeomType==STATIC_GEOMETRY_TYPE_TERRAIN ? 1:0]; }
/// \brief /// Gets the owner GUI context. inline IVGUIContext *GetContext() const { if (VISION_UNLIKELY(m_pContext==NULL && m_pOwner!=NULL)) m_pContext = m_pOwner->GetContext(); // recurse return m_pContext; }