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


C++ BoundingSphere::getRadius方法代码示例

本文整理汇总了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;
 }
开发者ID:Ornito,项目名称:ODFAEG,代码行数:10,代码来源:boundingEllipsoid.cpp

示例2: renderBoundingSphere

bool OpenGLRenderer::renderBoundingSphere(const BoundingSphere &sphere, const glm::vec3 &center, 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, &center[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;
}
开发者ID:gabr1e11,项目名称:3Dengine,代码行数:57,代码来源:OpenGLRenderer.cpp

示例3: expand

		Bounds::Ptr expand(const BoundingSphere &bounds) const {
			BoundingSphere::Desc desc;
			desc.pose = bounds.getPose();
			desc.radius = bounds.getRadius() + skinThickness;
			return desc.create();
		}
开发者ID:marekkopicki,项目名称:Golem,代码行数:6,代码来源:Heuristic.cpp


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