1
0
forked from 0ad/0ad
Commit Graph

168 Commits

Author SHA1 Message Date
913545aa41 Mark several CFixedVector2D as const and passed by reference in Geometry and a few other places. Mark some functions (that probably already were) inline.
Also make sure we don't include Geometry.h where it's not necessary.

This was SVN commit r17238.
2015-11-11 20:50:02 +00:00
6581796103 New long-range pathfinder.
Based on Philip's work located at
http://git.wildfiregames.com/gitweb/?p=0ad.git;a=shortlog;h=refs/heads/projects/philip/pathfinder
Includes code by wraitii, sanderd17 and kanetaka.

An updated version of docs/pathfinder.pdf describing the changes in
detail will be committed ASAP.

Running update-workspaces is needed after this change.

Fixes #1756.
Fixes #930, #1259, #2908, #2960, #3097
Refs #1200, #1914, #1942, #2568, #2132, #2563

This was SVN commit r16751.
2015-06-12 18:58:24 +00:00
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
eb7955599a Optimise silhouette rendering.
Do some intersection tests on the CPU so that the silhouette render
passes only have to draw models/patches that might actually contribute
to silhouettes, saving the CPU and GPU cost of rendering more objects
than necessary.

This was SVN commit r15483.
2014-07-03 01:00:25 +00:00
30e851ab90 Forward-declare CShaderProgramPtr, to avoid pulling in more headers than necessary and to hypothetically reduce build times by a minuscule amount.
This was SVN commit r15481.
2014-07-02 22:36:45 +00:00
b1b96a89d6 Fix culling for shadows and reflections.
Previously we had a single culling frustum based on the main camera, and
any object outside the frustum would never get rendered, even if it
should actually contribute to shadows or reflections/refractions. This
caused ugly pop-in effects in the shadows and reflections while
scrolling.

Extend the renderer to support multiple cull groups, each with a
separate frustum and with separate lists of submitted objects, so that
shadows and reflections will render the correctly culled sets of
objects.

Update the shadow map generation to compute the (hopefully) correct
bounds and matrices for this new scheme.

Include terrain patches in the shadow bounds, so hills can cast shadows
correctly.

Remove the code that tried to render objects slightly outside the camera
frustum in order to reduce the pop-in effect, since that was a
workaround for the lack of a proper fix.

Remove the model/patch filtering code, which was used to cull objects
that were in the normal camera frustum but should be excluded from
reflections/refractions, since that's redundant now too.

Inline DistanceToPlane to save a few hundred usecs per frame inside
CCmpUnitRenderer::RenderSubmit.

Fixes #504, #579.

This was SVN commit r15445.
2014-06-25 01:11:10 +00:00
fe3315376c Add BoundingSphere, SOverlaySphere.
BoundingSphere is similar to a bounding box, but more spherical.

SOverlaySphere is useful for visualising BoundingSphere (it's quite
inefficient and should only be used for debug functionality).

Normalise the camera frustum clipping planes, so that IsSphereVisible
gives the correct result.

This was SVN commit r15261.
2014-06-01 18:05:46 +00:00
72e11a2dea Fix VS2013 build errors, warnings
This was SVN commit r14073.
2013-11-03 12:46:07 +00:00
20ed5b118c Unify script conversions and remove JSInterface_Vector3D.
Because it was historically grown, we have some duplicated code for
converting script types to native types.
This patch removes the file JSConversions.cpp and moves some code to
ScriptConversions.cpp.
The places using JSConversions.cpp are changed to use the
ScriptInterface's conversion functions in ScriptConversions.cpp.
I also removed JSInterface_Vector3D because it had additional
requirements to the conversion code that no other code has and because
it's currently not used. I think it doesn't make sense to maintain code
just because it could possibly be used again later.

Closes #2213
Refs #1886

This was SVN commit r14036.
2013-10-20 17:13:53 +00:00
a4cd90ddfc Avoid non-ASCII characters in source code, since tools don't decode them consistently.
Fixes #2198.

This was SVN commit r14035.
2013-10-20 09:27:44 +00:00
d252e245ef Optimise fixed multiplies on MSVC x86
On MSVC, casting i32 to i64 then multiplying gets compiled into a call
to __allmul, which is slow. Use the __emul intrinsic instead.

GCC 4.6+ appears optimise this case automatically and doesn't need any
special handling.

This reduces the cost of ComputeShortPath by about 50% (testing AI vs AI
on Oasis 01).

This was SVN commit r13873.
2013-09-20 20:17:54 +00:00
a8a968d32c Catch exceptions by reference (by convention), based on patch from Markus, refs #1852
This was SVN commit r13421.
2013-05-22 22:27:53 +00:00
94c57085e9 Makes some classes NONCOPYABLE, based on patch by Markus, refs #1852
This was SVN commit r13419.
2013-05-22 21:40:56 +00:00
637c09b204 Add support for OpenBSD. Fixes #1463.
Backport os_getversion from premake4.4-beta4 and extend it to support
POSIX-compilant systems.
Add some missing newlines at the end of file as these cause warnings on
OpenBSD.
Update the config paths.

This was SVN commit r11970.
2012-06-13 20:43:56 +00:00
vts
1c005b0c0e Fixed AABB to OBB transformation resulting in NaN basis vectors when the AABB size in one or more dimensions is zero. Fixes #1121.
This was SVN commit r11928.
2012-05-31 23:17:15 +00:00
vts
34fc883317 Pretty unit selection overlay rings. Fixes #824.
This was SVN commit r11623.
2012-04-22 04:04:02 +00:00
769350a3e7 Compute camera height and zoom limits based on smoothed terrain heightmap. Fixes #794, based on patch by Dietger.
This was SVN commit r11556.
2012-04-18 20:39:00 +00:00
b7888aea52 Add support for specular materials.
Let materials specify shader uniform values.
Use interned strings for shader uniform/attribute names.
Remove confusing float* cast operator on CVector4D.
Simplify and clean up CVector4D.
Remove non-supported 'old' lighting model.

This was SVN commit r11453.
2012-04-08 15:55:06 +00:00
vts
305723f9a7 Prevent AABB/frustum intersections from blowing up on empty input bounds. Fixes #1027.
This was SVN commit r11441.
2012-04-05 22:29:01 +00:00
7fa6afac37 Corrects some Doxygen comments and adds a few others of interest.
This was SVN commit r11209.
2012-03-01 03:55:05 +00:00
a9eca31bad Even more GLES compatibility
This was SVN commit r11060.
2012-02-13 15:06:25 +00:00
db85833655 More GLES compatibility.
Move more rendering code to shader API.

This was SVN commit r11050.
2012-02-12 13:20:49 +00:00
4029d409bb Handle CBrush assertion failure less fatally
This was SVN commit r11049.
2012-02-12 12:36:05 +00:00
1f5b8f1c9a Move GUI renderer towards using shader infrastructure.
Remove support for unused GUI sprite effects.
Use vertex arrays for bounding box rendering.

This was SVN commit r11039.
2012-02-08 20:43:38 +00:00
41e3bad341 More build fixes for FreeBSD.
Adds BSD sysdep.
Adds support for MAKE variable, overriding make command in our build
scripts.
Fixes more files not ending with newline.

This was SVN commit r10994.
2012-01-31 00:06:56 +00:00
fc27a5c0ea More FreeBSD build fixes.
Fixes some warnings about files that don't end with newline.

This was SVN commit r10991.
2012-01-30 06:21:11 +00:00
cc5a0fba4e Use shader API for GUI text.
Flip GUI quads so we don't have to disable back-face culling.

This was SVN commit r10989.
2012-01-30 00:27:23 +00:00
8324a8981d Simplify GLSL program files.
Move water shaders to new shader system.

This was SVN commit r10982.
2012-01-29 12:04:39 +00:00
0ec4242962 Detect and fix printf signedness errors. Fixes #1086, #1087.
This was SVN commit r10846.
2012-01-01 16:43:10 +00:00
vts
db864f10c3 Rendering marker lines between buildings and rally points
Added command button to focus on rally point
(implements #524)

This was SVN commit r10704.
2011-12-10 07:07:04 +00:00
vts
fbb0e3995f Added prop point axes markers to Atlas' Actor Viewer panel
This was SVN commit r10703.
2011-12-10 05:11:25 +00:00
vts
85186c98b2 Better selection boxes. Closes #914, #295, #810.
This was SVN commit r10593.
2011-11-25 06:36:13 +00:00
959b5a505c Fix bug in incremental LOS computation
This was SVN commit r10446.
2011-10-28 13:15:33 +00:00
609f1643d5 Fix -Wconversion warnings in simulation code.
Cast to smaller integer types explicitly.
Generally avoid platform-dependent types (size_t) in simulation code.
Use float versions of math.h functions, not double.

This was SVN commit r10017.
2011-08-16 11:18:32 +00:00
81c9a9b1f1 Fix build with old GCC
This was SVN commit r9964.
2011-08-04 21:36:57 +00:00
2d662a1228 Add WELL512 RNG
This was SVN commit r9955.
2011-08-02 22:58:10 +00:00
8fee3d8ef8 # New territory border rendering.
Add textured line overlay rendering.
Change terrain height calculations to be triangulation-dependent for
improved accuracy.
Add triangulation-dependent terrain normal function.
Support separate S/T wrap modes for textures.
Rename CVector2D_Maths since it no longer conflicts with simulation
CVector2D.
Coalesce freed chunks in vertex buffers, to avoid excessive
fragmentation.
Add some things to help debug vertex buffer allocation a little.

This was SVN commit r9929.
2011-07-30 00:56:45 +00:00
b2837e2878 Fix compatibility more with Boost 1.47
This was SVN commit r9907.
2011-07-24 11:59:57 +00:00
78fd3a2ba2 Fix compatibility with Boost 1.47
This was SVN commit r9905.
2011-07-24 11:41:06 +00:00
2f0bd8d8b0 Upgrade to SpiderMonkey 1.8.5 (fixes #734)
This was SVN commit r9852.
2011-07-16 23:24:14 +00:00
b08e142193 Graphics optimisations and features from eihrul.
Add shadow filtering (PCF) option.
Fix ugly shadow saturation in old lighting mode.
Fix fancy water shader.
Fix camera matrix computation.
Support scissoring of camera frustum.
Optimise vertex skinning.
Inline various matrix functions.
Support filtering of the list of submitted models before a rendering
pass, for more precise culling.
Optimise water renderer (fixes #721, based on patch by ortalo).
Use scissoring when generating reflection/refraction textures.
Skip reflection/refraction texture generation when no water is visible.
Render alpha-blended objects differently (fixes #434).
Reduce shadow swimming effects.

This was SVN commit r9814.
2011-07-12 23:48:05 +00:00
4663ac0fe7 split debug_assert into ENSURE and ASSERT as discussed in a previous meeting.
the old debug_assert always ran and tested the expression, which slows
down release builds. wrapping them in #ifndef NDEBUG is clumsy. the new
ASSERT behaves like assert and ENSURE like the old debug_assert. Let's
change any time-critical but not-super-important ENSURE to ASSERT to
speed up release builds. (already done in bits.h and unique_range.h)

This was SVN commit r9362.
2011-04-30 13:01:45 +00:00
8af82baf67 # Minor particle system fixes.
Support emitters that are fully running as soon as the game starts.
Fix particle clumping when moving from off-screen to on-screen, by
computing updates more incrementally.
Fix overzealous culling of models with particle emitters.
Add particles to renderer stats.

This was SVN commit r9345.
2011-04-29 12:26:31 +00:00
c82d619cc4 Make decals only rotate around the Y axis, to avoid buggy stretched appearance when rotated non-horizontally
This was SVN commit r9298.
2011-04-22 13:19:23 +00:00
012c47057a Optimise some matrix operations, based on patch from ortalo.
Fixes #750.

This was SVN commit r9141.
2011-04-01 18:33:47 +00:00
d24c93237c # Initial version of terrain decal textures.
Rejig CModel to support non-mesh-based props.
Avoid redundant recomputation for non-moving CRenderableObjects.

This was SVN commit r9055.
2011-03-13 19:22:05 +00:00
3a5ca7fdbc Improve camera restraints at edge of map to be independent of zoom, and to work on circular maps.
Fixes #573.

This was SVN commit r9011.
2011-03-04 20:02:05 +00:00
1c7e33b528 Remove a load of implicit CStr type conversions, since they're error-prone and can cause silent data loss.
Handle most CStr8/CStrW conversions via UTF-8 instead of effectively
assuming Latin-1.
Return UTF-8 strings from Xeromyces API.

This was SVN commit r8929.
2011-02-17 20:08:20 +00:00
bd3bd084c0 Support new SpiderMonkey API.
wposix: Define int8_t compatibly with SpiderMonkey.
Remove unused camera, lightenv JS interfaces.
Remove most of vector JS interface.
Remove some of the redundant JS string conversion functions.
Remove unneeded vmem, _lodBias functions.
Clean up some formatting.

This was SVN commit r8629.
2010-11-16 23:00:52 +00:00
ede71ea791 Inline common vector/matrix operations, for performance.
Remove some redundant vector methods.
Compute skinning for positions and normals simultaneously.
(These changes reduce skinning cost by >50%.)

This was SVN commit r8170.
2010-09-24 16:54:20 +00:00