本文整理汇总了C++中CStr::ToFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ CStr::ToFloat方法的具体用法?C++ CStr::ToFloat怎么用?C++ CStr::ToFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStr
的用法示例。
在下文中一共展示了CStr::ToFloat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadMaterial
CMaterial CMaterialManager::LoadMaterial(const VfsPath& pathname)
{
if (pathname.empty())
return CMaterial();
std::map<VfsPath, CMaterial>::iterator iter = m_Materials.find(pathname);
if (iter != m_Materials.end())
return iter->second;
CXeromyces xeroFile;
if (xeroFile.Load(g_VFS, pathname, "material") != PSRETURN_OK)
return CMaterial();
#define EL(x) int el_##x = xeroFile.GetElementID(#x)
#define AT(x) int at_##x = xeroFile.GetAttributeID(#x)
EL(alpha_blending);
EL(alternative);
EL(define);
EL(shader);
EL(uniform);
EL(renderquery);
EL(required_texture);
EL(conditional_define);
AT(effect);
AT(if);
AT(define);
AT(quality);
AT(material);
AT(name);
AT(value);
AT(type);
AT(min);
AT(max);
AT(conf);
#undef AT
#undef EL
CMaterial material;
XMBElement root = xeroFile.GetRoot();
CPreprocessorWrapper preprocessor;
preprocessor.AddDefine("CFG_FORCE_ALPHATEST", g_Renderer.m_Options.m_ForceAlphaTest ? "1" : "0");
CVector4D vec(qualityLevel,0,0,0);
material.AddStaticUniform("qualityLevel", vec);
XERO_ITER_EL(root, node)
{
int token = node.GetNodeName();
XMBAttributeList attrs = node.GetAttributes();
if (token == el_alternative)
{
CStr cond = attrs.GetNamedItem(at_if);
if (cond.empty() || !preprocessor.TestConditional(cond))
{
cond = attrs.GetNamedItem(at_quality);
if (cond.empty())
continue;
else
{
if (cond.ToFloat() <= qualityLevel)
continue;
}
}
material = LoadMaterial(VfsPath("art/materials") / attrs.GetNamedItem(at_material).FromUTF8());
break;
}
else if (token == el_alpha_blending)
{
material.SetUsesAlphaBlending(true);
}
else if (token == el_shader)
{
material.SetShaderEffect(attrs.GetNamedItem(at_effect));
}
else if (token == el_define)
{
material.AddShaderDefine(CStrIntern(attrs.GetNamedItem(at_name)), CStrIntern(attrs.GetNamedItem(at_value)));
}
else if (token == el_conditional_define)
{
std::vector<float> args;
CStr type = attrs.GetNamedItem(at_type).c_str();
int typeID = -1;
if (type == CStr("draw_range"))
{
typeID = DCOND_DISTANCE;
float valmin = -1.0f;
float valmax = -1.0f;
CStr conf = attrs.GetNamedItem(at_conf);
if (!conf.empty())
{
CFG_GET_VAL("materialmgr." + conf + ".min", valmin);
CFG_GET_VAL("materialmgr." + conf + ".max", valmax);
//.........这里部分代码省略.........