本文整理汇总了C++中Sensor::isOnSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ Sensor::isOnSurface方法的具体用法?C++ Sensor::isOnSurface怎么用?C++ Sensor::isOnSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sensor
的用法示例。
在下文中一共展示了Sensor::isOnSurface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addChild
void Shape::addChild(const std::string &name, ConfigurableObject *child) {
const Class *cClass = child->getClass();
if (cClass->derivesFrom(MTS_CLASS(BSDF))) {
m_bsdf = static_cast<BSDF *>(child);
} else if (cClass->derivesFrom(MTS_CLASS(Emitter))) {
Emitter *emitter = static_cast<Emitter *>(child);
if (m_emitter != NULL)
Log(EError, "Tried to attach multiple emitters to a shape!");
if (emitter) {
if (!emitter->isOnSurface())
Log(EError, "Tried to attach an incompatible emitter to a surface!");
if (m_exteriorMedium)
emitter->setMedium(m_exteriorMedium);
}
m_emitter = emitter;
} else if (cClass->derivesFrom(MTS_CLASS(Sensor))) {
Sensor *sensor = static_cast<Sensor *>(child);
if (m_sensor != NULL)
Log(EError, "Tried to attach multiple sensors to a shape!");
if (sensor) {
if (!sensor->isOnSurface())
Log(EError, "Tried to attach an incompatible sensor to a surface!");
if (m_exteriorMedium)
sensor->setMedium(m_exteriorMedium);
}
m_sensor = sensor;
} else if (cClass->derivesFrom(MTS_CLASS(Subsurface))) {
Assert(m_subsurface == NULL);
if (m_interiorMedium != NULL)
Log(EError, "Shape \"%s\" has both an interior medium "
"and a subsurface scattering model -- please choose one or the other!", getName().c_str());
m_subsurface = static_cast<Subsurface *>(child);
} else if (cClass->derivesFrom(MTS_CLASS(Medium))) {
if (name == "interior") {
Assert(m_interiorMedium == NULL || m_interiorMedium == child);
if (m_subsurface != NULL)
Log(EError, "Shape \"%s\" has both an interior medium "
"and a subsurface scattering model -- please choose one or the other!", getName().c_str());
m_interiorMedium = static_cast<Medium *>(child);
} else if (name == "exterior") {
Assert(m_exteriorMedium == NULL || m_exteriorMedium == child);
m_exteriorMedium = static_cast<Medium *>(child);
if (m_emitter)
m_emitter->setMedium(m_exteriorMedium);
if (m_sensor)
m_sensor->setMedium(m_exteriorMedium);
} else {
Log(EError, "Shape: Invalid medium child (must be named "
"'interior' or 'exterior')!");
}
} else {
ConfigurableObject::addChild(name, child);
}
}