Commit graph

304 commits

Author SHA1 Message Date
Bill Currie
3669e3aa2e Make alias model caching optional.
For now, only the glsl loader disables caching, but it stores the frame
vertices in GL memory, so its hunk usage is relatively lower (and will be
lower still when I get skins sorted out).
2012-01-17 19:31:50 +09:00
Bill Currie
fb428f8067 Rename mod_flood.c to floodfill.c 2012-01-17 19:31:50 +09:00
Bill Currie
7ba7130f42 Load the sky texture as two separate textures.
The sky texture is normally 256x128, with each 128 wide side being the two
layers of the sky.
2012-01-11 21:09:57 +09:00
Bill Currie
b43d03a98b Let the render specific texture loader decide on sky texture loading.
This is necessary to allow the glsl texture loader to process the sky
textures.
2012-01-11 21:08:04 +09:00
Bill Currie
aa27a3f49c Load bsp model textures as repeating mipmaps. 2012-01-07 18:05:54 +09:00
Bill Currie
204c1aba03 Don't use the miptex_t after converting to texture_t. 2012-01-07 17:08:07 +09:00
Bill Currie
6f18035c12 Fix up alias-16 support.
After getting in contact with serplord, I now know that the sw alias
loading was correct. Turns out the gl loaders was mostly correct, just a
mistaken subtract rather than add. And with that, I can implement alias-16
support in glsl. better yet, since all the work is done in the loader, the
renderer doesn't know anything about it :) However, I need to create some
16-bit models for testing.
2012-01-05 12:52:12 +09:00
Bill Currie
add5440ad1 Upload the normals with the vertex data.
Not all hardware can access a texture sampler from the vertex shader, and I
don't want multiple paths this early in the game. Now, vertex normals are
uploaded as shorts. Should be 14 bytes per vertex (was 10, could have been
8 if I had put the normal index with the vertex rather than st).
2012-01-04 09:42:00 +09:00
Bill Currie
2a3151cecd Hook in alias model drawing.
Nothing is visible yet.
2012-01-02 20:28:40 +09:00
Bill Currie
540bccbc27 Load all the alias vertex data as bytes.
I had forgotten I wanted to do it this way.
2012-01-02 13:41:12 +09:00
Bill Currie
2ad5aa7aed Unbind the array and element array buffers when done.
Not doing so wreaked havoc on my 2d rendering (what's he doing here, and
why's he messing with my redering? ;)
2012-01-02 10:08:56 +09:00
Bill Currie
f3884c659c Finish alias skin loading and load vertex data into GL. 2012-01-01 23:55:27 +09:00
Bill Currie
edb05fdfce Rename Vector3Scale and QuatCompScale.
They are now VectorCompMult and QuatCompMult.
2011-12-30 20:04:55 +09:00
Bill Currie
bcdcd7b36d Implement sprint glsl loading.
That was... easy.
2011-12-30 09:36:57 +09:00
Bill Currie
91afdcf064 Don't call init_box when not doing a box trace.
I took the opportunity to pass qf through callgrind. init_box was
surprisingly expensive, especially considering its results were never used.
2011-12-25 17:11:48 +09:00
Bill Currie
2894689f71 Clean up mod_lightmap_bytes.
Just how many definitions do we need?
2011-12-25 13:02:26 +09:00
Bill Currie
dcf2b14188 Implement alias model skin loading for glsl. 2011-12-25 13:02:26 +09:00
Bill Currie
e62eb23f67 And do the real merge.
That drastically simplifies the processes of alias model loading for glsl :)
2011-12-25 11:04:03 +09:00
Bill Currie
c0d37ddc1e Pseudo merge gl and sw Mod_LoadAliasGroup.
Interestingly, this didn't break gl alias model renderering (but then, it
does weird things to the data anyway).
2011-12-25 10:53:53 +09:00
Bill Currie
1f8db5fe3a Pseudo merge gl and sw Mod_LoadAliasFrame. 2011-12-25 10:34:29 +09:00
Bill Currie
59ef1eae9d Split out the floodfile code into its own file. 2011-12-23 19:01:31 +09:00
Bill Currie
33c5320c0e Create stubs for most of the required render functions.
nq-glslx almost links. Just some suspicious references in host.c I want to
check before doing anything more.
2011-12-23 12:19:50 +09:00
Bill Currie
497461b4c2 Make a start on making a pure GLSL renderer.
For now, only nq-glslx will be built, but as there is no actual code, it
doesn't link. However, this gets the glsl stuff into the build system.
2011-12-23 12:19:13 +09:00
Bill Currie
8aa5a8139c Split out the portal sanity tests.
With this, the portal code can be tested separately, including the freeing
of the portal information.
2011-12-08 14:59:35 +09:00
Bill Currie
f9877ce0e0 Add a function to free a hull's portal information. 2011-12-08 14:58:08 +09:00
Bill Currie
fceed07d0b Tidy up my diagrams. 2011-12-08 08:45:53 +09:00
Bill Currie
9f32004599 Add a fixme.
I've had enough of this for the moment, but I'm pretty sure the test needs
some more consideration, and I'll probably forget about it if I don't mark
it.
2011-12-07 17:27:13 +09:00
Bill Currie
2a27db146e Use a bit of epsilon in trace_contents().
All tests pass again.
2011-12-07 15:35:19 +09:00
Bill Currie
66dffef936 Get trace_to_leaf working a little better.
I think the recursion decision needs a little more work, but this gets the
current tests working (though there's still a failure due to fp math).
2011-12-07 15:31:33 +09:00
Bill Currie
ccbc69a7f5 Carve out some more cave and add some more tests.
One of them even breaks the code :)
2011-12-07 13:31:21 +09:00
Bill Currie
4ed8b69e24 Check the cross product length before testing its direction.
This fixes the bogus portal crossings.
2011-12-07 12:20:04 +09:00
Bill Currie
5af88d33fe Trace to the current portal rather than the portal's plane. 2011-12-07 12:17:51 +09:00
Bill Currie
9d2914474c Fix the edge vectors when bounding the portal points. 2011-12-07 12:16:58 +09:00
Bill Currie
6a4021517b Move the box face info into trace_state and init only once.
Then clean up the mess of excess function paramenters.
2011-12-07 10:54:37 +09:00
Bill Currie
fc14826cd6 Reorganize the code a little. 2011-12-07 10:42:39 +09:00
Bill Currie
4f13d19b7e Optimize edges_intersect().
I found wolfram's line-line intersection page and noticed their equation
for the time of intersection was rather different to mine. After analyzing
the differences, it turns out they produce exactly the same results (when
the lines are coplanar), but their method allows me to eliminate one dot
product (4->3). Not only that, but it turns out that their method works
equally well for skew lines (ie, non-coplanar).

mine:
  CxA.CxA
  -------
  CxA.AxB

theirs:
  CxA.AxB
  -------
  AxB.AxB
2011-12-07 10:35:58 +09:00
Bill Currie
ff693a956a Avoid missed portals in trace_to_leaf(). 2011-12-06 22:09:40 +09:00
Bill Currie
8c840a7003 Sanitize trace_hits_plane().
While unit normals aren't needed, they were too big for sane math. Now
epsilon can be used for the distance tests. One of the two new tests passes
now :).
2011-12-06 22:06:25 +09:00
Bill Currie
2b65f81b72 Use a saner "infinity".
8e6 is just too big for reasonable floating point.
This fixes the bogus portals.
2011-12-06 20:50:09 +09:00
Bill Currie
632817fed5 Fail properly when the portals are bogus. 2011-12-06 20:48:31 +09:00
Bill Currie
f496f4d260 Whee, more tests that break things :) 2011-12-06 20:47:57 +09:00
Bill Currie
8fe703d747 Trace to adjoining leafs when necessary.
When the trace stradles a plane in the current leaf, check the other side
of the portal, too, as it is possible that leaf will restrict the movement
of the trace.

All current tests pass! However, I can think of some situations (and I
already have a solution) where things will fail, but that's next.
2011-12-06 17:27:05 +09:00
Bill Currie
4c17ca9583 Break out trace_hits_portal() from trace_enters_leaf(). 2011-12-06 08:46:04 +09:00
Bill Currie
9a9079a2b3 Correct the start-solid in a corner test.
It turns out that the box trace CAN get out of the solid from that location
(though a similar point trace can not). This is because of my decision to
allow non-points to touch a plane from either side without crossing the
plane, whereas a point touching a plane is always considered to be on the
front side of the plane as there is no further information to disambiguate
on which side of the plane the point is.
2011-12-05 22:11:58 +09:00
Bill Currie
4419d4c4ad Move the trace into the leaf before testing the contents.
The trace is moved as far into the leaf as possible without leaving the
other side of the leaf. This ensures that trace_contents is started from a
good location. There is currently a problem with traces that stradle a
plane getting, but this has cleared up all the current contents related
tests.
2011-12-05 22:11:58 +09:00
Bill Currie
c588d28b96 Clear contents flags before calling trace_contents. 2011-12-05 22:11:58 +09:00
Bill Currie
8307d9f233 Rename check_in_leaf to trace_enters_leaf. 2011-12-05 22:11:58 +09:00
Bill Currie
3bd029d599 Make the contents flags clear.
I got tired of not being able to remember which flag was which in the
output.
2011-12-05 22:11:47 +09:00
Bill Currie
8e512a087c More failing contents tests.
However, I have a plan :)
2011-12-05 09:03:04 +09:00
Bill Currie
b4a497baab Correctly restore the saved start point.
This fixes the point test failures.
2011-12-04 21:12:12 +09:00