本文整理汇总了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;
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}