本文整理汇总了C++中osl::ShadingSystem::getattribute方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadingSystem::getattribute方法的具体用法?C++ ShadingSystem::getattribute怎么用?C++ ShadingSystem::getattribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osl::ShadingSystem
的用法示例。
在下文中一共展示了ShadingSystem::getattribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_shadergroup_globals_info
void ShaderGroup::get_shadergroup_globals_info(OSL::ShadingSystem& shading_system)
{
m_uses_dPdtime = true;
int num_globals = 0;
if (!shading_system.getattribute(
impl->m_shader_group_ref.get(),
"num_globals_needed",
num_globals))
{
RENDERER_LOG_WARNING(
"getattribute: num_globals_needed call failed for shader group %s; "
"assuming shader group uses all globals.",
get_name());
return;
}
if (num_globals != 0)
{
OIIO::ustring* globals = 0;
if (!shading_system.getattribute(
impl->m_shader_group_ref.get(),
"globals_needed",
OIIO::TypeDesc::PTR,
&globals))
{
RENDERER_LOG_WARNING(
"getattribute: globals_needed call failed for shader group %s; "
"assuming shader group uses all globals.",
get_name());
return;
}
m_uses_dPdtime = false;
for (int i = 0; i < num_globals; ++i)
{
if (globals[i] == g_dPdtime_str)
m_uses_dPdtime = true;
}
}
}
示例2: get_shadergroup_closures_info
void ShaderGroup::get_shadergroup_closures_info(OSL::ShadingSystem& shading_system)
{
m_has_emission = true;
m_has_transparency = true;
m_has_subsurface = true;
m_has_holdout = true;
m_has_debug = true;
int num_unknown_closures = 0;
if (!shading_system.getattribute(
impl->m_shader_group_ref.get(),
"unknown_closures_needed",
num_unknown_closures))
{
RENDERER_LOG_WARNING(
"getattribute: unknown_closures_needed call failed for shader group %s; "
"assuming shader group has all kinds of closures.",
get_name());
return;
}
if (num_unknown_closures != 0)
{
RENDERER_LOG_WARNING(
"shader group %s has unknown closures; "
"assuming shader group has all kinds of closures.",
get_name());
return;
}
int num_closures = 0;
if (!shading_system.getattribute(
impl->m_shader_group_ref.get(),
"num_closures_needed",
num_closures))
{
RENDERER_LOG_WARNING(
"getattribute: num_closures_needed call failed for shader group %s; "
"assuming shader group has all kinds of closures.",
get_name());
}
if (num_closures != 0)
{
OIIO::ustring* closures = 0;
if (!shading_system.getattribute(
impl->m_shader_group_ref.get(),
"closures_needed",
OIIO::TypeDesc::PTR,
&closures))
{
RENDERER_LOG_WARNING(
"getattribute: closures_needed call failed for shader group %s; "
"assuming shader group has all kinds of closures.",
get_name());
return;
}
m_has_emission = false;
m_has_transparency = false;
m_has_subsurface = false;
m_has_holdout = false;
m_has_debug = false;
for (int i = 0; i < num_closures; ++i)
{
if (closures[i] == g_emission_str)
m_has_emission = true;
if (closures[i] == g_transparent_str)
m_has_transparency = true;
if (closures[i] == g_subsurface_str)
m_has_subsurface = true;
if (closures[i] == g_holdout_str)
m_has_holdout = true;
if (closures[i] == g_debug_str)
m_has_debug = true;
}
}
}