Removed, no longer needed (replacement using GLSL coming)
This was SVN commit r1296.
This commit is contained in:
parent
e3137cd302
commit
82108a30c9
@ -1,123 +0,0 @@
|
||||
#include "precompiled.h"
|
||||
#include "graphics/ProgramManager.h"
|
||||
|
||||
#define SAFE_DELETE(x) \
|
||||
if((x)) { delete (x); (x) = NULL; }
|
||||
|
||||
CProgramManager::CProgramManager()
|
||||
{
|
||||
#ifdef BUILD_CG
|
||||
m_Context = cgCreateContext();
|
||||
assert(m_Context);
|
||||
FindPPVersion();
|
||||
#endif
|
||||
}
|
||||
|
||||
CProgramManager::~CProgramManager()
|
||||
{
|
||||
#ifdef BUILD_CG
|
||||
if(m_Context)
|
||||
cgDestroyContext(m_Context);
|
||||
#endif
|
||||
}
|
||||
|
||||
CVertexProgram *CProgramManager::FindVertexProgram(const char *file)
|
||||
{
|
||||
CVertexProgram *prog = NULL;
|
||||
pp_map::iterator iter;
|
||||
|
||||
if((iter = m_VertexProgs.find(std::string(file))) != m_VertexProgs.end())
|
||||
return (CVertexProgram *)(*iter).second;
|
||||
else
|
||||
{
|
||||
prog = new CVertexProgram(file);
|
||||
if(prog && prog->IsValid())
|
||||
m_VertexProgs[std::string(file)] = prog;
|
||||
else
|
||||
{
|
||||
SAFE_DELETE(prog);
|
||||
}
|
||||
}
|
||||
|
||||
return prog;
|
||||
}
|
||||
|
||||
void CProgramManager::Bind(CVertexProgram *prog)
|
||||
{
|
||||
#ifdef BUILD_CG
|
||||
assert(prog);
|
||||
if(m_VPProfile == CG_PROFILE_UNKNOWN || !prog->IsValid())
|
||||
return;
|
||||
|
||||
prog->Bind();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CProgramManager::WritePPInfo(FILE *file)
|
||||
{
|
||||
#ifdef BUILD_CG
|
||||
std::string version = "";
|
||||
switch(m_VPProfile)
|
||||
{
|
||||
case CG_PROFILE_VP30:
|
||||
version = "VP 3.0";
|
||||
break;
|
||||
case CG_PROFILE_VP20:
|
||||
version = "VP 2.0";
|
||||
break;
|
||||
case CG_PROFILE_ARBVP1:
|
||||
version = "ARB VP1";
|
||||
break;
|
||||
default:
|
||||
version = "No VP support";
|
||||
break;
|
||||
}
|
||||
fprintf(file, "Vertex Programs: %s\n", version.c_str());
|
||||
|
||||
switch(m_FPProfile)
|
||||
{
|
||||
case CG_PROFILE_FP30:
|
||||
version = "FP 3.0";
|
||||
break;
|
||||
case CG_PROFILE_FP20:
|
||||
version = "FP 2.0";
|
||||
break;
|
||||
case CG_PROFILE_ARBVP1:
|
||||
version = "ARB FP1";
|
||||
break;
|
||||
default:
|
||||
version = "No FP support";
|
||||
break;
|
||||
}
|
||||
fprintf(file, "Fragment Programs: %s\n", version.c_str());
|
||||
#else
|
||||
fprintf(file, "VP/FP support not compiled!\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BUILD_CG
|
||||
|
||||
void CProgramManager::FindPPVersion()
|
||||
{
|
||||
#if BUILD_CG
|
||||
if(cgGLIsProfileSupported(CG_PROFILE_VP30))
|
||||
m_VPProfile = CG_PROFILE_VP30;
|
||||
else if(cgGLIsProfileSupported(CG_PROFILE_FP20))
|
||||
m_VPProfile = CG_PROFILE_VP20;
|
||||
else if(cgGLIsProfileSupported(CG_PROFILE_ARBVP1))
|
||||
m_VPProfile = CG_PROFILE_ARBVP1;
|
||||
else
|
||||
m_VPProfile = CG_PROFILE_UNKNOWN;
|
||||
|
||||
if(cgGLIsProfileSupported(CG_PROFILE_FP30))
|
||||
m_FPProfile = CG_PROFILE_FP30;
|
||||
else if(cgGLIsProfileSupported(CG_PROFILE_FP20))
|
||||
m_FPProfile = CG_PROFILE_FP20;
|
||||
else if(cgGLIsProfileSupported(CG_PROFILE_ARBFP1))
|
||||
m_FPProfile = CG_PROFILE_ARBFP1;
|
||||
else
|
||||
m_FPProfile = CG_PROFILE_UNKNOWN;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -1,40 +0,0 @@
|
||||
#ifndef __H_PROGRAMMANAGER_H__
|
||||
#define __H_PROGRAMMANAGER_H__
|
||||
|
||||
#include <string>
|
||||
#include "Singleton.h"
|
||||
#include "renderer/VertexProgram.h"
|
||||
|
||||
typedef STL_HASH_MAP<std::string, CVertexProgram *> pp_map;
|
||||
|
||||
#define g_ProgramManager CProgramManager::GetSingleton()
|
||||
|
||||
|
||||
class CProgramManager : public Singleton<CProgramManager>
|
||||
{
|
||||
public:
|
||||
CProgramManager();
|
||||
~CProgramManager();
|
||||
|
||||
CVertexProgram *FindVertexProgram(const char *file);
|
||||
void Bind(CVertexProgram *prog);
|
||||
|
||||
void WritePPInfo(FILE *file);
|
||||
#ifdef BUILD_CG
|
||||
CGprofile GetVPProfile() { return m_VPProfile; }
|
||||
CGprofile GetFPProfile() { return m_FPProfile; }
|
||||
CGcontext GetContext() { return m_Context; }
|
||||
#endif
|
||||
private:
|
||||
#ifdef BUILD_CG
|
||||
void FindPPVersion();
|
||||
#endif
|
||||
pp_map m_VertexProgs;
|
||||
#ifdef BUILD_CG
|
||||
CGcontext m_Context;
|
||||
CGprofile m_VPProfile;
|
||||
CGprofile m_FPProfile;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user