本文整理汇总了C++中BoundingSphere::getRadius方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingSphere::getRadius方法的具体用法?C++ BoundingSphere::getRadius怎么用?C++ BoundingSphere::getRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoundingSphere
的用法示例。
在下文中一共展示了BoundingSphere::getRadius方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: intersects
bool BoundingEllipsoid::intersects(BoundingSphere &bs, CollisionResultSet::Info& info) {
//We do the same for check the collision with a circle, except taht the circle have only 1 ray.
//The equation for the circle is then a bit different.
math::Ray r(bs.getCenter(), center);
math::Vec3f near, far;
if (!intersectsWhere(r, near, far, info))
return false;
math::Vec3f d = far - center;
return (center.computeDistSquared(bs.getCenter()) - bs.getRadius() * bs.getRadius() - d.magnSquared()) <= 0;
}
示例2: renderBoundingSphere
bool OpenGLRenderer::renderBoundingSphere(const BoundingSphere &sphere, const glm::vec3 ¢er, const glm::vec3 &color, Camera &camera,
RenderTarget &renderTarget)
{
/* Calculate MVP matrix, bounding box coordinates are already in world coordinates */
glm::mat4 MVP = camera.getPerspectiveMatrix() * camera.getViewMatrix();
/* Bind the render target */
renderTarget.bind();
{
GLuint boxPosVAO, boxPosVBO;
__(glEnable(GL_DEPTH_TEST));
//__(glPolygonMode(GL_FRONT_AND_BACK, GL_FILL));
//__(glEnable(GL_CULL_FACE));
/* Bind program to upload the uniform */
_renderBoundingSphere.attach();
/* Send our transformation to the currently bound _renderBoundingSpheres, in the "MVP" uniform */
_renderBoundingSphere.setUniformMat4("u_MVPMatrix", &MVP);
_renderBoundingSphere.setUniformMat4("u_projectionMatrix", &camera.getPerspectiveMatrix());
_renderBoundingSphere.setUniformVec3("u_boxColor", const_cast<glm::vec3 &>(color));
_renderBoundingSphere.setUniformFloat("u_radius", sphere.getRadius());
__(glGenVertexArrays(1, &boxPosVAO));
__(glBindVertexArray(boxPosVAO));
__(glGenBuffers(1, &boxPosVBO));
__(glBindBuffer(GL_ARRAY_BUFFER, boxPosVBO));
__(glBufferData(GL_ARRAY_BUFFER, sizeof center, ¢er[0], GL_STATIC_DRAW));
__(glEnableVertexAttribArray(0));
__(glVertexAttribPointer(0, // attribute. No particular reason for 0, but must match the layout in the _renderBoundingSpheres.
3, // size
GL_FLOAT, // type
GL_FALSE, // normalized?
0, // stride
(void *)0 // array buffer offset
));
__(glDrawArrays(GL_POINTS, 0, 1));
__(glBindVertexArray(0));
__(glDeleteBuffers(1, &boxPosVBO));
__(glDeleteVertexArrays(1, &boxPosVAO));
/* Unbind */
_renderBoundingSphere.detach();
}
renderTarget.unbind();
return true;
}
示例3: expand
Bounds::Ptr expand(const BoundingSphere &bounds) const {
BoundingSphere::Desc desc;
desc.pose = bounds.getPose();
desc.radius = bounds.getRadius() + skinThickness;
return desc.create();
}