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


C++ vec3::get_y方法代码示例

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


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

示例1: result_info

result_info	compute_box_visibility(const vec3& center, const vec3& extent, const plane_info frustum[6], result_info in)
// Returns a visibility code indicating the culling status of the
// given axis-aligned box.  The result_info passed in should indicate
// which planes might cull the box, by setting the corresponding
// bit in in.active_planes.
{
//	if (in.culled) return in;	// This check should be done by caller.

    // Check the box against each active frustum plane.
    int	bit = 1;
    for (int i = 0; i < 6; i++, bit <<= 1) {
        if ((bit & in.active_planes) == 0) {
            // This plane is already known to not cull the box.
            continue;
        }

        const plane_info&	p = frustum[i];
        // Check box against this plane.
        float	d = p.normal * center - p.d;
        float	extent_toward_plane = fabsf(extent.get_x() * p.normal.get_x())
                                      + fabsf(extent.get_y() * p.normal.get_y())
                                      + fabsf(extent.get_z() * p.normal.get_z());
        if (d < 0) {
            if (-d > extent_toward_plane) {
                // Box is culled by plane; it's not visible.
                return result_info(true, 0);
            } // else this plane is ambiguous so leave it active.
        } else {
            if (d > extent_toward_plane) {
                // Box is accepted by this plane, so
                // deactivate it, since neither this
                // box or any contained part of it can
                // ever be culled by this plane.
                in.active_planes &= ~bit;
                if (in.active_planes == 0) {
                    // This box is definitively inside all the culling
                    // planes, so there's no need to continue.
                    return in;
                }
            } // else this plane is ambigious so leave it active.
        }
    }

    return in;	// Box not definitively culled.  Return updated active plane flags.
}
开发者ID:weihuoya,项目名称:gameswf,代码行数:45,代码来源:cull.cpp

示例2: if

plane_class	classify_point( const plane_info& p, vec3 a, float slop )
// Classify the given point with respect to the given plane; use a tolerance
// of +/- slop to determine when a point is ON the plane.
{
	float	distance = p.normal * a - p.d;

	if ( distance < -slop ) {
		return INSIDE;
	} else if ( distance > slop ) {
		if ( print_debug ) {
			printf( "d = %f, pn = %f %f %f, pd = %f, a = %f %f %f, p*a = %f\n",
					distance, p.normal.get_x(), p.normal.get_y(), p.normal.get_z(), p.d,
					a.get_x(), a.get_y(), a.get_z(),
					p.normal * a
				);	//xxxx
		}
		return OUTSIDE;
	} else {
		return ON;
	}
}
开发者ID:prepare,项目名称:gameswf,代码行数:21,代码来源:bsp.cpp


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