示例#1
0
int SolidLeaf::CullDraw(const Frustum& f)
{
  if (!f.Contains(m_bsphere))
  {
    return 0;
  }
  Draw();
  return GetNumberOfPolygons();  
}
示例#2
0
MATH_IGNORE_UNUSED_VARS_WARNING

RANDOMIZED_TEST(AABBPBVolumeIntersect)
{
	vec pt = vec::RandomBox(rng, POINT_VEC_SCALAR(-SCALE), POINT_VEC_SCALAR(SCALE));
	Frustum b = RandomFrustumContainingPoint(pt);
	AABB a = RandomAABBContainingPoint(pt, 10.f);
	assert(a.Intersects(b));
	assert(b.Intersects(a));

	bool contained = b.Contains(a);

	vec centerPoint = b.CenterPoint();
	assert(b.Contains(b.CenterPoint()));

	PBVolume<6> pbVolume = ToPBVolume(b);
	assert(pbVolume.Contains(b.CenterPoint()));
	CullTestResult r = pbVolume.InsideOrIntersects(a);
	assert(r == TestInside || r == TestNotContained);
	if (contained)
		assert(r == TestInside);
}
示例#3
0
int SolidComposite::CullDraw(const Frustum& f)
{
  if (!f.Contains(m_bsphere))
  {
    return 0;
  }

  // Counts actual no. of polygons drawn.
  int totalPolys = 0;
  for (CompVector::iterator it = m_children.begin();
       it != m_children.end();
       ++it)
  {
    SolidComponent* pComp = (*it).GetPtr();
    AmjuGL::PushMatrix();
    if (pComp)
    {
      pComp->Orientate();
      totalPolys += pComp->CullDraw(f);
    }
    AmjuGL::PopMatrix();
  }
  return totalPolys;
}