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.
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.
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.
-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.
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.
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()};
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.