Example #1
0
void
_KeyboardFunc(unsigned char ubKey, int iX, int iY)
{
	switch(ubKey)
	{
	case 's':
		compute_streamlines();
		glutPostRedisplay();
		break;

	case 'w':
		// MOD-BY-LEETEN 01/20/2011-FROM:
			// cLineRenderer._SetInteger(CTubeRenderer::DRAW_POLYGON, CTubeRenderer::DRAW_POLYGON_WIREDFRAME);
		// TO:
		{
			static int iWiredFrameOrFill = 0;
			iWiredFrameOrFill = 1 - iWiredFrameOrFill;
			switch(iWiredFrameOrFill)
			{
			case 0: cLineRenderer._SetInteger(CTubeRenderer::DRAW_POLYGON, CTubeRenderer::DRAW_POLYGON_WIREDFRAME);	break;
			case 1:	cLineRenderer._SetInteger(CTubeRenderer::DRAW_POLYGON, CTubeRenderer::DRAW_POLYGON_FILL);	break;
			}
		}
		// MOD-BY-LEETEN 01/20/2011-END
		glutPostRedisplay();
		break;

	#if	0	// DEL-BY-LEETEN 01/20/2011-BEGIN
	case 'f':
		cLineRenderer._SetInteger(CTubeRenderer::DRAW_POLYGON, CTubeRenderer::DRAW_POLYGON_FILL);
		glutPostRedisplay();
		break;
	#endif	// DEL-BY-LEETEN 01/20/2011-END

	case 'l':
		{
			int iLighting;
			cLineRenderer._GetInteger(CLineRenderer::ENABLE_LIGHTING, &iLighting);
			iLighting = !iLighting;
			cLineRenderer._SetInteger(CLineRenderer::ENABLE_LIGHTING, iLighting);
		}
		glutPostRedisplay();
		break;

	}
}
void mykey(unsigned char key, int x, int y)
{
        switch(key) {
	case 'q': exit(1);
	  break; 
	case 's': compute_streamlines(); 
	  glutPostRedisplay(); 
	  break; 
	case 'd': 
	  toggle_draw_streamlines = !toggle_draw_streamlines; 
	  toggle_animate_streamlines = false; 
	  break; 
	case'a': 
	  toggle_animate_streamlines = !toggle_animate_streamlines; 
	  toggle_draw_streamlines = false; 
	  first_frame = 1; 
	}
}
Example #3
0
void mykey(unsigned char key, int x, int y)
{
	switch(key) {
	case 27:
		exit(0);
		break;

	case 'S': 
	case 's': 
	//	compute_streamlines_by_click();
		compute_streamlines(); 
		//compute_streamlines_load_file() ;
//hand_tuning_streamlines();
		glutPostRedisplay(); 
		break; 
	case 'L': 
	case 'l': 
		//compute_streamlines(); 
		compute_streamlines_load_file() ;

		glutPostRedisplay(); 
		break; 	case 'D': 
	case 'd': 
		toggle_draw_streamlines = !toggle_draw_streamlines; 
		toggle_animate_streamlines = false; 

		break; 
	case'A': 
	case'a': 
		toggle_animate_streamlines = !toggle_animate_streamlines; 
		toggle_draw_streamlines = false; 
		first_frame = 1; 
		break;

	case 'T':
	case 't':
		//testReconstruction();
		toggle_entropy==0?toggle_entropy=1:toggle_entropy=0;
		glutPostRedisplay(); 

		break;
	}
}
void
_KeyboardFunc(unsigned char ubKey, int iX, int iY)
{
	switch(ubKey)
	{
	case 's':
		compute_streamlines();
		glutPostRedisplay();
		break;

	case 'h':
		{
			int iHalo;
			cLineRenderer._GetInteger(CLineRenderer::ENABLE_HALO, &iHalo);
			iHalo = !iHalo;
			cLineRenderer._SetInteger(CLineRenderer::ENABLE_HALO, iHalo);
		}
		glutPostRedisplay();
		break;

	case 'l':
		{
			int iLighting;
			cLineRenderer._GetInteger(CLineRenderer::ENABLE_LIGHTING, &iLighting);
			iLighting = !iLighting;
			cLineRenderer._SetInteger(CLineRenderer::ENABLE_LIGHTING, iLighting);
		}

		glutPostRedisplay();
		break;

	// ADD-BY-LEETEN 09/29/2012-BEGIN
	case 'S':
		{
			VECTOR3 v3Min, v3Max;
			osuflow->Boundary(v3Min, v3Max);
			float pfDomainMin[4];
			float pfDomainMax[4];
			for(size_t d = 0; d < 3; d++)
			{
				pfDomainMin[d] = v3Min[d];
				pfDomainMax[d] = v3Max[d];
			}
			pfDomainMin[3] = 0.0f;
			pfDomainMax[3] = 0.0f;

			char szFilename[1024];
			strcpy(szFilename, szVecFilePath);
			strcat(szFilename, ".trace");

			OSUFlow::WriteFlowlines(
				pfDomainMin,
				pfDomainMax,
				&sl_list,
				NULL,
				szFilename);
			LOG(printf("Save the streamlines to %s", szFilename));
		}
		break;
	// ADD-BY-LEETEN 09/29/2012-END

	}
}
Example #5
0
int main(int argc, char** argv) 
{
		g_filename=argv[1];


//	testTriangulation();
//downsampling();

//	float error=0.005;
//printf("value=%f\n",-error*log2(error)-(1-error)*log2(1-error)+error*log2(359));
//getchar();

readPatches_region();


	VECTOR3 minB, maxB; 

	osuflow = new OSUFlowEntropy(); 
	//printf("read file %s\n", argv[1]); 
//	g_filename=argv[1];
	osuflow->LoadData((const char*)argv[1], true);//, minB, maxB); //true: a steady flow field 

	osuflow->Boundary(minLen, maxLen); // get the boundary 
	minB[0] = minLen[0]; minB[1] = minLen[1];  minB[2] = minLen[2];
	maxB[0] = maxLen[0]; maxB[1] = maxLen[1];  maxB[2] = maxLen[2];
	osuflow->SetBoundary(minB, maxB);  // set the boundary. just to test
	// the subsetting feature of OSUFlow
	printf(" volume boundary X: [%f %f] Y: [%f %f] Z: [%f %f]\n", 
		minLen[0], maxLen[0], minLen[1], maxLen[1], 
		minLen[2], maxLen[2]); 

	center[0] = (minLen[0]+maxLen[0])/2.0; 
	center[1] = (minLen[1]+maxLen[1])/2.0; 
	center[2] = (minLen[2]+maxLen[2])/2.0; 
	printf("center is at %f %f %f \n", center[0], center[1], center[2]); 
	len[0] = maxLen[0]-minLen[0]; 
	len[1] = maxLen[1]-minLen[1]; 
	len[2] = maxLen[2]-minLen[2]; 

	int xdim,ydim,zdim;
	osuflow->GetFlowField()->getDimension(xdim,ydim,zdim);
	//	reseeding(xdim, ydim,"Time00_fake_3D.vec.data", "Time02_fake_3D.vec.data","seed1.data","seed2.data");

	glutInit(&argc, argv); 
	glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH); 
	glutInitWindowSize(winWidth,winHeight); 

	glutCreateWindow("Display streamlines"); 
	glutPositionWindow(700,50);
	glutDisplayFunc(display); 
	//  glutIdleFunc(idle); 
	glutTimerFunc(10, timer, 0); 
	glutMouseFunc(mymouse); 
	glutMotionFunc(mymotion);
	glutKeyboardFunc(mykey); 
	//SetShaders();

	#if	ENTER_GLUT_LOOP	
	glutMainLoop();

	#else
	compute_streamlines();
	#endif
	return 0;
}