本文整理汇总了C++中Assembly::colors方法的典型用法代码示例。如果您正苦于以下问题:C++ Assembly::colors方法的具体用法?C++ Assembly::colors怎么用?C++ Assembly::colors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assembly
的用法示例。
在下文中一共展示了Assembly::colors方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: build_assembly_symbol_table
void InputBinder::build_assembly_symbol_table(
const Assembly& assembly,
SymbolTable& symbols)
{
try
{
insert_entities(symbols, assembly.colors(), SymbolTable::SymbolColor);
insert_entities(symbols, assembly.textures(), SymbolTable::SymbolTexture);
insert_entities(symbols, assembly.texture_instances(), SymbolTable::SymbolTextureInstance);
insert_entities(symbols, assembly.bsdfs(), SymbolTable::SymbolBSDF);
insert_entities(symbols, assembly.bssrdfs(), SymbolTable::SymbolBSSRDF);
insert_entities(symbols, assembly.edfs(), SymbolTable::SymbolEDF);
#ifdef APPLESEED_WITH_OSL
insert_entities(symbols, assembly.shader_groups(), SymbolTable::SymbolShaderGroup);
#endif
insert_entities(symbols, assembly.surface_shaders(), SymbolTable::SymbolSurfaceShader);
insert_entities(symbols, assembly.materials(), SymbolTable::SymbolMaterial);
insert_entities(symbols, assembly.lights(), SymbolTable::SymbolLight);
insert_entities(symbols, assembly.objects(), SymbolTable::SymbolObject);
insert_entities(symbols, assembly.object_instances(), SymbolTable::SymbolObjectInstance);
}
catch (const SymbolTable::ExceptionDuplicateSymbol& e)
{
RENDERER_LOG_ERROR("duplicate entity \"%s\".", e.string());
++m_error_count;
}
}
示例2: bind_assembly_entity_to_input
void InputBinder::bind_assembly_entity_to_input(
const Scene& scene,
const SymbolTable& scene_symbols,
const Assembly& assembly,
const SymbolTable& assembly_symbols,
const char* entity_type,
const char* entity_name,
const char* param_value,
InputArray::iterator& input)
{
switch (assembly_symbols.lookup(param_value))
{
case SymbolTable::SymbolColor:
bind_color_to_input(
assembly.colors(),
param_value,
input);
break;
case SymbolTable::SymbolTextureInstance:
bind_texture_instance_to_input(
assembly.textures(),
assembly.texture_instances(),
assembly.get_uid(),
entity_type,
entity_name,
param_value,
input);
break;
case SymbolTable::SymbolNotFound:
// No entity with this name was found in this scope.
// Attempt to bind the input to a scene entity.
bind_scene_entity_to_input(
scene,
scene_symbols,
entity_type,
entity_name,
param_value,
input);
break;
default:
RENDERER_LOG_ERROR(
"while defining %s \"%s\": cannot bind \"%s\" to parameter \"%s\".",
entity_type,
entity_name,
param_value,
input.name());
++m_error_count;
break;
}
}
示例3: collect_relations_from_assembly
void collect_relations_from_assembly(Assembly& assembly)
{
collect_relations_from(assembly.colors());
collect_relations_from(assembly.textures());
collect_relations_from(assembly.texture_instances());
collect_relations_from(assembly.shader_groups());
collect_relations_from(assembly.assembly_instances());
collect_relations_from(assembly.bsdfs());
collect_relations_from(assembly.bssrdfs());
collect_relations_from(assembly.edfs());
collect_relations_from(assembly.surface_shaders());
collect_relations_from(assembly.materials());
collect_relations_from(assembly.lights());
collect_relations_from(assembly.objects());
collect_relations_from(assembly.object_instances());
collect_relations_from(assembly.volumes());
for (auto& child_assembly : assembly.assemblies())
collect_relations_from_assembly(child_assembly);
// Lights are implicitly referenced by their parent assembly.
for (auto& light : assembly.lights())
{
const InputBinder::ReferencedEntity referenced_entity(assembly.lights(), &light);
insert_relation(referenced_entity, assembly);
}
// Object instances are implicitly referenced by their parent assembly.
for (auto& object_instance : assembly.object_instances())
{
const InputBinder::ReferencedEntity referenced_entity(assembly.object_instances(), &object_instance);
insert_relation(referenced_entity, assembly);
}
// Assembly instances are implicitly referenced by their parent assembly.
for (auto& assembly_instance : assembly.assembly_instances())
{
const InputBinder::ReferencedEntity referenced_entity(assembly.assembly_instances(), &assembly_instance);
insert_relation(referenced_entity, assembly);
}
}
示例4: remove_unused_entities_from_assembly
void remove_unused_entities_from_assembly(Assembly& assembly)
{
remove_unused_entities_from(assembly.colors());
remove_unused_entities_from(assembly.textures());
remove_unused_entities_from(assembly.texture_instances());
remove_unused_entities_from(assembly.shader_groups());
remove_unused_entities_from(assembly.assembly_instances());
remove_unused_entities_from(assembly.bsdfs());
remove_unused_entities_from(assembly.bssrdfs());
remove_unused_entities_from(assembly.edfs());
remove_unused_entities_from(assembly.surface_shaders());
remove_unused_entities_from(assembly.materials());
remove_unused_entities_from(assembly.lights());
remove_unused_entities_from(assembly.objects());
remove_unused_entities_from(assembly.object_instances());
remove_unused_entities_from(assembly.volumes());
for (auto& child_assembly : assembly.assemblies())
remove_unused_entities_from_assembly(child_assembly);
}
示例5: try_bind_assembly_entity_to_input
bool InputBinder::try_bind_assembly_entity_to_input(
const Scene& scene,
const SymbolTable& scene_symbols,
const Assembly& assembly,
const SymbolTable& assembly_symbols,
const char* entity_type,
const char* entity_name,
const char* param_value,
InputArray::iterator& input)
{
if (input.format() == InputFormatEntity)
{
#define BIND(symbol, collection) \
case symbol: \
input.bind(collection.get_by_name(param_value)); \
return true
switch (assembly_symbols.lookup(param_value))
{
BIND(SymbolTable::SymbolColor, assembly.colors());
BIND(SymbolTable::SymbolTexture, assembly.textures());
BIND(SymbolTable::SymbolTextureInstance, assembly.texture_instances());
BIND(SymbolTable::SymbolBSDF, assembly.bsdfs());
BIND(SymbolTable::SymbolBSSRDF, assembly.bssrdfs());
BIND(SymbolTable::SymbolEDF, assembly.edfs());
#ifdef APPLESEED_WITH_OSL
BIND(SymbolTable::SymbolShaderGroup, assembly.shader_groups());
#endif
BIND(SymbolTable::SymbolSurfaceShader, assembly.surface_shaders());
BIND(SymbolTable::SymbolMaterial, assembly.materials());
BIND(SymbolTable::SymbolLight, assembly.lights());
BIND(SymbolTable::SymbolObject, assembly.objects());
BIND(SymbolTable::SymbolObjectInstance, assembly.object_instances());
}
#undef BIND
}
else
{
switch (assembly_symbols.lookup(param_value))
{
case SymbolTable::SymbolColor:
bind_color_to_input(
assembly.colors(),
param_value,
input);
return true;
case SymbolTable::SymbolTextureInstance:
bind_texture_instance_to_input(
assembly.texture_instances(),
assembly.get_uid(),
entity_type,
entity_name,
param_value,
input);
return true;
}
}
return false;
}
示例6: add_cube
void add_cube(
Assembly& assembly,
const size_t ix,
const size_t iy,
const double fx,
const double fz,
const Color3b& color,
const Transformd& transform) override
{
const string color_suffix = color_to_string(color);
const string color_name = "color_" + color_suffix;
const string material_name = "material_" + color_suffix;
if (assembly.colors().get_by_name(color_name.c_str()) == 0)
{
const Color3f reflectance = Color3f(color) * (1.0f / 255);
assembly.colors().insert(
ColorEntityFactory::create(
color_name.c_str(),
ParamArray()
.insert("color_space", "srgb"),
ColorValueArray(3, &reflectance[0])));
const string brdf_name = "brdf_" + color_suffix;
assembly.bsdfs().insert(
DisneyBRDFFactory().create(
brdf_name.c_str(),
ParamArray()
.insert("anisotropic", 0.0)
.insert("base_color", color_name)
.insert("clearcoat", 1.0)
.insert("clearcoat_gloss", 0.9)
.insert("metallic", 0.0)
.insert("roughness", 0.3)
.insert("sheen", 0.0)
.insert("sheen_tint", 0.0)
.insert("specular", 0.9)
.insert("specular_tint", 1.0)
.insert("subsurface", 1.0)));
assembly.materials().insert(
GenericMaterialFactory().create(
material_name.c_str(),
ParamArray()
.insert("surface_shader", "physical_surface_shader")
.insert("bsdf", brdf_name)));
}
// Create an assembly for this cube.
const string coordinates_suffix = coordinates_to_string(ix, iy);
const string cube_assembly_name = "assembly_" + coordinates_suffix;
auto_release_ptr<Assembly> cube_assembly(
AssemblyFactory().create(cube_assembly_name.c_str()));
// Instantiate the cube mesh object (from the parent assembly) into this assembly.
cube_assembly->object_instances().insert(
ObjectInstanceFactory::create(
"cube.0_inst",
ParamArray(),
"cube.0",
Transformd::identity(),
StringDictionary()
.insert("default", material_name)));
// Create an instance of the cube assembly.
const string cube_assembly_inst_name = cube_assembly_name + "_inst";
auto_release_ptr<AssemblyInstance> cube_assembly_inst(
AssemblyInstanceFactory::create(
cube_assembly_inst_name.c_str(),
ParamArray(),
cube_assembly_name.c_str()));
cube_assembly_inst->transform_sequence().set_transform(0.0, transform);
// Insert both the cube assembly and its instance into the parent assembly.
assembly.assemblies().insert(cube_assembly);
assembly.assembly_instances().insert(cube_assembly_inst);
}