void ezQtTypeWidget::BuildUI(const ezRTTI* pType, const char* szIncludeProperties, const char* szExcludeProperties) { ezMap<ezString, const ezManipulatorAttribute*> manipulatorMap; const ezRTTI* pParentType = pType; while (pParentType != nullptr) { const auto& attr = pParentType->GetAttributes(); for (ezPropertyAttribute* pAttr : attr) { if (pAttr->GetDynamicRTTI()->IsDerivedFrom<ezManipulatorAttribute>()) { const ezManipulatorAttribute* pManipAttr = static_cast<const ezManipulatorAttribute*>(pAttr); if (!pManipAttr->m_sProperty1.IsEmpty()) manipulatorMap[pManipAttr->m_sProperty1] = pManipAttr; if (!pManipAttr->m_sProperty2.IsEmpty()) manipulatorMap[pManipAttr->m_sProperty2] = pManipAttr; if (!pManipAttr->m_sProperty3.IsEmpty()) manipulatorMap[pManipAttr->m_sProperty3] = pManipAttr; if (!pManipAttr->m_sProperty4.IsEmpty()) manipulatorMap[pManipAttr->m_sProperty4] = pManipAttr; if (!pManipAttr->m_sProperty5.IsEmpty()) manipulatorMap[pManipAttr->m_sProperty5] = pManipAttr; if (!pManipAttr->m_sProperty6.IsEmpty()) manipulatorMap[pManipAttr->m_sProperty6] = pManipAttr; } } pParentType = pParentType->GetParentType(); } BuildUI(pType, manipulatorMap, szIncludeProperties, szExcludeProperties); }
void NIDAQWrapper::Initialize() { BuildUI(); // Setup our read channel readHandle = GetTask("readTask", winLog); for(int x = 0; x < 12; x++) { std::stringstream s; std::string name; s << "Voltage_" << x; s >> name; GetReadChannel(readHandle, name.c_str(), x, winLog); } StartTask(readHandle, EveryNCallback, this, winLog); // Setup our write channels writeHandles.push_back(TaskHandle()); writeHandles[0] = GetTask("write0"); GetWriteChannel(writeHandles[0], "DigitalOut_0", 0, winLog); writeHandles.push_back(TaskHandle()); writeHandles[1] = GetTask("write1"); GetWriteChannel(writeHandles[1], "DigitalOut_1", 1, winLog); StartTask(writeHandles[0], NULL, NULL, winLog); StartTask(writeHandles[1], NULL, NULL, winLog); wrefresh(winLog); return; }
void UIView::OnSwitchTo() { UI::VBox *box = Pi::ui->VBox(); UI::Expand *expander = Pi::ui->Expand(); BuildUI(expander); box->PackEnd(expander); box->PackEnd(new GameUI::Panel(Pi::ui.Get())); Pi::ui->DropAllLayers(); Pi::ui->GetTopLayer()->SetInnerWidget(box); }
// Main procedure INT WINAPI WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR pszCmdLine, INT nCmdShow) { hThisInstance = hinst; BuildUI(); FillList(); SendMessage(hListbox, LB_SETCARETINDEX, 0, 0); SendMessage(hListbox, LB_SETTOPINDEX, 0, 0); MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; }
ezQtTypeWidget::ezQtTypeWidget(QWidget* pParent, ezQtPropertyGridWidget* pGrid, ezObjectAccessorBase* pObjectAccessor, const ezRTTI* pType, const char* szIncludeProperties, const char* szExcludeProperties) : QWidget(pParent) , m_pGrid(pGrid) , m_pObjectAccessor(pObjectAccessor) , m_pType(pType) { EZ_ASSERT_DEBUG(m_pGrid && m_pObjectAccessor && m_pType, ""); m_pLayout = new QGridLayout(this); m_pLayout->setColumnStretch(0, 1); m_pLayout->setColumnStretch(1, 0); m_pLayout->setColumnMinimumWidth(1, 5); m_pLayout->setColumnStretch(2, 2); m_pLayout->setMargin(0); m_pLayout->setSpacing(0); setLayout(m_pLayout); m_pGrid->GetObjectManager()->m_PropertyEvents.AddEventHandler(ezMakeDelegate(&ezQtTypeWidget::PropertyEventHandler, this)); m_pGrid->GetCommandHistory()->m_Events.AddEventHandler(ezMakeDelegate(&ezQtTypeWidget::CommandHistoryEventHandler, this)); ezManipulatorManager::GetSingleton()->m_Events.AddEventHandler(ezMakeDelegate(&ezQtTypeWidget::ManipulatorManagerEventHandler, this)); BuildUI(pType, szIncludeProperties, szExcludeProperties); }
void ezQtTypeWidget::BuildUI(const ezRTTI* pType, const ezMap<ezString, const ezManipulatorAttribute*>& manipulatorMap, const char* szIncludeProperties, const char* szExcludeProperties) { ezQtScopedUpdatesDisabled _(this); const ezRTTI* pParentType = pType->GetParentType(); if (pParentType != nullptr) BuildUI(pParentType, manipulatorMap, szIncludeProperties, szExcludeProperties); ezUInt32 iRows = m_pLayout->rowCount(); for (ezUInt32 i = 0; i < pType->GetProperties().GetCount(); ++i) { const ezAbstractProperty* pProp = pType->GetProperties()[i]; if (pProp->GetFlags().IsSet(ezPropertyFlags::Hidden)) continue; if (pProp->GetAttributeByType<ezHiddenAttribute>() != nullptr) continue; if (pProp->GetSpecificType()->GetAttributeByType<ezHiddenAttribute>() != nullptr) continue; if (pProp->GetCategory() == ezPropertyCategory::Constant) continue; if (szIncludeProperties != nullptr && ezStringUtils::FindSubString(szIncludeProperties, pProp->GetPropertyName()) == nullptr) continue; if (szExcludeProperties != nullptr && ezStringUtils::FindSubString(szExcludeProperties, pProp->GetPropertyName()) != nullptr) continue; ezQtPropertyWidget* pNewWidget = ezQtPropertyGridWidget::CreatePropertyWidget(pProp); EZ_ASSERT_DEV(pNewWidget != nullptr, "No property editor defined for '{0}'", pProp->GetPropertyName()); pNewWidget->setParent(this); pNewWidget->Init(m_pGrid, m_pObjectAccessor, pType, pProp); auto& ref = m_PropertyWidgets[pProp->GetPropertyName()]; ref.m_pWidget = pNewWidget; ref.m_pLabel = nullptr; if (pNewWidget->HasLabel()) { ezQtManipulatorLabel* pLabel = new ezQtManipulatorLabel(this); pLabel->setText(QString::fromUtf8(pNewWidget->GetLabel())); pLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); pLabel->setContentsMargins(0, 0, 0, 0); // 18 is a hacked value to align label with group boxes. pLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); connect(pLabel, &QWidget::customContextMenuRequested, pNewWidget, &ezQtPropertyWidget::OnCustomContextMenu); m_pLayout->addWidget(pLabel, iRows + i, 0, 1, 1); m_pLayout->addWidget(pNewWidget, iRows + i, 2, 1, 1); auto itManip = manipulatorMap.Find(pProp->GetPropertyName()); if (itManip.IsValid()) { pLabel->SetManipulator(itManip.Value()); } ref.m_pLabel = pLabel; ref.m_sOriginalLabelText = pNewWidget->GetLabel(); } else { m_pLayout->addWidget(pNewWidget, iRows + i, 0, 1, 3); } } }
void SSAO::Initialize(int screenWidth, int screenHeight, float farC, float nearC, float fov) { _app->SwitchActive("sib"); _screenHeight = screenHeight; _screenWidth = screenWidth; _showDebug = false; _near = nearC; _far = farC; _fov = fov; _kernalSize = 16; _noiseSize = 64; _rad = 0.065; _totStrength = 1.6; _strength = 0.7; _offset = 18; _falloff = 0.0001; _defrad = 0.02; _deftotStrength = 3.38; _defstrength = 0.7; _defoffset = 18; _deffalloff = 0.0002; _blurSize = 4; _defblurSize = 4; srand(time(NULL)); //create cosntant buffer D3D11_BUFFER_DESC ssaoBuff; ssaoBuff.BindFlags = D3D11_BIND_CONSTANT_BUFFER; ssaoBuff.ByteWidth = sizeof(SSAOBuffer); ssaoBuff.Usage = D3D11_USAGE_DYNAMIC; ssaoBuff.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; ssaoBuff.MiscFlags = 0; ssaoBuff.StructureByteStride = 0; _device->CreateBuffer(&ssaoBuff, 0, &_ssaoBuffer); //create cosntant buffer D3D11_BUFFER_DESC ssaoBuff2; ssaoBuff2.BindFlags = D3D11_BIND_CONSTANT_BUFFER; ssaoBuff2.ByteWidth = sizeof(SSAOBuffer2); ssaoBuff2.Usage = D3D11_USAGE_DYNAMIC; ssaoBuff2.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; ssaoBuff2.MiscFlags = 0; ssaoBuff2.StructureByteStride = 0; HRESULT hret = _device->CreateBuffer(&ssaoBuff2, 0, &_ssaoBuffer2); _deviceContext->PSSetConstantBuffers(11, 1, &_ssaoBuffer2); _deviceContext->PSSetConstantBuffers(10, 1, &_ssaoBuffer); _deviceContext->VSSetConstantBuffers(10, 1, &_ssaoBuffer); //initialize render targets _normalAndDepthBuffer = new RenderTarget(_device, _deviceContext); _normalAndDepthBuffer->CreateRenderTarget(_screenWidth, _screenHeight, DXGI_FORMAT_R32G32B32A32_FLOAT); _ssaoRT = new RenderTarget(_device, _deviceContext); _ssaoRT->CreateRenderTarget(_screenWidth, _screenHeight, DXGI_FORMAT_R32_FLOAT); _blurRT = new RenderTarget(_device, _deviceContext); _blurRT->CreateRenderTarget(_screenWidth, _screenHeight, DXGI_FORMAT_R32_FLOAT); BuildFullScreenQuad(); BuildSampleKernal(); BuildNoise(); BuildFrustumCorner(); BuildTextures(); BuildUI(); _ndPass= new ShaderProgram(_device, _deviceContext); _ndPass->CompileShaders(L"media/hlsl/normalAndDepthPass.vsh", L"media/hlsl/normalAndDepthPass.psh"); _ssaoPass= new ShaderProgram(_device, _deviceContext); _ssaoPass->CompileShaders(L"media/hlsl/ssaoPass.vsh", L"media/hlsl/ssaoPass.psh"); _blurPass= new ShaderProgram(_device, _deviceContext); _blurPass->CompileShaders(L"media/hlsl/blurrPass.vsh", L"media/hlsl/blurrPass.psh"); _debug= new ShaderProgram(_device, _deviceContext); _debug->CompileShaders(L"media/hlsl/debug.vsh", L"media/hlsl/debug.psh"); UpdateBuffer(); UpdateBuffer2(); }