Commit Graph

1379 Commits

Author SHA1 Message Date
Bill Currie b5add680f7 Add Mat4as3MultVec.
to transform a vertex without the translation (eg, for normals) without
having to have separate matrices.
2012-05-20 15:20:18 +09:00
Bill Currie 0fbaa2a88a Add sw32 support for iqm models.
That was easy :)
2012-05-20 14:23:41 +09:00
Bill Currie 6ace105e31 Fix some macro parenthesis issues. 2012-05-19 21:25:58 +09:00
Bill Currie d25f39cc7d Remove pskindesc from affinetridesc_t.
It's never used after being set.
2012-05-19 09:29:05 +09:00
Bill Currie c0517b1d97 Factor out the blend palette creation.
gl, sw and sw32 use blend palettes, so share the code. This also abandons
the optimization for transforming verts in sw (had all sorts of problems
anyway). sw still doesn't work, though.
2012-05-19 00:34:15 +09:00
Bill Currie fb10f38fd4 SW now tries (but fails miserably) to render iqm models.
Something seems to be very wrong with the transforms.
2012-05-18 23:31:14 +09:00
Bill Currie da87ac0ce5 Remove some unused parameters. 2012-05-17 21:33:22 +09:00
Bill Currie da313cfae7 Load iqm models in the sw renderers.
sw32 loses 32 bit textures :/
loading is /slow/ (converting rgb(a) to 8bit palette... ouch.
2012-05-17 21:17:48 +09:00
Bill Currie c3801d46e5 Render iqm models in GL.
There are still many issues to sort out, but the basics are working.

Problems:
	rendered fullbright (no lighting done)
	normals are ignored
	extra textures (glow etc) not used/loaded

4 models on the screen don't seem to be a problem.
2012-05-17 15:58:29 +09:00
Bill Currie f958afad53 Optionally allocate extra data for iqm blend frames.
Also, correct the blend parameter type (int->float. oops).
2012-05-17 15:57:07 +09:00
Bill Currie 02f8aa6b75 Add Mat4MultAdd macro. 2012-05-17 15:56:01 +09:00
Bill Currie c0df07b607 Enable loading of iqm models in gl.
They don't render yet, but the engine doesn't segfault.
The vertex blend indices are rewritten with blend palette indices.
2012-05-17 15:55:38 +09:00
Bill Currie e722352a61 Add SYS_MODEL developer flag (8192) 2012-05-17 13:39:45 +09:00
Bill Currie 23284536b5 Move IQM freeing into common code. 2012-05-16 18:09:44 +09:00
Bill Currie 041d63c828 Move the frame blending into common code. 2012-05-16 17:44:18 +09:00
Bill Currie 111377f1be Use buffer objects for iqm vertex arrays and elements. 2012-05-15 21:08:47 +09:00
Bill Currie 1375c3cf03 Finally, load textures for iqm :) 2012-05-15 21:08:47 +09:00
Bill Currie c694b9f77e Add Mat4Blend macro. 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 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 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 9a3206795e Add VectorUnshear().
VectorUnshear uses the exact same shear vector to remove shear from a
sheared vector. ie with:
  VectorShear (shear, v, w);
  VectorUnshear (shear, w, x);
x == v within fp math limits.
2012-05-15 21:08:44 +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 1473dbd526 Add a comment about the evaluation order in VectorShear. 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 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 724427a976 Add component-wise vector and quaternion division.
Mostly for non-uniform scaling.
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 890223ef8e Correct the definition of DualQuatNorm.
I'd gotten the norm and magnitude mixed up (partly because the document I
was following got the names mixed up), and then munged the formulas
together.
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 26a878da48 Stub out the iqm loader. 2012-05-15 21:08:43 +09:00
Bill Currie f9a384ffd4 Make simple gravity acceleration framerate independent.
Now it doesn't matter if you get 22 fps or 72, you jump the same height,
which actually happens to be slightly higher than the previous 72fps jump.
Effectively, you jump the height you would if you got infinite fps ;)
2012-04-28 14:54:58 +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 efaef89c5f Add a shortcut function for quaterion/vector multiplication.
I got the idea from blender when I discovered by accident that quat * vect
produces the same result as quat * qvect * quat* and looked up the code to
check what was going on. While matrix/vector multiplication still beats the
pants off quaternion/vector multiplication, QuatMultVec is a slight
optimization over quat * qvect * quat* (17+,24* vs 24+,32*, plus no need to
to generate quat*).
2012-04-26 09:48:08 +09:00
Bill Currie 866c56c236 Do not try to lerp entities when their model changes.
This avoids sending invalid pose data to the renderer. The symptom was a
vertex array offset higher than the vertex array size. Discovered by calim
of nouveau while he was debugging a driver problem found by QF. Many
thanks.
2012-04-25 10:09:23 +09:00
Bill Currie 87e56e0655 Fix some doxygen issues. 2012-04-22 22:20:45 +09:00
Bill Currie bc1b483525 Nuke the rcsid stuff.
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie 7fc700b802 Allow alias textures up to 1024x1024.
Blender's default texture size is 1024x1024, and there doesn't seem to be
any reason not to support it.
2012-04-15 14:13:05 +09:00
Bill Currie 633f70b2f1 Remove a functionally dead symbol.
The only purpose clearnotify seemed to be serving was to stop the console
plugin from loading :P
2012-04-12 17:05:42 +09:00
Bill Currie 7fc99f9c60 Fix gl and glsl support in sdl. 2012-04-12 16:47:37 +09:00
Bill Currie 8401704c4e Connect up palette setting for gl and glsl.
The GL plugin now seems to work. GLSL still segs :(
2012-04-12 13:57:05 +09:00