void DiEditorManager::Command_ToolOpen(const MyGUI::UString& _commandName, bool& _result) { void* wndHandle = DiBase::Driver->GetMainRenderWindow()->GetWindow()->GetWndHandle(); DiVector<DiString> out; DiString filter = "XML effect file(fx)|*.fx|All files (*.*)|*.*"; DiPathLib::OpenFileDialog(wndHandle, "Effect file", DiAssetManager::GetInstance().GetBasePath(), "", filter, 0, out); if (out.size() >= 1) { OpenFx(out[0]); } _result = true; }
void DiInstanceManager::DefragmentBatches(bool optimizeCull, DiVector<DiInstancedModelPtr> &usedEntities, InstanceBatchVec &fragmentedBatches) { auto itor = fragmentedBatches.begin(); auto end = fragmentedBatches.end(); while( itor != end && !usedEntities.empty() ) { if( !(*itor)->IsStatic() ) { (*itor)->DefragmentBatch( optimizeCull, usedEntities ); } ++itor; } InstanceBatchVec::iterator lastImportantBatch = itor; while( itor != end ) { if( !(*itor)->IsStatic() ) { (*itor)->DefragmentBatchDiscard(); itor->reset(); } else { *lastImportantBatch++ = *itor; } ++itor; } const size_t remainingBatches = end - lastImportantBatch; fragmentedBatches.resize( fragmentedBatches.size() - remainingBatches ); }
void DiEffectManager::ParticleSystemTemplateNames(DiVector<DiString>& v) { auto itEnd = mParticleSystemTemplates.end(); for (auto it = mParticleSystemTemplates.begin(); it != itEnd; ++it) { v.push_back((*it).first); } }
void SetGameLocWindow::notifyBrowser(MyGUI::Widget* _sender) { if (_sender == mButtonBrwoser) { DiString outFolder; void* wndHandle = DiBase::Driver->GetMainRenderWindow()->GetWindow()->GetWndHandle(); #if DEMI_PLATFORM == DEMI_PLATFORM_OSX DiVector<DiString> out; DiString filter = "Mac Application(app)|*.app|All files (*.*)|*.*"; DiPathLib::OpenFileDialog(wndHandle, "Game Application", DiPathLib::GetApplicationPath(), "", filter, 0, out); if (out.size() >= 1) mTextLocation->setCaption(out[0].c_str()); #else DiPathLib::OpenDirectoryDialog(wndHandle, "Game root directory", DiPathLib::GetApplicationPath(), outFolder); mTextLocation->setCaption(outFolder.c_str()); #endif } }
void DiFoliageChunk::GetBatches( DiVector<DiRenderUnit*>& visible ) { LayerBatches::iterator it; LayerBatches::iterator itEnd = mLayerBatches.end(); for ( it = mLayerBatches.begin(); it != itEnd; ++it) { visible.push_back(it->second); } }
void DiEditorManager::SaveAll() { if (!mFxFileName.empty()) { SaveAll(mFxFileName); } else { void* wndHandle = DiBase::Driver->GetMainRenderWindow()->GetWindow()->GetWndHandle(); DiVector<DiString> out; DiString filter = "XML effect file(fx)|*.fx|All files (*.*)|*.*"; DiPathLib::SaveFileDialog(wndHandle, "Effect file", DiPathLib::GetApplicationPath(), "", filter, 0, out); if (out.size() >= 1) { SaveAll(out[0]); } } }
DiVector<DiTheradWin32::ThreadDebugInfo> DiTheradWin32::GetRunningThreadDebugInfos() { DiVector<DiTheradWin32::ThreadDebugInfo> infos; DiTheradWin32::criticalSection.Enter(); for (auto it = ThreadList.begin(); it != ThreadList.end(); ++it) { DiTheradWin32* cur = *it; if (cur->IsRunning()) { ThreadDebugInfo info; info.threadName = cur->GetName(); info.threadPriority = cur->GetPriority(); info.threadStackSize = cur->GetStackSize(); infos.push_back(info); } } DiTheradWin32::criticalSection.Leave(); return infos; }
uint64 DiShaderManager::CoverterFlags(const DiVector<DiString>& flags) { uint64 flag = 0; for(size_t i = 0; i < flags.size(); i++){ MapNameFlagsIt it = mCommonFlag.find(flags[i]); if(it != mCommonFlag.end()){ flag |= it->second; } } return flag; }
bool DiCommandManager::AddCommand(const DiString& cmd, DiCmdFuntion function, const DiString& help) { DI_ASSERT(function); if (!function) return false; DiVector<DiString> splitList = cmd.Tokenize(" "); if (splitList.empty()) return false; DiCmdInfo kCmdInfo; kCmdInfo.mName = splitList[0]; kCmdInfo.mDesc = help; kCmdInfo.mFunc = function; kCmdInfo.mName.ToLower(); mCmdInfos[kCmdInfo.mName] = kCmdInfo; return true; }
void UpdateScene() { float time = DiBase::Driver->GetElapsedSecond(); float rx = DiMath::Sin(time * 0.7f) * 0.2f; float ry = DiMath::Sin(time * 0.3f) * 0.1f; float rz = DiMath::Sin(time * 0.2f) * 0.1f; DiMat3 m; DiQuat rot; m.FromEulerAnglesXYZ(DiRadian(rx), DiRadian(ry), DiRadian(rz)); rot.FromRotationMatrix(m); for (size_t i = 0; i < nodes.size(); i++) nodes[i]->SetOrientation(rot); }
void InitScene() { DiSceneManager* sm = DiBase::Driver->GetSceneManager(); mat = DiMaterial::QuickCreate("lambert_v", "lambert_p"); mat->SetDiffuse(DiColor::White); sm->SetAmbientColor(DiColor(0.1f, 0.1f, 0.1f, 0.1f)); DiDirLightPtr dirlight = make_shared<DiDirLight>(); sm->AttachObject(dirlight); dirlight->SetColor(DiColor()); dirlight->SetDirection(DiVec3(-1, -1, -2).normalisedCopy()); int amount = 2; DiCullNode* parent = sm->GetRootNode(); for (int i = 0; i < amount; i++) { DiSimpleShapePtr model = make_shared<DiSimpleShape>(); model->CreateBox(10); model->SetMaterial(mat); DiCullNode* node = parent->CreateChild(); node->AttachObject(model); node->Translate(10, 0, 0); nodes.push_back(node); parent = node; } parent = sm->GetRootNode(); for (int i = 0; i < amount; i++) { DiSimpleShapePtr model = make_shared<DiSimpleShape>(); model->CreateBox(10); model->SetMaterial(mat); DiCullNode* node = parent->CreateChild(); node->AttachObject(model); node->Translate(-10, 0, 0); nodes.push_back(node); parent = node; } parent = sm->GetRootNode(); for (int i = 0; i < amount; i++) { DiSimpleShapePtr model = make_shared<DiSimpleShape>(); model->CreateBox(10); model->SetMaterial(mat); DiCullNode* node = parent->CreateChild(); node->AttachObject(model); node->Translate(0, 10, 0); nodes.push_back(node); parent = node; } parent = sm->GetRootNode(); for (int i = 0; i < amount; i++) { DiSimpleShapePtr model = make_shared<DiSimpleShape>(); model->CreateBox(10); model->SetMaterial(mat); DiCullNode* node = parent->CreateChild(); node->AttachObject(model); node->Translate(0, -10, 0); nodes.push_back(node); parent = node; } parent = sm->GetRootNode(); for (int i = 0; i < amount; i++) { DiSimpleShapePtr model = make_shared<DiSimpleShape>(); model->CreateBox(10); model->SetMaterial(mat); DiCullNode* node = parent->CreateChild(); node->AttachObject(model); node->Translate(0, 0, 10); nodes.push_back(node); parent = node; } parent = sm->GetRootNode(); for (int i = 0; i < amount; i++) { DiSimpleShapePtr model = make_shared<DiSimpleShape>(); model->CreateBox(10); model->SetMaterial(mat); DiCullNode* node = parent->CreateChild(); node->AttachObject(model); node->Translate(0, 0, -10); nodes.push_back(node); parent = node; } }