1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-25 17:53:47 +00:00
Commit graph

532 commits

Author SHA1 Message Date
fgenesis
4c941419b4 ensure that texcoords are always updated when changing things that affect them 2023-10-20 02:42:52 +02:00
fgenesis
f1796475f1 undo parts of prev commits; move old fudge from font atlas code to tile rendering.
this should now be correct and much simpler to maintain from now on.
downside is that it breaks the appearance of quads with tex repeat on,
but i don't think anyone ever used this ever since i've added the Lua functions;
so i'm just calling it broken in older versions and move on.
2023-10-20 02:06:45 +02:00
fgenesis
b33080b0ea remove immediate mode from quad rendering. breaks a couple rendering details too. WIP. 2023-10-20 00:37:00 +02:00
fgenesis
a4ea66761b fixes to SceneEditor, some more things are working again 2023-10-20 00:35:25 +02:00
fgenesis
4013a9c09b working on quad repeat, this probably breaks it but will continue later 2023-09-13 23:39:22 +02:00
fgenesis
db8912cb16 Merge branch 'tile-optimization' of github.com:AquariaOSE/Aquaria into tile-optimization 2023-09-10 20:34:09 +02:00
fgenesis
8d49e62428 SceneEditor: hovering tiles works again 2023-09-08 19:23:03 +02:00
fgenesis
f1656d2fbc small clarification in framebuffer, no functional change 2023-08-26 02:09:44 +02:00
fgenesis
048a787cb1 get rid of beforeScaleOffset 2023-08-26 00:58:47 +02:00
fgenesis
c959b9f6d6 don't need to set line width again and again 2023-08-26 00:31:46 +02:00
fgenesis
a111bfc17f use VBO to render tile borders
Also fix oversight in DynamicGPUBuffer::drawElements(); first wasn't used
2023-08-26 00:14:05 +02:00
fgenesis
cc78b300cc Cleanups and fixes to AfterEffect
- fully uses RenderGrid now, no more immediate mode
- remove RippleEffect because it was unused
- Don't render the grid if no effects are active. Sames some GPU time.
- Fix ShockEffect math, broken 2 commits ago
2023-08-25 21:49:16 +02:00
fgenesis
c1084a022d forgot a virtual dtor 2023-08-25 20:14:30 +02:00
fgenesis
2f7dd87d8b fix IBO generation...oops 2023-08-25 14:07:25 +02:00
fgenesis
71f9120c30 rework AfterEffect to use RenderGrid instead of its own thing 2023-08-25 14:07:11 +02:00
fgenesis
3c48349e94 remove tiny unused things 2023-08-25 01:57:28 +02:00
fgenesis
7e040ea354 tile repeat with grid effects works again 2023-08-25 00:40:14 +02:00
fgenesis
f9a91e87e4 Move CombinedRenderAndGPUState up one level 2023-08-25 00:39:35 +02:00
fgenesis
d31d320719 set GL textures to always repeat to avoid unnecessary calls to glTexParameteri()
Shouldn't have any visual changes because edge clamp is never actually used
2023-08-25 00:38:36 +02:00
fgenesis
17452f175e tiny fixes to VBO 2023-08-25 00:35:27 +02:00
fgenesis
6a7aa66bab splinegrid: allow changing point size to better acommodate very large or very small textures 2023-08-22 21:28:05 +02:00
fgenesis
368271c40e More work on tile rendering:
- Use indexed triangle rendering, no more GL_QUADS for tiles
- Fix aquarian text on maps
- Tile tex repeat mode works again

Known broken:
- Editor
- Tile repeat with grid effects
2023-08-09 02:41:04 +02:00
fgenesis
395ff079e9 Experimenting with GL debug context and GL_ARB_debug_output 2023-08-09 02:34:12 +02:00
fgenesis
ff035a37fa fix some asserts 2023-08-01 22:39:48 +02:00
fgenesis
e27a031229 Get rid of GL functions with double precision that were accidentally used
# Conflicts:
#	BBGE/OpenGLStubs.h
2023-08-01 22:39:34 +02:00
fgenesis
defaa60850 don't quadruple overdraw points in grid debug render 2023-08-01 20:46:55 +02:00
fgenesis
2993145f2a "3" is not a valid internalformat for glTexImage2D() 2023-08-01 20:46:35 +02:00
fgenesis
704981dd00 initial support for static vertex buffers. TileRender uses that now. 2023-07-20 23:11:18 +02:00
fgenesis
e9e81e5ef9 "3" is not a valid internalformat for glTexImage2D() 2023-07-20 22:28:20 +02:00
fgenesis
bc3dfdb9a3 don't quadruple overdraw points in grid debug render 2023-07-20 22:27:50 +02:00
fgenesis
16235a4ad1 Get rid of GL functions with double precision that were accidentally used 2023-07-18 18:59:09 +02:00
fgenesis
7768bf3059 unnecessary file 2023-07-18 18:58:18 +02:00
fgenesis
3ac706f1b6 Fix support for vertically flipped tiles
Turns out there was another renderer bug that would effectively
ignore the vertical flip if a Quad had an active ElementEffect that
used a grid (effects on numpad keys 1,2,3,5,6).
2023-07-18 18:57:54 +02:00
fgenesis
1da28ec40a fix tile repeat, works now 2023-07-14 05:21:16 +02:00
fgenesis
9b1c3bba18 rendering optimizations; work towards making the transition to VBOs eventually 2023-07-14 04:25:59 +02:00
fgenesis
ab218ceca6 tiles are now culled 2023-07-14 01:33:59 +02:00
fgenesis
bd5b2b3495 Rework + optimize map tile storage & rendering, initial working draft.
class Element is completely gone.
(The files are still there but no longer compiled in. Will delete later)

Broken still:
- support for vertical flip
- the editor
- culling
2023-07-14 00:19:33 +02:00
fgenesis
e8c405cd9e more drafting for tile redering optimization
This is the last commit before the old Element class gets ripped
2023-07-11 22:30:28 +02:00
fgenesis
0818fbcdb4 fix worldmap selected tile not rendering properly 2023-07-11 04:39:55 +02:00
fgenesis
6686080ddb invert two x,y loops for more efficient grid updating 2023-07-11 03:49:49 +02:00
fgenesis
976ce8ff3e split grid rendering off from Quad, to a new RenderGrid class 2023-07-10 17:23:19 +02:00
fgenesis
0f0f3e9023 fix typo that never loaded tileset idx 0 2023-07-10 16:28:04 +02:00
fgenesis
c09098e13c wip towards Element draw refactor; still using old render path 2023-07-10 02:29:21 +02:00
fgenesis
4b52730be2 Fix parallax horizontal flip rotation bug, but now maps are wrong
Unfortunatelx maps were designed with this bug present,
and now tile rotation on parallax layers is wrong for flipped tiles.
This also affected background fish swarms and anything that
was on a parallax layer and flipped horizontally.
Need to fix maps next...

See also: commit 76ba2b1211
2023-07-03 19:00:12 +02:00
fgenesis
aaed341569 Cleanup underwater checks, fix rectangular water bubbles
Long/thin rectangular nodes were not handled correctly,
because it would only check the nearest waterbubble node
for overlap, not all on the map.

+ Lua func: isUnderWater(x, y, radius)
2023-06-23 15:05:05 +02:00
fgenesis
5e75bc486c fixup core resource (un/re)load 2023-06-23 14:27:41 +02:00
fgenesis
825670f651 More fixes for breakage introduced in 70b8dcdc3a:
- fix typo that broke repeat-scale loading
- fix broken tile effects loading
- fix randomly shuffled world map tiles (as textures were loaded in a random order)
- reload tileset on editor reload (because we want to edit textures duh)
2023-06-02 01:32:37 +02:00
fgenesis
478857f149 Quad texture coords are never interpolated, make those a normal Vector 2023-06-01 20:24:14 +02:00
fgenesis
fc76b2de12 fix hidden checks, oops
Turns out any part of the hierarchy can be hidden, not just the parent.
Esp. the game menu does this.
2023-06-01 20:19:37 +02:00
fgenesis
d740aa06e1 very slightly more verbose loading 2023-06-01 12:59:07 +02:00
fgenesis
d1cbc6f783 support loading *.qoi images
Now png/qoi/jpg are supported, and some subset of tga
because we need that to load zga files for savegame thumbnails
2023-05-31 18:07:55 +02:00
fgenesis
dc5d385864 remove self-refs (core->...) in Core 2023-05-31 17:40:41 +02:00
fgenesis
fd1ac85af3 remove pointless self-refs (dsq->... and core->...) in DSQ 2023-05-31 17:37:20 +02:00
fgenesis
7041143ef8 Texture loading, part 2: make TextureMgr work with special paths; some fixes
Ie. explicit relativs paths (./) or absolute paths that are not part of
the regular texture search dirs

Also forgot to clear a free()'d pointer.
2023-05-31 17:12:14 +02:00
fgenesis
4e632f9f6c BmpFont usage is now a ref instead of a ptr, const-ify glfont 2023-05-31 17:08:52 +02:00
fgenesis
69ae4bdb20 Fix uninitialized glLineWidth() when rendering nodes; use green color for nodes that have a script
That would explain why nodes were drawn with thin lines whenever DebugText was on screen...
2023-05-31 17:06:33 +02:00
fgenesis
9cd9601485 Drop textures when no longer needed
Textures used to be unloaded as soon as they were unreferenced.
The TextureMgr cache keeps an active reference to prevent load-unload-load
cycles so it only unloads things when explicitly asked.
This does require some more peak VRAM during map/tileset transitions
especially, since old textures are unloaded only after the next map
has been loaded, but the shortened load times should be worth it.
2023-05-31 01:36:50 +02:00
fgenesis
70b8dcdc3a Rework texture loading, part 1
Major code/logic cleanups + it has a multithreaded batch mode now.
The VFS code doesn't like multiple threads at all,
so for now there's a big lock in front of where it matters.
Changed precacher, map/tileset, and worldmap loading to batched mode.

Still TODO:
- fix broken mod preview images
- reloading resources on debug key
- make mod recache entirely unnecessary
- actually drop resources when no longer needed
2023-05-31 00:55:16 +02:00
fgenesis
1100e286a6 don't spam log when bone not found 2023-05-30 00:41:16 +02:00
fgenesis
c7c9cae999 remove semi-broken editor tile alignment functions and related code 2023-05-25 17:54:38 +02:00
fgenesis
74ad8f7804 Build fixes for Linux, some warnings and compatibility fixes for C++17 and up 2023-05-25 16:58:08 +02:00
fgenesis
d2c0e3e241 Add Lua func bone_getCollisionMaskNormal()
This repurposes the (now, after the prev commit) unused Bone::getCollisionMaskNormal()
2023-04-18 01:54:12 +02:00
fgenesis
640f08af13 simplify bonelocking, add Lua functions
- does no longer depend on collision mask
- remove global Game::lastCollideMaskIndex
- remove the horribly convoluted and now unused RenderObject::getInvRotPosition()
+ Lua func entity_getBoneLockDelay()
+ Lua func entity_setBoneLockDelay()
2023-04-18 01:42:21 +02:00
fgenesis
0a3f57486b Simplify RenderObject::followCamera math, remove branches, cleanup followCamera related code.
It also appears that a RenderObject is always on a layer when rendered.
Assert this in the code. This saves some extra branches.
2023-03-05 21:25:59 +01:00
fgenesis
81bfcb2f65 more precise comment 2023-03-02 03:42:39 +01:00
fgenesis
28766f0d5a make RenderObject::followCamera not modified during rendering
This takes out the last of the RenderObject mutables.

This also fixes the long-standing editor bug that map tiles
that are once moved to parallax layers and then back to a
normal layer keep their scroll factor until the tile is deleted
or the map saved and reloaded.
2023-03-02 03:41:00 +01:00
fgenesis
76ba2b1211 make RenderObject::rotation not modified during rendering, simplify duplicated code 2023-03-02 03:29:04 +01:00
fgenesis
f4147b99c4 make RenderObject::scale not modified during rendering 2023-03-02 02:19:48 +01:00
fgenesis
7a5a5feb39 make RenderObject::position not modified during rendering; small cleanup 2023-03-02 02:12:32 +01:00
fgenesis
ed98a3328e anim editor: allow to select anim by name (no more hammering PgUp/PgDown!) 2022-11-18 01:52:46 +01:00
fgenesis
92ab459736 Improve some skel anim edge cases; warning fixes. Also new Lua function.
+ entity_setAnimationTime()
2022-11-16 22:46:56 +01:00
fgenesis
96f28702e4 fix anim editor not generating keyframes for newly inserted bones.
broke this during my recent anim editor work, oops
2022-11-13 12:29:11 +01:00
fgenesis
288fb6b7fa fix crash when saving skel after bones were removed 2022-10-12 18:59:25 +02:00
fgenesis
cc1530b5e5 eliminate one gigantic global float->uint->float roundtrip cast
whyyyy
2022-09-25 06:02:22 +02:00
fgenesis
58e9ba340e Add skel/bone gridDrawOrder attrib to control the way the gris is drawn
Also ignore grid.z (used as worldmap alpha) by default because it's really
only needed for the world map and ignoring it results in less GL calls.
2022-09-25 04:30:38 +02:00
fgenesis
cfa5d45932 render: remove one mutable hack, border color is now per-quad 2022-09-24 04:57:08 +02:00
fgenesis
e47d253945 fix derp in 4c52a147b0 2022-09-23 18:21:36 +02:00
fgenesis
575a83abd6 Initial implementation of bspline support in the animation editor 2022-09-23 18:10:44 +02:00
fgenesis
4c52a147b0 harden SimpleIStringStream against user errors and kill operator bool()
Like this:
  size_t x;
  if(is >> x) {...}
This used to return true despite x never being populated, because
is was casted to bool, which is fine to shift by uninitialized, and
likely returned true. Whatever.
2022-09-23 18:09:26 +02:00
fgenesis
b74c5a2986 Invert Quad::renderGrid() draw loop to be more cache friendly 2022-09-14 05:36:46 +02:00
fgenesis
4b64147914 MSVC optimizer doesn't like refs to primitive types 2022-09-14 05:21:25 +02:00
fgenesis
a1005dafe2 Make Bone::ANIM_* a bitmask. This also changes Lua constant ANIM_ALL from 10 to 3. 2022-09-14 05:20:37 +02:00
fgenesis
8e979e0e05 simplify Quad::drawGrid 2022-09-14 05:11:56 +02:00
fgenesis
29fd4ec44e clean up interpolators; WIP towards bspline support in anim editor 2022-09-13 18:38:44 +02:00
fgenesis
55689228bf Attempt to fix crash when instantiating Core alone but this is definitely not enough 2022-09-12 00:12:41 +02:00
fgenesis
0afd09dc75 bspline wip more 2022-09-05 17:19:34 +02:00
fgenesis
214590742d wip splines 2022-09-04 17:16:35 +02:00
fgenesis
a494a3f411 ignore mouse motion events generated by SDL_WarpMouse().
Also fix bug that mouse.change got stuck on a tiny value and constantly
move the camera in editor mode.
This is a continuation of 764d106d50 and seems to fix the
previous issues with SDL2 >= 2.0.17

Also remove some unused vars.
2022-08-24 14:16:25 +02:00
fgenesis
9e2c640b51 attempt to fix crash when loading a saved game on a map with an already collected health upgrade
This problem might have been introduced in 06270eaac0 but not sure.
The crash could happen due to a use-after-free memory access:
When deleting an entity with skel in postInit(), deletion would be
delayed by 1 frame because that is how entity_delete() works.
During deletion, RenderObject::children were removed and deleted
but SkeletalSprite::bones still had those pointers.
Additionally an object would delete its children in onUpdate() after
safeKill(), and still proceed to run scripts, which would then possibly
access freed memory too.
This fix causes children to not be deleted until we're out of the update()
cycle, and instead delete children together with the root object.
2022-07-18 23:00:22 +02:00
fgenesis
d7ff053efd Rewrite SceneEditor level generation and skinning, use light pink to designate areas that should not be skinned
This also fixes a long-standing off-by-one with the generated ObsRows:
Before this commit, the game would (upon F11) eat every black pixel from
the map template that was directly left of a white pixel, eg.
#### ## # ## ... would become
###  #    #  ...

GENERATED MAPS ARE NOW DIFFERENT!
With this bug gone, dumping obs (F8) and loading that back in as a map
template (F11) should now be fully round-trip compatible and not lose
pixels anymore.

Extra feature:
(R>=200, G in [128..199], B>=200) in the map template now designate zones
that should not be obstructed but also not generate border rocks when
skinned (F12). Makes editing energy temple styled maps much easier since
we don't have to manually erase tiles on layer "5" anymore, all the time.
2022-07-06 08:59:55 +02:00
fgenesis
71ceac4d22 oops 2022-07-02 21:04:18 +02:00
fgenesis
cfba5d7d4a update RenderObject::gravity like the rest of the InterpolatedVectors 2022-06-20 18:39:08 +02:00
fgenesis
614f987df2 Make Game::fillGridFromQuad() and RenderObject::getInvRotPosition() use glm instead of the GL matrix stack 2022-06-20 18:36:49 +02:00
fgenesis
baa1170e6f remove RenderObject::isPieceFlippedHorizontal() + tiny cleanup 2022-06-20 17:46:37 +02:00
fgenesis
21c51e06cb git gud 2022-06-20 04:35:51 +02:00
fgenesis
f01db61292 show better errors when we fail to start up 2022-06-20 04:25:18 +02:00
fgenesis
60dd1d7bc7 fix build on osx? 2022-06-19 03:59:54 +02:00
fgenesis
e960b238be revert part of 72f2b44620, now rendering of entities that are just simple quads is ok again 2022-06-10 03:51:26 +02:00
fgenesis
72f2b44620 Tiny simplification in render pass logic 2022-06-09 02:32:19 +02:00
fgenesis
a2e7e4a670 undo prev. commit and fix this properly. i'm just blind. 2022-06-06 01:41:50 +02:00