bool MedusaModule::OnLoad(IEventArg& e /*= IEventArg::Empty*/) { NodeEditorFactory::Instance().Initialize(); ResolutionAdapter::Instance().Initialize(ApplicationSettings::Instance().ResultWinSize()); ResolutionAdapter::Instance().InitializeCameras(); RenderEngine::Instance().InitializeBeforeWindow(!MEDUSA_FLAG_HAS(ApplicationSettings::Instance().Features(),EngineFeatures::MultipleThreadRendering)); auto game = Application::Instance().Game(); //1. create window mWindow = WindowFactory::Create((MedusaWindowHandle)nullptr, game->Name()); MEDUSA_ASSERT_NOT_NULL(mWindow, ""); mWindow->SetSize(ResolutionAdapter::Instance().WinSize()); MEDUSA_ASSERT_TRUE(mWindow->Initialize(), ""); //2.create egl view mRootView = ViewFactory::CreateGLView(game->Name()); mWindow->AddView(mRootView); MEDUSA_ASSERT_NOT_NULL(mRootView, ""); mRootView->SetSize(ResolutionAdapter::Instance().WinSize()); MEDUSA_ASSERT_TRUE(mRootView->Initialize(), ""); //show window mWindow->Show(); RenderEngine::Instance().InitializeAfterWindow(!MEDUSA_FLAG_HAS(ApplicationSettings::Instance().Features(), EngineFeatures::MultipleThreadRendering)); mUpdateSystemStage.Add( ResourceManager::InstancePtr()); mUpdateSystemStage.Add(AnimationManager::InstancePtr()); mUpdateSystemStage.Add(ParticleManager::InstancePtr()); mUpdateSystemStage.Add(InputManager::InstancePtr()); #ifdef MEDUSA_AL mUpdateSystemStage.Add(AudioEngine::InstancePtr()); //must be after resource manager #endif mUpdateSystemStage.Initialize(); mUpdateSystemStage.ApplyOptionToAll(!MEDUSA_FLAG_HAS(ApplicationSettings::Instance().Features(), EngineFeatures::MultipleThreadUpdating) ? ExecuteOption::Sync : ExecuteOption::Async); SceneManager::Instance().Initialize(!MEDUSA_FLAG_HAS(ApplicationSettings::Instance().Features(), EngineFeatures::MultipleThreadRendering)); return true; }
void IMaterial::AddTexture( ITexture* texture ) { MEDUSA_ASSERT_NOT_NULL(texture,""); MEDUSA_ASSERT_FALSE(mTextures.ContainsKey(texture->Unit()),"Duplicate add texture of same unit"); MEDUSA_ASSERT_FALSE(mTextureSamplerDict.ContainsKey(texture->SamplerName()),"Duplicate add texture of same sampler name"); texture->Retain(); mTextures.Add(texture->Unit(),texture); mTextureSamplerDict.Add(texture->SamplerName(), texture); EnableBlend(texture->IsBlend()); if (mFirstTexture==nullptr) { mFirstTexture=texture; } }