For lerped frames (refEntity_t frame not equal oldframe) IQM joint
matrices may have incorrect axis scale. This can cause significant model
distortion. The matrix lerp is linear causing each vector to move in a
straight line between frames instead of arcing like a circle. Each joint
frame can have a different scale so can't just normalize the joint
matrix.
Store joints as quaternions and spherical lerp between them and then
convert to a matrix. For my test model, setting up the skeleton is four
times slower now but it still seems to be fast enough to be usable.
r_cubeMapping requires textureCubeLod() which is only in OpenGL 3.0
(GLSL 1.30) and later. It's not in OpenGL ES 3.0 / GLSL ES 3.00.
This needs to be checked before R_InitImages() so can't just check in
GLSL_InitGPUShaders().
Override the video mode list in the Team Arena data files with detected
modes from SDL like in ioquake3's Q3 UI. Add the aspect ratio to the
end of the video resolution (i.e., "640x480 (4:3)"). Add the current
(custom) video mode to the list.
Before when using a custom resolution in the menu you could not change
the video mode using the mouse because the resolution text was blank.
Now custom video resolution is displayed and can be clicked.
Team Arena HUD's team member info box can be cycled through using
nextTeamMember and prevTeamMember commands. nextTeamMember command loops
around when end of list is reached but prevTeamMember command got stuck
at last entry in list (team overview).
My commit last month "Fix SDL audio playback with surround sound" broke
16-bit stereo sound. S_TransferStereo16() still assumed that dma.samples
was a power of two. I also cleaned up code related to the previously
mentioned commit.
If user has surround sound enabled, ioq3 would not play any sound.
Fix painting sound buffer for 4/5.1 audio channels. Extra channels
currently play no audio.
BotSetEntityNumForGoal() was checking all entities that are not
team_redobelisk (which is the obelisk visual entity) to find the
untitled obelisk collision entity. This may fail in rare cases where
there is an another entity within 10 units of the obelisk origin.
Failing to find the correct entity may cause bots to not attack the
obelisk.
Instead add BotSetEntityNumForGoalWithActivator() for looking for the
obelisk collision entity by activator classname (team_redobelisk) which
should be less likely to find the wrong entity.
This doesn't affect official Team Arena maps (unknown if it affects any
others).
Reversed strcmp check was reported by Thomas Köppe.
Bounds are optional for animated IQM models but are not possible to
include with unanimated models (seems intended for use with separate
model containing animations and bounds). Calculating bounds for
unanimated IQM models fixes culling and head model on HUD which
calculates position from model bounds.
The axis returned for IQM tag was the animation's joint rotation without
the base frame joint rotation. It only worked correct for models that
did not rotate the base frame joints.
Using GPU vertex skinning is significantly faster than CPU vertex
skinning. Especially since OpenGL2 has to run R_VaoPackNormal() and
R_VaoPackTangent() each vertex each frame which causes CPU vertex
skinning to be significantly slower than OpenGL1 renderer.
Only calculate vertex blend matrix for each unique bone indexes/weights
combination once per-surface instead of recalculating for each vertex.
For best performance the model surfaces needs to use few vertex bone
indexes and weights combinations.
Unroll loops so GCC better optimizes them.
In my tests drawing animated IQM may take 50% as long in opengl1 and
70% as long in opengl2. It will vary by model though and might not
help much at all.
Made unanimated IQM models skip matrix math altogether.
- Only allocate memory for vertex arrays that are present in the IQM
file and are actually used (may not have colors or blend index/weights,
don't load tangents in opengl1). (Colors is fixed to next commit.)
- Explicitly handle loading IQM files without meshes (bones only).
- Better IQM validation. Header data offset 0 mean data is not present
in file. Check if required vertex arrays are present.
This involved a lot of white space changes and moving code around.
Fix two constants in GLSL shaders. Remove f suffix from float and fix
int to float assignment. They were causing shader compile errors in
OpenGL ES 2 context.
Remove disabling clip plane. Clip plane is unused and never enabled in
the opengl2 renderer. Remove disabling it to avoid causing a GL error
when using OpenGL 3.2 core profile or OpenGL ES.
Make VAO cache vertex stride be size of srfVert_t since that is what
is uploaded to the GPU. No behavior change. There is a disabled debug
id in srfVert_t though which if enabled changes srfVert_t size.
OpenGL ES is only required to support unsigned short for element buffer
values.
R_DrawElements() firstIndex argument was glIndex_t which caused element
indexes to wrap around to 0 when glIndex_t is an unsigned short.
(glIndex_t is an index into the vertexes buffer, not element buffer.)
Change it to 'int' like tess.firstIndex which is passed to
R_DrawElements().
World VAO cache buffer size allowed storing more vertexes than unsigned
short glIndex_t could reference. This resulted in the vertex indexes in
the element buffer wrapping around to 0.
Load functions procs supported by OpenGL ES 2.0, though there is not a
compatible renderer yet. Change argument for GLimp_Init from coreContext
to fixedFunction.
Also declare the GL functions in tr_local.h so there is compile error
for non-core GL functions instead of SEGFAULT from dereferencing a NULL
pointer.
Disable the non-functional stencil shadow code that hasn't been updated
to use OpenGL 3.2 core compatible drawing.
If renderer is compiled into client (USE_RENDERER_DLOPEN=0) and after
start up set r_allowExtension to 0 and run vid_restart, some extension
were still used.
This is one of the de facto standard interfaces used in Linux
distributions for cross-compilation (alongside overriding CC and
similar variables), and in particular is used in Debian and its
derivatives.
Signed-off-by: Simon McVittie <smcv@debian.org>
Connecting to a server running a different fs_game and using a
autoexec.cfg containing in_restart would hit a fatal error in IN_Init().
IN_Init called before SDL_Init( SDL_INIT_VIDEO )
Reported by smokey2k on the ioquake3 forum.
Linux loki-setup uninstaller is failing on distros that have /bin/sh
linked to Dash instead of Bash. Use standard shell method for
redirecting stdout and stderr instead of a Bash specific method.
On Windows the opaque textures on the holodeck doors model were drawn
solid black and did not fade out.
Set up ref entity lightDir and modelLightDir as unit vectors. I am
guessing the vector lengths are being used as a divisor in a GLSL shader
or something.
Also clear directedLight so the same fields are set for RF_FULLBRIGHT as
all other ref entities.