Hey!
I need to know how to calculate which Vertex lies in the Frustum and which does not, as I am loading Primitives into the Buffer and do not want to have more than nedded.
My current technique does it like that
bool inFrustum(Vector3 point,Vector3 relativeCam)
{
Vector3 camToPoint = relativeCam - point;
camToPoint.Normalize();
lookAt -= camPos;
lookAt.Normalize();
float angle = MathHelper.ToDegrees(Math.Abs((float)Math.Acos(Vector3.Dot(lookAt, camToPoint))));
if (Math.Abs(angle)>50f/2)
return false;
else return true;
RelativeCam means it is the Cam relativ to the Center of the Sphere.
It gets the Vektor of the Camera to the Vertex and the Vektor of the Camera where it is pointing to.
Then it calculates the Angle between them and checks if it is inside the 50° (45° + 5° safety).
But I got a big issue. If I go too close to the object (and while itself is rotating) I get positions where no vertex is getting through this function resulting in an empty window for short times.
Is there any better way for calculating this? Or do I have a calculation-mistake?
I tried to use this :
If
distance to middle < -radius
but it won't work at all Oo.