Commit Graph

847 Commits

Author SHA1 Message Date
608c27fe10 Exact stack rooting for structured cloning functions.
Refs #2415
Refs #2462

This was SVN commit r15597.
2014-08-01 20:55:16 +00:00
07653c9a70 Fixes crash when generating random maps.
We must not be in a request when calling the ScriptInterface destructor.

This was SVN commit r15572.
2014-07-27 18:17:16 +00:00
64efbfeae3 Fixes small memory leak introduced in 28bdd8540f.
Thanks to leper for pointing it out.

This was SVN commit r15569.
2014-07-26 23:09:24 +00:00
28bdd8540f Quite a lot of stack rooting related changes.
Changes GetProperty, SetProperty and HasProperty and a few other
functions to take handles. The conversions to CScriptVal or
CScriptValRooted at some places should be removed in the future. I've
done that to avoid an even larger patch.

Refs #2415
Refs #2462

This was SVN commit r15568.
2014-07-26 22:33:16 +00:00
17634d7507 Move the minimap to only use the shader pipeline. Should make it OpenGL ES compatible (untested).
This was SVN commit r15533.
2014-07-14 17:15:22 +00:00
8b45f453e5 Fix non-PCH build.
This was SVN commit r15498.
2014-07-06 16:35:41 +00:00
991d5bbd63 Fix random maps for my water changes. Fix the replay mode after I had broken it. Fix an occasional crash (that might have crashed Atlas, need someone to check).
Improve debugging slightly in case of framebuffer errors. Fix a few
style issues.

This was SVN commit r15486.
2014-07-04 09:03:21 +00:00
326290463e Further WIP water improvements. Add 3 different textures for different looks. Update some oasis maps for that. Streamline water settings (some removed, some added). Update Atlas for those (needs to be tested). Fix an issue with HQ water effects.
Please report any issue and/or crash. Those will get fixed in commits to
come. Refs #48.

This was SVN commit r15484.
2014-07-03 20:07:15 +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
343066040f Remove inconsistent checks for pSimulation2 when saving maps and ensure that it is set.
Remove commented out code writing triggers that has nothing to do with
the actual triggers implementation.
Free memory that was allocated for error reporting when when fork()
fails.
Remove dead initialization.

This was SVN commit r15477.
2014-07-01 19:00:41 +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
567917bf41 Give RMS access to the simulation templates. Fixes #1589. Patch by Itms.
This was SVN commit r15306.
2014-06-07 12:12:53 +00:00
e6b8339103 Minor optimisation for non-animated units.
This was SVN commit r15266.
2014-06-01 18:25:20 +00:00
1882f28504 New unit renderer.
Instead of each CCmpVisualActor rendering itself individually, collect
all the units in a single CCmpUnitRenderer. This avoids the overhead of
doing Interpolate/RenderSubmit calls every frame for every object in the
world. It also allows more efficient culling.

CCmpUnitRenderer knows the positions of each object at the start and end
of each turn, and computes the bounding sphere of the object along that
path. That allows quick culling without recomputing the precise
interpolated transform every frame. (In the future it could be improved
much more.)

Clarify and clean up the sending of PositionChanged messages, and add
new InterpolatedPositionChanged.

Remove the forceFloating parameter from GetInterpolatedTransform, since
it doesn't fit the new design. Replace it with a (non-synchronised) flag
in CCmpPosition.

Move construction progress from CCmpVisualActor to CCmpPosition, so that
it consistently affects all position/transform computation.

Refs #2337.

This was SVN commit r15265.
2014-06-01 18:24:50 +00:00
ceb3c3d366 MapReader: Load terrain before entities.
This allows component Init functions to make use of the terrain
immediately, instead of delaying some computations until the first
frame.

This was SVN commit r15262.
2014-06-01 18:08:11 +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
e79adae921 Attempt to work around LOS texture alignment bug.
For unknown reasons, sometimes glTexSubImage2D acts as if
GL_UNPACK_ALIGNMENT = 2 or 4, instead of 1. This causes the odd-sized
array uploaded for the LOS texture to be interpreted incorrectly, and
the LOS texture gets rendered very incorrectly.

Pad the array to a multiple of 4 in all cases, so that
GL_UNPACK_ALIGNMENT shouldn't affect it.

Hopefully fixes #2594.

This was SVN commit r15216.
2014-05-25 13:30:39 +00:00
3014df2280 Disable wireframe mode in ranked games. Fixes #2401.
This was SVN commit r15050.
2014-04-28 05:02:20 +00:00
7acdde5c86 Changes tests to use global g_ScriptRuntime instead of creating a new JSRuntime for each test.
The tests crashed on my Debian systems but not on my Ubuntu system.
The crash happened in line 142 of SpiderMonkey's ThreadLocal.h.

I know that I had to use a workarounnd for contexts to avoid destroying
the context that was created first. I also had in mind that in newer
versions a JS_Init function got introduced which presumably solves this
kind of issues.
Based on this experience I assumed runtimes could have a similar problem
and this patch indeed fixes the issues.
Unfortunately the correct usage of JSRuntimes in that regard is not
documented.
There's only a rater misterious comment in JSAPI.h which hasn't been
cleared up so far and is most likely completely outdated
(https://bugzilla.mozilla.org/show_bug.cgi?id=992641).

This was SVN commit r14995.
2014-04-25 21:19:51 +00:00
833c2bac7a save/restore camera position and orientation in saved games, fixes #2354
This was SVN commit r14905.
2014-04-06 16:27:57 +00:00
e9e05f4efc Second (main) commit for the SpiderMonkey upgrade.
This commit contains all the required changes to our source files and
build scripts (hopefully).
A next commit will remove the old stuff of SpiderMonkey 1.8.5.

Spcial thanks to:
 - H4writer who helped a lot mainly with the performance issues we
had/have, but also with other problems or questions.
 - Leper for the review.
 - Historic_bruno for implementing the build scripts on Mac OS X and
testing on the Mac.
 - The people from the #jsapi channel and from
mozilla.dev.tech.js-engine who answered a lot of questions and helped
solving problems.
 - All the other people who helped

Refs #1886
Fixes #2442
Fixes #2416

This was SVN commit r14877.
2014-03-28 20:26:32 +00:00
ef888367aa Cleanup tex_codec, fixes #2456, patch by IronNerd.
This was SVN commit r14836.
2014-03-13 04:16:20 +00:00
a5639631ee Texture system refactoring and cleanup, fixes #2455, patch by IronNerd.
This was SVN commit r14835.
2014-03-13 02:37:05 +00:00
937ee8f77c Fixes clang "hidden overloaded virtual function" warning, patch by Echelon9, fixes #2388
This was SVN commit r14674.
2014-01-26 01:20:34 +00:00
d0e57cb0ff Change a few things to avoid warnings with gcc. Should fix #2359
This was SVN commit r14529.
2014-01-06 22:14:27 +00:00
15ec863aec Substantial speed-up of the foam generation code.
Remove waves for now as they were unsatisfactory.
Removes "shininess" as a water parameter as it was basically useless.
Add a button in Atlas to recompute water parameters so you can now see
fog in Atlas.

Fixes #1743, #1803 (invalid)
Refs #1875, #2114, #48.

This was SVN commit r14514.
2014-01-05 16:15:20 +00:00
d4b2c1285c add the ability to exclude props from the selection size + add aura visualisation rings again
This was SVN commit r14497.
2014-01-04 10:41:32 +00:00
4b1297b328 Removes g_ScriptingHost and implements global to compartment 1 to 1 relation.
Each GUI Page gets its own compartment and all ScriptInterfaces in the
same thread should now use the same JS Runtime.
This is required for the SpiderMonkey upgrade.
Check the ticket for details.

Closes #2241
Refs #1886
Refs #1966

This was SVN commit r14496.
2014-01-04 10:14:53 +00:00
b1c081e36d Set svn:eol-style=native, fix some inconsistent line endings
This was SVN commit r14299.
2013-12-06 00:42:50 +00:00
5f8b6be833 Some additions to the particle system:
This was SVN commit r14286.
2013-12-04 17:21:59 +00:00
acf1c420c1 Moves management of GL viewports to CRenderer, letting it store the current viewport; calling code can retrieve and restore it later (instead of using deprecated glPush/PopAttrib, previously removed for GLES compatibility by 7dec618898)
This was SVN commit r14235.
2013-11-28 00:57:39 +00:00
0170db4a53 Adding advanced graphical features into random maps. Fixes #2262.
This was SVN commit r14170.
2013-11-14 14:33:55 +00:00
e58fa107cc Fix skeleton caching.
This was SVN commit r14163.
2013-11-13 20:05:57 +00:00
7dec618898 Some attempts to fix GLES build in smooth LOS and post proc manager.
Replaces glBegin/End with glDrawArrays, GL_QUADS with GL_TRIANGLES, and
replaces glPush/PopAttrib by resetting the viewport manually.
Adjusts GLSL shaders for these changes.

This was SVN commit r14152.
2013-11-12 01:30:17 +00:00
5771bee032 First pass at fixing GLES build - more to come
This was SVN commit r14149.
2013-11-12 01:17:16 +00:00
0682c23fe3 Replaces BGRA textures with RGBA textures supported by GLES
This was SVN commit r14148.
2013-11-12 01:11:08 +00:00
3c47b12cbe Display texture memory usage in profiler's renderer stats
This was SVN commit r14116.
2013-11-09 01:03:23 +00:00
024dd82209 Fix non-PCH build
This was SVN commit r14024.
2013-10-19 01:11:20 +00:00
ac335f37c8 Fix some Clang warnings about unused private members
This was SVN commit r14023.
2013-10-19 00:53:58 +00:00
701508922f Use CStrIntern for font names to reduce lookup cost
This was SVN commit r14020.
2013-10-18 16:15:42 +00:00
91169c82c7 Optimise rendering of scrollable text boxes by clipping
Add optional clipping rectangle to CTextRenderer. Strings that are
printed
outside the vertical extent of the clipping rectangle will be
immediately
skipped. This greatly reduces the cost of large scrollable text boxes.

This was SVN commit r14019.
2013-10-18 16:05:02 +00:00
751558d894 Optimise text rendering by batching
When CTextRenderer is given multiple strings with no differences other
than position, render them in a single glDrawElements call to reduce
driver overhead.

Also avoid some unnecessary copies of std::wstrings.

This helps performance a bit with large GUI text boxes.

This was SVN commit r14018.
2013-10-18 16:02:48 +00:00
b6c7c0d799 Optimise glyph lookup in text renderer
std::map lookup was a major cost when rendering large amounts of text.
Replace it with a more efficient 2-level array.

This was SVN commit r14017.
2013-10-18 15:56:12 +00:00
5778484a77 Refactor text renderer
Replace unifont with CFont and CFontManager, since the h_mgr interface
was
needlessly inconvenient.

Load the font textures through CTextureManager, to support dynamic
reloading (e.g. when resetting GL state - see #741).

Add CFontMetrics as a convenient wrapper for code that just wants to
measure text.

Fixes #1117.

This was SVN commit r14016.
2013-10-18 15:53:07 +00:00
8799bd98b0 Support 8bpp textures
When textures.xml specifies format="alpha", the input is expected to be
an
8-bit greyscale PNG, and the output will be an 8-bit uncompressed
alpha-only DDS.

Add format override to CTextureProperties, to select between e.g.
GL_ALPHA
and GL_LUMINANCE for 8-bit textures.

This is needed so fonts can use the new texture system.

This was SVN commit r14015.
2013-10-18 15:36:31 +00:00
7901ed51d4 Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.

This was SVN commit r13938.
2013-10-04 02:29:16 +00:00
e700937fd3 Fix non-SSE x86 builds
This was SVN commit r13934.
2013-10-03 18:22:10 +00:00
c2583e42da Reduce memory allocations in the renderer
Use an arena allocator in ShaderModelRenderer::Render, to reduce
the allocation cost in STL containers.

Avoid unnecessary copying of std::vectors.

This was SVN commit r13911.
2013-09-29 14:48:11 +00:00
eceae8be5c Fix crash when setting rally point
This was SVN commit r13908.
2013-09-29 14:02:47 +00:00