当前位置: 首页>>代码示例>>C++>>正文


C++ AxisAlignedBoundingBox::llf方法代码示例

本文整理汇总了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;
}
开发者ID:Boffmann,项目名称:3D_Grafik,代码行数:30,代码来源:navigationmath.cpp

示例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

}
开发者ID:hpicgs,项目名称:cgsee,代码行数:38,代码来源:pathtracingbvh.cpp


注:本文中的AxisAlignedBoundingBox::llf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。