本文整理汇总了C++中PropertyList::getTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyList::getTransform方法的具体用法?C++ PropertyList::getTransform怎么用?C++ PropertyList::getTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyList
的用法示例。
在下文中一共展示了PropertyList::getTransform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnvMap
EnvMap(const PropertyList &props) :
Emitter(props.getTransform("toWorld", Transform()))
{
//set the arguments
std::string filePath = props.getString("lightProbPath", "");
filesystem::path path = getFileResolver()->resolve(filePath);
//try to set it
try {
if (path.extension() == "exr") {
m_lightprobe = new Bitmap(path.str());
m_wrapper = new HSWrapper(*m_lightprobe);
m_latlngMap = new LatLongMap();
m_BBox.min = Point2i(0, 0);
m_BBox.max = Point2i(m_lightprobe->cols(), m_lightprobe->rows());
m_width = m_lightprobe->cols();
m_height = m_lightprobe->rows();
} else {
cerr << "Fatal error: unknown file \"" << filePath
<< "\", expected an extension of type .exr" << endl;
}
} catch (const std::exception &e) {
cerr << "Fatal error: " << e.what() << endl;
}
}
示例2: input
WavefrontOBJ(const PropertyList &propList) {
typedef boost::unordered_map<OBJVertex, uint32_t, OBJVertexHash> VertexMap;
/* Process the OBJ-file line by line */
QString filename = propList.getString("filename");
QFile input(filename);
if (!input.open(QIODevice::ReadOnly | QIODevice::Text))
throw NoriException(QString("Cannot open \"%1\"").arg(filename));
Transform trafo = propList.getTransform("toWorld", Transform());
cout << "Loading \"" << qPrintable(filename) << "\" .." << endl;
m_name = filename;
QTextStream stream(&input);
QTextStream line;
QString temp, prefix;
std::vector<Point3f> positions;
std::vector<Point2f> texcoords;
std::vector<Normal3f> normals;
std::vector<uint32_t> indices;
std::vector<OBJVertex> vertices;
VertexMap vertexMap;
while (!(temp = stream.readLine()).isNull()) {
line.setString(&temp);
line >> prefix;
if (prefix == "v") {
Point3f p;
line >> p.x() >> p.y() >> p.z();
p = trafo * p;
positions.push_back(p);
} else if (prefix == "vt") {
示例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
}