本文整理汇总了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;
}
示例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);
}
}