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


C++ BSDF::init方法代码示例

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


在下文中一共展示了BSDF::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DiffuseBSDF

BSDF *Material::getBSDF(SurfacePoint &pt) {
   BSDF *bsdf = NULL;
   
   if (m_bsdf == "diffuse") {
      bsdf = new DiffuseBSDF(pt, this);
   } else if (m_bsdf == "dielectric") {
      bsdf = new DielectricBSDF(pt, this);
   } else if (m_bsdf == "modifiedPhong" || m_bsdf == "phong") {
      bsdf = new ModifiedPhongBSDF(pt, this);
   } else if (m_bsdf == "absorbent") {
      bsdf = new AbsorbentBSDF(pt, this);
   } else if (m_bsdf == "specular") {
      (*this)["transparency"] = 0.0;
      bsdf = new DielectricBSDF(pt, this);
   } else if (m_bsdf == "transmissive") {
      (*this)["transparency"] = 1.0;
      bsdf = new DielectricBSDF(pt, this);
   } else {
      cerr << "invalid material (BSDF type): " << m_bsdf << endl;
      ASSERT(0 && "Found Invalid Material (BSDF type)");
      return NULL;
   }
   
   bsdf->init();
   return bsdf;
}
开发者ID:fisch0920,项目名称:Milton,代码行数:26,代码来源:Material.cpp

示例2: BDPTPathVertex

    BDPTPathVertex(const Scene& scene,
                   const PowerBasedLightSampler& sampler,
                   float lightSample,
                   const Vec2f& positionSample,
                   const Vec2f& directionSample,
                   const Light*& pLight,
                   float& lightPdf,
                   uint32_t pathCount,
                   MisFunctor&& mis) {
        pLight = sampler.sample(scene, lightSample, lightPdf);

        if(!pLight) {
            lightPdf = 0.f;
            m_Power = zero<Vec3f>();
            m_fPathPdf = 0.f;
            m_nDepth = 0u;
            return;
        }

        RaySample raySample;
        float rayOriginPdf, intersectionPdfWrtArea,
              rayOriginToIncidentDirJacobian;
        auto Le = pLight->sampleExitantRay(scene, positionSample,
                                           directionSample, raySample, rayOriginPdf, m_Intersection,
                                           rayOriginToIncidentDirJacobian,
                                           intersectionPdfWrtArea);

        if(Le == zero<Vec3f>() || raySample.pdf == 0.f) {
            m_Power = Le;
            m_fPathPdf = 0.f;
            m_nDepth = 0u;
            return;
        }

        raySample.pdf *= lightPdf;
        Le /= raySample.pdf;

        m_Power = Le;
        m_nDepth = 1u;

        if(!m_Intersection) {
            m_fPathPdf = 0.f;
            m_fPdfWrtArea = 0.f;
            m_fdVC = 0.f;
            m_fdVCM = 0.f;
        } else {
            m_BSDF.init(-raySample.value.dir, m_Intersection, scene);
            m_fPathPdf = rayOriginPdf * intersectionPdfWrtArea;
            m_fPdfWrtArea = intersectionPdfWrtArea;
            m_fdVCM = mis(pathCount / m_fPdfWrtArea);
            m_fdVC = mis(pathCount * rayOriginToIncidentDirJacobian / m_fPathPdf);
        }
    }
开发者ID:Celeborn2BeAlive,项目名称:pg2015-code,代码行数:53,代码来源:recursive_mis_bdpt.hpp


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