本文整理汇总了C++中GpuProgramPtr::load方法的典型用法代码示例。如果您正苦于以下问题:C++ GpuProgramPtr::load方法的具体用法?C++ GpuProgramPtr::load怎么用?C++ GpuProgramPtr::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GpuProgramPtr
的用法示例。
在下文中一共展示了GpuProgramPtr::load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadFromString
//---------------------------------------------------------------------------
GpuProgramPtr GpuProgramManager::loadFromString(const String& name,
const String& groupName, const String& code,
GpuProgramType gptype, const String& syntaxCode)
{
GpuProgramPtr prg;
{
OGRE_LOCK_AUTO_MUTEX
prg = getByName(name);
if (prg.isNull())
{
prg = createProgramFromString(name, groupName, code, gptype, syntaxCode);
}
}
prg->load();
return prg;
}
示例2: initialise
//---------------------------------------------------------------------
//---------------------------------------------------------------------
void ShadowVolumeExtrudeProgram::initialise(void)
{
if (!mInitialised)
{
String syntax;
bool vertexProgramFinite[OGRE_NUM_SHADOW_EXTRUDER_PROGRAMS] =
{
false, false, false, false,
true, true, true, true
};
bool vertexProgramDebug[OGRE_NUM_SHADOW_EXTRUDER_PROGRAMS] =
{
false, true, false, true,
false, true, false, true
};
Light::LightTypes vertexProgramLightTypes[OGRE_NUM_SHADOW_EXTRUDER_PROGRAMS] =
{
Light::LT_POINT, Light::LT_POINT,
Light::LT_DIRECTIONAL, Light::LT_DIRECTIONAL,
Light::LT_POINT, Light::LT_POINT,
Light::LT_DIRECTIONAL, Light::LT_DIRECTIONAL
};
// load hardware extrusion programs for point & dir lights
if (GpuProgramManager::getSingleton().isSyntaxSupported("arbvp1"))
{
// ARBvp1
syntax = "arbvp1";
}
else if (GpuProgramManager::getSingleton().isSyntaxSupported("vs_1_1"))
{
syntax = "vs_1_1";
}
else if (GpuProgramManager::getSingleton().isSyntaxSupported("vs_4_0"))
{
syntax = "vs_4_0";
}
else
{
OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR,
"Vertex programs are supposedly supported, but neither "
"arbvp1, vs_1_1 nor vs_4_0 syntaxes are present.",
"SceneManager::initShadowVolumeMaterials");
}
// Create all programs
for (unsigned short v = 0; v < OGRE_NUM_SHADOW_EXTRUDER_PROGRAMS; ++v)
{
// Create debug extruders
if (GpuProgramManager::getSingleton().getByName(
programNames[v]).isNull())
{
if (syntax == "vs_4_0")
{
HighLevelGpuProgramPtr vp =
HighLevelGpuProgramManager::getSingleton().createProgram(
programNames[v], ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME,
"hlsl", GPT_VERTEX_PROGRAM);
vp->setSource(ShadowVolumeExtrudeProgram::getProgramSource(
vertexProgramLightTypes[v], syntax,
vertexProgramFinite[v], vertexProgramDebug[v]));
vp->setParameter("target", syntax);
vp->setParameter("entry_point", "vs_main");
vp->load();
if (frgProgramName.empty())
{
frgProgramName = "Ogre/ShadowFrgProgram";
HighLevelGpuProgramPtr fp =
HighLevelGpuProgramManager::getSingleton().createProgram(
frgProgramName, ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME,
"hlsl", GPT_FRAGMENT_PROGRAM);
fp->setSource(mGeneralFs_4_0);
fp->setParameter("target", "ps_4_0");
fp->setParameter("entry_point", "fs_main");
fp->load();
}
}
else
{
GpuProgramPtr vp =
GpuProgramManager::getSingleton().createProgramFromString(
programNames[v], ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME,
ShadowVolumeExtrudeProgram::getProgramSource(
vertexProgramLightTypes[v], syntax,
vertexProgramFinite[v], vertexProgramDebug[v]),
GPT_VERTEX_PROGRAM, syntax);
vp->load();
}
}
}
mInitialised = true;
}
}