Object::Object( Scene & scene, MeshArray const & meshes, MaterialArray const & materials ) : Movable() , m_meshes( meshes ) , m_materials( materials ) , m_scale( 1.0f, 1.0f, 1.0f ) , m_scene( scene ) { assert( meshes.size() == materials.size() && "Meshes and materials sizes don't match" ); }
bool has_emitting_materials(const MaterialArray& materials) { for (size_t i = 0; i < materials.size(); ++i) { if (materials[i] && materials[i]->has_emission()) return true; } return false; }
bool uses_alpha_mapping(const MaterialArray& materials) { for (size_t i = 0, e = materials.size(); i < e; ++i) { if (materials[i]) { if (materials[i]->has_alpha_map()) return true; if (const ShaderGroup* sg = materials[i]->get_uncached_osl_surface()) return sg->has_transparency(); } } return false; }
bool uses_alpha_mapping(const MaterialArray& materials) { for (size_t i = 0; i < materials.size(); ++i) { if (materials[i]) { if (materials[i]->has_alpha_map()) return true; #ifdef APPLESEED_WITH_OSL if (materials[i]->has_osl_surface()) return materials[i]->get_uncached_osl_surface()->has_transparency(); #endif } } return false; }
void LightSampler::store_object_area_in_shadergroups( const AssemblyInstance* assembly_instance, const ObjectInstance* object_instance, const double object_area, const MaterialArray& materials) { for (size_t i = 0, e = materials.size(); i < e; ++i) { if (const Material* m = materials[i]) { if (const ShaderGroup* sg = m->get_uncached_osl_surface()) { if (sg->has_emission()) { sg->set_surface_area( assembly_instance, object_instance, object_area); } } } } }