Commit Graph

3435 Commits

Author SHA1 Message Date
Bill Currie a032aa5adf Get the lights working (as such).
They work nicely now when the normal map and texture are bypassed (don't
know what texture is getting used currently).
2012-05-15 21:08:47 +09:00
Bill Currie 8c5e278bf8 Implement frame blending for iqm.
Now that I have things working... :)
2012-05-15 21:08:47 +09:00
Bill Currie a938c7fb14 Almost fix the animations.
There's still a problem with his finger tips and feet, but the rest of his
limbs seem to be working well. Much thanks to Spike for encouraging me to
do a dump of the matices that are actually sent to the card.

It turns out that animated joints remain relative right up to the last
moment.
2012-05-15 21:08:46 +09:00
Bill Currie 4ba69b511b Make quat_origin the right type.
It's quat_t, not vec3_t :P.
2012-05-15 21:08:46 +09:00
Bill Currie 202ab04572 Ensure the rotation quats are normalized.
Doesn't make any noticeable difference, but it doesn't hurt.
2012-05-15 21:08:46 +09:00
Bill Currie 31d89782ef Use the correct index variable when byteswapping the arrays.
Not the cause of the broken animations :(
2012-05-15 21:08:46 +09:00
Bill Currie 7cda91a879 Temporarily disable dual quaternions.
The animation data isn't getting loaded or used properly (not sure yet).
This helps ensure it's not something I've done wrong with dual quats.
2012-05-15 21:08:46 +09:00
Bill Currie 4b38048a5c Create functions for rotation and translation. 2012-05-15 21:08:46 +09:00
Bill Currie 5b4fdd2a93 Use the correct position for light calcs.
I should have remembered that gl_FragCoord wasn't right.
2012-05-15 21:08:46 +09:00
Bill Currie 2080c337d7 Avoid using malloc/free every model/frame. 2012-05-15 21:08:46 +09:00
Bill Currie c2e0674d50 Implement R_IQMGetLerpedFrames().
Like R_AliasGetLerpedFrames, but for IQM. It calcualtes the current frame
number and blend between the previous and current frames.
2012-05-15 21:08:46 +09:00
Bill Currie 8387d987e2 Change position to vposition. 2012-05-15 21:08:46 +09:00
Bill Currie 099ef348c6 Advance the vertex attrib index.
Disabling the array right after enabling it was causing things to just not
work :P
2012-05-15 21:08:46 +09:00
Bill Currie d1d4c6142c Get the frame data from the right places.
Always using joint[0] of the frames wasn't very useful.
2012-05-15 21:08:46 +09:00
Bill Currie 74cb49ef7c Free the blended frame data. 2012-05-15 21:08:45 +09:00
Bill Currie 551dfc47fb Build the iqm vertex arrays in the correct order.
They need to be built in ascending type order (makes life easier in the
renderer).
2012-05-15 21:08:45 +09:00
Bill Currie bea8f8f9c4 Fix a segfault when searching for dlights.
Uninitialized var bites my bum :P
2012-05-15 21:08:45 +09:00
Bill Currie 2e98c31175 Check the corrent bits when reading scale frame data.
Fixes the invalid reads when loading an iqm (at least for mrfixit).
2012-05-15 21:08:45 +09:00
Bill Currie 9c69404163 Attempt to render iqm models.
Things are a right mess (segfaults, invalid accesses on load, etc), but
hey, it's a start :)
2012-05-15 21:08:45 +09:00
Bill Currie 15fd3be73a Allow iqm models when storing efrags. 2012-05-15 21:08:45 +09:00
Bill Currie a880f33152 Set the model type for iqm.
Forgot this rather important step :P
2012-05-15 21:08:45 +09:00
Bill Currie 41e7a6c70c Search for the "nearest" dlights.
Nearness is a function of both distance and intensity: distant bright
lights can take priority over close dim lights.
2012-05-15 21:08:45 +09:00
Bill Currie 0becd35b65 Begin work on rendering iqm models.
No chance of working yet, but the shaders compile :)
2012-05-15 21:08:45 +09:00
Bill Currie 078cb10caf Add a stride field to iqm_t.
Since iqm vertex arrays are variable, and I don't want to calculate the
stride every time I render a model, cached the value used when building the
arrays.
2012-05-15 21:08:45 +09:00
Bill Currie 15d35fbdc9 Add mvp_mat and some comments. 2012-05-15 21:08:45 +09:00
Bill Currie 59c5bf2f9e Code up an initial version of the iqm vertex shader.
Probably more bugs than an old kitchen cupboard :P
2012-05-15 21:08:45 +09:00
Bill Currie 6ab3bd45e5 Implement IQM animation loading.
Bone poses are converted to dual quaternions + shear + scale for nice
skinning. Will likely be slow for software skinning, but too bad.
2012-05-15 21:08:45 +09:00
Bill Currie bf38e6073e Implement iqm joint loading. 2012-05-15 21:08:44 +09:00
Bill Currie 9f253454e4 Implement and test Mat4Inverse(). 2012-05-15 21:08:44 +09:00
Bill Currie fa6270322f Make Mat4Decompose a little more intuitive.
Params are now in application order (good thing not much code uses it yet).
2012-05-15 21:08:44 +09:00
Bill Currie de131c18ad Add VectorShear and really test Mat4Decompose.
And the tests really exercised VectorShear (first attempt had things
messed up when more than one shear value was non-zero). Also,
Mat4Decompose wasn't orthogonalizing the z axis row. Oops. Anyway,
Mat4Decompose is now known to work well, and the usage of its output is
understood :)
2012-05-15 21:08:44 +09:00
Bill Currie 8cea6b0a1e Fix a scaling snafu in Mat4Decompose.
Found when checking how rotation affects non-uniform scaling (haven't
written proper tests yet: need to figure out how).
2012-05-15 21:08:44 +09:00
Bill Currie 82abd5e426 More matrix tests. 2012-05-15 21:08:44 +09:00
Bill Currie 730f9668bd Add support for mat4 * vec3 2012-05-15 21:08:44 +09:00
Bill Currie 50af8a562e Add tests for matrix decomposition and fix the bugs. 2012-05-15 21:08:44 +09:00
Bill Currie 52ab4f64f9 Add code for loading vertex colors.
And correct an oopsie in bledweights.
2012-05-15 21:08:44 +09:00
Bill Currie 215d2e9747 Add a function to decompose a matrix.
The function gives rotation(quaternion), scale, shear, and translation (all
three as vectors), shear is (XY, XZ, YZ).
2012-05-15 21:08:44 +09:00
Bill Currie 1be9384f10 Load the iqm vertex and triangle data.
Still have the meshes, joints and animations to go.
2012-05-15 21:08:43 +09:00
Bill Currie 8aabb704d2 Add tests for inverting a dual quad transform. 2012-05-15 21:08:43 +09:00
Bill Currie f874aeb941 Add support for duals and dual quaternions.
Not everything is unit-tested, but the currently important stuff is.
2012-05-15 21:08:43 +09:00
Bill Currie 3b938592c3 Dump some gl limits. 2012-05-15 21:08:43 +09:00
Bill Currie 26a878da48 Stub out the iqm loader. 2012-05-15 21:08:43 +09:00
Bill Currie e6c0512f31 Ensure dstring has space for terminating 0.
It seems (some versions of) windows vsnprintf don't count the terminating 0
when limiting the number of chars written to the buffer. Nor do they
guarantee the output string will be terminated.
2012-05-10 14:48:43 +09:00
Bill Currie 0036a5e113 Ensure edict_size is never 0.
Avoids division by / in NUM_FOR_EDICT
2012-05-06 21:35:42 +09:00
Bill Currie 099d9ec3f2 Move the increment of order out of the loop.
I don't know what gcc's optimizations would do with it, but it seems quite
reasonable to pull the code out of the loop by hand.
2012-05-05 18:01:00 +09:00
Bill Currie cf5c9f067f Make GL_DrawAliasShadow const correct.
Despair's having troubles with segfaults that I can't reproduce. If it's a
strict aliasing problem, this might help.
2012-05-05 17:55:30 +09:00
Bill Currie a43bd755ca Fix the 32-bit x86 build of the software renderer.
I really need to remove the sledge-hammer approach, but this at least gets
QF working out-of-the-box on 32-bit x86 systems.
2012-04-28 13:02:36 +09:00
Bill Currie 8791b35e55 Add support for half floats.
iqm and OpenGL use them, so they might come in handy. The tests use values
from wikipedia and a couple extra.
2012-04-26 20:55:11 +09:00
Bill Currie 1a0ccf6a92 Add vec = quat * vec to the progs engine. 2012-04-26 11:58:20 +09:00
Bill Currie 0a22a98b60 Fix some mis-versioned opcodes.
Many of the quaternion opcodes were marked as being available for id progs.
oops
2012-04-26 10:26:43 +09:00