Esempio n. 1
0
void resetMesh() {
	//remove it from scenegraph
	if(g_lpTissue) {
		TheSceneGraph::Instance().world()->removeRawRigidBody(g_lpTissue->getB3RigidBody());
		TheSceneGraph::Instance().remove(g_lpTissue);
		SAFE_DELETE(g_lpTissue);
	}

	VolMesh* temp = NULL;
	if(FileExists(g_strFilePath)) {
		temp = new PS::MESH::VolMesh();
		LogInfoArg1("Begin to read vega file from: %s", g_strFilePath.cptr());
		bool res = PS::MESH::VolMeshIO::readVega(temp, g_strFilePath);
		if(!res)
			LogErrorArg1("Unable to load mesh from: %s", g_strFilePath.cptr());
	}
	else {
		AnsiStr strExample = g_parser.value<AnsiStr>("example");
		int pos = -1;
		if(strExample == "one")
			temp = PS::MESH::VolMeshSamples::CreateOneTetra();
		else if(strExample == "two")
			temp = PS::MESH::VolMeshSamples::CreateTwoTetra();
		else if(strExample.lfindstr(AnsiStr("cube"), pos)) {

			U32 nx, ny, nz = 0;
			sscanf(strExample.cptr(), "cube_%u_%u_%u", &nx, &ny, &nz);
			temp = PS::MESH::VolMeshSamples::CreateTruthCube(nx, ny, nz, 0.2);
		}
		else if(strExample.lfindstr(AnsiStr("eggshell"), pos)) {

			U32 nx, ny;
			//float radius, thickness;
			sscanf(strExample.cptr(), "eggshell_%u_%u", &nx, &ny);
			temp = PS::MESH::VolMeshSamples::CreateEggShell(nx, ny);
		}
		else
			temp = PS::MESH::VolMeshSamples::CreateOneTetra();
	}


	LogInfo("Loaded mesh to temp");
	g_lpTissue = new SGBulletRigidBodyCuttableMesh(*temp, temp->countNodes());
	g_lpTissue->setFlagDrawSweepSurf(false);
	g_lpTissue->setDrawNodes(false);
	g_lpTissue->setDrawWireFrame(false);
	g_lpTissue->setFlagSplitMeshAfterCut(false);
	g_lpTissue->setFlagDrawAABB(false);
	TheSceneGraph::Instance().world()->addRawRigidBody(g_lpTissue->getB3RigidBody());
	TheSceneGraph::Instance().add(g_lpTissue);
	g_lpTissue->setAnimate(false);
	SAFE_DELETE(temp);


	g_lpAvatar->setTissue(g_lpTissue);
	LogInfo("Mesh loaded");
}
Esempio n. 2
0
AnsiStr SceneGraph::gpuInfo() {
	AnsiStr strVendorName = AnsiStr((const char*)glGetString(GL_VENDOR));
	AnsiStr strRenderer   = AnsiStr((const char*)glGetString(GL_RENDERER));
	AnsiStr strVersion	 = AnsiStr((const char*)glGetString(GL_VERSION));
	AnsiStr strExtensions = AnsiStr((const char*)glGetString(GL_EXTENSIONS));

	int pos;
	if(strVendorName.lfindstr("Intel", pos)) {
			cout << "WARNING: Integrated GPU is being used!" << endl;
			LogWarning("Non-Discrete GPU selected for rendering!");
	}

	return  AnsiStr("GPU: ") + strVendorName + ", " + strRenderer + ", " + strVersion;
}