本文整理汇总了C++中PropertyList::getColor方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyList::getColor方法的具体用法?C++ PropertyList::getColor怎么用?C++ PropertyList::getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyList
的用法示例。
在下文中一共展示了PropertyList::getColor方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Conductor
Conductor(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");
}
}
示例2: 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);
}
示例3: 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
}
示例4: Emitter
NORI_NAMESPACE_BEGIN
areaLight::areaLight (const PropertyList &props) :
Emitter()
{
//set the arguments
m_radiance = props.getColor("radiance", Color3f(10.0f, 10.0f, 10.0f));
m_shootInNormalDirc = props.getBoolean("shootInNormal", false);
}
示例5: 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;
}
示例6: 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");
}
示例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: 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));
}
示例9:
Diffuse(const PropertyList &propList) {
m_albedo = propList.getColor("albedo", Color3f(0.5f));
}