Example #1
0
void GBI_MakeCurrent( MicrocodeInfo *current )
{
   int i;
    if (current != GBI.top)
    {
        if (current == GBI.bottom)
        {
            GBI.bottom = current->higher;
            GBI.bottom->lower = NULL;
        }
        else
        {
            current->higher->lower = current->lower;
            current->lower->higher = current->higher;
        }

        current->higher = NULL;
        current->lower = GBI.top;
        GBI.top->higher = current;
        GBI.top = current;
    }

    if (!GBI.current || (GBI.current->type != current->type))
    {

        for (i = 0; i <= 0xFF; i++)
            GBI.cmd[i] = GBI_Unknown;

        RDP_Init();
        switch (current->type)
        {
            case F3D:       F3D_Init();     break;
            case F3DEX:     F3DEX_Init();   break;
            case F3DEX2:    F3DEX2_Init();  break;
            case L3D:       L3D_Init();     break;
            case L3DEX:     L3DEX_Init();   break;
            case L3DEX2:    L3DEX2_Init();  break;
            case S2DEX:     S2DEX_Init();   break;
            case S2DEX2:    S2DEX2_Init();  break;
            case F3DDKR:    F3DDKR_Init();  break;
            case F3DWRUS:   F3DWRUS_Init(); break;
            case F3DPD:     F3DPD_Init();   break;
            case F3DCBFD:   F3DCBFD_Init(); break;
        }
    }


    GBI.current = current;
}
Example #2
0
void GBI_MakeCurrent( MicrocodeInfo *current )
{
   int i;
   if (current != GBI.top)
   {
      if (current == GBI.bottom)
      {
         GBI.bottom = current->higher;
         GBI.bottom->lower = NULL;
      }
      else
      {
         current->higher->lower = current->lower;
         current->lower->higher = current->higher;
      }

      current->higher = NULL;
      current->lower = GBI.top;
      GBI.top->higher = current;
      GBI.top = current;
   }

   if (!GBI.current || (GBI.current->type != current->type))
   {

      for (i = 0; i <= 0xFF; i++)
         GBI.cmd[i] = GBI_Unknown;

      RDP_Init();
      switch (current->type)
      {
         case F3D:       F3D_Init();     break;
         case F3DEX:     F3DEX_Init();   break;
         case F3DEX2:    F3DEX2_Init();  break;
         case L3D:       L3D_Init();     break;
         case L3DEX:     L3DEX_Init();   break;
         case L3DEX2:    L3DEX2_Init();  break;
         case S2DEX:     S2DEX_Init();   break;
         case S2DEX2:    S2DEX2_Init();  break;
         case F3DDKR:    F3DDKR_Init();  break;
			case F3DJFG:	 F3DJFG_Init();	break;
			case F3DSWSE:	 F3DSWSE_Init();	break;
         case F3DWRUS:   F3DWRUS_Init(); break;
         case F3DPD:     F3DPD_Init();   break;
#ifdef NEW
			case F3DEX2CBFD:F3DEX2CBFD_Init(); break;
			case Turbo3D:	F3D_Init();		break;
			case ZSortp:	ZSort_Init();	break;
#else
         case F3DEX2CBFD:   F3DCBFD_Init(); break;
#endif
      }

#ifdef NEW
		if (current->NoN)
      {
         // Disable near and far plane clipping
         glEnable(GL_DEPTH_CLAMP);
         // Enable Far clipping plane in vertex shader
         glEnable(GL_CLIP_DISTANCE0);
      } else {
			glDisable(GL_DEPTH_CLAMP);
			glDisable(GL_CLIP_DISTANCE0);
		}
#endif
   }
#ifdef NEW
   else if (current->NoN != current->NoN)
   {
		if (current->NoN) {
			// Disable near and far plane clipping
			glEnable(GL_DEPTH_CLAMP);
			// Enable Far clipping plane in vertex shader
			glEnable(GL_CLIP_DISTANCE0);
		}
		else {
			glDisable(GL_DEPTH_CLAMP);
			glDisable(GL_CLIP_DISTANCE0);
		}
	}
#endif

   GBI.current = current;
}
Example #3
0
void GBIInfo::_makeCurrent(MicrocodeInfo * _pCurrent)
{
	if (_pCurrent->type == NONE) {
		LOG(LOG_ERROR, "[GLideN64]: error - unknown ucode!!!\n");
		return;
	}

	if (m_pCurrent == nullptr || (m_pCurrent->type != _pCurrent->type)) {
		m_pCurrent = _pCurrent;
		_flushCommands();

		RDP_Init();

		G_TRI1 = G_TRI2 = G_TRI4 = G_QUAD = -1; // For correct work of gSPFlushTriangles()

		switch (m_pCurrent->type) {
			case F3D:		F3D_Init();		break;
			case F3DEX:		F3DEX_Init();	break;
			case F3DEX2:	F3DEX2_Init();	break;
			case L3D:		L3D_Init();		break;
			case L3DEX:		L3DEX_Init();	break;
			case L3DEX2:	L3DEX2_Init();	break;
			case S2DEX:		S2DEX_Init();	break;
			case S2DEX2:	S2DEX2_Init();	break;
			case F3DDKR:	F3DDKR_Init();	break;
			case F3DJFG:	F3DJFG_Init();	break;
			case F3DSWSE:	F3DSWSE_Init();	break;
			case F3DWRUS:	F3DWRUS_Init();	break;
			case F3DPD:		F3DPD_Init();	break;
			case Turbo3D:	F3D_Init();		break;
			case ZSortp:	ZSort_Init();	break;
			case F3DEX2CBFD:F3DEX2CBFD_Init(); break;
		}

#ifndef GLESX
		if (m_pCurrent->NoN) {
			// Disable near and far plane clipping
			glEnable(GL_DEPTH_CLAMP);
			// Enable Far clipping plane in vertex shader
			glEnable(GL_CLIP_DISTANCE0);
		} else {
			glDisable(GL_DEPTH_CLAMP);
			glDisable(GL_CLIP_DISTANCE0);
		}
#endif
	} else if (m_pCurrent->NoN != _pCurrent->NoN) {
#ifndef GLESX
		if (_pCurrent->NoN) {
			// Disable near and far plane clipping
			glEnable(GL_DEPTH_CLAMP);
			// Enable Far clipping plane in vertex shader
			glEnable(GL_CLIP_DISTANCE0);
		}
		else {
			glDisable(GL_DEPTH_CLAMP);
			glDisable(GL_CLIP_DISTANCE0);
		}
#endif
	}
	m_pCurrent = _pCurrent;
}