本文整理汇总了C++中Reference::Evaluate方法的典型用法代码示例。如果您正苦于以下问题:C++ Reference::Evaluate方法的具体用法?C++ Reference::Evaluate怎么用?C++ Reference::Evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reference
的用法示例。
在下文中一共展示了Reference::Evaluate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
BSDF *custom_material_phong::GetBSDF(const DifferentialGeometry &dgGeom,
const DifferentialGeometry &dgShading) const {
//not sure about this yet
DifferentialGeometry dgs=dgShading;
//or this:
//allocate memory for BSDF, poiting bsdf to a new BSDF
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
//allocate to diff a custom BxDF with reflection spectrum kd
Spectrum kd = Kd->Evaluate(dgs).Clamp();
BxDF *diff = BSDF_ALLOC(custom_BxDF_phongDiffuse)(kd);
//my specular reflectance
Spectrum ks = Ks->Evaluate(dgs).Clamp();
BxDF *spec = BSDF_ALLOC(custom_BxDF_phongSpecular)(ks,float(n));
//add both diff and spec BSDFS to the BSDF of this material
//***sets the BSDF of this material
bsdf->Add(diff);
bsdf->Add(spec);
return bsdf;
}
示例2:
// custom_material Method Definitions
BSDF *custom_material::GetBSDF(const DifferentialGeometry &dgGeom,
const DifferentialGeometry &dgShading) const {
//issue debugging warning
//Warning("custom_material\n");
//declare geometry that will be used in BRDF
DifferentialGeometry dgs;
//if there is to be a bump map, call Bump, which modifies dgs
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
//allocate memory for BSDF, poiting bsdf to a new BSDF
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
//set a spectrum kd to the spectrum stored in texure Kd
//***gets color spectrum of diffuse reflection***
Spectrum kd = Kd->Evaluate(dgs).Clamp();
//allocate to diff a custom BxDF with reflection spectrum kd
//***diffuse reflection characteristics***
BxDF *diff = BSDF_ALLOC(custom_BxDF3)(kd);
/* commented dpl 10 august 2005
// specular reflectance from pbrt's plastic model
//allocate to (temp) fresnes a fresneldielectric bsdf with
//parameters (1.5, 1)
//***will set part of specular reflection properties***
Fresnel *fresnel =
BSDF_ALLOC(FresnelDielectric)(1.5f, 1.f);
//set a spectrum ks to the spectrum stored in the texture Ks
//***gets color spectrum of specular reflection***
Spectrum ks = Ks->Evaluate(dgs).Clamp();
//get the roughness from roughness (?)
float rough = roughness->Evaluate(dgs);
//allocate memory for specular reflection BSDF
//***sets specular BSDF according to microfacet model
//with color params ks, fresnel and blinn models (?) ***
BxDF *spec = BSDF_ALLOC(Microfacet)(ks, fresnel,
BSDF_ALLOC(Blinn)(1.f / rough));
*/
//my specular reflectance
Spectrum ks = Ks->Evaluate(dgs).Clamp();
BxDF *spec = BSDF_ALLOC(custom_BxDF2)(ks);
//add both diff and spec BSDFS to the BSDF of this material
//***sets the BSDF of this material
bsdf->Add(diff);
bsdf->Add(spec);
return bsdf;
}
示例3:
// Substrate Method Definitions
BSDF *Substrate::GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading) const {
// Allocate _BSDF_, possibly doing bump-mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
Spectrum d = Kd->Evaluate(dgs).Clamp();
Spectrum s = Ks->Evaluate(dgs).Clamp();
float u = nu->Evaluate(dgs);
float v = nv->Evaluate(dgs);
bsdf->Add(BSDF_ALLOC(FresnelBlend)(d, s, BSDF_ALLOC(Anisotropic)(1.f/u, 1.f/v)));
return bsdf;
}
示例4: Clamp
// Matte Method Definitions
BSDF *danMatte::GetBSDF(const DifferentialGeometry &dgGeom,
const DifferentialGeometry &dgShading) const {
// Allocate _BSDF_, possibly doing bump-mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
// Evaluate textures for _Matte_ material and allocate BRDF
Spectrum r = Kd->Evaluate(dgs).Clamp();
float sig = Clamp(sigma->Evaluate(dgs), 0.f, 90.f);
if (sig == 0.)
bsdf->Add(BSDF_ALLOC(Lambertian)(r));
else
bsdf->Add(BSDF_ALLOC(OrenNayar)(r, sig));
return bsdf;
return bsdf;
}
示例5: Bump
void Material::Bump(Reference<Texture<float> > d,
const DifferentialGeometry &dgGeom,
const DifferentialGeometry &dgs,
DifferentialGeometry *dgBump) {
// Compute offset positions and evaluate displacement texture
DifferentialGeometry dgEval = dgs;
// Shift _dgEval_ _du_ in the $u$ direction
float du = .5f * (fabsf(dgs.dudx) + fabsf(dgs.dudy));
if (du == 0.f) du = .01f;
dgEval.p = dgs.p + du * dgs.dpdu;
dgEval.u = dgs.u + du;
dgEval.nn =
Normalize((Normal)Cross(dgs.dpdu, dgs.dpdv) +
du * dgs.dndu);
float uDisplace = d->Evaluate(dgEval);
// Shift _dgEval_ _dv_ in the $v$ direction
float dv = .5f * (fabsf(dgs.dvdx) + fabsf(dgs.dvdy));
if (dv == 0.f) dv = .01f;
dgEval.p = dgs.p + dv * dgs.dpdv;
dgEval.u = dgs.u;
dgEval.v = dgs.v + dv;
dgEval.nn =
Normalize((Normal)Cross(dgs.dpdu, dgs.dpdv) +
dv * dgs.dndv);
float vDisplace = d->Evaluate(dgEval);
float displace = d->Evaluate(dgs);
// Compute bump-mapped differential geometry
*dgBump = dgs;
dgBump->dpdu = dgs.dpdu +
(uDisplace - displace) / du * Vector(dgs.nn) +
displace * Vector(dgs.dndu);
dgBump->dpdv = dgs.dpdv +
(vDisplace - displace) / dv * Vector(dgs.nn) +
displace * Vector(dgs.dndv);
dgBump->nn =
Normal(Normalize(Cross(dgBump->dpdu, dgBump->dpdv)));
if (dgs.shape->reverseOrientation ^
dgs.shape->transformSwapsHandedness)
dgBump->nn *= -1.f;
// Orient shading normal to match geometric normal
if (Dot(dgGeom.nn, dgBump->nn) < 0.f)
dgBump->nn *= -1.f;
}
示例6:
// Plastic Method Definitions
BSDF *plastic_dan::GetBSDF(const DifferentialGeometry &dgGeom,
const DifferentialGeometry &dgShading) const {
// Allocate _BSDF_, possibly doing bump-mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
Spectrum kd = Kd->Evaluate(dgs).Clamp();
BxDF *diff = BSDF_ALLOC(Lambertian)(kd);
Fresnel *fresnel =
BSDF_ALLOC(FresnelDielectric)(1.5f, 1.f);
Spectrum ks = Ks->Evaluate(dgs).Clamp();
float rough = roughness->Evaluate(dgs);
BxDF *spec = BSDF_ALLOC(Microfacet)(ks, fresnel,
BSDF_ALLOC(Blinn)(1.f / rough));
bsdf->Add(diff);
bsdf->Add(spec);
return bsdf;
}
示例7:
// Mirror Method Definitions
BSDF *Mirror::GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading) const {
// Allocate _BSDF_, possibly doing bump-mapping with _bumpMap_
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
Spectrum R = Kr->Evaluate(dgs).Clamp();
if (!R.Black())
bsdf->Add(BSDF_ALLOC(SpecularReflection)(R,
BSDF_ALLOC(FresnelNoOp)()));
return bsdf;
}
示例8:
BSDF *custom_material_matte::GetBSDF(const DifferentialGeometry &dgGeom,
const DifferentialGeometry &dgShading) const {
//not sure about this yet
DifferentialGeometry dgs=dgShading;
//or this:
//allocate memory for BSDF, poiting bsdf to a new BSDF
BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn);
//allocate to diff a custom BxDF with reflection spectrum kd
Spectrum kd = Kd->Evaluate(dgs).Clamp();
BxDF *diff = BSDF_ALLOC(custom_BxDF_Lambertian)(kd);
//add both diff and spec BSDFS to the BSDF of this material
bsdf->Add(diff);
return bsdf;
}