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


C++ BoundingBox::GetMin方法代码示例

本文整理汇总了C++中BoundingBox::GetMin方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingBox::GetMin方法的具体用法?C++ BoundingBox::GetMin怎么用?C++ BoundingBox::GetMin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BoundingBox的用法示例。


在下文中一共展示了BoundingBox::GetMin方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Intersects

IntersectionType::Enum BoundingFrustum::Intersects(const BoundingBox& box) const {
    IntersectionType::Enum containment = IntersectionType::Contains;

    Vector3f min = box.GetMin();
    Vector3f max = box.GetMax();
    Vector3f boxCorners[8] = {  Vector3f(min),
                                Vector3f(max),
                                Vector3f(min.x, min.y, max.z),
                                Vector3f(min.x, max.y, min.z),
                                Vector3f(min.x, max.y, max.z),
                                Vector3f(max.x, min.y, min.z),
                                Vector3f(max.x, min.y, max.z),
                                Vector3f(max.x, max.y, min.z)
                             };

    for(U32 i = 0; i < 6; ++i) {
        U32 out = 0;                                                //number of box corners "outside" plane
        for(U32 j = 0; j < 8; ++j) {
            if (planes[i].DistanceToPoint(boxCorners[j]) < 0) {
                ++out;
            }
        }

        if (out == 8) {
            return IntersectionType::Disjoint;                      //all corners outside
        } else if (out != 0) {
            containment = IntersectionType::Intersection;           //some outside, some inside... continue testing
        }
    }

    return containment;
}
开发者ID:panmar,项目名称:pg3,代码行数:32,代码来源:BoundingVolumes.cpp

示例2: SetBox

void CollisionShape::SetBox(BoundingBox bbox)
{
	type = CollisionShapeType::BOX;
	box = bbox;
	vec3 bmin = bbox.GetMin();
	vec3 bmax = bbox.GetMax();	
	collisionMesh = new CollisionMesh;
	// Front
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmin.x, bmin.y, bmax.z), vec3(bmax.x, bmin.y, bmax.z), vec3(bmax.x, bmax.y, bmax.z)));
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmin.x, bmin.y, bmax.z), vec3(bmax.x, bmax.y, bmax.z), vec3(bmin.x, bmax.y, bmax.z)));
	// Back
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmin.x, bmin.y, bmin.z), vec3(bmin.x, bmax.y, bmin.z), vec3(bmax.x, bmax.y, bmin.z)));
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmin.x, bmin.y, bmin.z), vec3(bmax.x, bmax.y, bmin.z), vec3(bmax.x, bmin.y, bmin.z)));
	// Right
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmax.x, bmin.y, bmax.z), vec3(bmax.x, bmin.y, bmin.z), vec3(bmax.x, bmax.y, bmin.z)));
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmax.x, bmin.y, bmax.z), vec3(bmax.x, bmax.y, bmin.z), vec3(bmax.x, bmax.y, bmax.z)));
	// Left
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmin.x, bmin.y, bmax.z), vec3(bmin.x, bmax.y, bmax.z), vec3(bmin.x, bmax.y, bmin.z)));
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmin.x, bmin.y, bmax.z), vec3(bmin.x, bmax.y, bmin.z), vec3(bmin.x, bmin.y, bmin.z)));
	// Top
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmin.x, bmax.y, bmax.z), vec3(bmax.x, bmax.y, bmax.z), vec3(bmax.x, bmax.y, bmin.z)));
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmin.x, bmax.y, bmax.z), vec3(bmax.x, bmax.y, bmin.z), vec3(bmin.x, bmax.y, bmin.z)));
	// Bottom
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmin.x, bmin.y, bmax.z), vec3(bmin.x, bmin.y, bmin.z), vec3(bmax.x, bmin.y, bmin.z)));
	collisionMesh->triangles.push_back(CollisionTriangle(vec3(bmin.x, bmin.y, bmax.z), vec3(bmax.x, bmin.y, bmin.z), vec3(bmax.x, bmin.y, bmax.z)));

	MarkedDirty();
}
开发者ID:ibachar,项目名称:firecube,代码行数:28,代码来源:CollisionShape.cpp

示例3: AddWireBox

 void DebugRenderer::AddWireBox(const BoundingBox& bbox, const Matrix& transform, const Color& color, Lifespan lifespan) {
     Vector3f min = bbox.GetMin();
     Vector3f max = bbox.GetMax();
     Vector3f translation = (min + max) / 2.0f;
     Vector3f scale(max.x - min.x, max.y - min.y, max.z - min.z);
     Matrix newTransform = Matrix::CreateScale(scale) * Matrix::CreateTranslation(translation) * transform;
     AddWireBox(newTransform, color, lifespan);
 }
开发者ID:panmar,项目名称:pg2,代码行数:8,代码来源:DebugRenderer.cpp

示例4: DrawWireBox

    void BufferedPrimitiveRenderer::DrawWireBox(const BoundingBox& bbox,
        const Matrix& transform,
        const Color& color /*= DefaultColor*/,
        DebugLifespan::Enum lifespan /*= DebugLifespan::Temporary*/,
        bool depthEnabled /*= false*/, 
        bool antiAliased /*= false*/) {

        Vector3f min = bbox.GetMin();
        Vector3f max = bbox.GetMax();
        Vector3f translation = (min + max) / 2.0f;
        Vector3f scale(max.x - min.x, max.y - min.y, max.z - min.z);
        Matrix newTransform = Matrix::CreateScale(scale) * Matrix::CreateTranslation(translation) * transform;
        DrawWireBox(newTransform, color, lifespan, depthEnabled, antiAliased);
    }
开发者ID:panmar,项目名称:pg3,代码行数:14,代码来源:BufferedPrimitiveRenderer.cpp

示例5: DrawCollisionBoxColored

void DrawManager::DrawCollisionBoxColored(const BoundingBox& pBoundingBox) const
{
	glBegin(GL_QUADS);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMin().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMax().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMax().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMin().y,pBoundingBox.GetMax().z);
    glEnd();

    glBegin(GL_QUADS);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMax().y,pBoundingBox.GetMin().z);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMax().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMax().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMax().y,pBoundingBox.GetMin().z);
    glEnd();

    glBegin(GL_QUADS);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMin().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMin().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMin().y,pBoundingBox.GetMin().z);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMin().y,pBoundingBox.GetMin().z);
    glEnd();
}
开发者ID:johannawald,项目名称:ICT207,代码行数:23,代码来源:DrawManager.cpp

示例6: DrawBox

	void Renderer::DrawBox(const BoundingBox& box, const Vector4& color, const bool depth /*= true*/)
	{
		const auto& min = box.GetMin();
		const auto& max = box.GetMax();
	
		DrawLine(Vector3(min.x, min.y, min.z), Vector3(max.x, min.y, min.z), color, depth);
		DrawLine(Vector3(max.x, min.y, min.z), Vector3(max.x, max.y, min.z), color, depth);
		DrawLine(Vector3(max.x, max.y, min.z), Vector3(min.x, max.y, min.z), color, depth);
		DrawLine(Vector3(min.x, max.y, min.z), Vector3(min.x, min.y, min.z), color, depth);
		DrawLine(Vector3(min.x, min.y, min.z), Vector3(min.x, min.y, max.z), color, depth);
		DrawLine(Vector3(max.x, min.y, min.z), Vector3(max.x, min.y, max.z), color, depth);
		DrawLine(Vector3(max.x, max.y, min.z), Vector3(max.x, max.y, max.z), color, depth);
		DrawLine(Vector3(min.x, max.y, min.z), Vector3(min.x, max.y, max.z), color, depth);
		DrawLine(Vector3(min.x, min.y, max.z), Vector3(max.x, min.y, max.z), color, depth);
		DrawLine(Vector3(max.x, min.y, max.z), Vector3(max.x, max.y, max.z), color, depth);
		DrawLine(Vector3(max.x, max.y, max.z), Vector3(min.x, max.y, max.z), color, depth);
		DrawLine(Vector3(min.x, max.y, max.z), Vector3(min.x, min.y, max.z), color, depth);
	}
开发者ID:PanosK92,项目名称:Directus3D,代码行数:18,代码来源:Renderer.cpp

示例7: Transform

BoundingBox BoundingBox::Transform(const BoundingBox& bbox, const Matrix& transform) {
    Vector3f min = Vector3f::Transform(bbox.GetMin(), transform);
    Vector3f max = Vector3f::Transform(bbox.GetMax(), transform);
    return BoundingBox(min, max);
}
开发者ID:panmar,项目名称:pg3,代码行数:5,代码来源:BoundingVolumes.cpp

示例8: DrawCollisionBox

void DrawManager::DrawCollisionBox(const BoundingBox& pBoundingBox) const
{
    glBegin(GL_LINE_LOOP);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMax().y,pBoundingBox.GetMin().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMax().y,pBoundingBox.GetMin().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMin().y,pBoundingBox.GetMin().z);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMin().y,pBoundingBox.GetMin().z);
    glEnd();

    glBegin(GL_LINE_LOOP);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMin().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMax().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMax().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMin().y,pBoundingBox.GetMax().z);
    glEnd();

    glBegin(GL_LINE_LOOP);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMax().y,pBoundingBox.GetMin().z);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMax().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMax().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMax().y,pBoundingBox.GetMin().z);
    glEnd();

    glBegin(GL_LINE_LOOP);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMin().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMin().y,pBoundingBox.GetMax().z);
		glVertex3f(pBoundingBox.GetMin().x,pBoundingBox.GetMin().y,pBoundingBox.GetMin().z);
		glVertex3f(pBoundingBox.GetMax().x,pBoundingBox.GetMin().y,pBoundingBox.GetMin().z);
    glEnd();
}
开发者ID:johannawald,项目名称:ICT207,代码行数:30,代码来源:DrawManager.cpp


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