本文整理汇总了C++中ParamSet::FindOneSpectrum方法的典型用法代码示例。如果您正苦于以下问题:C++ ParamSet::FindOneSpectrum方法的具体用法?C++ ParamSet::FindOneSpectrum怎么用?C++ ParamSet::FindOneSpectrum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParamSet
的用法示例。
在下文中一共展示了ParamSet::FindOneSpectrum方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateGoniometricLight
std::shared_ptr<GonioPhotometricLight> CreateGoniometricLight(
const Transform &light2world, const Medium *medium,
const ParamSet ¶mSet) {
Spectrum I = paramSet.FindOneSpectrum("I", Spectrum(1.0));
Spectrum sc = paramSet.FindOneSpectrum("scale", Spectrum(1.0));
std::string texname = paramSet.FindOneFilename("mapname", "");
return std::make_shared<GonioPhotometricLight>(light2world, medium, I * sc,
texname);
}
示例2: CreatePointLight
std::shared_ptr<PointLight> CreatePointLight(const Transform &light2world,
const Medium *medium,
const ParamSet ¶mSet) {
Spectrum I = paramSet.FindOneSpectrum("I", Spectrum(1.0));
Spectrum sc = paramSet.FindOneSpectrum("scale", Spectrum(1.0));
Point3f P = paramSet.FindOnePoint3f("from", Point3f(0, 0, 0));
Transform l2w = Translate(Vector3f(P.x, P.y, P.z)) * light2world;
return std::make_shared<PointLight>(l2w, medium, I * sc);
}
示例3: CreateDistantLight
std::shared_ptr<DistantLight> CreateDistantLight(const Transform &light2world,
const ParamSet ¶mSet) {
Spectrum L = paramSet.FindOneSpectrum("L", Spectrum(1.0));
Spectrum sc = paramSet.FindOneSpectrum("scale", Spectrum(1.0));
Point3f from = paramSet.FindOnePoint3f("from", Point3f(0, 0, 0));
Point3f to = paramSet.FindOnePoint3f("to", Point3f(0, 0, 1));
Vector3f dir = from - to;
return std::make_shared<DistantLight>(light2world, L * sc, dir);
}
示例4: CreateProjectionLight
std::shared_ptr<ProjectionLight> CreateProjectionLight(
const Transform &light2world, const Medium *medium,
const ParamSet ¶mSet) {
Spectrum I = paramSet.FindOneSpectrum("I", Spectrum(1.0));
Spectrum sc = paramSet.FindOneSpectrum("scale", Spectrum(1.0));
Float fov = paramSet.FindOneFloat("fov", 45.);
std::string texname = paramSet.FindOneFilename("mapname", "");
return std::make_shared<ProjectionLight>(light2world, medium, I * sc,
texname, fov);
}
示例5: CreateDiffuseAreaLight
std::shared_ptr<AreaLight> CreateDiffuseAreaLight(
const Transform &light2world, const Medium *medium,
const ParamSet ¶mSet, const std::shared_ptr<Shape> &shape) {
Spectrum L = paramSet.FindOneSpectrum("L", Spectrum(1.0));
Spectrum sc = paramSet.FindOneSpectrum("scale", Spectrum(1.0));
int nSamples = paramSet.FindOneInt("nsamples", 1);
if (PbrtOptions.quickRender) nSamples = std::max(1, nSamples / 4);
return std::make_shared<DiffuseAreaLight>(light2world, medium, L * sc,
nSamples, shape);
}
示例6: CreateInfiniteLight
std::shared_ptr<InfiniteAreaLight> CreateInfiniteLight(
const Transform &light2world, const ParamSet ¶mSet) {
Spectrum L = paramSet.FindOneSpectrum("L", Spectrum(1.0));
Spectrum sc = paramSet.FindOneSpectrum("scale", Spectrum(1.0));
std::string texmap = paramSet.FindOneFilename("mapname", "");
int nSamples = paramSet.FindOneInt("nsamples", 1);
if (PbrtOptions.quickRender) nSamples = std::max(1, nSamples / 4);
return std::make_shared<InfiniteAreaLight>(light2world, L * sc, nSamples,
texmap);
}
示例7: CreateSpotLight
std::shared_ptr<SpotLight> CreateSpotLight(const Transform &l2w,
const Medium *medium,
const ParamSet ¶mSet) {
Spectrum I = paramSet.FindOneSpectrum("I", Spectrum(1.0));
Spectrum sc = paramSet.FindOneSpectrum("scale", Spectrum(1.0));
Float coneangle = paramSet.FindOneFloat("coneangle", 30.);
Float conedelta = paramSet.FindOneFloat("conedeltaangle", 5.);
// Compute spotlight world to light transformation
Point3f from = paramSet.FindOnePoint3f("from", Point3f(0, 0, 0));
Point3f to = paramSet.FindOnePoint3f("to", Point3f(0, 0, 1));
Vector3f dir = Normalize(to - from);
Vector3f du, dv;
CoordinateSystem(dir, &du, &dv);
Transform dirToZ =
Transform(Matrix4x4(du.x, du.y, du.z, 0., dv.x, dv.y, dv.z, 0., dir.x,
dir.y, dir.z, 0., 0, 0, 0, 1.));
Transform light2world =
l2w * Translate(Vector3f(from.x, from.y, from.z)) * Inverse(dirToZ);
return std::make_shared<SpotLight>(light2world, medium, I * sc, coneangle,
coneangle - conedelta);
}
示例8: MakeMedium
std::shared_ptr<Medium> MakeMedium(const std::string &name,
const ParamSet ¶mSet,
const Transform &medium2world) {
Float sig_a_rgb[3] = {.0011f, .0024f, .014f},
sig_s_rgb[3] = {2.55f, 3.21f, 3.77f};
Spectrum sig_a = Spectrum::FromRGB(sig_a_rgb),
sig_s = Spectrum::FromRGB(sig_s_rgb);
std::string preset = paramSet.FindOneString("preset", "");
bool found = GetMediumScatteringProperties(preset, &sig_a, &sig_s);
if (preset != "" && !found)
Warning("Material preset \"%s\" not found. Using defaults.",
preset.c_str());
Float scale = paramSet.FindOneFloat("scale", 1.f);
Float g = paramSet.FindOneFloat("g", 0.0f);
sig_a = paramSet.FindOneSpectrum("sigma_a", sig_a) * scale;
sig_s = paramSet.FindOneSpectrum("sigma_s", sig_s) * scale;
Medium *m = NULL;
if (name == "homogeneous") {
m = new HomogeneousMedium(sig_a, sig_s, g);
} else if (name == "heterogeneous") {
int nitems;
const Float *data = paramSet.FindFloat("density", &nitems);
if (!data) {
Error("No \"density\" values provided for heterogeneous medium?");
return NULL;
}
int nx = paramSet.FindOneInt("nx", 1);
int ny = paramSet.FindOneInt("ny", 1);
int nz = paramSet.FindOneInt("nz", 1);
Point3f p0 = paramSet.FindOnePoint3f("p0", Point3f(0.f, 0.f, 0.f));
Point3f p1 = paramSet.FindOnePoint3f("p1", Point3f(1.f, 1.f, 1.f));
if (nitems != nx * ny * nz) {
Error(
"GridDensityMedium has %d density values; expected nx*ny*nz = "
"%d",
nitems, nx * ny * nz);
return NULL;
}
Transform data2Medium = Translate(Vector3f(p0)) *
Scale(p1.x - p0.x, p1.y - p0.y, p1.z - p0.z);
m = new GridDensityMedium(sig_a, sig_s, g, nx, ny, nz,
medium2world * data2Medium, data);
} else
Warning("Medium \"%s\" unknown.", name.c_str());
paramSet.ReportUnused();
return std::shared_ptr<Medium>(m);
}