void VendorHandler::pass3to2() {
    setValid2(true);
    setName2(name3());
    setStreet2(street3());
    setCity2(city3());
    setState2(state3());
    setRegion2(region3());
    setTime2(time3());
    setZip2(zip3());
    setPrice2(price3());
}
示例#2
0
文件: worksmain.c 项目: skitt/sysd7
void main (void)
{
  int cs = 1;
  while (1)
    {
      /* Display current state on LED */

      if (cs == 10)
	leddisplay ('0');
      else
	leddisplay ('0' + cs);
      switch (cs)
	{
	case 1:
	  cs = state1 ();
	  break;
	case 2:
	  cs = state2 ();
	  break;
	case 3:
	  cs = state3 ();
	  break;
	case 4:
	  cs = state4 ();
	  break;
	case 5:
	  cs = state5 ();
	  break;
#if 0
	case 6:
	  cs = state6 ();
	  break;
#endif
	case 7:
	  cs = state7 ();
	  break;
	case 8:
	  cs = state8 ();
	  break;
#if 0
	case 9:
	  cs = state9 ();
	  break;
#endif
	case 10:
	  cs = state10 ();
	  break;
	default:
	  cs = 1;
	  break;
	}
    }
}
// One-size-fits-all update func
void borderFunc()
{
	if (state == 1)
		state1();
	if (state == 3)
		state2();
	if (state == 4)
		state3();
	if (state == 2)
		state4();
	fourPorts();
}
示例#4
0
// Processes an event which drives a change in state.
void processEvent (char event) {
	int ProcessedCorrectly = 0;
	currentState = peek ();

	printf ("Processing event: %c for state: %c \n", event, currentState);

	switch(currentState) {
		case STATE0:
			ProcessedCorrectly = state0 (event);
			break;
		case STATE1:
			ProcessedCorrectly = state1 (event);
			break;
		case STATE2:
			ProcessedCorrectly = state2 (event);
			break;
		case STATE3:
			ProcessedCorrectly = state3 (event);
			break;
		case STATE4:
			ProcessedCorrectly = state4 (event);
			break;
		case STATE5:
			ProcessedCorrectly = state5 (event);
			break;
		case STATE6:
			ProcessedCorrectly = state6 (event);
			break;
		case STATE7:
			ProcessedCorrectly = state7 (event);
			break;
		case STATE8:
			ProcessedCorrectly = state8 (event);
			break;
		case STATE9:
			ProcessedCorrectly = state9 (event);
			break;
		case STATEA:
			ProcessedCorrectly = state10 (event);
			break;
		case STATEB:
			ProcessedCorrectly = state11 (event);
			break;
		default:
			printf ("Unknown state %d for event  %c \n", currentState, event);
			ProcessedCorrectly = 1;
		}
	if(ProcessedCorrectly == 1) {
		printf ("The Grammar Failed The Syntax Machine\n");
		exit (0);
		}
	}
示例#5
0
TEST( RenderingView, manySingleStatesBatching )
{
   // setup reflection types
   ReflectionTypesRegistry& typesRegistry = ReflectionTypesRegistry::getInstance();
   typesRegistry.addSerializableType< Geometry >( "Geometry", NULL );
   typesRegistry.addSerializableType< Light >( "Light", NULL );
   typesRegistry.addSerializableType< RenderStateMock >( "RenderStateMock", NULL );

   RenderStateMock state1( "1" );
   RenderStateMock state2( "2" );
   RenderStateMock state3( "3" );
   RenderStateMock state4( "4" );

   GeometryMock* g1 = new GeometryMock( "1" );
   GeometryMock* g2 = new GeometryMock( "2" );
   GeometryMock* g3 = new GeometryMock( "3" );
   GeometryMock* g4 = new GeometryMock( "4" );

   g1->addState( state1 );
   g2->addState( state2 );
   g3->addState( state3 );
   g4->addState( state3 );

   Model model;
   model.add( g1 );
   model.add( g2 );
   model.add( g3 );
   model.add( g4 );

   // setup the renderer
   RendererMock renderer;
   renderer.setMechanism( new RenderingMechanismMock( model ) );

   // move the camera so that the entire scene is visible
   renderer.getActiveCamera().accessLocalMtx().setTranslation( Vector( 0, 0, -10 ) );

   // render the scene
   renderer.render();
   CPPUNIT_ASSERT_EQUAL( std::string( "set RS 1;RenderGeometry_1;reset RS 1;set RS 2;RenderGeometry_2;reset RS 2;set RS 3;RenderGeometry_4;RenderGeometry_3;reset RS 3;" ), renderer.m_seqLog );

   // cleanup
   typesRegistry.clear();
}
示例#6
0
void	unitTestFSA(void)
{
  FSA	fsa;
  State state("FIRST", true);

  try {
    // this is supposed to throw but if it doesn't the assert will fail
    assert(fsa["S0"].getName() == "S1");
  } catch (const std::out_of_range &oor) {
    (void)oor;
  }
  // testing a single final state FSA
  fsa.addState(state);
  assert(fsa["FIRST"].getName() == "FIRST");
  fsa.setInitialState(state);
  assert(fsa.getInitialState() == "FIRST");
  assert(fsa.getState() == "FIRST");
  assert(fsa.consumeEdge('c') == false);
  assert(fsa.getState() == "FIRST");
  assert(fsa.consumeEdge('d') == false);
  assert(fsa.getState() == "FIRST");
  // testing a three state FSA
  State	state2("SECOND", false);
  State	state3("THIRD", true);

  fsa["FIRST"].setFinal(false);
  fsa["FIRST"].link(Edge('c'), state2);
  state2.link(Edge('d'), state3);
  fsa.addState(state2);
  fsa.addState(state3);
  fsa.reset();
  assert(fsa.getState() == "FIRST");
  assert(fsa.consumeEdge('c') == false);
  assert(fsa.getState() == "SECOND");
  assert(fsa.consumeEdge('d') == true);
  assert(fsa.getState() == "THIRD");
  std::cout << "FSA passed unit tests" << std::endl;
}
示例#7
0
文件: vt100.c 项目: sigflup/vt100
void vt_out(struct term_t *pwin, unsigned int ch)
{
  int f;
  unsigned char c;
  int go_on = 0;
  wchar_t wc;
  term_t *win;

  win = (term_t *)pwin;
  if (!ch)
    return;


  c = (unsigned char)ch;

  if (win->state.vt_docap == 2) /* Literal. */
    fputc(c, win->state.capfp);

  /* Process <31 chars first, even in an escape sequence. */
  switch (c) {
    case '\r': /* Carriage return */
      term_wputc(win, c);
      if (win->state.vt_addlf) {
        term_wputc(win, '\n');
        if (win->state.vt_docap == 1)
          fputc('\n', win->state.capfp);
      }
      break;
    case '\t': /* Non - destructive TAB */
//      printf("tab pants\n");
      /* Find next tab stop. */
      for (f = win->cursor_x + 1; f < 160; f++)
        if (win->state.vt_tabs[f / 32] & (1 << f % 32))
          break;
      if (f >= win->W)
        f = win->W - 1;
      term_wlocate(win, f, win->cursor_y);
      if (win->state.vt_docap == 1)
        fputc(c, win->state.capfp);
      break;
    case 013: /* Old Minix: CTRL-K = up */
      term_wlocate(win, win->cursor_x, win->cursor_y - 1);
      break;
    case '\f': /* Form feed: clear screen. */
      term_winclr(win);
      term_wlocate(win, 0, 0);
      break;
    case 14:
      break;
    case 15:
      break;
    case 24:
    case 26:  /* Cancel escape sequence. */
      esc_s = 0;
      break;
    case ESC: /* Begin escape sequence */
      esc_s = 1;
      break;
    case 128+ESC: /* Begin ESC [ sequence. */
      esc_s = 2;
      break;
    case '\n':
    case '\b':
    case 7: /* Bell */
      term_wputc(win, c);
      if (win->state.vt_docap == 1)
        fputc(c, win->state.capfp);
      break;
    default:
      go_on = 1;
      break;
  }
  if (!go_on)
    return;
 

  /* Now see which state we are in. */
  switch (esc_s) {
    case 0: /* Normal character */
      /* XXX:mappers */
      c&=0xff;

      if (!win->state.enable_iconv) {
        one_mbtowc ((char *)&wc, (char *)&c, 1); 
        if (win->state.vt_insert)
          term_winschar(win, wc, 1);
        else
          term_wputc(win, wc);
      } else 
        term_wputc(win, c);
     
      break;
    case 1: /* ESC seen */
      state1(win, c);
      break;
    case 2: /* ESC [ ... seen */
      state2(win, c);
      break;
    case 3:
      state3(win, c);
      break;
    case 4:
      state4(win, c);
      break;
    case 5:
      state5(win, c);
      break;
    case 6:
      state6(win, c);
      break;
    case 7:
      state7(win,c);
      break;
  }

}
示例#8
0
void vt_out(int ch)
{
  static unsigned char last_ch;
  int f;
  unsigned char c;
  int go_on = 0;
  wchar_t wc;

  if (!ch)
    return;

  if (last_ch == '\n'
      && vt_line_timestamp != TIMESTAMP_LINE_OFF)
    {
      struct timeval tmstmp_now;
      static time_t tmstmp_last;
      char s[36];
      struct tm tmstmp_tm;

      gettimeofday(&tmstmp_now, NULL);
      if ((   vt_line_timestamp == TIMESTAMP_LINE_PER_SECOND
           && tmstmp_now.tv_sec != tmstmp_last)
          || vt_line_timestamp == TIMESTAMP_LINE_SIMPLE
          || vt_line_timestamp == TIMESTAMP_LINE_EXTENDED)
        {
          if (   localtime_r(&tmstmp_now.tv_sec, &tmstmp_tm)
              && strftime(s, sizeof(s), "[%F %T", &tmstmp_tm))
            {
              output_s(s);
              switch (vt_line_timestamp)
                {
                case TIMESTAMP_LINE_SIMPLE:
                  output_s("] ");
                  break;
                case TIMESTAMP_LINE_EXTENDED:
                  snprintf(s, sizeof(s), ".%03ld] ", tmstmp_now.tv_usec / 1000);
                  output_s(s);
                  break;
                case TIMESTAMP_LINE_PER_SECOND:
                  output_s("\r\n");
                  break;
                };
            }
          tmstmp_last = tmstmp_now.tv_sec;
        }
    }

  c = (unsigned char)ch;
  last_ch = c;

  if (vt_docap == 2) /* Literal. */
    fputc(c, capfp);

  /* Process <31 chars first, even in an escape sequence. */
  switch (c) {
    case 5: /* AnswerBack for vt100's */
      if (vt_type != VT100) {
        go_on = 1;
        break;
      }
      v_termout(P_ANSWERBACK, 0);
      break;
    case '\r': /* Carriage return */
      mc_wputc(vt_win, c);
      if (vt_addlf)
        output_c('\n');
      break;
    case '\t': /* Non - destructive TAB */
      /* Find next tab stop. */
      for (f = vt_win->curx + 1; f < 160; f++)
        if (vt_tabs[f / 32] & (1 << f % 32))
          break;
      if (f >= vt_win->xs)
        f = vt_win->xs - 1;
      mc_wlocate(vt_win, f, vt_win->cury);
      if (vt_docap == 1)
        fputc(c, capfp);
      break;
    case 013: /* Old Minix: CTRL-K = up */
      mc_wlocate(vt_win, vt_win->curx, vt_win->cury - 1);
      break;
    case '\f': /* Form feed: clear screen. */
      mc_winclr(vt_win);
      mc_wlocate(vt_win, 0, 0);
      break;
#if !TRANSLATE
    case 14:
    case 15:  /* Change character set. Not supported. */
      break;
#else
    case 14:
      vt_charset = 1;
      break;
    case 15:
      vt_charset = 0;
      break;
#endif
    case 24:
    case 26:  /* Cancel escape sequence. */
      esc_s = 0;
      break;
    case ESC: /* Begin escape sequence */
      esc_s = 1;
      break;
    case 128+ESC: /* Begin ESC [ sequence. */
      esc_s = 2;
      break;
    case '\n':
      if(vt_addcr)
        mc_wputc(vt_win, '\r');
      output_c(c);
	  break;
    case '\b':
    case 7: /* Bell */
      output_c(c);
      break;
    default:
      go_on = 1;
      break;
  }
  if (!go_on)
    return;

  /* Now see which state we are in. */
  switch (esc_s) {
    case 0: /* Normal character */
      if (vt_docap == 1)
        fputc(P_CONVCAP[0] == 'Y' ? vt_inmap[c] : c, capfp);
      if (!using_iconv()) {
        c = vt_inmap[c];    /* conversion 04.09.97 / jl */
#if TRANSLATE
        if (vt_type == VT100 && vt_trans[vt_charset] && vt_asis == 0)
          c = vt_trans[vt_charset][c];
#endif
      }
      /* FIXME: This is wrong, but making it right would require
       * removing all the 8-bit mapping features. Assuming the locale
       * is 8-bit, the character should not be changed by mapping to
       * wchar and back; if the locale is multibyte, there is no hope
       * of getting it right anyway. */
      if (!using_iconv()) {
        one_mbtowc (&wc, (char *)&c, 1); /* returns 1 */
        if (vt_insert)
          mc_winschar2(vt_win, wc, 1);
        else
          mc_wputc(vt_win, wc);
      } else {
        mc_wputc(vt_win, c);
      }
      break;
    case 1: /* ESC seen */
      state1(c);
      break;
    case 2: /* ESC [ ... seen */
      state2(c);
      break;
    case 3:
      state3(c);
      break;
    case 4:
      state4(c);
      break;
    case 5:
      state5(c);
      break;
    case 6:
      state6(c);
      break;
    case 7:
      state7(c);
      break;
  }

  /* Flush output to capture file so that all output is visible there
   * immediately. Causes a write syscall for every call though. */
  if (capfp)
    fflush(capfp);
}
示例#9
0
/* function DisplayCallbackFunction(void)
* Description:
*  - this is the openGL display routine
*  - this draws the sprites appropriately
*/
void DisplayCallbackFunction(void)
{

	/* clear the screen */
	glClearColor(0.2f, 0.2f, 0.2f, 0.8f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// borders--------------------------------------
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glViewport(0, 0, windowWidth, windowHeight);



	if (state == 0) // Default View
	{
		fourPorts();

		//first viewpoint

		glMatrixMode(GL_PROJECTION);
		glViewport(0, 0, windowWidth / 2, windowHeight / 2);
		Camera cam1(0.0f, 0.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity(); // clear our the transform matrix
		glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
		cam1.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();

		//Second Viewport -----------------------------------------------------

		glMatrixMode(GL_PROJECTION);
		glViewport(windowWidth / 2, windowHeight / 2, windowWidth / 2, windowHeight / 2);
		Camera cam2(10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		glOrtho(-30.0f, 30.0f, -30.0f, 30.0f, 1.0f, 100.0f);
		cam2.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();

		//Third viewport-----------------------------------------------------------------------------

		glViewport(windowWidth / 2, 0, windowWidth / 2, windowHeight / 2);
		glMatrixMode(GL_PROJECTION);
		Camera cam3(0.0f, 10.0f, 0.0000001f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
		cam3.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();


		//Fourth viewport--------------------------------------------------------------------------------------------

		glViewport(0, windowHeight / 2, windowWidth / 2, windowHeight / 2);
		glMatrixMode(GL_PROJECTION);
		Camera cam4(5.0f, 5.0f, 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		gluPerspective(90.0f, 1.0f, 1.0f, 100.0f);
		cam4.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		drawSceneObjects();

		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glViewport(0, 0, windowWidth, windowHeight);
	}

	if (state == 1)
	{
		state1();
		fourPorts();

		//Second Viewport -----------------------------------------------------

		glMatrixMode(GL_PROJECTION);
		glViewport(windowWidth / 2, windowHeight / 2, windowWidth / 2, windowHeight / 2);
		Camera cam2(10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		glOrtho(-30.0f, 30.0f, -30.0f, 30.0f, 1.0f, 100.0f);
		cam2.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();

		//Third viewport-----------------------------------------------------------------------------

		glViewport(windowWidth / 2, 0, windowWidth / 2, windowHeight / 2);
		glMatrixMode(GL_PROJECTION);
		Camera cam3(0.0f, 10.0f, 0.0000001f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
		cam3.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();


		//Fourth viewport--------------------------------------------------------------------------------------------

		glViewport(0, windowHeight / 2, windowWidth / 2, windowHeight / 2);
		glMatrixMode(GL_PROJECTION);
		Camera cam4(5.0f, 5.0f, 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		gluPerspective(90.0f, 1.0f, 1.0f, 100.0f);
		cam4.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		drawSceneObjects();

		// Update

		//first viewport

		glMatrixMode(GL_PROJECTION);
		glViewport(0, 0, windowWidth / 2, windowHeight / 2);
		Camera cam1(0.0f, 0.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity(); // clear our the transform matrix
		glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
		cam1.applyCameraTransformations();
		cam = cam1;
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();

		//Draw Shapes

		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	}

	if (state == 2)
	{
		state2();
		fourPorts();

		//first viewpoint

		glMatrixMode(GL_PROJECTION);
		glViewport(0, 0, windowWidth / 2, windowHeight / 2);
		Camera cam1(0.0f, 0.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity(); // clear our the transform matrix
		glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
		cam1.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();

		//Third viewport-----------------------------------------------------------------------------

		glViewport(windowWidth / 2, 0, windowWidth / 2, windowHeight / 2);
		glMatrixMode(GL_PROJECTION);
		Camera cam3(0.0f, 10.0f, 0.0000001f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
		cam3.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();


		//Fourth viewport--------------------------------------------------------------------------------------------

		glViewport(0, windowHeight / 2, windowWidth / 2, windowHeight / 2);
		glMatrixMode(GL_PROJECTION);
		Camera cam4(5.0f, 5.0f, 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		gluPerspective(90.0f, 1.0f, 1.0f, 100.0f);
		cam4.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		drawSceneObjects();

		// Update Cam--------------

		updateEm();

		//Second Viewport -----------------------------------------------------

		glMatrixMode(GL_PROJECTION);
		glViewport(windowWidth / 2, windowHeight / 2, windowWidth / 2, windowHeight / 2);
		Camera cam2(10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		glOrtho(-30.0f, 30.0f, -30.0f, 30.0f, 1.0f, 100.0f);
		cam2.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

	}

	if (state == 3)
	{
		state3();
		fourPorts();

		//first viewpoint

		glMatrixMode(GL_PROJECTION);
		glViewport(0, 0, windowWidth / 2, windowHeight / 2);
		Camera cam1(0.0f, 0.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity(); // clear our the transform matrix
		glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
		cam1.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();

		//Second Viewport -----------------------------------------------------

		glMatrixMode(GL_PROJECTION);
		glViewport(windowWidth / 2, windowHeight / 2, windowWidth / 2, windowHeight / 2);
		Camera cam2(10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		glOrtho(-30.0f, 30.0f, -30.0f, 30.0f, 1.0f, 100.0f);
		cam2.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();

		//Fourth viewport--------------------------------------------------------------------------------------------

		glViewport(0, windowHeight / 2, windowWidth / 2, windowHeight / 2);
		glMatrixMode(GL_PROJECTION);
		Camera cam4(5.0f, 5.0f, 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		gluPerspective(90.0f, 1.0f, 1.0f, 100.0f);
		cam4.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		drawSceneObjects();

		// Update Cam

		updateEm();

		//Third viewport-----------------------------------------------------------------------------

		glViewport(windowWidth / 2, 0, windowWidth / 2, windowHeight / 2);
		glMatrixMode(GL_PROJECTION);
		Camera cam3(0.0f, 10.0f, 0.0000001f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
		cam3.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	}

	if (state == 4)
	{
		state4();
		fourPorts();

		//first viewpoint

		glMatrixMode(GL_PROJECTION);
		glViewport(0, 0, windowWidth / 2, windowHeight / 2);
		Camera cam1(0.0f, 0.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity(); // clear our the transform matrix
		glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
		cam1.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();

		//Second Viewport -----------------------------------------------------

		glMatrixMode(GL_PROJECTION);
		glViewport(windowWidth / 2, windowHeight / 2, windowWidth / 2, windowHeight / 2);
		Camera cam2(10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		glOrtho(-30.0f, 30.0f, -30.0f, 30.0f, 1.0f, 100.0f);
		cam2.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();

		//Third viewport-----------------------------------------------------------------------------

		glViewport(windowWidth / 2, 0, windowWidth / 2, windowHeight / 2);
		glMatrixMode(GL_PROJECTION);
		Camera cam3(0.0f, 10.0f, 0.0000001f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
		cam3.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		drawSceneObjects();

		// Update Cam

		updateEm();

		//Fourth viewport--------------------------------------------------------------------------------------------

		glViewport(0, windowHeight / 2, windowWidth / 2, windowHeight / 2);
		glMatrixMode(GL_PROJECTION);
		Camera cam4(5.0f, 5.0f, 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glLoadIdentity();
		gluPerspective(90.0f, 1.0f, 1.0f, 100.0f);
		cam4.applyCameraTransformations();
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		drawSceneObjects();
	}
	static unsigned int oldTimeSinceStart = 0;
	unsigned int timeSinceStart = glutGet(GLUT_ELAPSED_TIME);
	unsigned int deltaT = timeSinceStart - oldTimeSinceStart;
	oldTimeSinceStart = timeSinceStart;

	cam.Update((float)deltaT / 1000.0);
	cam.applyCameraTransformations();
	//end of borders---------------------------------

	//first viewpoint

	//glMatrixMode(GL_PROJECTION);
	//glViewport(0, 0, windowWidth / 2, windowHeight / 2);
	//Camera cam1(0.0f, 0.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
	//glLoadIdentity(); // clear our the transform matrix
	//glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
	//cam1.applyCameraTransformations();
	//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	//drawSceneObjects();
	//
	////Second Viewport -----------------------------------------------------
	//
	//glMatrixMode(GL_PROJECTION);
	//glViewport(windowWidth / 2, windowHeight / 2, windowWidth / 2, windowHeight / 2);
	//Camera cam2(10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
	//glLoadIdentity();
	//glOrtho(-30.0f, 30.0f, -30.0f, 30.0f, 1.0f, 100.0f);
	//cam2.applyCameraTransformations();
	//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	//drawSceneObjects();
	//
	////Third viewport-----------------------------------------------------------------------------
	//
	//glViewport(windowWidth / 2, 0, windowWidth / 2, windowHeight / 2);
	//glMatrixMode(GL_PROJECTION);
	//Camera cam3(0.0f, 10.0f, 0.0000001f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
	//glLoadIdentity();
	//glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 100.0f);
	//cam3.applyCameraTransformations();
	//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	//drawSceneObjects();
	//
	//
	////Fourth viewport--------------------------------------------------------------------------------------------
	//
	//glViewport(0, windowHeight / 2, windowWidth / 2, windowHeight / 2);
	//glMatrixMode(GL_PROJECTION);
	//Camera cam4(5.0f, 5.0f, 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
	//glLoadIdentity();
	//gluPerspective(90.0f, 1.0f, 1.0f, 100.0f);
	//cam4.applyCameraTransformations();
	//glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	//drawSceneObjects();

	//---------------------------------------------------------------------------------------------------


	/* Swap Buffers to Make it show up on screen */
	glutSwapBuffers();
}