void CascadedShadowMapApp::CSMTypeChangedHandler(UIComboBox const & sender) { CascadedShadowLayerType type = static_cast<CascadedShadowLayerType>(sender.GetSelectedIndex() + 1); deferred_rendering_->SetCascadedShadowType(type); dialog_->Control<UIStatic>(id_pssm_factor_static_)->SetEnabled(CSLT_PSSM == type); dialog_->Control<UISlider>(id_pssm_factor_slider_)->SetEnabled(CSLT_PSSM == type); }
//---------------------------------------------------------------------------- void _AxisButtonCallback(UIFrame *frame, UICallType type) { UIComboBox *comboBox = DynamicCast<UIComboBox>(frame); if (comboBox) { std::string chooseStr = comboBox->GetChooseStr(); if ("Local" == chooseStr) { PX2_EDIT.SetEditAxisMode(Edit::EAM_LOCAL); } else if ("World" == chooseStr) { PX2_EDIT.SetEditAxisMode(Edit::EAM_WORLD); } else if ("Parent" == chooseStr) { PX2_EDIT.SetEditAxisMode(Edit::EAM_PARENT); } } }
void DeferredRenderingApp::BufferChangedHandler(UIComboBox const & sender) { buffer_type_ = sender.GetSelectedIndex(); deferred_rendering_->Display(static_cast<DeferredRenderingLayer::DisplayType>(buffer_type_)); if (dialog_->Control<UICheckBox>(id_aa_)->GetChecked()) { anti_alias_enabled_ = 1 + (DeferredRenderingLayer::DT_Edge == buffer_type_); RenderEngine& re = Context::Instance().RenderFactoryInstance().RenderEngineInstance(); re.PPAAEnabled(anti_alias_enabled_); } }
void AreaLightingApp::LightTypeChangedHandler(UIComboBox const & sender) { switch (sender.GetSelectedIndex()) { case 0: point_light_->Enabled(true); point_light_src_->Visible(true); sphere_area_light_->Enabled(false); sphere_area_light_src_->Visible(false); tube_area_light_->Enabled(false); tube_area_light_src_->Visible(false); dialog_->Control<UIStatic>(id_radius_static_)->SetVisible(false); dialog_->Control<UISlider>(id_radius_slider_)->SetVisible(false); dialog_->Control<UIStatic>(id_length_static_)->SetVisible(false); dialog_->Control<UISlider>(id_length_slider_)->SetVisible(false); break; case 1: point_light_->Enabled(false); point_light_src_->Visible(false); sphere_area_light_->Enabled(true); sphere_area_light_src_->Visible(true); tube_area_light_->Enabled(false); tube_area_light_src_->Visible(false); dialog_->Control<UIStatic>(id_radius_static_)->SetVisible(true); dialog_->Control<UISlider>(id_radius_slider_)->SetVisible(true); dialog_->Control<UIStatic>(id_length_static_)->SetVisible(false); dialog_->Control<UISlider>(id_length_slider_)->SetVisible(false); break; case 2: point_light_->Enabled(false); point_light_src_->Visible(false); sphere_area_light_->Enabled(false); sphere_area_light_src_->Visible(false); tube_area_light_->Enabled(true); tube_area_light_src_->Visible(true); dialog_->Control<UIStatic>(id_radius_static_)->SetVisible(false); dialog_->Control<UISlider>(id_radius_slider_)->SetVisible(false); dialog_->Control<UIStatic>(id_length_static_)->SetVisible(true); dialog_->Control<UISlider>(id_length_slider_)->SetVisible(true); break; default: break; } }
//---------------------------------------------------------------------------- EU_PreViewFrame::EU_PreViewFrame() { float toolBarSize = PX2_UISM.Size_ToolBar; mToolFrame = new0 UIFrame(); AttachChild(mToolFrame); mToolFrame->LocalTransform.SetTranslateY(-1.0f); UIPicBox *picBox = mToolFrame->CreateAddBackgroundPicBox(); picBox->SetColor(PX2_UISM.Color_ToolBar); mToolFrame->SetAnchorHor(0.0f, 1.0f); mToolFrame->SetAnchorVer(1.0f, 1.0f); mToolFrame->SetPivot(0.5f, 1.0f); mToolFrame->SetSize(Sizef(0.0f, toolBarSize)); float comboWidth = 50.0f; UIComboBox *comboBox = new0 UIComboBox(); mToolFrame->AttachChild(comboBox); comboBox->LocalTransform.SetTranslateY(-1.0f); comboBox->SetSize(comboWidth, toolBarSize); comboBox->SetAnchorHor(0.0f, 0.0f); comboBox->SetAnchorParamHor(comboWidth/2.0f, 0.0f); comboBox->SetAnchorVer(0.5f, 0.5f); comboBox->AddChooseStr("1"); comboBox->AddChooseStr("2"); comboBox->AddChooseStr("3"); comboBox->SetChooseListHeightSameWithChooses(); comboBox->Choose(0); mCanvasPreView = new0 EU_CanvasPreView(); mCanvasPreView->SetName("CanvasPreView"); mCanvasPreView->LocalTransform.SetTranslateY(-1.0f); AttachChild(mCanvasPreView); mCanvasPreView->LocalTransform.SetTranslateY(-1.0f); mCanvasPreView->SetAnchorHor(0.0f, 1.0f); mCanvasPreView->SetAnchorVer(0.0f, 1.0f); mCanvasPreView->SetAnchorParamVer(0.0f, -PX2_UISM.Size_ToolBar); }
void GlobalIlluminationApp::IllumChangedHandler(UIComboBox const & sender) { deferred_rendering_->DisplayIllum(sender.GetSelectedIndex()); }
//---------------------------------------------------------------------------- EU_StageFrame::EU_StageFrame() { mToolFrame = new0 UIFrame(); AttachChild(mToolFrame); mToolFrame->LocalTransform.SetTranslateY(-1.0f); UIPicBox *picBox = mToolFrame->CreateAddBackgroundPicBox(); picBox->SetColor(PX2_UISM.Color_ToolBar); mToolFrame->SetAnchorHor(0.0f, 1.0f); mToolFrame->SetAnchorVer(1.0f, 1.0f); mToolFrame->SetPivot(0.5f, 1.0f); mToolFrame->SetSize(Sizef(0.0f, PX2_UISM.Size_ToolBar)); mToolFrame->SetUIChildPickOnlyInSizeRange(false); Sizef butSize = Sizef(PX2_UISM.Size_ToolBarBut, PX2_UISM.Size_ToolBarBut); float butSpace = 2.0f; Sizef spliterSize = Sizef(4.0f, PX2_UISM.Size_ToolBar - 2); float addButPos = 0.0f; // edit type addButPos = butSize.Width / 2.0f; UIButton *butET_SCENE = new0 UIButton(); mToolFrame->AttachChild(butET_SCENE); butET_SCENE->LocalTransform.SetTranslateY(-1.0f); butET_SCENE->SetAnchorHor(0.0f, 0.0f); butET_SCENE->SetAnchorVer(0.5f, 0.5f); butET_SCENE->SetAnchorParamHor(addButPos, 0.0f); butET_SCENE->SetSize(butSize); butET_SCENE->SetName("ButET_Scene"); butET_SCENE->AddVisitor(this); butET_SCENE->CreateAddText("Sce"); butET_SCENE->GetText()->SetFontColor(PX2_UISM.Color_ContentFont); butET_SCENE->GetText()->SetFontScale(PX2_UISM.Size_PropertyFontScale); addButPos += butSpace + butSize.Width; UIButton *butET_UI = new0 UIButton(); mToolFrame->AttachChild(butET_UI); butET_UI->LocalTransform.SetTranslateY(-1.0f); butET_UI->SetAnchorHor(0.0f, 0.0f); butET_UI->SetAnchorVer(0.5f, 0.5f); butET_UI->SetAnchorParamHor(addButPos, 0.0f); butET_UI->SetSize(butSize); butET_UI->SetName("ButET_UI"); butET_UI->AddVisitor(this); butET_UI->CreateAddText("UI"); butET_UI->GetText()->SetFontColor(PX2_UISM.Color_ContentFont); butET_UI->GetText()->SetFontScale(PX2_UISM.Size_PropertyFontScale); addButPos += butSpace + butSize.Width; UIButton *butET_Terrain = new0 UIButton(); mToolFrame->AttachChild(butET_Terrain); butET_Terrain->LocalTransform.SetTranslateY(-1.0f); butET_Terrain->SetAnchorHor(0.0f, 0.0f); butET_Terrain->SetAnchorVer(0.5f, 0.5f); butET_Terrain->SetAnchorParamHor(addButPos, 0.0f); butET_Terrain->SetSize(butSize); butET_Terrain->SetName("ButET_Terain"); butET_Terrain->AddVisitor(this); butET_Terrain->CreateAddText("Ter"); butET_Terrain->GetText()->SetFontColor(PX2_UISM.Color_ContentFont); butET_Terrain->GetText()->SetFontScale(PX2_UISM.Size_PropertyFontScale); addButPos += (butSize.Width / 2.0f + butSpace + spliterSize.Width / 2.0f); UIFPicBox *spliter = new0 UIFPicBox(); mToolFrame->AttachChild(spliter); spliter->GetUIPicBox()->SetTexture("Data/engine/white.png"); spliter->GetUIPicBox()->SetColor(PX2_UISM.Color_ToolBarSpliter); spliter->LocalTransform.SetTranslateY(-1.0f); spliter->SetAnchorHor(0.0f, 0.0f); spliter->SetAnchorVer(0.5f, 0.5f); spliter->SetAnchorParamHor(addButPos, 0.0f); spliter->SetSize(spliterSize); // edit mode float comboWidth = 100.0f; addButPos += (spliterSize.Width / 2.0f + butSpace + comboWidth / 2.0f); UIComboBox *axisComboBox = new0 UIComboBox(); mToolFrame->AttachChild(axisComboBox); axisComboBox->LocalTransform.SetTranslateY(-1.0f); axisComboBox->SetAnchorHor(0.0f, 0.0f); axisComboBox->SetAnchorVer(0.5f, 0.5f); axisComboBox->SetAnchorParamHor(addButPos, 0.0f); axisComboBox->SetSize(Sizef(comboWidth, butSize.Height)); axisComboBox->SetName("ComAxis"); axisComboBox->AddChooseStr("World"); axisComboBox->AddChooseStr("Local"); axisComboBox->AddChooseStr("Parent"); axisComboBox->SetChooseListHeightSameWithChooses(); axisComboBox->SetTextColor(Float3::MakeColor(220, 220, 220)); axisComboBox->GetSelectButton()->GetText()->SetFontScale(0.65f); axisComboBox->Choose(0); axisComboBox->AddUICallback(_AxisButtonCallback); addButPos += comboWidth / 2.0f + butSize.Width/2.0f + butSpace; UIButton *butEM_Select = new0 UIButton(); mToolFrame->AttachChild(butEM_Select); butEM_Select->LocalTransform.SetTranslateY(-1.0f); butEM_Select->SetAnchorHor(0.0f, 0.0f); butEM_Select->SetAnchorVer(0.5f, 0.5f); butEM_Select->SetAnchorParamHor(addButPos, 0.0f); butEM_Select->SetSize(butSize); butEM_Select->SetName("ButEM_Select"); butEM_Select->AddVisitor(this); butEM_Select->CreateAddText("Sel"); butEM_Select->GetText()->SetFontColor(PX2_UISM.Color_ContentFont); butEM_Select->GetText()->SetFontScale(PX2_UISM.Size_PropertyFontScale); addButPos += butSize.Width + butSpace; UIButton *butEM_Trans = new0 UIButton(); mToolFrame->AttachChild(butEM_Trans); butEM_Trans->LocalTransform.SetTranslateY(-1.0f); butEM_Trans->SetAnchorHor(0.0f, 0.0f); butEM_Trans->SetAnchorVer(0.5f, 0.5f); butEM_Trans->SetAnchorParamHor(addButPos, 0.0f); butEM_Trans->SetSize(butSize); butEM_Trans->SetName("ButEM_Trans"); butEM_Trans->AddVisitor(this); butEM_Trans->CreateAddText("Tra"); butEM_Trans->GetText()->SetFontColor(PX2_UISM.Color_ContentFont); butEM_Trans->GetText()->SetFontScale(PX2_UISM.Size_PropertyFontScale); addButPos += butSize.Width + butSpace; UIButton *butEM_Rotate = new0 UIButton(); mToolFrame->AttachChild(butEM_Rotate); butEM_Rotate->LocalTransform.SetTranslateY(-1.0f); butEM_Rotate->SetAnchorHor(0.0f, 0.0f); butEM_Rotate->SetAnchorVer(0.5f, 0.5f); butEM_Rotate->SetAnchorParamHor(addButPos, 0.0f); butEM_Rotate->SetSize(butSize); butEM_Rotate->SetName("ButEM_Rotate"); butEM_Rotate->AddVisitor(this); butEM_Rotate->CreateAddText("Rot"); butEM_Rotate->GetText()->SetFontColor(PX2_UISM.Color_ContentFont); butEM_Rotate->GetText()->SetFontScale(PX2_UISM.Size_PropertyFontScale); addButPos += butSize.Width + butSpace; UIButton *butEM_Scale = new0 UIButton(); mToolFrame->AttachChild(butEM_Scale); butEM_Scale->LocalTransform.SetTranslateY(-1.0f); butEM_Scale->SetAnchorHor(0.0f, 0.0f); butEM_Scale->SetAnchorVer(0.5f, 0.5f); butEM_Scale->SetAnchorParamHor(addButPos, 0.0f); butEM_Scale->SetSize(butSize); butEM_Scale->SetName("ButEM_Scale"); butEM_Scale->AddVisitor(this); butEM_Scale->CreateAddText("Sle"); butEM_Scale->GetText()->SetFontColor(PX2_UISM.Color_ContentFont); butEM_Scale->GetText()->SetFontScale(PX2_UISM.Size_PropertyFontScale); AddStage(); PX2_EDIT.SetEditType(Edit::ET_SCENE); ComeInEventWorld(); SetActivateSelfCtrled(false); }
void CascadedShadowMapApp::CascadesChangedHandler(UIComboBox const & sender) { num_cascades_ = sender.GetSelectedIndex() + 1; deferred_rendering_->SetViewportCascades(0, num_cascades_, pssm_factor_); }