Commit Graph

597 Commits (5041aa377d04622d32a1cf494d6671d13b6909d1)

Author SHA1 Message Date
tomangelo 5041aa377d
Merge pull request #1156 from AbigailBuccaneer/redundant-shadowmap-renderbuffer
Don't create a color renderbuffer for shadow map
2018-07-23 12:14:45 +02:00
krzys-h 12cf57409c Support more buttonX.png files in other places than just buttons 2018-05-10 11:24:59 +02:00
AbigailBuccaneer c027b54add Don't create a color renderbuffer for shadow map
When rendering the shadow map offscreen using framebuffer objects, it's
not necessary to create a color renderbuffer. Currently
FramebufferParams only lets you choose between a renderbuffer and a
texture for both color and depth attachments. This changes that, and now
you can ask for a texture, a renderbuffer, or nothing.

This improves performance. On my computer, with an 8192x8192 shadow map,
this improves overall frame time by 8.0%.
2018-05-09 17:25:52 +01:00
krzys_h 182c4c5cbf
Merge pull request #1154 from AbigailBuccaneer/shadow-shimmering
Fix shadow shimmering
2018-05-07 20:53:28 +02:00
krzys_h a54f65f71b
Merge pull request #1152 from AbigailBuccaneer/consistent-shadow-antialiasing
Improve shadow quality and performance in gl33
2018-05-07 20:53:21 +02:00
krzys_h 50ed675acd
Merge pull request #1150 from AbigailBuccaneer/debug-rendering
Add generic debug rendering functions
2018-05-07 20:53:12 +02:00
krzys_h f146d2885b
Merge pull request #1149 from AbigailBuccaneer/tighter-visibility-checking
Improve object visibility culling with tighter bounding spheres
2018-05-07 20:53:00 +02:00
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
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
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
immibis 8b0ccf6667 Fix horizontal scrolling of background images. 2017-08-05 20:08:00 +12:00
immibis 2e8798b33d Make planets stay in one place in the sky - at least in the X direction. 2017-08-05 20:08:00 +12:00
immibis 2751db3245 Add horizontal FoV to CEngine 2017-08-05 19:45:08 +12:00
krzys-h d860a08d21 Merge long first frame rendering fix from #898
Also did some changes to make sure the "F1 to open SatCom" appears immediately (not after 0.1s),
and that mission timer won't start ticking in the first simulation frame (mainly for code battle initial pause)
2017-06-04 13:10:50 +02:00
krzys-h 4faabf2185 Apply shadow mapping performance counter patch from #923 2017-06-03 21:11:18 +02:00
Abigail f4614658cf Fix -Wundefined-var-template warning (#963)
This avoids specializing CSingleton<T>::m_instance for each type, and
instead just defines it once in the header. This is allowed by the
standard, multiple definitions are merged in the same way that inline
functions are.
2017-05-29 20:46:11 +02:00
krzys-h 02aa281d30 Remove unnecessary m_instance declarations
They don't do anything at all in gcc and clang, but cause compile errors in MSVC
see #955
2017-05-24 14:00:34 +02:00
krzys-h 648dfd75c4 Fix handling of particle 'father' objects when they are destroyed 2017-05-23 20:31:55 +02:00
krzys-h 2d7911f155 Fix delete() in CBot not destroying PowerCells properly 2017-05-23 20:19:47 +02:00
Abigail 11d950221b Fix all compiler warnings and enable -Werror (#955)
This removes all compilation warnings on:
* g++ 4.7.4, 4.8.5, 4.9.4, 5.4.1, 6.3.0, 7.0.1-svn246759
* clang++ 3.9.1, 4.0.0, 5.0.0-svn303007
2017-05-22 11:10:35 +02:00
krzys-h 6bebbb3f70 Fix sky rendering artifact 2017-05-18 19:03:19 +02:00
krzys-h f6cc629054 Log correct terrain relief resolution 2017-05-18 18:32:22 +02:00
krzys-h 880f31a7c6 Add basics of scoreboard implementation; better support for multiple teams 2017-05-17 18:22:58 +02:00
krzys-h 6cd72543c4 Fix amount of damage from OrgaShooters
I messed it up in previous commit, 0.002/2 is 0.001 not 0.0005 :P
2017-04-29 13:18:01 +02:00
krzys-h fda58a6008 Change bullet collision logic to allow for collisions with non-damageable objects
For now, you have to add bulletWall=true to objects you want bullets to collide with.
It's ugly but will work for now. This is needed mostly for compatibility
with exercises which use barriers to block movement but not bullets.

I also made the collision checks run more often because otherwise the bullets
would sometimes miss the objects (but only visually)
2017-04-29 13:14:10 +02:00
piotrwalkusz1 6ec13017eb Fix apperance camera position, closes #802 (#880) 2017-01-02 18:43:19 +01:00
Tomasz Kapuściński 9bdd83771e Optimizations and changes in OpenGL 2.1 device.
* Limited number of lights to 4
* Only directional lights
* Per-pixel lighting
* Improved dynamic shadows a bit
2017-01-02 16:35:40 +01:00
Tomasz Kapuściński 7bb3245092 Optimizations and changes in OpenGL 3.3 device.
* Limited number of lights to 4
* Only directional lights
* Per-pixel lighting
* Improved dynamic shadows a bit
* Optimized texture changes
2017-01-01 17:16:54 +01:00
krzys-h 88c6818cfd Fix code style issues 2016-11-26 13:48:12 +01:00
krzys-h 3bac0aabd9 Fix buffer overrun when rendering goto() debug texture, closes #841 2016-11-11 17:26:37 +01:00
krzys-h 6e4764b97c Fix GroundSpot blending, closes #846 2016-11-11 17:06:53 +01:00
Tomasz Kapuściński e7c41ae9e6 Correction in changing wrap mode in SetState 2016-11-10 13:00:42 +01:00
Tomasz Kapuściński 9fe85e280a Code simplification in CGL14Device 2016-11-10 12:34:30 +01:00
Tomasz Kapuściński 993d9e9ed6 Added rendering with generic vertex formats 2016-11-04 14:13:16 +01:00
Tomasz Kapuściński ae3b2b8572 Added types and vertex format specification 2016-11-04 11:59:57 +01:00
krzys-h 3472ec6613 Revert CParticle::CheckChannel changes
I misinterpreted this as being a bug, while actually it seems to be an explicit CParticle design choice (maybe not the best one, but whatever). We DO need better docs for some old code like this :/

Fixes #806

This reverts commit 99a831a03b.
2016-09-27 18:34:54 +02:00
MrSimbax 92b1e544ec Remove default lambda parameters
They cause compilation error on MSVC and should give errors, as it's explicitly stated in the C++11 standard: http://stackoverflow.com/questions/6281472/why-does-a-default-argument-for-a-lambda-argument-trigger-a-pedantic-gcc-warni
2016-08-18 10:02:54 +02:00
krzys-h c03d8beb8b Import documentation from old dev wiki
I also updated all outdated information I could find, please tell me if I missed something

Model format documentation needs an update
2016-08-05 17:04:16 +02:00
krzys-h dbe7fd6ef0 Added performance counter for UI particles 2016-07-24 18:19:37 +02:00
krzys-h ffd688e2d7 Do not render the shadow map when pause blur is active 2016-07-24 16:56:47 +02:00
krzys-h 2c3e90b126 Added CBot performance counter 2016-07-24 16:36:13 +02:00
krzys-h 5fea22ff03 Moved performance counters to a separate class 2016-07-24 16:18:25 +02:00