本文整理汇总了C++中Medium::fill_rgb_data方法的典型用法代码示例。如果您正苦于以下问题:C++ Medium::fill_rgb_data方法的具体用法?C++ Medium::fill_rgb_data怎么用?C++ Medium::fill_rgb_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Medium
的用法示例。
在下文中一共展示了Medium::fill_rgb_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load_media
void Scene::load_media(const string& filename)
{
Medium air;
air.get_ior(mono).resize(1);
air.get_ior(mono)[0] = complex<double>(1.0, 0.0);
air.fill_rgb_data();
air.name = "default";
set_medium(air);
for(unsigned int i = 0; i < planes.size(); ++i)
meshes.push_back(planes[i]->get_mesh());
load_mpml(filename, media, interfaces);
for(unsigned int i = 0; i < meshes.size(); ++i)
for(unsigned int j = 0; j < meshes[i]->materials.size(); ++j)
{
const ObjMaterial& mat = meshes[i]->materials[j];
string name = mat.name;
Interface& iface = interfaces[name];
if(!iface.med_in)
{
iface.name = name;
iface.med_in = &media[name];
iface.med_in->name = name;
Color< complex<double> >& ior = iface.med_in->get_ior(mono);
ior.resize(1);
ior[0] = complex<double>(mat.ior, 0.0);
float emissive = 0.0f;
for(unsigned int k = 0; k < 3; ++k)
emissive += mat.ambient[k];
if(emissive > 0.0)
{
iface.med_in->emissive = true;
Color<double>& emission = iface.med_in->get_emission(rgb);
emission.resize(3);
for(unsigned int k = 0; k < emission.size(); ++k)
emission[k] = mat.ambient[k];
}
}
iface.med_in->fill_rgb_data();
iface.med_in->fill_mono_data();
if(iface.med_out)
{
iface.med_out->fill_rgb_data();
iface.med_out->fill_mono_data();
}
if(mat.has_texture)
{
Texture*& tex = textures[mat.tex_name];
tex = new Texture;
string path_and_name = mat.tex_path + mat.tex_name;
tex->load(path_and_name.c_str());
}
}
for(unsigned int i = 0; i < planes.size(); ++i)
meshes.pop_back();
}