本文整理汇总了C++中ParamSet::FindOneFilename方法的典型用法代码示例。如果您正苦于以下问题:C++ ParamSet::FindOneFilename方法的具体用法?C++ ParamSet::FindOneFilename怎么用?C++ ParamSet::FindOneFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParamSet
的用法示例。
在下文中一共展示了ParamSet::FindOneFilename方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: 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);
}
示例4: if
std::vector<std::shared_ptr<Shape>> CreatePLYMesh(
const Transform *o2w, const Transform *w2o, bool reverseOrientation,
const ParamSet ¶ms,
std::map<std::string, std::shared_ptr<Texture<Float>>> *floatTextures) {
const std::string filename = params.FindOneFilename("filename", "");
p_ply ply = ply_open(filename.c_str(), rply_message_callback, 0, nullptr);
if (!ply) {
Error("Couldn't open PLY file \"%s\"", filename.c_str());
return std::vector<std::shared_ptr<Shape>>();
}
if (!ply_read_header(ply)) {
Error("Unable to read the header of PLY file \"%s\"", filename.c_str());
return std::vector<std::shared_ptr<Shape>>();
}
p_ply_element element = nullptr;
long vertexCount = 0, faceCount = 0;
/* Inspect the structure of the PLY file */
while ((element = ply_get_next_element(ply, element)) != nullptr) {
const char *name;
long nInstances;
ply_get_element_info(element, &name, &nInstances);
if (!strcmp(name, "vertex"))
vertexCount = nInstances;
else if (!strcmp(name, "face"))
faceCount = nInstances;
}
if (vertexCount == 0 || faceCount == 0) {
Error("PLY file \"%s\" is invalid! No face/vertex elements found!",
filename.c_str());
return std::vector<std::shared_ptr<Shape>>();
}
CallbackContext context;
if (ply_set_read_cb(ply, "vertex", "x", rply_vertex_callback, &context,
0x030) &&
ply_set_read_cb(ply, "vertex", "y", rply_vertex_callback, &context,
0x031) &&
ply_set_read_cb(ply, "vertex", "z", rply_vertex_callback, &context,
0x032)) {
context.p = new Point3f[vertexCount];
} else {
Error("PLY file \"%s\": Vertex coordinate property not found!",
filename.c_str());
return std::vector<std::shared_ptr<Shape>>();
}
if (ply_set_read_cb(ply, "vertex", "nx", rply_vertex_callback, &context,
0x130) &&
ply_set_read_cb(ply, "vertex", "ny", rply_vertex_callback, &context,
0x131) &&
ply_set_read_cb(ply, "vertex", "nz", rply_vertex_callback, &context,
0x132))
context.n = new Normal3f[vertexCount];
/* There seem to be lots of different conventions regarding UV coordinate
* names */
if ((ply_set_read_cb(ply, "vertex", "u", rply_vertex_callback, &context,
0x220) &&
ply_set_read_cb(ply, "vertex", "v", rply_vertex_callback, &context,
0x221)) ||
(ply_set_read_cb(ply, "vertex", "s", rply_vertex_callback, &context,
0x220) &&
ply_set_read_cb(ply, "vertex", "t", rply_vertex_callback, &context,
0x221)) ||
(ply_set_read_cb(ply, "vertex", "texture_u", rply_vertex_callback,
&context, 0x220) &&
ply_set_read_cb(ply, "vertex", "texture_v", rply_vertex_callback,
&context, 0x221)) ||
(ply_set_read_cb(ply, "vertex", "texture_s", rply_vertex_callback,
&context, 0x220) &&
ply_set_read_cb(ply, "vertex", "texture_t", rply_vertex_callback,
&context, 0x221)))
context.uv = new Point2f[vertexCount];
/* Allocate enough space in case all faces are quads */
context.indices = new int[faceCount * 6];
context.vertexCount = vertexCount;
ply_set_read_cb(ply, "face", "vertex_indices", rply_face_callback, &context,
0);
if (!ply_read(ply)) {
Error("Unable to read the contents of PLY file \"%s\"",
filename.c_str());
ply_close(ply);
return std::vector<std::shared_ptr<Shape>>();
}
ply_close(ply);
if (context.error) return std::vector<std::shared_ptr<Shape>>();
// Look up an alpha texture, if applicable
std::shared_ptr<Texture<Float>> alphaTex;
//.........这里部分代码省略.........
示例5: if
std::vector<std::shared_ptr<Shape>> CreatePLYMesh(
const Transform *o2w, const Transform *w2o, bool reverseOrientation,
const ParamSet ¶ms,
std::map<std::string, std::shared_ptr<Texture<Float>>> *floatTextures) {
const std::string filename = params.FindOneFilename("filename", "");
p_ply ply = ply_open(filename.c_str(), rply_message_callback, 0, nullptr);
if (!ply) {
Error("Couldn't open PLY file \"%s\"", filename.c_str());
return std::vector<std::shared_ptr<Shape>>();
}
if (!ply_read_header(ply)) {
Error("Unable to read the header of PLY file \"%s\"", filename.c_str());
return std::vector<std::shared_ptr<Shape>>();
}
p_ply_element element = nullptr;
long vertexCount = 0, faceCount = 0;
/* Inspect the structure of the PLY file */
while ((element = ply_get_next_element(ply, element)) != nullptr) {
const char *name;
long nInstances;
ply_get_element_info(element, &name, &nInstances);
if (!strcmp(name, "vertex"))
vertexCount = nInstances;
else if (!strcmp(name, "face"))
faceCount = nInstances;
}
if (vertexCount == 0 || faceCount == 0) {
Error("PLY file \"%s\" is invalid! No face/vertex elements found!",
filename.c_str());
return std::vector<std::shared_ptr<Shape>>();
}
CallbackContext context;
if (ply_set_read_cb(ply, "vertex", "x", rply_vertex_callback, &context,
0x030) &&
ply_set_read_cb(ply, "vertex", "y", rply_vertex_callback, &context,
0x031) &&
ply_set_read_cb(ply, "vertex", "z", rply_vertex_callback, &context,
0x032)) {
context.p = new Point3f[vertexCount];
} else {
Error("PLY file \"%s\": Vertex coordinate property not found!",
filename.c_str());
return std::vector<std::shared_ptr<Shape>>();
}
if (ply_set_read_cb(ply, "vertex", "nx", rply_vertex_callback, &context,
0x130) &&
ply_set_read_cb(ply, "vertex", "ny", rply_vertex_callback, &context,
0x131) &&
ply_set_read_cb(ply, "vertex", "nz", rply_vertex_callback, &context,
0x132))
context.n = new Normal3f[vertexCount];
/* There seem to be lots of different conventions regarding UV coordinate
* names */
if ((ply_set_read_cb(ply, "vertex", "u", rply_vertex_callback, &context,
0x220) &&
ply_set_read_cb(ply, "vertex", "v", rply_vertex_callback, &context,
0x221)) ||
(ply_set_read_cb(ply, "vertex", "s", rply_vertex_callback, &context,
0x220) &&
ply_set_read_cb(ply, "vertex", "t", rply_vertex_callback, &context,
0x221)) ||
(ply_set_read_cb(ply, "vertex", "texture_u", rply_vertex_callback,
&context, 0x220) &&
ply_set_read_cb(ply, "vertex", "texture_v", rply_vertex_callback,
&context, 0x221)) ||
(ply_set_read_cb(ply, "vertex", "texture_s", rply_vertex_callback,
&context, 0x220) &&
ply_set_read_cb(ply, "vertex", "texture_t", rply_vertex_callback,
&context, 0x221)))
context.uv = new Point2f[vertexCount];
/* Allocate enough space in case all faces are quads */
context.indices = new int[faceCount * 6];
context.vertexCount = vertexCount;
ply_set_read_cb(ply, "face", "vertex_indices", rply_face_callback, &context,
0);
if (!ply_read(ply)) {
Error("Unable to read the contents of PLY file \"%s\"",
filename.c_str());
ply_close(ply);
return std::vector<std::shared_ptr<Shape>>();
}
ply_close(ply);
if (context.error) return std::vector<std::shared_ptr<Shape>>();
// Look up an alpha texture, if applicable
std::shared_ptr<Texture<Float>> alphaTex;
//.........这里部分代码省略.........