Occlusion query
Currently we are using a physics engine raycast for these 2 engine features:
- the determining of object (e.g. item, npc) the cursor is pointing at
- the sun flare effect (which goes away when the sun is occluded by something)
This is too inaccurate because some objects use a simpler mesh for collision (e.g. for a shelf, a box). The result is that some items cannot be picked up at all. Also, for the sun it's inaccurate because some things don't even have a physical representation (e.g. tree leaves).
My proposal is to use a hardware occlusion query for both of these issues. Basically it can render objects seperately in the next frame and then we can check how many pixels were occluded.
Since we need to know the object that we are occlusion testing against beforehand, for the object detection we first have to cast a physics ray (but we have to exclude objects from the result that cannot be activated, since they could be false positives). Then, in the next GPU frame, we can occlusion test the object (the 1 pixel under the mouse should suffice) If it was occluded by something, do nothing. If it wasn't, then we can activate the object.
It is important to note that the query result will be 1 or 2 frames delayed, but that's totally acceptable.
TL;DR use a shiny feature ogre provides to make the "cursor to object" detection work better.
(RM-220 from redmine: created on 2012-03-20 by scrawl ., , closed on 2012-03-31 by scrawl .)