The Bounding Frustum..
I tried to use the Bounding Frustum object so that I could draw the objects that was located within the cameras frustum; the bounding frustum is an object that has functions like 'Contains' and 'Intersect' so I wanted to use that to make less draw calls. It's not necessary to draw objects that aren't on screen.
So I wanted to first of all apply this to my planets; added a Bounding Sphere to my object which is an object itself that the Bounding Frustum uses to check if this Bounding Sphere is within the Frustum or not.
It's built in within Monogame and it works like
BoundingFrustum bf = new BoundingFrustum(viewMatrix * projectionMatrix);
BoundingSphere bs = new BoundingSphere(planetTranslation, radius);
if (bf.Contains(bs) != ContainmentType.Disjoint)
{
// Draw this planet because it's visible within the camera's frustum
}
But it wasn't working on first try, not the second either and so forth!
I've also turned to the Monogame Community for help and asked if this was a bug, but I didn't receive an answer there. After a day trial and error I made it work, the bug report was a false alarm.
Happy it's working though!
But I found another bug (for sure this time) that I wrote about at the Monogame Community but I haven't heard a PIP from anyone about this one either.
The bug is that the Development Build 3.7 makes the application go into Break Mode when trying to load a .FBX model, if you build it in release mode.
Content.Load<Model>("fbx_model");
Will make it go into Break Mode!
But it is working if you're using a .DAE model file instead, so I've converted the vehicle into a Collada (.DAE) file instead so that I could carry on.
See you soon because I have more to tell.
Kommentarer
Skicka en kommentar