0ad/source/maths
Yves 8e30410109 Improve PickEntitiesAtPoint
First, do a ray intersection test with the bounding-sphere for all
entities on the map and then check the more detailed selection shape for
the remaining candidates. Do checks that require component lookups after
the ray intersection tests because these are relatively expensive.
The old method for figuring out which entities are below the mouse
cursor was incorrect because it does a 2D check to filter out the first
candidates which can lead to incorrect results with lower camera angles
and high buildings or buildings with a large footprint. Such problems
were avoided with quite a large radius for this 2D test and resulted in
a large number of candiate entities after this first test (200-500).
Also rename PickEntitiesAtPoint to PickEntityAtPoint and make it return
only one (the closest) match.

I've tested performance with the tracelogger by starting a map and then
moving the mouse in circles for one minute. The results were relatively
stable. I've compared the total time percentage of input.js:836, which
spends nearly all of the time in PickEntityAtPoint.
Ardennes Forest - Normal size:       Original: 41.46%    Patched: 31.6%
Ardennes Forest - Giant size:        Original: 40.59%    Patched: 51.55%

As we see, it's faster on normal map sizes but slower on giant maps with
a lot of entities.
This approach can be further improved with some kind of spatial
subdivision for the culling (like an octree), which would help the unit
renderer too. This way it should be possible to make it faster (and
still correct) on all map sizes and with a large total numbers of
entities.

This was SVN commit r16098.
2015-01-01 23:05:26 +00:00
..
tests Fix VS2013 build errors, warnings 2013-11-03 12:46:07 +00:00
BoundingBoxAligned.cpp Forward-declare CShaderProgramPtr, to avoid pulling in more headers than necessary and to hypothetically reduce build times by a minuscule amount. 2014-07-02 22:36:45 +00:00
BoundingBoxAligned.h Optimise silhouette rendering. 2014-07-03 01:00:25 +00:00
BoundingBoxOriented.cpp Fixed AABB to OBB transformation resulting in NaN basis vectors when the AABB size in one or more dimensions is zero. Fixes #1121. 2012-05-31 23:17:15 +00:00
BoundingBoxOriented.h Avoid non-ASCII characters in source code, since tools don't decode them consistently. 2013-10-20 09:27:44 +00:00
BoundingSphere.h Improve PickEntitiesAtPoint 2015-01-01 23:05:26 +00:00
Brush.cpp Forward-declare CShaderProgramPtr, to avoid pulling in more headers than necessary and to hypothetically reduce build times by a minuscule amount. 2014-07-02 22:36:45 +00:00
Brush.h Forward-declare CShaderProgramPtr, to avoid pulling in more headers than necessary and to hypothetically reduce build times by a minuscule amount. 2014-07-02 22:36:45 +00:00
Ease.h Pretty unit selection overlay rings. Fixes #824. 2012-04-22 04:04:02 +00:00
Fixed.cpp Remove a load of implicit CStr type conversions, since they're error-prone and can cause silent data loss. 2011-02-17 20:08:20 +00:00
Fixed.h Optimise fixed multiplies on MSVC x86 2013-09-20 20:17:54 +00:00
FixedVector2D.h Optimise fixed multiplies on MSVC x86 2013-09-20 20:17:54 +00:00
FixedVector3D.h Optimise fixed multiplies on MSVC x86 2013-09-20 20:17:54 +00:00
MathUtil.h Graphics optimisations and features from eihrul. 2011-07-12 23:48:05 +00:00
Matrix3D.cpp More GLES compatibility. 2012-02-12 13:20:49 +00:00
Matrix3D.h Add support for specular materials. 2012-04-08 15:55:06 +00:00
MD5.cpp split debug_assert into ENSURE and ASSERT as discussed in a previous meeting. 2011-04-30 13:01:45 +00:00
MD5.h Force some byte-order functions to be inline. 2010-05-25 18:47:11 +00:00
Noise.cpp # New territory border rendering. 2011-07-30 00:56:45 +00:00
Noise.h Makes some classes NONCOPYABLE, based on patch by Markus, refs #1852 2013-05-22 21:40:56 +00:00
NUSpline.cpp split debug_assert into ENSURE and ASSERT as discussed in a previous meeting. 2011-04-30 13:01:45 +00:00
NUSpline.h Add GPL header 2009-04-18 17:00:33 +00:00
Plane.cpp Fix culling for shadows and reflections. 2014-06-25 01:11:10 +00:00
Plane.h Fix culling for shadows and reflections. 2014-06-25 01:11:10 +00:00
Quaternion.cpp Inline common vector/matrix operations, for performance. 2010-09-24 16:54:20 +00:00
Quaternion.h fix relics of GPL comment insertion (removing empty description comments and in some cases adding new file descriptions) 2009-05-03 11:47:38 +00:00
Random.h Fix build with old GCC 2011-08-04 21:36:57 +00:00
Sqrt.cpp # Rewrite of the game's simulation system 2010-01-09 19:20:14 +00:00
Sqrt.h # Rewrite of the game's simulation system 2010-01-09 19:20:14 +00:00
Vector2D.h Pretty unit selection overlay rings. Fixes #824. 2012-04-22 04:04:02 +00:00
Vector3D.cpp Optimise silhouette rendering. 2014-07-03 01:00:25 +00:00
Vector3D.h Optimise silhouette rendering. 2014-07-03 01:00:25 +00:00
Vector4D.h Add support for specular materials. 2012-04-08 15:55:06 +00:00