Commit graph

3275 commits

Author SHA1 Message Date
Andrei Alexeyev
8d2ee76710
replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
Andrei Alexeyev
c49357ffef
fix deprecations 2021-08-31 23:33:16 +03:00
Andrei Alexeyev
93d779df43
macrohax: make MACROHAX_CONCAT useful and simplify a bunch of macros 2021-08-31 23:33:16 +03:00
Andrei Alexeyev
f7ed0befdf
coroutine: allow omitting the args struct when declaring tasks 2021-08-31 23:33:16 +03:00
Andrei Alexeyev
cf92f499cf
macrohax: add utilities for implementing macro overloads 2021-08-31 23:33:16 +03:00
Andrei Alexeyev
d89d0896e2
macrohax: add some argument-counting macros 2021-08-31 23:33:16 +03:00
Andrei Alexeyev
373edc33ba
coroutine: deprecate NO_ARGS and enhance macros with GNU extensions
Removed dummy char fields from arg structs, as their only purpose was to
hack around silly standard preprocessor limitations. { } should now be
used instead of NO_ARGS.
2021-08-31 23:33:16 +03:00
Andrei Alexeyev
f73b1d6891
Abandon standard C conformance and require GNU extensions
Removed the use_gnu_ext option as well as fallback paths for compilers
that don't support GNU extensions. To my knowledge, none of those
compilers support C11 to a sufficient extent to compile Taisei anyway,
and those fallbacks are very poorly tested.

Pedantic warnings are now disabled, and extensions that are common to
reasonably recent versions of GCC and clang are permitted to be relied
on (list of allowed extensions TBA).
2021-08-31 23:33:16 +03:00
Andrei Alexeyev
f3fcec70f6
stage1: fix bg for "fast" and "minimal" postprocess modes 2021-08-30 18:58:13 +03:00
Andrei Alexeyev
1ae8811bc4
lasers: improve collision; move to lasers/
Moved quantization out of the draw code. The laser is now quantized once
per frame, and the segment data is used for both collisions and
rendering. Player motion is now accounted for as well, preventing
phasing through thin lasers. The overall result is more precise *and*
faster collision detection.
2021-08-25 11:58:08 +03:00
Andrei Alexeyev
20b360fbd9
geometry: rework lineseg_circle_intersect; add a few useful functions
Fixed a false negative in lineseg_circle_intersect that could occur when
the closest point lies outside the line segment, yet the segment is
still within the circle's radius. Optimized to avoid square roots. Added
functions for querying the closest point on a line segment without
distance restrictions.
2021-08-23 03:46:52 +03:00
Andrei Alexeyev
593f756a70
renderer/null: return a more sensible fake viewport value
Avoids an assertion failure in r_framebuffer_viewport_rect
2021-08-22 03:07:42 +03:00
Andrei Alexeyev
9f2a3633ad
stage: fix --frameskip 2021-08-22 03:03:55 +03:00
Andrei Alexeyev
4d1b4eb72a
lasers: new renderer based on signed distance fields (#317)
* lasers: new SDF-based renderer (WIP)

* lasers: tweak sdf_apply shader

* lasers: fix incorrect rendering at 'unlucky' resolutions

* lasers: optimize rendering of multiple lasers

Try to coalesce render passes as much as possible

* lasers: fix warning

* lasers: move rendering into a new file

* lasers: correct "time" coordinate mapping for texturing

* lasers: wrote a novel about laser rendering [skip ci]

* lasers: fux tpyo

* remove references to old laser shape shaders

* lasers: fix some rendering edge cases
2021-08-22 01:27:12 +03:00
Alice D
cbe07e53df
story: fix some typos and awkward wording (#316) 2021-08-13 20:21:13 +03:00
Andrei Alexeyev
defb32fb74
renderer: add function to retrieve the default quad model 2021-08-11 14:06:41 +03:00
Andrei Alexeyev
ebfb845863
color: add alternative data accessors for convenience 2021-08-11 14:06:39 +03:00
Andrei Alexeyev
8d0a7682af
update koishi 2021-08-11 14:04:44 +03:00
Alice D
c6a6bda159
build,ci: turn on precompiled headers for emscripten (#315) 2021-08-06 01:59:55 +03:00
Andrei Alexeyev
c3538181ed
boss: add boss_add_attack_task_with_args() 2021-07-25 14:38:15 +03:00
Andrei Alexeyev
61d2d18731
gl33: only regen auto mipmaps if texture is to be used in the next draw 2021-07-20 14:16:15 +03:00
Andrei Alexeyev
7e58ebe8b9
gl33: fix linear-to-nearest filter remapping for unfilterable textures 2021-07-19 15:10:35 +03:00
Andrei Alexeyev
9666bae1bc
Fix gcc11 warnings 2021-07-18 19:09:12 +03:00
Andrei Alexeyev
5b5767a67a
pixmap/png: shut up bogus GCC -Wclobber warning 2021-07-18 19:02:43 +03:00
Andrei Alexeyev
b4e07470d8
pixmap: refactor
* Split conversion-related code into a separate file.
* Renamed loaders to fileformat handlers.
* Added API for exporting into one of the supported file formats.
* Replaced serialization APIs with an "internal" fileformat capable of
  of storing any Pixmap. It is identical to the serialization format.
* Removed PNG writing code from video_screenshot_task, now using the new
  pixmap export API instead.
2021-07-18 18:27:38 +03:00
Andrei Alexeyev
1840c85273
stages: add empty templates for custom entity types 2021-07-18 17:52:45 +03:00
Andrei Alexeyev
edac2dfe57
camcontrol: fix -Wreturn-type 2021-07-18 11:19:17 +03:00
Andrei Alexeyev
16d00b5672
build: make -Wreturn-type an error 2021-07-18 11:18:34 +03:00
Andrei Alexeyev
d10c5d0e7e
renderer: fix gles30/webgl breakage 2021-07-18 11:16:16 +03:00
Andrei Alexeyev
a6bb29529b
stage3: delete redundant textures 2021-07-18 10:41:13 +03:00
Andrei Alexeyev
cbbaa3eb7f
renderer: Add API to dump texture data into a pixmap 2021-07-18 10:39:05 +03:00
Andrei Alexeyev
da5d45efc3
camcontrol: release mouse when window is not focused 2021-07-18 10:38:43 +03:00
Andrei Alexeyev
20ec3e62e9
gl33: fix even more texture management issues
We still can't have two incompatible samplers bound to the same
texturing unit, even if there is no texture bound to it.
2021-07-13 00:24:46 +03:00
Andrei Alexeyev
b45b2c22ce
renderer,gl33: fix texture management issues
Previously we assumed that we generally do not need to unbind textures
from shader samplers: if a sampler had no Taisei-level texture binding,
we would simply not update its OpenGL-level binding. This assumption is
no longer valid after introduction of cubemap textures. Shader samplers
always have an OpenGL-level binding to a texturing unit (0 by default).
If the sampler type is not compatible with the type of texture bound to
its texturing unit (e.g. 2D texture with a cube sampler), the draw call
will raise an error, even if the shader does not actually use the
invalid sampler.

For that reason, we now make sure that all samplers without a
Taisei-level texture binding are assigned a texturing unit with no
OpenGL-level texture binding. The texunit juggling logic had to be fixed
quite a bit to correctly handle unbinding textures.

Additionally, some assertions have been added to prevent assigning
incompatible textures to samplers via the renderer API, and the number
of minimum required texturing units has been raised to 8 (we sometimes
need more than 4 bound textures at a time).
2021-07-13 00:21:03 +03:00
Andrei Alexeyev
087f1ab0d9
renderer,texture_loader: Add support for cubemap textures
On the renderer side, the concept of a "texture class" has been
introduced. There are currently two texture classes: 2D and Cubemap.
These map to `sampler2D` and `samplerCube` in shaders, respectively.
Textures now also have an additional `layers` property. Its meaning
depends on the texture class. For simple 2D textures, there is always
only 1 layer. Cubemaps always have 6 layers, one for each face. In the
future, layers could be used to represent depth in 3D textures and
individual images in array textures.

Much of the texture loading code has been refactored, as it wasn't
adequate for loading multiple images for a single texture. Both Basis
Universal cubemaps and traditional image-based cubemaps are supported,
although no runtime preprocessing is implemented for cubemaps. The Basis
Universal format is strongly recommended.

The mkbasis utility can now convert 2:1 equirectangular panoramas into
`.basis` cubemaps with the --equirect-cubemap map.

A `vec3 fixCubeCoord(vec3 v)` function has been added to `utils.glslh`,
to convert a vector into the suitable coordinate system for sampling a
cubemap. The vector doesn't need to be normalized.
2021-07-11 18:08:00 +03:00
Andrei Alexeyev
d38c33c8a2
mkbasis: support for constructing cubemaps from equirectangular maps
Requires py360convert from pip (imported on demand)
2021-07-11 18:08:00 +03:00
Andrei Alexeyev
4bebd1ab5d
gl33: don't try to create context if SDL_CreateWindow fails 2021-07-11 18:07:37 +03:00
Andrei Alexeyev
687e347ef1
compat: fix another name clash with windows headers 2021-07-10 21:28:01 +03:00
Andrei Alexeyev
ad9228e0a0
stage3: restructure into a folder-based layout
It's an absolute mess, but should make integrating stage3_revamp easier…
2021-07-10 03:24:07 +03:00
Andrei Alexeyev
4c203ed0bf
camcontrol: crude hack to hide all entities 2021-07-09 22:56:07 +03:00
Andrei Alexeyev
efdaf51928
stage3d: add free camera control tool for debugging 2021-07-09 22:56:07 +03:00
Alice D
e9a9b1f002
ci: Small fixes for the Emscripten test builders. (#308) 2021-07-09 03:54:10 +03:00
Alice D
7955529bfd
build,ci: Bump emsdk to 2.0.25, rework separate check for tot (#304) 2021-07-02 14:03:28 +03:00
Andrei Alexeyev
f9add8c657
pixmap: fix pixmap_source_path()
It was modifying its const char* argument instead of the copy
2021-06-27 12:03:07 +03:00
Andrei Alexeyev
9bb51687c3
renderer/api: workaround for ASan false positive 2021-06-27 12:02:29 +03:00
Andrei Alexeyev
c1f36bf0a5
common_tasks: fix common_easing_animate
Make it actually arrive at the target value
2021-06-23 05:30:43 +03:00
laochailan
2e5000299f
stage4: SSR water effect
Co-authored-by: Andrei Alexeyev <akari@taisei-project.org>
2021-06-19 02:28:24 +03:00
laochailan
d724d7d997
move easing_animate to common tasks 2021-06-19 02:28:19 +03:00
Andrei Alexeyev
8fed29ca68
projectile: fix warnings 2021-06-18 17:07:51 +03:00
Andrei Alexeyev
659ed15e43
Fix some issues found by clang static analysis 2021-06-18 16:11:00 +03:00