OpenGL2: Add GPU vertex skinning for IQM models
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.
This commit is contained in:
parent
cccd283be8
commit
11337c9fa2
10 changed files with 533 additions and 34 deletions
|
@ -908,6 +908,8 @@ static void RB_FogPass( void ) {
|
|||
|
||||
if (glState.vertexAnimation)
|
||||
index |= FOGDEF_USE_VERTEX_ANIMATION;
|
||||
else if (glState.boneAnimation)
|
||||
index |= FOGDEF_USE_BONE_ANIMATION;
|
||||
|
||||
sp = &tr.fogShader[index];
|
||||
}
|
||||
|
@ -921,6 +923,11 @@ static void RB_FogPass( void ) {
|
|||
GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
|
||||
GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
|
||||
|
||||
if (glState.boneAnimation)
|
||||
{
|
||||
GLSL_SetUniformMat4BoneMatrix(sp, UNIFORM_BONEMATRIX, glState.boneMatrix, glState.boneAnimation);
|
||||
}
|
||||
|
||||
GLSL_SetUniformInt(sp, UNIFORM_DEFORMGEN, deformGen);
|
||||
if (deformGen != DGEN_NONE)
|
||||
|
@ -1005,7 +1012,14 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
|
||||
if (backEnd.currentEntity && backEnd.currentEntity != &tr.worldEntity)
|
||||
{
|
||||
index |= LIGHTDEF_ENTITY;
|
||||
if (glState.boneAnimation)
|
||||
{
|
||||
index |= LIGHTDEF_ENTITY_BONE_ANIMATION;
|
||||
}
|
||||
else
|
||||
{
|
||||
index |= LIGHTDEF_ENTITY_VERTEX_ANIMATION;
|
||||
}
|
||||
}
|
||||
|
||||
if (pStage->stateBits & GLS_ATEST_BITS)
|
||||
|
@ -1028,6 +1042,10 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
{
|
||||
shaderAttribs |= GENERICDEF_USE_VERTEX_ANIMATION;
|
||||
}
|
||||
else if (glState.boneAnimation)
|
||||
{
|
||||
shaderAttribs |= GENERICDEF_USE_BONE_ANIMATION;
|
||||
}
|
||||
|
||||
if (pStage->stateBits & GLS_ATEST_BITS)
|
||||
{
|
||||
|
@ -1043,7 +1061,14 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
|
||||
if (backEnd.currentEntity && backEnd.currentEntity != &tr.worldEntity)
|
||||
{
|
||||
index |= LIGHTDEF_ENTITY;
|
||||
if (glState.boneAnimation)
|
||||
{
|
||||
index |= LIGHTDEF_ENTITY_BONE_ANIMATION;
|
||||
}
|
||||
else
|
||||
{
|
||||
index |= LIGHTDEF_ENTITY_VERTEX_ANIMATION;
|
||||
}
|
||||
}
|
||||
|
||||
if (r_sunlightMode->integer && (backEnd.viewParms.flags & VPF_USESUNLIGHT) && (index & LIGHTDEF_LIGHTTYPE_MASK))
|
||||
|
@ -1074,6 +1099,11 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
GLSL_SetUniformVec3(sp, UNIFORM_LOCALVIEWORIGIN, backEnd.or.viewOrigin);
|
||||
|
||||
GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
|
||||
|
||||
if (glState.boneAnimation)
|
||||
{
|
||||
GLSL_SetUniformMat4BoneMatrix(sp, UNIFORM_BONEMATRIX, glState.boneMatrix, glState.boneAnimation);
|
||||
}
|
||||
|
||||
GLSL_SetUniformInt(sp, UNIFORM_DEFORMGEN, deformGen);
|
||||
if (deformGen != DGEN_NONE)
|
||||
|
@ -1368,7 +1398,16 @@ static void RB_RenderShadowmap( shaderCommands_t *input )
|
|||
ComputeDeformValues(&deformGen, deformParams);
|
||||
|
||||
{
|
||||
shaderProgram_t *sp = &tr.shadowmapShader;
|
||||
shaderProgram_t *sp = &tr.shadowmapShader[0];
|
||||
|
||||
if (glState.vertexAnimation)
|
||||
{
|
||||
sp = &tr.shadowmapShader[SHADOWMAPDEF_USE_VERTEX_ANIMATION];
|
||||
}
|
||||
else if (glState.boneAnimation)
|
||||
{
|
||||
sp = &tr.shadowmapShader[SHADOWMAPDEF_USE_BONE_ANIMATION];
|
||||
}
|
||||
|
||||
vec4_t vector;
|
||||
|
||||
|
@ -1380,6 +1419,11 @@ static void RB_RenderShadowmap( shaderCommands_t *input )
|
|||
|
||||
GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
|
||||
|
||||
if (glState.boneAnimation)
|
||||
{
|
||||
GLSL_SetUniformMat4BoneMatrix(sp, UNIFORM_BONEMATRIX, glState.boneMatrix, glState.boneAnimation);
|
||||
}
|
||||
|
||||
GLSL_SetUniformInt(sp, UNIFORM_DEFORMGEN, deformGen);
|
||||
if (deformGen != DGEN_NONE)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue