本文整理汇总了C++中AxisAlignedBoundingBox::llf方法的典型用法代码示例。如果您正苦于以下问题:C++ AxisAlignedBoundingBox::llf方法的具体用法?C++ AxisAlignedBoundingBox::llf怎么用?C++ AxisAlignedBoundingBox::llf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AxisAlignedBoundingBox
的用法示例。
在下文中一共展示了AxisAlignedBoundingBox::llf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: boundaryVisible
bool NavigationMath::boundaryVisible(
const QMatrix4x4 & mvp
, const AxisAlignedBoundingBox & b)
{
const QVector3D box[8] =
{
// front
QVector3D(b.llf().x(), b.llf().y(), b.urb().z())
, QVector3D(b.urb().x(), b.llf().y(), b.urb().z())
, QVector3D(b.urb().x(), b.urb().y(), b.urb().z())
, QVector3D(b.llf().x(), b.urb().y(), b.urb().z())
// back
, QVector3D(b.llf().x(), b.llf().y(), b.llf().z())
, QVector3D(b.urb().x(), b.llf().y(), b.llf().z())
, QVector3D(b.urb().x(), b.urb().y(), b.llf().z())
, QVector3D(b.llf().x(), b.urb().y(), b.llf().z())
};
// transform bounds and check if any point is outside NDC (Normalized Device
// Coordinates) space
for(int i = 0; i < 8; ++i)
{
const QVector3D t = mvp * box[i];
if(qAbs<float>(t.x()) > 1.0 || qAbs<float>(t.y()) > 1.0)
return false;
}
return true;
}
示例2: addToGeometry
void PathTracingBVH::addToGeometry(Node *node) {
AxisAlignedBoundingBox aabb = node->boundingBox();
int aabbIndex = m_geometry->size();
m_geometry->push_back(glm::vec4()); //llf dummy
m_geometry->push_back(glm::vec4()); //urb dummy
//add triangles
for (auto child : node->children()) {
if (child->children().size() == 0) { //the current child is a leaf ==> it is a triangle object
TriangleObject *triangleObject = dynamic_cast<TriangleObject *>(child);
if (triangleObject == nullptr) { //we have to be safe because it could also be an empty Group
qDebug() << "PathTracingBVH : addToGeometry(Node *) : dynamic cast to TriangleObject * failed";
continue;
}
p_TriangleList triangles = triangleObject->triangles();
for (int i = 2; i < triangles->size(); i += 3) {
m_geometry->push_back(glm::vec4(triangles->at(i - 2), 3.0f)); // data1
m_geometry->push_back(glm::vec4(triangles->at(i - 1), 0.0f)); // data2
m_geometry->push_back(glm::vec4(triangles->at(i ), 0.0f)); // data3
}
} else { //internal node
addToGeometry(child);
}
}
glm::vec3 aabbEnlargement = aabb.radius() * glm::vec3(0.000001f, 0.000001f, 0.000001f);
m_geometry->at(aabbIndex) = glm::vec4(
aabb.llf() - aabbEnlargement, //llf
0.0f //we are a bounding box
); //data1
m_geometry->at(aabbIndex + 1) = glm::vec4(
aabb.urb() + aabbEnlargement, //urb
float(m_geometry->size()) // points to one behind the last entry in geometry list,
// that is the next object on the same hierarchy level (or a higher hierarchy level
// if there is none on the same)
); //data2
}