void OBSBasic::AddSourceWithProperty(const char *id) { size_t curTime = base::Time::Now().ToTimeT(); const char *src_name = obs_source_get_display_name(id); std::ostringstream os; os << src_name << "_" << curTime; std::string name = os.str(); OBSScene scene = GetCurrentScene(); if (!scene) return; obs_source_t * source = obs_source_create(id, name.c_str(), NULL, nullptr); if (source) { obs_scene_atomic_update(scene, [](void *data, obs_scene_t *scene){ obs_scene_add(scene, (obs_source_t *)data); }, source); } CreatePropertiesWindow(source, true); obs_source_release(source); }
//*********************************************************************** BOOL CLGBApp::GotoCurrentScene() //*********************************************************************** { LPGBSCENE lpScene = (LPGBSCENE)GetCurrentScene(); if (lpScene) return(GotoScene(lpScene->GetWindow(), lpScene->GetSceneNo(), lpScene->GetNextSceneNo())); else return(FALSE); }
void OBSBasic::on_switchSceneBtn_clicked() { tbliveLog.Log(lss_info, L"on_switchSceneBtn_clicked"); OBSScene curScene = GetCurrentScene(); obs_source_t * source = obs_scene_get_source(curScene); SetCurrentScene(source, false); TransitionToScene(source, false); m_streamingScene = source; SetTabStreamingStatus(QT_UTF8(obs_source_get_name(m_streamingScene))); CurrentTabSceneUpdateControls(); }
void CSceneManager::TriggerOnEnterAction() { if (m_bUpdateSwitcher) { if (m_onEnterScene.size() > 0) { BEYONDENGINE_CHECK_HEAP; for (uint32_t i = 0; i < m_onEnterScene.size(); ++i) { if (m_onEnterScene[i] == GetCurrentScene()) { // We can safely call OnEnter here because all components loaded are initialized. m_onEnterScene[i]->OnEnter(); break; } } m_onEnterScene.clear(); // Because OnEnter may cause much time, to avoid delta time too much, we manually clear the delta time. CApplication::GetInstance()->GetUpdateTimeMeter().Tick(); BEYONDENGINE_CHECK_HEAP; } } }
//Draw the bucketz void RenderManager::Draw( void ) { unsigned __int16 lastEffect = 65000; unsigned __int16 lastMaterial = 65000; bool sameEffect = false; bool sameMaterial = false; IDirect3DSurface9* opaqueSurface; m_opaqueTexture->GetSurfaceLevel( 0, &opaqueSurface ); IDirect3DSurface9* depthSurface; m_depthTexture->GetSurfaceLevel( 0, &depthSurface ); IDirect3DSurface9* shadowSurface; m_shadowTexture->GetSurfaceLevel( 0, &shadowSurface ); IDirect3DSurface9* finalSurface = NULL; if( Scene::m_postProcessing ) { m_finalBuffer->GetSurfaceLevel( 0, &finalSurface ); } // Every frame an entirely new image will be created. // Before drawing anything, then, the previous image will be erased // by "clearing" the image buffer (filling it with a solid color) const D3DRECT* subRectanglesToClear = NULL; DWORD subRectangleCount = 0; DWORD clearTheRenderTargetAndZ = D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER; DWORD clearTheRenderTargetNoZ = D3DCLEAR_TARGET; D3DCOLOR clearColor; { clearColor = m_clearColor; } float noZBuffer = 1.0f; DWORD noStencilBuffer = 1; HRESULT result; result = g_RenderDevices.GetDevice()->BeginScene(); assert( SUCCEEDED( result ) ); // SET SCENE CONSTANTS... RenderManager::SetSceneConstants( ); //===============DRAW SHADOW (use depth technique)===================== if( GetCurrentScene()->m_shadowMap && m_depthBucket.size() > 0 ) { #ifdef _DEBUG D3DPERF_EndEvent( ); D3DPERF_BeginEvent( D3DCOLOR_XRGB(255, 0, 0 ), L"Shadow Bucket"); #endif //render the depth bucket. still not the way i want to be doing it, but let's get the grade... //SET DEPTH SURFACE AS RENDER TARGET g_RenderDevices.GetDevice()->SetRenderTarget( 0, shadowSurface ); //CLEAR IT result = g_RenderDevices.GetDevice()->Clear( subRectangleCount, subRectanglesToClear, clearTheRenderTargetAndZ, clearColor, noZBuffer, noStencilBuffer ); assert( SUCCEEDED( result ) ); for(int i = 0; i < (int)m_depthBucket.size(); i++ ) { ResourcePtr<EffectReference> effectRef = m_depthBucket[i].se_entity->m_material->rm_Reference.m_effect; unsigned __int16 check = effectRef->rm_Reference.m_effectId; unsigned __int16 check2 = (unsigned __int16) m_depthBucket[i].se_key >> 13; Entity* currentEntity = m_depthBucket[i].se_entity; if( effectRef->rm_Reference.m_effectId != lastEffect ) sameEffect = false; else sameEffect = true; lastEffect = effectRef->rm_Reference.m_effectId; unsigned __int16 matCheck = m_depthBucket[i].se_entity->m_material->rm_Reference.m_materialId; unsigned __int16 matCheck2 = 0x0000000D & m_depthBucket[i].se_key; if( matCheck == lastMaterial ) sameMaterial = true; else sameMaterial = false; lastMaterial = matCheck; ResourcePtr<MaterialReference> mRef = m_depthBucket[i].se_entity->m_material; RenderManager::SetUniformData( currentEntity, effectRef, mRef, sameEffect, sameMaterial, 7 ); currentEntity->Draw(); } }