本文整理汇总了C++中ShadingPoint::get_primitive_index方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadingPoint::get_primitive_index方法的具体用法?C++ ShadingPoint::get_primitive_index怎么用?C++ ShadingPoint::get_primitive_index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadingPoint
的用法示例。
在下文中一共展示了ShadingPoint::get_primitive_index方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluate_pdf
double LightSampler::evaluate_pdf(const ShadingPoint& shading_point) const
{
assert(shading_point.is_triangle_primitive());
const EmittingTriangleKey triangle_key(
shading_point.get_assembly_instance().get_uid(),
shading_point.get_object_instance_index(),
shading_point.get_region_index(),
shading_point.get_primitive_index());
const EmittingTriangle* triangle = m_emitting_triangle_hash_table.get(triangle_key);
return triangle->m_triangle_prob * triangle->m_rcp_area;
}
示例2: evaluate
//.........这里部分代码省略.........
// Return a gray scale value proportional to the accessibility.
const float accessibility = static_cast<float>(1.0 - occlusion);
shading_result.set_main_to_linear_rgb(Color3f(accessibility));
}
break;
case AssemblyInstances:
shading_result.set_main_to_linear_rgb(
integer_to_color(shading_point.get_assembly_instance().get_uid()));
break;
case ObjectInstances:
shading_result.set_main_to_linear_rgb(
integer_to_color(shading_point.get_object_instance().get_uid()));
break;
case Regions:
{
const uint32 h =
mix_uint32(
static_cast<uint32>(shading_point.get_object_instance().get_uid()),
static_cast<uint32>(shading_point.get_region_index()));
shading_result.set_main_to_linear_rgb(integer_to_color(h));
}
break;
case Primitives:
{
const uint32 h =
mix_uint32(
static_cast<uint32>(shading_point.get_object_instance().get_uid()),
static_cast<uint32>(shading_point.get_region_index()),
static_cast<uint32>(shading_point.get_primitive_index()));
shading_result.set_main_to_linear_rgb(integer_to_color(h));
}
break;
case Materials:
{
const Material* material = shading_point.get_material();
if (material)
shading_result.set_main_to_linear_rgb(integer_to_color(material->get_uid()));
else shading_result.set_main_to_opaque_pink_linear_rgba();
}
break;
case RaySpread:
{
const ShadingRay& ray = shading_point.get_ray();
if (!ray.m_has_differentials)
break;
const Material* material = shading_point.get_material();
if (material)
{
const Material::RenderData& material_data = material->get_render_data();
#ifdef APPLESEED_WITH_OSL
// Execute the OSL shader if there is one.
if (material_data.m_shader_group)
{
shading_context.execute_osl_shading(
*material_data.m_shader_group,
shading_point);
}