Example #1
0
void BinTree::PosDisplay(TreeNode * pHead) {
    if (pHead->m_pLeft != NULL)
        PreDisplay(pHead->m_pLeft);
    if (pHead->m_pRight != NULL)
        PreDisplay(pHead->m_pRight);
    cout << pHead->m_nValue << " ";
}
Example #2
0
// Draw prime numbers pattern :
void DisplayFunc()
{
  float zoom;
  float X, Y;
  unsigned int primeNumberCounter;

  PreDisplay();

  zoom = 1.0f / (greatestPrimeNumber+1.0f);
  primeNumberCounter = 0;

 glColor3f(1.0f, 1.0f, 1.0f);

  glBegin(GL_POINTS);

  // 'primeNumbersCount' can excess 'primeNumbersMaxCount' if the limit of drawable points has been reached :
  while ( (primeNumberCounter < primeNumbersCount) && (primeNumberCounter < primeNumbersMaxCount) )
  {
    X = 0.5f * tPrimesCoordinatesOnSpiral[primeNumberCounter*2] * zoom;
    Y = 0.5f * tPrimesCoordinatesOnSpiral[primeNumberCounter*2+1] * zoom;
    glVertex2f(X, Y);
    primeNumberCounter++;
  }
  glEnd();

  PostDisplay();
}
Example #3
0
/****************************************************************************
 * Open a glut compatible window and set callbacks
 ****************************************************************************/
static void OpenGlutWindow()
{
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);

	glutInitWindowPosition(0, 0);
	glutInitWindowSize(WinX, WinY);
	WinId = glutCreateWindow("Stable Fluids!");

	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
	glClear(GL_COLOR_BUFFER_BIT);
	glutSwapBuffers();
	glClear(GL_COLOR_BUFFER_BIT);
	glutSwapBuffers();

	glEnable(GL_LINE_SMOOTH);
	glEnable(GL_POLYGON_SMOOTH);

	PreDisplay();

	glutKeyboardFunc(KeyFunc);
	glutMouseFunc(MouseFunc);
	glutMotionFunc(MotionFunc);
	glutReshapeFunc(ReshapeFunc);
	glutIdleFunc(IdleFunc);
	glutDisplayFunc(DisplayFunc);
}
Example #4
0
static void DisplayFunc(void)
{
	PreDisplay();

	if (dvel) DrawVelocity();
	else		DrawDensity();

	PostDisplay();
}
Example #5
0
static void Display()
{
	PreDisplay();

	if (bVel)
		DisplayVelocityField();
	else if (bSmoke)
		DispolayDensityField();
	else if (bParticles)
		DisplayParticles();
	else
		DisplayParticles();

	PostDisplay();
}
Example #6
0
static void DisplayFunc()
{
	PreDisplay();

	if (DisplayVel)
	{
		DrawVelocity();
	}
	else
	{
		DrawDensity();
	}

	PostDisplay();
}
Example #7
0
static void WindowShowup(int width, int height)
{
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
	glutInitWindowPosition((glutGet(GLUT_SCREEN_WIDTH) - width) / 2,
		(glutGet(GLUT_SCREEN_HEIGHT) - height) / 2);
	glutInitWindowSize(width, height);
	ID = glutCreateWindow("Smoke Sim VFXEpoch");
	glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
	glClear(GL_COLOR_BUFFER_BIT);
	glutSwapBuffers();
	glClear(GL_COLOR_BUFFER_BIT);
	glutSwapBuffers();
	PreDisplay();
	glutKeyboardFunc(Keys);
	glutMouseFunc(mouse_func);
	glutMotionFunc(motion_func);
	glutReshapeFunc(Reshape);
	glutIdleFunc(Idle);
	glutDisplayFunc(Display);
}
Example #8
0
static void OpenGlutWindow(void)
{
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);

	glutInitWindowPosition(0, 0);
	glutInitWindowSize(win_x, win_y);
	win_id = glutCreateWindow("Alias | wavefront");

	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
	glClear(GL_COLOR_BUFFER_BIT);
	glutSwapBuffers();

	PreDisplay();

	glutKeyboardFunc(KeyFunc);
	glutMouseFunc(MouseFunc);
	glutMotionFunc(MotionFunc);
	glutReshapeFunc(ReshapeFunc);
	glutIdleFunc(IdleFunc);
	glutDisplayFunc(DisplayFunc);
}
Example #9
0
// Draw prime numbers pattern :
void DisplayFunc()
{
  float zoom;
  float X, Y;
  unsigned int primeNumberCounter;

  PreDisplay();

  zoom = 1.0f / (greatestPrimeNumber+1.0f);
  primeNumberCounter = 0;
  
  glPointSize(3.f);

  int nbParticlesLeft = 0;
  std::vector<float> currentColor;
  int currentIndex = 0;
  std::map<int, std::vector<float> >::iterator it;

  if(previousNbPositions > 0){
      it = tableColorProducer.find(currentMessageTrace.at(currentIndex));
     nbParticlesLeft = currentMessageTrace.at(currentIndex+1);
  }

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(60.0,(GLfloat)glutGet(GLUT_WINDOW_WIDTH) / (GLfloat)glutGet(GLUT_WINDOW_HEIGHT), 1.0, 2000.0);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(0,0,5,   0,0,0,   0,1,0);

  track.center=vcg::Point3f(0, 0, 0);
  track.radius= 1;
  track.GetView();
  track.Apply(false);

  glPushMatrix();
  float d=2.0f/(sqrt(dx*dx + dy*dy + dz*dz));
  glScalef(d,d,d);

  glTranslatef(-cx,-cy,-cz);

  glBegin(GL_POINTS);

  
  for(unsigned int i = 0; i < previousNbPositions; i++){
	if(it != tableColorProducer.end())
	   glColor3f(it->second.at(0),it->second.at(1),it->second.at(2));
	else
	   glColor3f(1.f,1.f,1.f);
	glVertex3d(positions[i * 3],positions[i * 3 + 1],positions[ i * 3 + 2]);
	glColor3f(1.f,1.f,1.f);

        nbParticlesLeft--;
        if(nbParticlesLeft <= 0 && currentIndex <( (int)(currentMessageTrace.size()) - 2)){
           currentIndex+=2;
	   it = tableColorProducer.find(currentMessageTrace.at(currentIndex));
           nbParticlesLeft = currentMessageTrace.at(currentIndex+1);
	}
  }

  glEnd();

  DrawSimulationArea();

  glPopMatrix();
  track.DrawPostApply();

  PostDisplay();
}