whoa, calm down :)
@Disch:
For those of you who don't understand the problem: |
...
this describes exactly what I'm talking about, sorry if I gave a too abstract problem description (and then additional details trying to help you understand), I just tried to make it easier for you.
Actually, the: maintain an id in the base class that describes what exact type the derived is, and then route using a switch would be a good solution. I think it would have the same performance as this virtual function type of thing.
To add I think one can't skip writing the backend functions for all permutations, so I guess an optimal solution would be to keep the number of types down to a minimum (say 4), like: sphere, aabb, obb, arbitrary mesh. This would give 24 functions to write. But for 5 one would have to write 120, so 4 will definitely be the limit.
currently I have sphere, aabb, plane, frustum, but not all classes support each type of test (is this on the right side of a plane, is A inside B (order matters here), does A intersect B (order doesn't matter)), I wrote so far 12 backend functions alltogether, plus the virtual functions that route to the correct one.