当前位置: 首页>>代码示例>>C++>>正文


C++ Medium::get_ior方法代码示例

本文整理汇总了C++中Medium::get_ior方法的典型用法代码示例。如果您正苦于以下问题:C++ Medium::get_ior方法的具体用法?C++ Medium::get_ior怎么用?C++ Medium::get_ior使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Medium的用法示例。


在下文中一共展示了Medium::get_ior方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例2: water

Medium water(double T, double S)
{
  static const double M_4PI = 4.0*M_PI;

  Medium m;
  Color< complex<double> >& ior = m.get_ior(spectrum);
  ior.resize(no_of_samples);
  ior.wavelength = first_wavelength;
  ior.step_size = wavelength_step_size;

  for(unsigned int i = 0; i < ior.size(); ++i)
  {
    double lambda = ior.wavelength + i*ior.step_size;
    double Psi_T = TS_correction[i][0];
    double Psi_S = TS_correction[i][1];
    double ior_imag = ior_imag_part[i] + lambda*((T - 22)*Psi_T + S*Psi_S)/M_4PI;
    ior[i] = complex<double>(water_ior_real_part(lambda, T, S), ior_imag);
  }

  m.name = "water";
  return m;  
}
开发者ID:,项目名称:,代码行数:22,代码来源:


注:本文中的Medium::get_ior方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。