Commit Graph

25 Commits

Author SHA1 Message Date
Bill Currie 26330d0fcb [scene] Update the empty world for the new mnode_t
This gets my qwaq-x11 test scene working again (and makes use of a plane
at infinity, yay PGA).
2022-05-23 01:33:21 +09:00
Bill Currie 7240d2dc80 [model] Move plane info into mnode_t, and visframe out
The main goal was to get visframe out of mnode_t to make it thread-safe
(each thread can have its own visframe array), but moving the plane info
into mnode_t made for better data access patters when traversing the bsp
tree as the plane is right there with the child indices. Nicely, the
size of mnode_t is the same as before (64 bytes due to alignment), with
4 bytes wasted.

Performance-wise, there seems to be very little difference. Maybe
slightly slower.

The unfortunate thing about the change is the plane distance is negated,
possibly leading to some confusion, particularly since the box and
sphere culling functions were affected. However, this is so point-plane
distance calculations can be done with a single 4d dot product.
2022-05-22 12:41:23 +09:00
Bill Currie d3965af2ae [scene] Improve directional light handling
While it wasn't the root cause of the disappearing lights (even after
sorting out the light limit issue), because the cause of that was
everything working as designed, I suspect sunlight wasn't reaching as
far as it should. Even it it was, this should be slightly faster
(especially for larger maps) as leafs can be tested 32 or 64 at a time
rather than individually.
2022-05-19 13:26:45 +09:00
Bill Currie 1dff24dbd0 [scene] Implement Hierarchy_Copy
It copies an entire hierarchy (minus actual entities, but I'm as yet
unsure how to proceed with them), even across scenes as the source scene
is irrelevant and the destination scene is used for creating the new
transforms.
2022-05-08 11:14:00 +09:00
Bill Currie 91c877b1a1 [scene] Zero freshly allocated entity memory
I don't remember why I didn't want to clear it. I hope this doesn't
cause other trouble.
2022-05-07 00:51:44 +09:00
Bill Currie 79add5590b [build] Fix some make distcheck issues
The never ending battle against bit-rot.
2022-05-06 15:50:13 +09:00
Bill Currie 72cb7d3fdd [scene] Make the empty world work with lights
Needed visibility and a sky surf flag, otherwise no lights were visible
(why does this seem familiar?).
2022-05-05 23:49:31 +09:00
Bill Currie 95264b3a54 [ruamoko] Move emtpy_world into scene
And use it as the default worldmodel for new scenes. Since it's
statically allocated, it shouldn't cause any harm so long as no one
tries to free it.
2022-05-05 23:49:31 +09:00
Bill Currie 41a12f066b [client] Clean up light loading
By adding Light_AddLight to scene light management
2022-05-05 23:49:31 +09:00
Bill Currie df5b471342 [scene] Support ambient lighting in worldspawn
Abyss of Pandemonium uses global ambient light a lot, but doesn't
specify it in every map (nothing extracting entities and adding a
reasonable value can't fix). I imagine some further tweaking will be
needed.
2022-05-05 23:49:30 +09:00
Bill Currie 9ee0eada1f [vulkan] Move non-specific lighting code out of Vulkan
The parsing of light data from maps is now in the client library, and
basic light management is in scene. Putting the light loading code into
the Vulkan renderer was a mistake I've wanted to correct for a while.
The client code still needs a bit of cleanup, but the basics are working
nicely.
2022-05-05 23:49:30 +09:00
Bill Currie eaaa0f597f [scene] Set the color for new entities
Black doesn't show up too well on black. Really, this isn't the best
fix, but it will do until I can rework entities to use a component
system.
2022-05-04 18:00:35 +09:00
Bill Currie 0983cc5d8c [scene] Fix a spelling error in a comment 2022-05-04 14:44:54 +09:00
Bill Currie dce1a4d292 [util] Force 32-bit windows malloc to be 16-byte aligned
By replacing it :P (and its friends). This gets the non-sw renderers
working with recent scene changes.
2022-03-09 20:00:51 +09:00
Bill Currie d69355f521 [renderer] Support multiple entity queues
While there's currently only the one still, this will allow the entities
to be multiply queued for multi-pass rendering (eg, shadows). As the
avoidance of putting an entity in the same queue more than once relies
on the entity id, all entities now come from the scene (which is stored
in cl_world in the client code for nq and qw), thus the extensive
changes in the clients.
2022-03-05 02:05:39 +09:00
Bill Currie 6ec8e29429 [scene] Track hierarchies instead of root transforms
The root transform of each hierarchy can be extracted from the first
transform of the list in the hierarchy, so no information is lost. The
main reason for the change is I discovered (obvious in hindsight) that
deleting root transforms was O(n) due to keeping them in an array, thus
the use of a linked list (I don't expect a hierarchy to be in more than
one such list), and I didn't want the transforms to be in a linked list.
2022-03-04 06:43:30 +09:00
Bill Currie ab91d73635 [scene] Use scene resources for the main hierarchy block
This will reduce the memory churn when creating hierarchies as
transforms switch between being root and child.
2022-03-02 10:49:41 +09:00
Bill Currie b210f01837 [scene] Manage scene roots in transform
Since transforms now know the scene to which they belong, and they know
when they are root and when not, getting the transform code to manage
the scene roots is the best way to keep the list of root transforms
consistent.
2022-03-02 10:43:52 +09:00
Bill Currie 5ad7c0fbd6 [scene] Add a camera object
It holds the data for a basic 3d camera (transform, fov, near and far
clip). Not used yet as there is much work to be done in cleaning up the
client code.
2022-02-25 10:41:50 +09:00
Bill Currie 2615953e17 [scene] Move transform getters into inline functions 2022-02-21 08:33:41 +09:00
Bill Currie 54f0af854b [ruamoko] Wrap the transform fuctions
Except for get/set name as I'm still pondering strings.
2022-02-15 00:06:39 +09:00
Bill Currie ba3879c6e0 [scene] Make transforms owned by the scene
This actually has at least two benefits: the transform id is managed by
the scene and thus does not need separate management by the Ruamoko
wrapper functions, and better memory handling of the transform objects.
Another benefit that isn't realized yet is that this is a step towards
breaking the renderers free of quake and quakeworld: although the
clients don't actually use the scene yet, it will be a good place to
store the rendering information (functions to run, etc).
2022-02-14 20:01:36 +09:00
Bill Currie f6ac614e09 [scene] Add functions for scene and entity create/delete
Scene creation was already there, but now can be deleted, as can
entities.
2022-02-14 16:41:38 +09:00
Bill Currie 8b1eec08cf [scene] Provide direct access to the world matrix
Holding onto the pointer is not a good idea, and it is read-only as
direct manipulation of the world matrix is not supported. However, this
is useful for passing the matrix to the GPU.
2021-12-24 06:45:13 +09:00
Bill Currie 40a26e4bc8 [scene] Rename libQFentity to libQFscene
And start working on scene management.
2021-07-24 14:20:59 +09:00