gr_find_closest_color did not need it. Remove it. For the others,
resetting the count is sufficient. There is no need to reset the
individual elements.
The SDL_mixer library has already been instructed, via Mix_Volume, to
scale the volume of sounds on all channels, by an amount based on
digi_volume. There is no need to manipulate the effective distance of a
particular sound to further scale it by digi_volume. Even if this
second scale was needed, it was done incorrectly, because it was only
applied when the sound was started, but not re-applied when the sound's
volume was updated due to positional changes. As a result, any sound
which was updated would switch to an unscaled version. Sounds which
were never updated, such as those attached to the viewer object, would
retain their original scaled volume.
Update the implementation of digi_mixer_set_channel_volume to call
Mix_SetDistance in the same way as digi_mixer_start_sound, for
readability and consistency.
Add RAII wrappers for unmounting PHYSFS paths. Use them in places that
previously handled unmounting explicitly. Also, use it for descent.hog
/ descent2.hog, which previously were left mounted indefinitely.
The fallthrough appears to be intentional. Add an annotation to allow
it.
Fixes: 6bc0e822d2 ("Handle HUD overlays in separate screen rects for stereo renderings.")
Note since ogl_stereo_frame() is only ever called once per ogl_start_frame()..
ogl_end_frame() instance, only the active stereo eye view needs to be handled.
Implies that separate left/right viewport/transform caches are redundant.
Equivalent to legacy Descent 1.5 pixel shift methods for stereo formats.
Since Descent is rendering viewpoint differences for left/right eyes,
pixel shifting via display viewport is sufficient adjustment.
Since OGL layer here is essentially handling display output surfaces,
the OGL projection transform is not useful for stereo parallax effects
as when used for 3D scenes.
Enable stereo mode when launched via -gl_stereo option.
GL_STEREO quad buffering may not be available unless OGL layer
supports stereo pixel format descriptors.
Half-height viewport rendering for above/below format.
Half-width viewport rendering for side/by/side formats.
HUD & cockpit elements disabled when stereo views active.
OGL layer used for rendering surfaces, so using left/right viewports absent stereo quad buffers.
Using legacy Descent +/- eye offset method for left/right stereo perspective rendering passes.
fbd05a1592 dropped an include of "jukebox.h" as unnecessary. jukebox
was almost unnecessary, but jukebox includes physfsx, and physfsx
includes stdexcept. stdexcept is necessary. Include stdexcept
directly.
Fixes: fbd05a1592 ("optimize include files (include what you use)")
PHYSFSX_isNewPath retrieves from PhysFS a list of all paths, then
searches them, and frees them at the end. PhysFS can search its own
list without needing the allocations, so delegate the work to it.
Rebirth built with OpenGL has a hard dependency on the GL utility
library, but did not have a configure time test to report this. Add
one.
Reported-by: shoober420 <https://github.com/dxx-rebirth/dxx-rebirth/issues/468>
Define separate enum values for rotation data in both the high bits,
where it is usually kept, and the low bits, where it is sometimes used
for math or comparisons.
Define an enum value to represent the composite of the index and the
rotation, since the composite is not suitable for use as an array
subscript. Add helper functions to extract the component pieces.
Normally, this shouldn't matter, and on almost all
OpenGL drivers out there, it really doesn't, but
the Raspberry Pi 4's "V3D" Mesa driver behaves
differently: It simply won't draw any lines as long
as GL_CULL_FACE is enabled, so we need to disable
it.
Similar to 09eff19a66, _g3_draw_poly can
store the control information on the stack to avoid an allocation, since
the total size is bounded and relatively small.
Similar to 09eff19a66, _g3_draw_tmap_2 can
store the control information on the stack to avoid an allocation, since
the total size is bounded and relatively small.