Commit graph

3504 commits

Author SHA1 Message Date
Zack Middleton
c1ab47a764 Rename client-config.json based on CLIENTBIN
Also make viewing client.html directly use client-config.json in the
same directory so it's possible to "live edit" both the files without
having to run make.
2024-06-11 04:40:08 -04:00
Zack Middleton
7bfd5c90b8 Add support for mods to web client
ioquake3.html?fs_game=missionpack will run Team Arena when not using
--preload-file.
2024-06-11 04:40:08 -04:00
Zack Middleton
2660bb4a03 Add support for overriding basegame to web client
List files for multiple games in a single client-config.json file so
that com_basegame argument can pick different game data.

Use ioquake3.html?com_basegame=demoq3 (or tademo) to run the Quake 3 or
Team Arena demo. They require new QVMs from baseq3/missionpack to run.
2024-06-11 04:40:08 -04:00
Zack Middleton
8365ea7ed2 Customize the web client HTML file
Modify the client HTML file when copying it to the build directory to
apply current CLIENTBIN and BASEGAME. It always loads engine/data from
the current directory (no need to try to locate the build directory).
2024-06-11 04:40:08 -04:00
Zack Middleton
e6c0776d98 Allow web client to use unzipped QVMs
Compile the QVMs and automatically uses them when not using --preload-file.
2024-06-11 04:40:08 -04:00
Zack Middleton
41ec9ae05f Make emscripten --preload-file opt-in 2024-06-11 04:40:08 -04:00
Zack Middleton
ab8f7eb0bd Clean up emscripten in Makefile
- Remove emscripten build steps from Makefile (see readme)
- USE_CURL=0 has no effect
- HAVE_VM_COMPILED=false has no effect
- WebGL 1 and 2 are supported by the OpenGL2 renderer
- FULL_ES2 (client-side arrays) isn't needed
- Rename EMSCRIPTENOBJ to GENERATEDTARGETS and separate it from
  TARGETS so it's more readable.
2024-06-11 04:40:08 -04:00
Zack Middleton
b14c5a3d9c Add BUILD_RENDERER_OPENGL1 to disable opengl1
Have emscripten disable BUILD_RENDERER_OPENGL1 instead of hardcoded to
disable opengl1 client.
2024-06-11 04:40:08 -04:00
Zack Middleton
198c92b9f8 Add DEPEND_MAKEFILE to disable rebuild on Makefile edit 2024-06-11 04:40:08 -04:00
James Darpinian
e0ce0ceea0 Add Emscripten to README 2024-06-09 22:10:52 -04:00
James Darpinian
14a4278cdb Add GitHub Actions workflow for web/Emscripten 2024-06-09 22:10:52 -04:00
James Darpinian
1f9cbddf37 Speed up GitHub Actions with -j 2024-06-09 22:10:52 -04:00
James Darpinian
f2169ed0b4 Support debug Emscripten build 2024-06-09 22:10:52 -04:00
James Darpinian
9348dbf643 Silence compiler warnings 2024-06-09 22:10:52 -04:00
James Darpinian
6fe061c36e Fix build when specifying PLATFORM=emscripten manually instead of using emmake 2024-06-09 22:10:52 -04:00
James Darpinian
2765cd5398 Get rid of "Nothing to be done for _.zip" message 2024-06-09 22:10:52 -04:00
James Darpinian
db24dfe13f ioquake3.html replaces Emscripten-generated HTML shell
This enables several things:
* Optionally load pk3 files from a web server at runtime instead of bundling them with Emscripten at build time
* Set command line arguments via URL param
* It's not ugly
2024-06-09 22:10:52 -04:00
James Darpinian
e247b316a7 Rebuild every target if Makefile changes 2024-06-09 22:10:52 -04:00
James Darpinian
37d78b6279 Add .vscode and baseq3 to gitignore 2024-06-09 22:10:52 -04:00
Zack Middleton
413be19a8d Add -ffast-math for emscripten to match other platforms
Co-authored-by: James Darpinian <jdarpinian@gmail.com>
2024-06-09 22:10:52 -04:00
Zack Middleton
25a680ab6e Allow building for emscripten with "emmake make"
Co-authored-by: James Darpinian <jdarpinian@gmail.com>
2024-06-09 22:10:52 -04:00
Zack Middleton
17cadb5369 Fix using emscripten 3.1.27+
emscripten 3.1.27 reduced the stack size from 5MB to 64KB. This caused
run-time errors: Uncaught RuntimeError: index out of bounds

Co-authored-by: James Darpinian <jdarpinian@gmail.com>
2024-06-09 22:10:52 -04:00
Zack Middleton
6f5c038947 Use BASEGAME for emscripten assets 2024-06-08 23:28:09 -04:00
Zack Middleton
4fc059b940 Fix emscripten build directions 2024-06-07 19:11:40 -04:00
Zack Middleton
f41bd37fde Add minimal emscripten support 2024-06-06 20:51:44 -04:00
Zack Middleton
f869bffe97 OpenGL2: Fallback to OpenGL ES if OpenGL fails 2024-06-06 19:49:17 -04:00
Zack Middleton
551fa6c797 OpenGL2: Fix issues running under WebGL 2024-06-06 19:49:17 -04:00
Jack Slater
980147721a
Merge pull request #664 from zturtleman/opengles2 2024-06-05 17:33:16 -10:00
Zack Middleton
98b9008c0d OpenGL2: Use CPU vertex animation if too few vertex attributes
OpenGL ES has a minimum of 8 vertex attributes while desktop OpenGL has
a minimum of 16. Vertex animation uses attributes 10 to 12.
2024-06-05 21:36:48 -05:00
Zack Middleton
b25a3c6e4d OpenGL2: Add run-time support for unsigned short indexes
OpenGL ES 2 is only required to support unsigned short for indexes.
2024-06-05 21:36:05 -05:00
Zack Middleton
3b984d2b51 OpenGL2: Add OpenGL ES 2.0+ support
This mainly targets OpenGL ES 2.0 but it also supports compiling GLSL as
ESSL 3.00. It's missing support for framebuffer objects which should be
possible on ES 2. (Though using renderbuffers instead of textures.)

opengl1 cvars that are not supported will display a message and disable
the cvar. This has not been reviewed for new opengl2 cvars. Enabling
cvars may cause rendering issues. Some of the broken cvars may be
possible to support using OpenGL ES 3 features.

The game displays okay with the default cvars.
2024-06-05 21:33:08 -05:00
Zack Middleton
1fc83e4845 Update macOS version for GitHub CI
macOS 11 runner image is scheduled to be removed next month.
2024-05-20 15:16:04 -04:00
rilysh
735d987303 Makefile: fix compilation on FreeBSD 2024-05-18 12:48:44 +01:00
Alan Zhao
aecf3f55ce
Use nanosleep(2) instead of usleep(3)
usleep(3) was declared obsolete in POSIX.1-2001 and removed in
POSIX.1-2008 and nanosleep(2) was recommended to be used instead.
2024-05-15 18:14:52 -04:00
Jack Slater
60dfabbeb7
Update SECURITY.md 2024-04-18 08:45:56 -10:00
Zack Middleton
5a918bfa96 opengl1: Fix skybox in OpenGL 1.1
Fix six image skybox having a black border around the sides of the sky
when using OpenGL 1.1 (using CL_CLAMP instead of GL_CLAMP_TO_EDGE).

It's technically visible in q3dm10 but it's more obvious in Team Arena
maps such as mpteam6.
2024-04-18 00:04:33 -04:00
Zack Middleton
f9547e4533 OpenGL2: Don't mix drawing to default framebuffer and FBO
Don't draw the world scene to a separate FBO from the rest of the
screen.

This fixes the world scene having HOM instead of seeing through to the
previously drawn content. World of Padman uses this to have a separate
3D scene for the sky and world in wop_padship for dynamic skybox.

This also makes r_ext_framebuffer_multisample apply to HUD models
instead of depending on r_ext_multisample (which doesn't work on Linux
with some Intel graphics).
2024-03-02 06:09:59 -05:00
Zack Middleton
2cd1a7ef4a Fix GitHub Actions CI deprecation warnings 2024-02-26 13:28:57 -05:00
Zack Middleton
7d711f8121 Fix running on Windows XP
Newer mingw-w64 changed default Windows version compatibility.
Need to specify older behavior for EnumProcesses() to avoid "missing
K32EnumProcesses()" runtime error.
2024-02-17 17:01:44 -05:00
Zack Middleton
9881c561ad OpenGL2: Fix flares behind mirror being visible
When r_ext_framebuffer_multisample > 0 was used, flares behind the
mirror in q3tourney6 were incorrectly visible. This was because it
checks scene depth in the depth prepass which only drew opaque
surfaces. It also needs to contain depth for mirror/portal surfaces.
2024-02-13 09:11:35 -05:00
Zack Middleton
5d60f6035a OpenGL2: Fix hack for tcMod transform on merged lightmaps
When using merged lightmaps, only change tcMod transform for tcGen
lightmap.
2024-02-10 16:23:54 -05:00
Zack Middleton
e3abcffeb0 OpenGL2: Fix using merged lightmaps with tcGen environment
tcGen environment generates texcoords in range of 0.0 to 1.0 and they
need to be offset to the position/size in the merged lightmap atlas.

This also needs to be after tcMods so they apply for the original range.
This fixes tcMod scale used by main_q3abanner and shinygrate1_4.

This issue was visible on the blue monitor (comp3c) near the plasmagun
in q3dm0 and the Quake III Arena banner in q3dm17.

Affected shaders in Quake 3 and Team Arena maps:

textures/base_wall/comp3
textures/base_wall/comp3b
textures/base_wall/comp3b_dark
textures/base_wall/comp3c
textures/base_wall/main_q3abanner
textures/base_wall/shinygrate1_4
textures/sfx/teslacoil

All of the shaders are used by q3dm0 but other maps also use some.
2024-02-10 16:23:54 -05:00
Zack Middleton
eaefa35580 OpenGL2: Fix merged lightmap hacks to have real lightmap index
This fixes the texcoord range to be 0.0 to 1.0 for external lightmaps in
shaders that also have an internal lightmap. (Instead of 2.0 to 3.0 for
example.) This only affects clampMap as repeating wrapping sampled the
correct location. I haven't found such a shader but I need to get real
lightmap index for future merged lightmap hacks.
2024-02-10 16:23:54 -05:00
Zack Middleton
7426ac2176 OpenGL2: Fix sun rays being affected by the viewport size
Using r_drawSunRays 1, r_hdr 0, cg_viewsize 50 caused the sun rays to
only draw properly in the bottom right quarter of the world viewport.

The scissor rectangle for the world viewport was applied to the first
FBO_FastBlit() in RB_SunRays().

Set glScissor() in FBO_FastBlit() as it's done in FBO_Blit() and
FBO_BlitFromTexture(). Sun rays probably worked correctly with r_hdr 1
because the blit for HDR changed the scissor state.
2024-02-08 16:34:05 -05:00
Zack Middleton
93abc60a5b OpenGL2: Fix applying tcMod turb
Shader stage tcMods for matrix and turb effects need to be applied in
order for turb to be correct and all tcMod turb need to be applied
instead of only the last one.

Quake 3's textures/liquids/slime1 had tcMod turb and then tcMod scale.
OpenGL2 applied the matrix first and then turb which had the wrong result.
2024-01-18 03:16:39 -05:00
Zack Middleton
5ede35d8dd Fix building QVMs on Linux with Windows line endings
On non-Windows, compiling QVM tools failed if dagcheck.md had CRLF line
endings and compiling QVMs failed if game source had CRLF line endings.

Also made Windows open the files as binary (no automatic CRLF to LF) so
it behaves the same as on non-Windows.
2023-12-26 23:26:47 -05:00
Zack Middleton
b07ff2a3ca OpenGL2: Fix parsing q3gl2_sun without two additional tokens
If mapLightScale and shadowScale weren't included at the end of
q3gl2_sun, the next shader line was skipped by SkipRestOfLine().

COM_ParseExt() with allowLineBreaks=qfalse, returns "" once and
then goes to the next line anyway. (Doesn't work well multiple
"optional" tokens. It looks like a vanilla bug.)
2023-12-23 14:31:47 -05:00
Zack Middleton
ae0878ca61 OpenGL2: Fix q3map2 lightstyles effects
Fixes World of Padman wop_trashmap.

For r_mergeLightmaps 1
- Fix tcMod transform on "map $lightmap" stages
- Fix external lightmap image texcoords if shader also has an internal
  lightmap

For r_sunlightMode 1
- Fix "tcGen lightmap" stages with blendFunc GL_SRC_ALPHA GL_ONE being
  converted to white image + modulate lightmap and drawing incorrectly
2023-12-23 14:31:47 -05:00
Zack Middleton
972635ea5a OpenGL2: Fix updating the loading screen with r_cubeMapping 1
Generating cubemaps set backEnd.viewParms.isMirror = qtrue while the
loading screen said 'loading... maps/q3dm1.bsp' and it just stayed like
that until done loading (no additional messages or item icons) because
all 2D drawing was culled due to flipped culling for isMirror.

This was noticed because a recent commit fixed RB_ShowImages() to be
drawn to the screen instead of draw into renderFbo and never blit to
the screen. Now the loading screen draws over it as expected.

Mentioned commit: a81df34905
"OpenGL2: Fix border for cg_viewsize using HDR/FB-MSAA w/postProcess"
2023-11-22 21:11:41 -05:00
Zack Middleton
03bc4eb810 OpenGL2: Fix FB-MSAA on AMD Windows driver
Fix r_ext_framebuffer_multisample > 0 causing the screen to always be
solid black when using AMD Windows driver.

The AMD Windows driver requires binding renderbuffer for it to be valid.
The OpenGL2 renderer uses GL_EXT_direct_state_access that shouldn't
require this. It would be required for Core/GL_ARB_direct_state_access.
It seems like a driver bug.
2023-11-20 18:30:12 -05:00