|
From: SourceForge.net <no...@so...> - 2004-02-20 22:47:01
|
Bugs item #901427, was opened at 2004-02-20 22:39 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=442052&aid=901427&group_id=45158 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Dair Grant (grantd) Assigned to: Dair Grant (grantd) Summary: Implement visibility culling Initial Comment: Implement the kQ3XMethodTypeRendererIsBoundingBoxVisible method for OpenGL renderers, and make use of this when submitting groups with bounding boxes. Was discussed on the mailing list, and a proposal was: -------------------------------- > Do you see this general-purpose test in QuesaMath.h as something > we would expose to users, or something only for internal use? I think it's similar to the Q3Ray3D_IntersectXXX routines: these were written internally for the picking code (E3Utils.c is a good place for these to live temporarily until you firm up the interface), but they're really general purpose 3D utilities. A general visibility test routine would be useful in other circumstances (perhaps you have your own data structure for organising the world: if you can derive a bounding box from it, you could use this routine to do your own culling), and it would also be useful to have a bounding-sphere version as well. These are quicker, if less accurate, so perhaps what we need is: typedef enum TQ3Visibility { kQ3VisibleIsNot = 0, // kQ3False kQ3VisibleCompletely = 1, // kQ3True kQ3VisiblePartially = 2, } TQ3Visibility; TQ3Visibility Q3BoundingBox_IsVisible(box, TQ3View-or-camera- spec) TQ3Visibility Q3BoundingSphere_IsVisible(sphere, TQ3View-or- camera-spec) Currently the IsBoundingBox renderer method returns a TQ3Boolean. It would be useful to change this to return one of these visibility enums, so we could do this in a binary compatible manner by having the first two enum values correspond to the values for kQ3False/kQ3True. It wouldn't be source compatible, but a)it's a simple cast to fix and b)the only code I know of that uses this method is the code in QD3D that queries the QD3D IR. The reason for changing the return type is it'd be useful to add an IsBoundingSphere method to renderers as well. Both box and sphere methods would be implemented just by calling on to the Q3BoundingXXX_IsVisible methods for our IR, but this would mean Quesa could be a bit smarter. >> 2. When submitting a display group with a bounding box, call the >> method to decide if the group really needs to be submitted. I.e., this test (or any bounding box test) could now be: - Call the IsBoundingSphere method. This gives you a fast test, and if it returns kQ3VisibleIsNot or kQ3VisibleCompletely then you're done. - If it returns kQ3VisiblePartially, call the IsBoundingBox method. This takes longer, but gives you a better decision for some edge cases. I suppose you could implement the above simply by sticking to bools and having the Q3BoundingBox_IsVisible do an internal test on a bounding sphere first and then on the box, but having both methods available would be more flexible. Flexible in that there's an OpenGL extension where you can hint that the geometry is entirely visible on the screen (rather than partially clipped) for a slight performance boost. If we were able to pass back an enum rather than a bool then we'd be able to identify this case in the future and use the extension if it's present. -------------------------------- ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=442052&aid=901427&group_id=45158 |