Exemplo n.º 1
0
bool ATITShader::loadShaderFromFiles(const char* vertPath, const char* fragPath)
{
   if(vertPath)
   {
      if(!loadVertexShaderFromFile(vertPath))
      {
         if(fragPath)
         {
            loadShaderFromFiles("Shaders/Debug/errorVert.arb", "Shaders/Debug/errorPixl.atit");
         }
         else
         {
            loadShaderFromFiles("Shaders/Debug/errorVert.arb", NULL);
         }
         return true;
      }
   }
   if(fragPath)
   {
      if(!loadFragmentShaderFromFile(fragPath))
      {
         if(vertPath)
         {
            glDeleteProgramsARB(1, &mVertexProgram);
            mVertexProgram = 0;
            loadShaderFromFiles("Shaders/Debug/errorVert.arb", "Shaders/Debug/errorPixl.atit");
         }
         else
         {
            loadShaderFromFiles(NULL, "Shaders/Debug/errorPixl.atit");
         }
         return true;
      }
   }
   
   mFilepath = NULL;
   
   return true;
}
bool DXShaderManager::loadShaderProgram( const string& name, const ArrayList<ShaderInfo> shaders )
{
	DXShaderProgram program;
	for (unsigned int i = 0; i < shaders.getSize(); ++i)
	{
		const ShaderInfo& shader = shaders[i];

		switch (shader.Type)
		{
		case WOE_SHADER_TYPE_VERTEX:

			program.pVertexShader = (ID3D11VertexShader*)loadVertexShaderFromFile(name);

			break;
		case WOE_SHADER_TYPE_FRAGMENT:

			program.pPixelShader = (ID3D11PixelShader*)loadPixelShaderFromFile(name);

			break;
		}
	}
}