Commit Graph

3149 Commits (6a0234edd5172f9eb3b2e241ef50584b92567fea)

Author SHA1 Message Date
krzys-h 6ccf32ec68 fixup! Fix code style in #1150 2018-05-07 20:28:31 +02:00
AbigailBuccaneer abeb7fceb2 Fix shadow shimmering
Shadow shimmering is a visual artefact where the outlines of shadow
mapped objects don't stay stable when the camera is moved or rotated.
The reason is that as the shadow map's origin moves, the objects
rendered to the shadow map have temporal aliasing around their edges.

The solution is to only move the shadow map in texel-sized increments.
Because the shadow map's projection is orthographic, moving the shadow
map origin in texel increments ensures that objects that aren't moving
don't show any temporal aliasing, as the position of the samples of the
object in worldspace stay the same.
2018-05-04 10:56:37 +01:00
AbigailBuccaneer 0d6fffd91f Improve shadow quality and performance in gl33
If CONFIG_QUALITY_SHADOWS is defined (which it always is) then the
fragment shader code that samples the shadow map will take five samples
in a cross shape around the point to be sampled, to apply antialiasing.

Currently, the offset of these samples is hardcoded to 0.00025× the
shadow map resolution. This is very inconsistent: if the shadow map
resolution is 128×128, then these samples are 0.032 texels apart, which
is a waste of four texture samples, and essentially means that no
antialiasing is applied. If the shadow map resolution is 8192×8192, then
these samples are 2.048 texels apart, which causes visual artefacts
around shadow edges, instead of giving smoother shadows.

The correct thing to do is to always sample exactly one texel away from
the original position. This is easy in GLSL 3.30, as it includes a
textureOffset function which offsets a texture fetch by an exact number
of texels. This is faster than manually calculating an offset ourselves,
it fixes visual artefacts at high resolutions, and it properly applies
antialiasing at low resolutions.
2018-05-02 16:30:45 +01:00
krzys-h 38a34829af Fix code style in #1150 2018-05-01 21:27:49 +02:00
melex750 a918fcabb4 Fix save/load NewScript programs for factory bots
Fixes #797
2018-04-30 13:43:03 -04:00
AbigailBuccaneer 6f6cfb136a Batch draw calls from CText to improve performance
This significantly speeds up text rendering. On my computer, looking at
the program editor with a full screen of text, this commit takes the
framerate from under 30 to 60 (hitting vsync).

Performance could be further improved in the gl33 renderer by using
instancing or glPrimitiveRestartIndex instead of glMultiDrawArrays, but
that would be a more invasive change.

All of the interface rendering could use a unified quad batching system,
instead of it being limited to CText, but that would require some
refactoring in CText as it currently draws using a different coordinate
space to the rest of the interface.

Fixes #1104.
2018-04-30 10:18:51 +01:00
AbigailBuccaneer c445d7d9a9 Add generic debug rendering functions
Currently the engine can draw debug spheres to show crash sphere
positions. This extends this to draw arbitrary spheres and cuboids,
transformed arbitrarily. With these in place it's now very quick and
easy to create a debug visualisation - for example, it's a one-line code
change to render the bounding box or sphere of every EngineObject.
2018-04-29 23:41:53 +01:00
AbigailBuccaneer 282a793a13 Improve object vis with tighter bounding spheres
This commit improves rendering performance by doing a better job of
checking whether an object is visible via its bounding sphere or not.

The engine maintains a bounding box for each EngineBaseObject that's
exactly large enough to fit every vertex. From this, it computes a
bounding sphere, and only draws objects if the sphere is within the view
frustum. Previously, the bounding sphere was always centered on the
EngineBaseObject's origin, even for models where the bounding box center
is significantly offset from the origin. Now, the bounding sphere is
always the tightest sphere which fits the bounding box.
2018-04-29 19:35:02 +01:00
AbigailBuccaneer c49c815ea5 Set uniforms less often during text rendering
We now call SetWindowCoordinates and SetInterfaceCoordinates once per
string, rather than once or twice per character.
2018-04-27 10:43:26 +01:00
krzys_h fdf67b8217
Merge pull request #1123 from B-CE/i18n
French translation update 1.11
2018-04-24 14:17:43 +02:00
krzys_h db90fcd2ef
Merge pull request #1118 from nextghost/dev
Czech translation
2018-04-24 14:17:23 +02:00
krzys_h 64ab5e3308
Merge pull request #1053 from colobot/dev-a-thing
added a thing
2018-04-24 14:13:42 +02:00
krzys_h 8b86a1f222
Merge pull request #1142 from AbigailBuccaneer/Wmissing-declarations
Compile with -Wmissing-declarations
2018-04-24 14:12:43 +02:00
krzys_h 6289ea91b1
Merge pull request #1140 from AbigailBuccaneer/Wsuggest-override
Compile with -Wsuggest-override under GCC
2018-04-24 14:12:31 +02:00
krzys_h 289b6577d5
Merge pull request #1139 from AbigailBuccaneer/clang-7
Fix building under clang-7
2018-04-24 14:12:15 +02:00
AbigailBuccaneer 4bca2b2243 Fix global sounds being positioned at camera
Certain sounds - such as those coming from the UI - aren't supposed to
sound as if they're coming from a given position. This is currently
accomplished by positioning the OpenAL source at the camera position.
This works, but if the camera position drastically moves during the
sound being played then it's possible to hear the sound fade out.

This pull request makes camera movement no longer affect global sounds,
by specifying their position as being (0, 0, 0) relative to the listener
position.

The easiest way to test this is to start a mission, press E to grab when
there's nothing in front of you, and scroll the mouse wheel quickly.
Pressing E will show the nothing-to-grab message which plays a beep
sound, and scrolling will quickly move the camera. Prior to this pull
request, the sound will fade, after this pull request it won't.

Fixes #1087.
2018-04-24 11:43:11 +01:00
krzys_h 419c430f7e
Jenkinsfile: Make colobot-lint use Clang flags 2018-04-23 19:03:38 +02:00
tomangelo2 5e8be5f6bc Better align of viewpoint UI 2018-04-23 08:12:33 +02:00
AbigailBuccaneer ea64edaa0b Compile with -Wmissing-declarations
-Wmissing-declarations enforces that every function (except for static
functions) must be declared separately before it's defined. This
essentially enforces that every function must be either static, or
declared in a header elsewhere.

This helps the optimizer, as it can do a better job of inlining if it
knows that a function won't be used outside of a given file. It also
helps -Wunused-function (which is enabled by -Wall) find more unused
functions.

Note that Clang spells this option -Wmissing-prototypes, which
confusingly is the name of a related but different warning option under
GCC.
2018-04-21 16:49:27 +01:00
krzys-h e964d3e48c Fix colobot-lint warnings 2018-04-20 02:21:12 +02:00
krzys-h 1c2bdc9cab Update license headers 2018-04-20 02:08:50 +02:00
krzys-h 9f1bd2176f Jenkinsfile: Run colobot-lint 2018-04-20 02:08:50 +02:00
krzys_h 72417fc28b
Jenkinsfile: Switch to declarative syntax
* Switch to declarative syntax
* Test parallel Windows/Linux build
* Remove some hard drive restrictions as now I have more HDD space on the server
2018-04-19 22:11:29 +02:00
AbigailBuccaneer 6978c28ee0 Compile with -Wsuggest-override under GCC
Clang by default compiles with -Winconsistent-missing-override, which
warns when a class declares virtual functions that override those in the
base class, and some but not all of them are explicitly declared
`override`.

GCC doesn't support this option, but has a stronger version,
-Wsuggest-override. In combination with -Werror, this means that any
virtual function that overrides another *must* be explicitly declared as
`override`.

This commit enables -Wsuggest-override where available. This means that
GCC users can't break the Clang build with inconsistent overrides (see
 #1113 and #1114) and consequently that any build that passes the pull
request CI build on Jenkins won't break because of inconsistent
overrides.
2018-04-19 19:58:44 +01:00
AbigailBuccaneer 5cec29f4e6 Fix building under clang-7
Currently the build fails because of -Wdelete-non-virtual-dtor warnings.
This catches when an object is destructed, has a non-virtual destructor,
and is an abstract base class or a non-final class with virtual
functions. The warning happens inside unique_ptr<T>::~unique_ptr.

The warning is to prevent somebody writing code like this:

    class MySceneEndCondition : public CSceneEndCondition {
        ~MySceneEndCondition() { /* some complex logic */ }
    };
    // this won't call MySceneEndCondition's destructor, potentially
    // leading to leaks or segfaults:
    std::unique_ptr<CSceneEndCondition> p{new MySceneEndCondition()};
2018-04-19 10:19:05 +01:00
tomangelo2 2f71cce9c9 Fix camera behaviour when switching to viewpoint 2018-04-15 00:06:04 +02:00
tomangelo2 b04d8d205b Added viewpoints feature
This allows you to set fixed viewpoints in specific location, without attaching to any object, enabling you to track the game from any location.
Proper camera handling will be implemented in next commits.
2018-04-11 21:24:20 +02:00
tomangelo2 ad6dd00275 Change new functions return type and switch to enum class
As suggested by @krzys_h
2018-04-08 23:43:22 +02:00
krzys-h 477dc0cae7 Some CBot code optimizations 2018-04-06 15:02:06 +02:00
krzys_h 0391aaf773
Merge pull request #1114 from B-CE/dev
Fix#1113 - a missing override keyword
2018-04-05 10:24:19 +02:00
B-CE da1b7e8c2d Fixes #274 : pasting tabs 2018-03-12 12:58:43 +01:00
B-CE 9c649cd8b2 Update french translation 2018-03-12 12:46:33 +01:00
B-CE 0e6d22a549 Fix clang compilation, fixes #1113 2018-03-12 12:42:22 +01:00
tomangelo2 d371338920 Fix scoreboard sorting parameters 2018-03-11 17:00:17 +01:00
tomangelo2 1b79e8409f Add switch to determine sort type
You can set it in scene file with ScoreboardSortType SortBy="Name" or "Points"
2018-03-07 21:25:35 +01:00
tomangelo2 ff0f22ef44 Sort scoreboard
First, the team with more points, then which team scored points faster
2018-03-07 15:46:30 +01:00
Martin Doucha 81b4d0e28b Add Czech translation 2018-02-24 20:39:29 +01:00
tomangelo2 5e606336ca Fixed TrackedTrainer tracks allignement 2018-02-12 15:11:14 +01:00
tomangelo2 f51f457023 Narrowed TrackedTrainer tracks
TrackedTrainers now have same width as other bots
2018-02-10 20:58:14 +01:00
Fiftytwo bd0c6d4344 Add PracticeBot helpfile 2017-12-22 17:02:37 +01:00
Fiftytwo a15b3e4dd4 Add Trainer icons 2017-12-22 16:51:25 +01:00
Fiftytwo 0fddd79501 Add PracticeBot alias detection in search() and detect() 2017-12-21 14:44:43 +01:00
Fiftytwo ca0ff013d4 Update Trainer bots 2017-12-21 01:49:56 +01:00
Fiftytwo e01a6bd0ef Add Builder documentation 2017-11-30 08:00:17 +01:00
Fiftytwo 7eb1df4119 Add aim recalibration during falling 2017-11-29 13:24:05 +01:00
Fiftytwo db23c6eecf Change Builder default camera type 2017-11-25 14:35:45 +01:00
Fiftytwo 5f8b7a8149 Update BotFactory interface 2017-11-25 12:30:16 +01:00
Fiftytwo e8b93f6cda Add Builder interface 2017-11-25 03:09:47 +01:00
Fiftytwo 614dc5e591 Builder research 2017-11-23 00:11:29 +01:00
krzys-h 7f6c0cd31e added a thing 2017-11-22 18:29:09 +01:00