本文整理汇总了C++中PropertyList::getFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyList::getFloat方法的具体用法?C++ PropertyList::getFloat怎么用?C++ PropertyList::getFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyList
的用法示例。
在下文中一共展示了PropertyList::getFloat方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Dielectric
Dielectric(const PropertyList &propList) {
/* Interior IOR (default: BK7 borosilicate optical glass) */
m_intIOR = propList.getFloat("intIOR", 1.5046f);
/* Exterior IOR (default: air) */
m_extIOR = propList.getFloat("extIOR", 1.000277f);
}
示例2:
Depth(const PropertyList &propList) {
/* Depth near and far plane distance */
m_near = propList.getFloat("near", 1e-4);
m_far = propList.getFloat("far", 1e2);
/* Min intensity */
m_Ka = propList.getFloat("ambiant", 0.1);
m_gamma = propList.getFloat("gamma", 5.0);
}
示例3: RoughDielectric
RoughDielectric(const PropertyList &propList) {
/* Interior IOR (default: BK7 borosilicate optical glass) */
m_intIOR = propList.getFloat("intIOR", 1.5046f);
/* Exterior IOR (default: air) */
m_extIOR = propList.getFloat("extIOR", 1.000277f);
/* RMS surface roughness */
m_alpha = propList.getFloat("alpha", 0.1f);
}
示例4: file
HeterogeneousMedium(const PropertyList &propList) {
// Denotes the scattering albedo
m_albedo = propList.getColor("albedo");
// An (optional) transformation that converts between medium and world coordinates
m_worldToMedium = propList.getTransform("toWorld", Transform()).inverse();
// Optional multiplicative factor that will be applied to all density values in the file
m_densityMultiplier = propList.getFloat("densityMultiplier", 1.0f);
m_filename = propList.getString("filename");
QByteArray filename = m_filename.toLocal8Bit();
QFile file(m_filename);
if (!file.exists())
throw NoriException(QString("The file \"%1\" does not exist!").arg(m_filename));
/* Parse the file header */
file.open(QIODevice::ReadOnly);
QDataStream stream(&file);
stream.setByteOrder(QDataStream::LittleEndian);
qint8 header[3], version; qint32 type;
stream >> header[0] >> header[1] >> header[2] >> version >> type;
if (memcmp(header, "VOL", 3) != 0 || version != 3)
throw NoriException("This is not a valid volume data file!");
stream >> m_resolution.x() >> m_resolution.y() >> m_resolution.z();
file.close();
cout << "Mapping \"" << filename.data() << "\" (" << m_resolution.x()
<< "x" << m_resolution.y() << "x" << m_resolution.z() << ") into memory .." << endl;
m_fileSize = (size_t) file.size();
#if defined(PLATFORM_LINUX) || defined(PLATFORM_MACOS)
int fd = open(filename.data(), O_RDONLY);
if (fd == -1)
throw NoriException(QString("Could not open \"%1\"!").arg(m_filename));
m_data = (float *) mmap(NULL, m_fileSize, PROT_READ, MAP_SHARED, fd, 0);
if (m_data == NULL)
throw NoriException("mmap(): failed.");
if (close(fd) != 0)
throw NoriException("close(): unable to close file descriptor!");
#elif defined(PLATFORM_WINDOWS)
m_file = CreateFileA(filename.data(), GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (m_file == INVALID_HANDLE_VALUE)
throw NoriException(QString("Could not open \"%1\"!").arg(m_filename));
m_fileMapping = CreateFileMapping(m_file, NULL, PAGE_READONLY, 0, 0, NULL);
if (m_fileMapping == NULL)
throw NoriException("CreateFileMapping(): failed.");
m_data = (float *) MapViewOfFile(m_fileMapping, FILE_MAP_READ, 0, 0, 0);
if (m_data == NULL)
throw NoriException("MapViewOfFile(): failed.");
#endif
m_data += 12; // Shift past the header
}
示例5: SpotLight
SpotLight(const PropertyList &props) :
Emitter()
{
//set the arguments
m_position = props.getPoint("position");
m_intensity = props.getColor("Intensity");
bool useLookAt = props.getBoolean("useLookAt", true);
if(useLookAt){
Vector3f lookPT = props.getPoint("lookAt", Point3f(0.0f, 0.0f, 0.0f));
m_direction = (lookPT - m_position).normalized();
} else {
m_direction = props.getVector("direction");
}
m_theta = props.getFloat("theta");
m_cosFalloffStart = props.getFloat("falloff");
}
示例6: Phong
Phong(const PropertyList &propList) {
m_Kd = propList.getColor("kd", Color3f(0.5f));
m_Ks = propList.getColor("ks", Color3f(0.5f));
m_exp = propList.getFloat("n", 20.0f);
// computation of the sampling weights
float wd = m_Kd.getLuminance();
float ws = m_Ks.getLuminance();
m_specSamplingWeight = ws / (ws + wd);
m_diffSamplingWeight = 1.0f - m_specSamplingWeight;
}
示例7: MicrofacetBRDF
MicrofacetBRDF(const PropertyList &propList) {
/* RMS surface roughness */
m_alpha = propList.getFloat("alpha", 0.1f);
/* Interior IOR (default: BK7 borosilicate optical glass) */
m_intIOR = propList.getFloat("intIOR", 1.5046f);
/* Exterior IOR (default: air) */
m_extIOR = propList.getFloat("extIOR", 1.000277f);
/* Albedo of the diffuse base material (a.k.a "kd") */
m_kd = propList.getColor("kd", Color3f(0.5f));
/* To ensure energy conservation, we must scale the
specular component by 1-kd.
While that is not a particularly realistic model of what
happens in reality, this will greatly simplify the
implementation. Please see the course staff if you're
interested in implementing a more realistic version
of this BRDF. */
m_ks = 1.0f - m_kd.maxCoeff();
}
示例8: RoughConductor
RoughConductor(const PropertyList &propList) {
materialName = propList.getString("materialName", "");
if(materialName != "") {
// load the specific material properties
if(!getMaterialProperties(materialName, m_eta, m_k)){
std::cout << "Material " << materialName << " not found!" << std::endl;
}
} else {
m_eta = propList.getColor("eta");
m_k = propList.getColor("k");
}
/* RMS surface roughness */
m_alpha = propList.getFloat("alpha", 0.1f);
}
示例9: StudentsTTest
StudentsTTest(const PropertyList &propList) {
/* The null hypothesis will be rejected when the associated
p-value is below the significance level specified here. */
m_significanceLevel = propList.getFloat("significanceLevel", 0.01f);
/* This parameter specifies a list of incidence angles that will be tested */
std::vector<std::string> angles = tokenize(propList.getString("angles", ""));
for (auto angle : angles)
m_angles.push_back(toFloat(angle));
/* This parameter specifies a list of reference values, one for each angle */
std::vector<std::string> references = tokenize(propList.getString("references", ""));
for (auto angle : references)
m_references.push_back(toFloat(angle));
/* Number of BSDF samples that should be generated (default: 100K) */
m_sampleCount = propList.getInteger("sampleCount", 100000);
}
示例10: executeService
void executeService(
string requesting_service,
int type,
CioSerial* in,
CioSerial* out )
{
//clog << "creating cioSerial object...";
CioSerial input;
CioSerial output;
//clog << "creating plist object...";
PropertyList plist_in;
plist_in.add("requesting_service", "sot");
plist_in.add("system", "dc");
//clog << "setting plist to CioSerial object...";
string plist_in_str = plist_in.getPackedString();
input.setData(plist_in_str, MimeType::STRING);
//clog << "setting mimetype...";
input.setMimeType("text/property-list");
//clog << "setting description...";
input.setDescription("none");
{
/// testing plist_in
PropertyList plist_test;
plist_test.initFromPackedString(plist_in_str);
clog << "\ntesting plist: " << plist_test.getString("system") << endl;
}
//clog << "requesting geometry from Geometry Service...";
this->requestService("CLAS12 Geometry Service", 0, &input, &output);
PropertyList plist_out;
if (output.getMimeType() == "text/property-list")
{
plist_out.initFromPackedString(output.getData());
}
plist_str = plist_out.getPackedString();
{
PropertyList p = plist_out.childPropertyList("gemc.dc");
clog << endl;
clog << "variables for gemc.dc\n\n";
clog << "region1.delx1: " << p.getFloat("region1.delx1") << endl;
clog << "region2.delx1: " << p.getFloat("region2.delx1") << endl;
clog << "region3.delx1: " << p.getFloat("region3.delx1") << endl;
clog << endl;
clog << "region1.dely: " << p.getFloat("region1.dely") << endl;
clog << "region2.dely: " << p.getFloat("region2.dely") << endl;
clog << "region3.dely: " << p.getFloat("region3.dely") << endl;
clog << endl;
clog << "region1.center_m.x: " << p.getFloat("region1.center_m.x") << endl;
clog << "region1.center_m.y: " << p.getFloat("region1.center_m.y") << endl;
clog << "region1.center_m.z: " << p.getFloat("region1.center_m.z") << endl;
clog << endl;
clog << "region2.center_m.x: " << p.getFloat("region2.center_m.x") << endl;
clog << "region2.center_m.y: " << p.getFloat("region2.center_m.y") << endl;
clog << "region2.center_m.z: " << p.getFloat("region2.center_m.z") << endl;
clog << endl;
clog << "region3.center_m.x: " << p.getFloat("region3.center_m.x") << endl;
clog << "region3.center_m.y: " << p.getFloat("region3.center_m.y") << endl;
clog << "region3.center_m.z: " << p.getFloat("region3.center_m.z") << endl;
clog << endl;
p = plist_out.childPropertyList("sot.dc");
clog << "wireplanedist.region0.superlayer1: " << p.getFloat("wireplanedist.region0.superlayer1") << endl;
clog << "wireplanedist.region1.superlayer1: " << p.getFloat("wireplanedist.region1.superlayer1") << endl;
clog << "wireplanedist.region2.superlayer1: " << p.getFloat("wireplanedist.region2.superlayer1") << endl;
clog << endl;
}
}
示例11: Phong
Phong(const PropertyList &propList) {
m_Kd = propList.getColor("kd", Color3f(0.5f));
m_Ks = propList.getColor("ks", Color3f(0.5f));
m_exp = propList.getFloat("n", 20.0f);
srand(time(NULL));
}
示例12: PhotonMapper
PhotonMapper(const PropertyList &props) {
/* Lookup parameters */
m_photonCount = props.getInteger("photonCount", 1000000);
m_photonRadius = props.getFloat("photonRadius", 0.0f /* Default: automatic */);
m_shootedRays = 0;
}