Commit graph

370 commits

Author SHA1 Message Date
Kreeblah 980c03b9ae
Fix Apple Clang errors and warnings 2023-04-06 16:42:49 -07:00
Kp e3553586c1 Use enum class for bitmap_index 2022-12-31 16:21:47 +00:00
Kp 4257391a47 Use enum class for polygon_model_index 2022-12-18 18:32:14 +00:00
Kp 90d3d82d8e Default disable VR side-by-side for OpenGL ES
VR requires glDrawBuffer, which Mesa OpenGL ES does not offer.  Default
VR to disabled for OpenGL ES users.  Users who want to try it anyway can
still set use_stereo_render=1 in the SCons environment.
2022-10-09 23:15:20 +00:00
Kp 73bcfb6d63 Simplify ogl_ubitblt_i GL array initialization
- Avoid zero-filling arrays that can be directly initialized with real
  values.
- Hold color_array const so it can be stored statically.
2022-10-02 19:51:35 +00:00
Kp 8c08dcc20f Merge branch 'refs/pull/633/head' into master 2022-10-02 19:50:49 +00:00
Kp 9a8c49ccbf Fix OpenGL ES build on SDL1
The preceding commit breaks OpenGLES + SDL1 support, by referencing
SDL_GL_* constants that are new in SDL2.  Add a preprocessor guard to
skip over the new constants when using SDL1.

Fixes: c90ac3e611 ("Fix OpenGL ES build on SDL2.")
2022-10-02 19:50:32 +00:00
Kp a48e6ab56b Pass std::span to _g3_draw_tmap 2022-09-24 17:47:52 +00:00
Kp ad8325b63c Pass std::span to _g3_draw_tmap_2 2022-09-24 17:47:52 +00:00
Kp 491d23e2d9 Pass std::span to _g3_draw_poly 2022-09-24 17:47:52 +00:00
JohnnyonFlame c90ac3e611 Fix OpenGL ES build on SDL2. 2022-09-18 21:35:55 -03:00
Kp 173d5559d7 Tighten TGA generation code
- Skip reading unused alpha channel in TGA screenshot path.  The alpha
  channel is discarded, so skip even retrieving it from OpenGL.
- Perform the red/blue swap in place, instead of copying into an
  additional buffer.
2022-07-02 18:10:45 +00:00
Kp 4fd412b2ea Precompute g3_draw_line GL color data 2022-06-05 17:44:52 +00:00
Kp e54338ce4e Combine canvas+color into g3_draw_line_context 2022-06-05 17:44:52 +00:00
Kp b8ae2c5e55 Remove unused-but-set variables in ogl_texture_stats 2022-01-15 20:39:10 +00:00
Kp d2478d0708 Require support for C++17 attribute [[fallthrough]] 2022-01-09 15:25:42 +00:00
Kreeblah 5b9b353231
Added high DPI flag to SDL 2.0 builds for macOS 2021-12-22 14:26:05 -08:00
Kp 157ec66668 Remove useless cast in DXX_USE_OGLES path in ogl_init_window
This triggers a diagnostic from -Wuseless-cast.  It appears to be
unnecessary, after tracing down typedefs.  It might need to be restored
if some platform uses a definition that is neither the same type nor
implicitly convertible.
2021-12-19 19:35:11 +00:00
Kp 93e98ae71a Fix -Wold-style-cast in DXX_USE_OGLES code 2021-12-19 19:26:44 +00:00
Kp 3cca690728 Assign weakly-typed symbolic names to ogl_ubitmapm_cs special cases 2021-11-01 03:37:18 +00:00
Kp 7bb55dff22 Remove dead computations in ogl_ubitmapm_cs 2021-11-01 03:37:18 +00:00
Kp 961aae074a Remove unused ogl_ubitmapm_cs argument scale
Every caller passes `F1_0`.  Remove the argument, and propagate its
results through the function.
2021-11-01 03:37:18 +00:00
Kp 5491630142 Pass canvas to ogl_texture_stats 2021-09-19 10:53:48 +00:00
Kp aba5fce3a9 Use enum class for gr fade_level 2021-09-19 10:53:48 +00:00
Kp 8623ce3c6a Pass canvas to ogl_draw_vertex_reticle 2021-09-12 16:20:52 +00:00
Kp 48a3ac2c53 Lift ogl_start_frame eye handling into caller 2021-09-12 16:20:52 +00:00
Kp d257d032f4 Avoid reloading GL viewport unnecessarily in stereo mode 2021-09-12 16:20:52 +00:00
Kp 7f51fa3ac5 Use enum class for VR StereoFormat 2021-09-12 16:20:52 +00:00
Kp c99b67e359 Switch callers to unchecked_partial_range(range) where possible
Use unchecked_partial_range(range) instead of
unchecked_partial_range(iterator), since the range form can preserve the
underlying index_type.
2021-09-04 12:17:14 +00:00
Kp ae3dc7f934 Simplify computed color reset
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.
2021-09-04 12:17:14 +00:00
Kp 1c90863d63 Move grs_main_bitmap earlier in the header 2021-09-04 12:17:14 +00:00
Kp 73c3474f8e Reduce uses of RAIIdmem for local variables 2021-06-28 03:37:49 +00:00
Dave Milici a394bd0312 Consolidated above/below format cases for readability. 2021-05-04 08:46:26 -07:00
Dave Milici 5025cedf45 Simplified case for above/below blank interval adjustment. 2021-05-03 16:05:12 -07:00
Dave Milici ea6379de2d Add above/below option sync blank interval for external sync doubler. 2021-04-08 14:07:35 -07:00
Kp 70ef749ff4 Consolidate stereo GL calls
Reorder the logic to unify the common calls at the bottom of the
function, and skip computing anything if called in no-stereo mode.
2021-04-04 22:01:25 +00:00
Kp 426621398f Only read viewport if VR needs it for an update 2021-04-04 22:01:25 +00:00
Kp 8cc8e80eae Fix VR build failure due to implicit fallthrough
The fallthrough appears to be intentional.  Add an annotation to allow
it.

Fixes: 6bc0e822d2 ("Handle HUD overlays in separate screen rects for stereo renderings.")
2021-04-04 22:01:25 +00:00
Dave Milici 6bc0e822d2 Handle HUD overlays in separate screen rects for stereo renderings. 2021-03-17 16:30:31 -07:00
Dave Milici ca1478ea88 Relocate stereo viewport scaling at caller level outside of OGL layer.
Almost compatible size with HUD screen effects if re-enabled.
2021-03-15 20:02:22 -07:00
Dave Milici 528650c37e Use std::array for viewport/tranform params per PR suggestion. 2021-03-15 14:45:29 -07:00
Dave Milici 08b8790ad0 Remove separate left/right caches for stereo viewport + transform params.
ogl_stereo_frame() is only ever called once for selected stereo view..
2021-03-15 14:30:48 -07:00
Dave Milici ab7924e129 Relocate viewport/transform adjustments inside ogl_stereo_frame() call.
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.
2021-03-15 14:01:53 -07:00
Dave Milici fdfcb726d1 Use frustum left/right clipping for image shift instead of viewport clipping.
left/right clipping planes affected by frustum matrix term M[2][0] (8th element)
2021-03-14 11:45:37 -07:00
Dave Milici 4ca5f63b49 Use GL viewport clipping for stereo parallax image shift adjustments.
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.
2021-03-11 12:32:01 -08:00
Dave Milici 8c8b7419b6 Improved conditionals for stereo vs non-stereo modes.
Hot-key handling for cycling thru stereo modes & parallax adjustments.
Simplified stereo adjustments for left/right eye separation & offsets.
Not quite compatible yet with Bob Akka stereo method from Descent 1.5.
Function key assignments different (F5..F8) due to pre-empted hot-keys.

ALT+SHIFT+F5:	decrease eye separation (VR_eye_width)
ALT+SHIFT+F6:	increase eye separation (VR_eye_width)
    SHIFT+F5:	decrease image shift (VR_eye_offset)
    SHIFT+F6:	increase image shift (VR_eye_offset)
ALT|SHIFT+F7:	reset eye separation + image shift
ALT|SHIFT+F8:	cycle thru half-width + half-height formats

Note for compiling dxx-rebirth snapshot on MacOSX:

export CXXFLAGS=-Wno-uninitialized
scons macos_add_frameworks=False
2021-03-11 12:32:01 -08:00
Dave Milici bb903a1d80 Support stereo viewport rendering in half-height & half-width formats.
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.
2021-03-11 12:32:01 -08:00
Dave Milici 4169183342 Initial stereo rendering test in side-by-side format.
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.
2021-03-11 12:32:01 -08:00
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp b70f569178 Use enum class for OGL_TEXFILT_* constants 2021-01-17 22:23:23 +00:00