2 Star 0 Fork 1

LeoPkuCs/PhysLeo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.cpp 3.43 KB
一键复制 编辑 原始数据 按行查看 历史
MikeXuPku 提交于 2018-08-20 16:51 . minor revision
#include "SceneGraphEdit.h"
#include "Driver.h"
#include <QtWidgets/QApplication>
#include <QThread>
#include <fstream>
#include "QtGuiApplication.h"
#include "GLwindow.h"
#include "Simulation.h"
#include "Display/Render.h"
using namespace Physika;
GravityCuda* gravity = nullptr;
PlaneForceCuda* externalForce = nullptr;
SlipPointCPU* slipPoint = nullptr;
VelocityDampingCuda* damping = nullptr;
LearningNode* learningNode = nullptr;
ExportLearnData* exportLearnDataPtr = nullptr;
Render* femForce = nullptr;
Render* pdmForce = nullptr;
Render* deltaForce = nullptr;
Render* surfaceFEM = nullptr;
Render* surfacePDM = nullptr;
Render* pointPDM = nullptr;
SimData* simDataFEM = nullptr;
SimData* simDataPDM = nullptr;
std::string* materialFile = nullptr;
//learning
DataSet<float>* dataSetPtr = nullptr;
int main(int argc, char *argv[])
{
//SceneGraph* sceneGraph = getSceneGraphByCode();
//SceneGraph* sceneGraph = getDemoPDMH2PDMH();
//SceneGraph* sceneGraph = getDemoFEMH2PDMH();
//SceneGraph* sceneGraph = getDemoFEMH2PDMN();
//SceneGraph* sceneGraph = getDemoFEMH2PDMHA();
//SceneGraph* sceneGraph = getDemoFEMH2PDMNA();
//SceneGraph* sceneGraph = exportCubeLearnData();
//SceneGraph* sceneGraph = exportAnisoCubeLearnData();
//SceneGraph* sceneGraph = exportCubePDMLinear();
//SceneGraph* sceneGraph = exportFlowerStvkData();
//SceneGraph* sceneGraph = DifferentPoissonRatio();
//SceneGraph* sceneGraph = DifferentNonlinearity();
//SceneGraph* sceneGraph = DifferentAnisotropy();
//SceneGraph* sceneGraph = FEMLinear2PDMLinearHomo();
//SceneGraph* sceneGraph = FEMNeoN2PDMModel();
//SceneGraph* sceneGraph = SpringBed();
//SceneGraph* sceneGraph = wrinkleCloth();
//SceneGraph* sceneGraph = armadillo();
//SceneGraph* sceneGraph = flower();
//SceneGraph* sceneGraph = convergeTest();
//SceneGraph* sceneGraph = turtle();
//SceneGraph* sceneGraph = spring();
//SceneGraph* sceneGraph = hand();
//SceneGraph* sceneGraph = twistCube();
//SceneGraph* sceneGraph = clothBend();
//SceneGraph* sceneGraph = nonlinearPoisson();
//SceneGraph* sceneGraph = cylinder();
//SceneGraph* sceneGraph = differentBasis();
//SceneGraph* sceneGraph = differentBasisCompress();
//SceneGraph* sceneGraph = NeohookeanTurtle();
SceneGraph* sceneGraph = NeohookeanBar();
//SceneGraph* sceneGraph = StvkBunny();
//SceneGraph* sceneGraph = MultiBodyCollision();
//SceneGraph* sceneGraph = Fracture();
//SceneGraph* sceneGraph = FractureBar();
QApplication a(argc, argv);
Simulation simulation;
QtGuiApplication control;
GLwindow window;
window.resize(800, 600);
window.move(0, 0);
control.move(900, 0);
Camera *camera = window.getCamera();
camera->setPosition(glm::vec3(0, 0, 20));
camera->setFocusPosition(glm::vec3(0, 0, 0));
camera->setNearClip(0.01f);
camera->setFarClip(1.0e3f);
Driver::setDt(1.0f);//0.04
//Driver::setDt(100.0f);
Driver::setCamera(camera);
Driver::setSceneGraph(sceneGraph);
QThread thread;
simulation.moveToThread(&thread);
QObject::connect(&thread, SIGNAL(started()), &simulation, SLOT(start()));
QObject::connect(&simulation, SIGNAL(updateWindow()), &window, SLOT(updateWindow()));
QObject::connect(&simulation, SIGNAL(finished()), &thread, SLOT(quit()));
QObject::connect(&simulation, SIGNAL(finished()), &window, SLOT(close()));
thread.start();
window.show();
control.show();
//enter into qt event loop
a.exec();
//release resource;
delete sceneGraph;
if (dataSetPtr != nullptr)delete dataSetPtr;
return 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/LeoPkuCs/PhysLeo.git
git@gitee.com:LeoPkuCs/PhysLeo.git
LeoPkuCs
PhysLeo
PhysLeo
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385