Commit graph

152 commits

Author SHA1 Message Date
Andrei Alexeyev
bc4924ac59
stagedraw: disable face culling for 2D rendering
It's never needed, and sometimes we have to re-enable it e.g. for blast
particles. This lets those cases batch together with other sprites.
2024-10-04 16:27:28 +02:00
Andrei Alexeyev
cef9524068
boss,stagedraw: improve overlay draw order 2024-10-04 16:27:28 +02:00
Andrei Alexeyev
7f570d2338
renderer/common/sprite_batch: remove string fields from SpriteParams 2024-09-22 21:18:31 +02:00
Andrei Alexeyev
85eff81c7f
resources/shader/fxaa: don't rely on magic _SIZE uniform 2024-08-30 11:52:47 +02:00
Andrei Alexeyev
4ebd7ba14b
gl33: remove trailing [0] from array uniform names 2024-08-30 11:52:47 +02:00
Andrei Alexeyev
b81f338d2d
stageobjects: add type-based macros for acquiring from/releasing into the correct pool 2024-06-05 21:58:58 +02:00
Andrei Alexeyev
13ace0e5c0
memory/mempool: refactor to avoid storing object size and alignment in struct
Works similarly to DYNAMMIC_ARRAY(type)
2024-06-05 21:16:02 +02:00
Andrei Alexeyev
05168ac2d7
memory/mempool: rename from objectpool 2024-06-05 18:35:08 +02:00
Andrei Alexeyev
8b37d1cbf2
src: the great #include massacre of 2024 2024-05-17 14:11:48 +02:00
Andrei Alexeyev
be7905d6a3
src: run upkeep 2024-05-17 04:58:47 +02:00
Andrei Alexeyev
aff16937e8
stagedraw: add stage_draw_is_initialized() API 2024-04-29 00:42:33 +02:00
Andrei Alexeyev
8f8ca2beca
all: use min/max macros; avoid some unnecessary conversions 2023-09-28 17:43:14 +02:00
Andrei Alexeyev
c2810e228d
all: use re()/im() macros 2023-09-28 17:43:14 +02:00
Andrei Alexeyev
b8ad5f7099
stage: massively boost all-clear bonus
Depends on PIV, current score, and difficulty
2023-09-07 21:50:56 +02:00
Andrei Alexeyev
b26e3b8d24
stagedraw: fix stage_draw_hud_score() signature 2023-07-30 06:22:14 +02:00
Andrei Alexeyev
9051769586
global,stage: remove global.timer
Not used anymore
2023-05-26 00:58:32 +02:00
Andrei Alexeyev
9a476f58e2
resource/font: lots of text rendering improvements
* Consistently use floats in the API and internally; don't round stuff
  arbitrarily.
* Use freetype's "normal" hinting algorithm.
* Implement subpixel positioning to avoid bad glyph spacing at small
  font sizes.
* Improved border control: inner and outer borders can be adjusted
  separately and per-font. (The "inner border" affects the "highlight"
  effect used in some shaders (blue channel)).
* Fix borders causing all glyphs to be misaligned (shifted down-right)
  by a constant offset.
* Various other improvements.
2023-05-12 08:29:26 +02:00
Andrei Alexeyev
9dade8ad33
resource: lifetime management redesign (WIP) 2023-04-29 20:01:50 +02:00
Andrei Alexeyev
ad295005db
resource: more consistent API function names 2023-04-29 20:01:50 +02:00
Andrei Alexeyev
00408b62d0
stagedraw: simplify copydepth pass via r_framebuffer_copy
On top of being less code, this is a tiny bit more efficient.
2023-04-10 06:47:55 +02:00
Andrei Alexeyev
3dc0faec9e
renderer/api: rename ClearBufferFlags to BufferKindFlags 2023-04-10 06:47:55 +02:00
Andrei Alexeyev
57a08d4c7a
replay/demoplayer: automatic "demo" playback when idling in menus
Currently the game comes with no demos; place your own replays into
$userdir/resources/demos if you want to test this.
2023-04-07 16:08:50 +02:00
Andrei Alexeyev
df6b97caf7
stageobjects,objectpool: simplify and reimplement on top of arenas
All pools now allocate from the same arena that is initialized once with
8MB of initial space and never deallocated, only reset between stages.
2023-04-07 16:08:49 +02:00
Andrei Alexeyev
b6978178b1
memory: use custom memory allocation wrappers
Introduces wrappers around memory allocation functions in `memory.h`
that should be used instead of the standard C ones.

These never return NULL and, with the exception of `mem_realloc()`,
zero-initialize the allocated memory like `calloc()` does.

All allocations made with the memory.h API must be deallocated with
`mem_free()`. Although standard `free()` will work on some platforms,
it's not portable (currently it won't work on Windows). Likewise,
`mem_free()` must not be used to free foreign allocations.

The standard C allocation functions are now diagnosed as deprecated.
They are, however, available with the `libc_` prefix in case interfacing
with foreign APIs is required. So far they are only used to implement
`memory.h`.

Perhaps the most important change is the introduction of the `ALLOC()`,
`ALLOC_ARRAY()`, and `ALLOC_FLEX()` macros. They take a type as a
parameter, and allocate enough memory with the correct alignment for
that type. That includes overaligned types as well. In most
circumstances you should prefer to use these macros. See the `memory.h`
header for some usage examples.
2023-01-18 13:23:22 +01:00
Andrei Alexeyev
3c7283f1c7
player: refactor power handling
Separate concepts of "stored" and "effective" power.
2022-10-03 20:53:22 +02:00
Andrei Alexeyev
b0578cad61
stagedraw: experimental boss zoom shader tweak 2021-12-17 14:40:25 +02:00
Andrei Alexeyev
c27e54c890
stagedraw: render background to a 16-bit float buffer
This allows storing HDR colors
2021-10-29 16:12:40 +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
Andrei Alexeyev
173c8c3cc6
replay: general refactor
* Split replay.c into multiple files under replay/; improve logical
  separation of replay-related code.
* Separate replay playback state from data.
* Get rid of global static replay struct and avoid unnecessary replay
  copying.
* Replay playback and recording are now independent and may occur
  simultaneously, although this functionality is not yet exposed. This
  enables replay "re-recording" while synthesizing new desync check
  events, possibly at a different rate from the original replay.
* Rate of recorded desync check events can now be controlled with the
  TAISEI_REPLAY_DESYNC_CHECK_FREQUENCY environment variable. The default
  value is 300 as before.
* Probably other stuff I forgot about.
2021-06-16 01:43:10 +03:00
Andrei Alexeyev
23f623a6a1
boss: misc cleanup; use events to identify attack state 2021-05-19 03:52:07 +03:00
Andrei Alexeyev
a5fd6fe5d9
Texturing overhaul: GPU compression, sRGB sampling, swizzles, etc. (#240)
* WIP compressed textures, swizzles, sRGB sampling, ...

* refactor texture type info & fix random bugs

* fix preprocessing of sRGB textures

* handle y-flipped basis textures

* glcommon: better WebGL compat for compressed format detection

* missed WEBGL_compressed_texture_pvrtc

* implement compressed texture xcoding and uploading

* Add basis_universal submodule

* Reorganize texture loader code

Clean up some code
Isolate Basis Universal loader into a separate module

* Add wrapper script for encoding .basis textures

* basisu: honor custom metadata written by the mkbasis.py script

* mkbasis.py: add --incredibly-slow and --dry-run

* Move pixmap code from util/ to pixmap/

* Add an on-disk transcode cache for basis textures to speed up loads

* Compress texture cache with zlib

* Use readable format names for basisu cache filenames

* basisu: mip bias test code

* basisu: small caching cleanup

* add TAISEI_BASISU_MIP_BIAS env variable

* Improve OpenGL format matching heuristics

* Document considerations for compressed format priority

* Remove dead code

* Enable two forgotten formats, BC3_RGBA and ATC_RGBA

Also prefer BC7 over BC1/BC3

* Recognize GL_ANGLE_compressed_texture_etc for ETC2 textures

* Default depth buffers to 24-bit; remove ANGLE hack

* Fix glcommon_check_extension for GLES2/legacy gl

* Add renderer feature bit for texture swizzle masks

* glcommon: Fixup internal formats for GLES2

Sized internal formats are not allowed in GLES2

* Fix emscripten compile errors

* Update basis_universal

* remove more dead code

* revert irrelevant stage4 change

* shut up UBSan

* basisu: shut up some debug spam

* Add normalmap sampling helper to util.glslh

* basisu: add a gray-alpha mode

* mkbasis.py: Abort if image dimansions aren't multiples of 4

* Add basic Basis Universal encoding documentation (WIP)

* doc/basisu: Add paragraph about modes; minor tweaks

* basisu: workarounds for GL texture size requirements

* gles20: fix uncompressed sRGB formats

* Partial workaround for missing swizzles in gles2 and webgl

* remove invalid assertion

* New renderer API to expose glDrawBuffers-like functionality

* stagedraw: disable all color outputs for copy_depth pass

required for WebGL compatibility

* support GL_ANGLE_request_extension

* emscripten: include *.basis in gfx package

Also fix a potential problem when more than one .pkgdir is used to
construct emscripten packages

* Don't rely on emscripten runtime to enable webgl extensions
2020-08-15 14:51:12 +03:00
Andrei Alexeyev
f329a9f016
Extended enemy properties
ENEMY_IMMUNE is now deprecated. Spawning an enemy with ENEMY_IMMUNE hp
sets up the new flags field to match old behavior. The hp value itself
has (almost) no special meaning anymore.
2020-07-09 15:25:57 +03:00
Andrei Alexeyev
89ecc0c55e
Establish more-or-less consistent resource getter functions
Deprecate old ad-hoc stuff like get_sprite, r_texture_get, etc.
2020-06-09 04:33:22 +03:00
Andrei Alexeyev
ee3bec1c22
Replace .obj models with .iqm (#232)
http://sauerbraten.org/iqm/

The iqms were converted from the objs with the official iqm "compiler",
but can be also exported directly from Blender with a script from the
SDK.

In addition, indexed rendering was fixed (it's not useless anymore), and
the winding order convention changed from counter-clockwise to clockwise
to facilitate faster model loading.

A limited subset of IQM functionality is currently supported:
	- One mesh per model.
	- Only floating point data in vertex arrays.
	- Only standard vertex arrays: positions, UVs, normals,
	tangents.
	- No animations etc.

The "standard" shader interface now receives an additional vec4 tangent
attribute. This attribute is currently ignored by shaders. The bitangent
vector can be computed in a vertex shader as:
	vec3 bitangent = cross(normal, tangent.xyz) * tangent.w;

* iqm: remove axis scrambling and re-export models

* remove debug stuff
2020-06-06 18:27:08 +03:00
Andrei Alexeyev
930d735740
boss: disable hurtbox when dying or fleeing
closes #180
2020-06-01 14:01:00 +03:00
Andrei Alexeyev
7072fe447d
Revamp screen shake system (#225) 2020-05-16 23:42:22 +03:00
Andrei Alexeyev
bd5082c0f0
Get rid of float32 and float64 typedefs
Use plain float and double when precision matters. There's no way to
consistently enforce usage of the typedefs now.
2020-05-09 09:25:38 +03:00
Andrei Alexeyev
f5f8f9fb49
Get rid of custom min() and max() functions
Use the standard fmin() and fmax() for floating point values, and ours
imin(), imax(), umin(), umax() for integers.
2020-05-09 09:16:07 +03:00
Andrei Alexeyev
9bcaa36634
Revamp boss distortion effect 2020-04-28 03:53:27 +03:00
Andrei Alexeyev
a7eb246664
Purge some dead code 2020-04-28 00:13:15 +03:00
Andrei Alexeyev
a9775c065b
Store sprite texture coords in normalized form 2020-04-25 05:36:48 +03:00
Andrei Alexeyev
3fc75a4bbd
Add stage_add_static_framebuffer
Register a stagedraw-managed framebuffer with static size
2020-04-25 03:04:33 +03:00
Andrei Alexeyev
e16e2184a3
Refactor entity system (#214)
* Smarter generic entity macros

The list of "core" entities is now defined in one macro, and hardcoded
_Generic dispatch tables are eliminated

* Get rid of "custom" entities

All entities are now "first-class". The list of known entity types has
been moved to known_entities.h. The system no longer needs to know the
definition of all entity structs.

* Refactor guts of ENT_BOX/ENT_UNBOX

Made the functions inline, Box::ent is now a proper pointer type (but
please don't use it directly), ENT_UNBOX returns NULL if the box is
"empty" (references NULL entity)

* Merge TASK_BIND_UNBOXED with TASK_BIND

* s/YoumuMyon/YoumuAMyon for consistency
2020-04-17 10:18:53 +03:00
Andrei Alexeyev
cdcea06ba6
stagedraw: add postprocessing events 2020-04-13 14:27:57 +03:00
Andrei Alexeyev
b6a6496c39
Coroutinize ReimuB (#205) 2020-03-25 08:52:18 +02:00
Andrei Alexeyev
4aa6ba5b3f
Extra stage background prototype 2020-03-04 22:26:50 +02:00
Andrei Alexeyev
8aad971114
clear up some ancient 3D confusion 2020-02-22 08:56:41 +02:00
Andrei Alexeyev
80b1026d08
Don't redefine standard complex macro; use a new cmplx typedef
This also introduces `float32`, `float64`, and `real` typedefs to be
used in place of `float` and `double` later. `real` is for game code and
other places where we don't particularly care about the precision and
format of the underlying type, and is currently defined to `double`.
`float32` and `float64` should replace `float` and `double` respectively
2019-11-22 05:38:48 +02:00
Andrei Alexeyev
9d3bf87559
Refactor matrix stack API to get rid of matrix mode (#177)
This replaces the r_mat_foo functions with specialized r_mat_{mv,tex,proj}_foo counterparts that operate explicitly on the modelview, texture, and projection matrix stacks respectively.
2019-10-12 15:02:15 +03:00
Andrei Alexeyev
b14b8493d4
Optimize text drawing
This adds a lower-level sprite batching API intended to reduce overhead
of bulk sprite submissions when it is known that no pipeline state needs
to be changed in-between individual sprites.
2019-10-03 02:49:10 +03:00