Esempio n. 1
0
void content()
{
	extern bool SphereInFrustum (float,float,float,float);

	glClear (GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);

	// extract frustum parameter of current camera
	extern void ExtractFrustum();
	ExtractFrustum();

	int nshow = 0;
	for (int i = 0; i < NSPHERES; i++) {
		if (! cull || SphereInFrustum (pos[i][0], pos[i][1],pos[i][2], radius[i])) {
			++nshow;
			glPushMatrix();
				glTranslatef (pos[i][0], pos[i][1], pos[i][2]);
				glutSolidSphere (radius[i], 120,120); 
			glPopMatrix();
		}
	}


	BEGIN_2D_OVERLAY (10,10);
	glDisable(GL_LIGHTING);
	glColor3f (1,1,0);
	if (cull) 	
		drawstr (1,1, "cull [%d|%d]", NSPHERES-nshow, NSPHERES);
	else
		drawstr (1,1, "no cull");
	END_2D_OVERLAY();

	content_count++;
	glutSwapBuffers();
}
Esempio n. 2
0
bool Frustum::Contains(const BoundingSphere& bs) const
{
#ifdef GEKKO
    return true; // TODO Wii culling too much - fix this properly
#endif

    if (bs.GetRadius() == 0)
    {
        //Engine::Instance()->ReportError("Bad Sphere radius.");
        return true;
    }
    return SphereInFrustum(bs.GetCentre().x,
                           bs.GetCentre().y,
                           bs.GetCentre().z,
                           bs.GetRadius());
}
Esempio n. 3
0
bool isBoundInFrustum(bound boundInfo) {
   return SphereInFrustum(boundInfo.center, boundInfo.radius*1.5) > 0;
}
Esempio n. 4
0
bool
CFrustum::SphereInFrustum( const CSphere & sphere  ) const
{
  return SphereInFrustum(sphere.GetPosition().x, sphere.GetPosition().y, sphere.GetPosition().z, sphere.GetRadius());
}