mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-27 22:42:09 +00:00
Always reset vertex attrib pointers with animated meshes.
This commit is contained in:
parent
ce9d0e8595
commit
41985945f6
1 changed files with 25 additions and 16 deletions
|
@ -1762,6 +1762,9 @@ void GLSL_VertexAttribsState(uint32_t stateBits)
|
|||
|
||||
void GLSL_VertexAttribPointers(uint32_t attribBits)
|
||||
{
|
||||
qboolean animated;
|
||||
int newFrame, oldFrame;
|
||||
|
||||
if(!glState.currentVBO)
|
||||
{
|
||||
ri.Error(ERR_FATAL, "GL_VertexAttribPointers: no VBO bound");
|
||||
|
@ -1771,11 +1774,16 @@ void GLSL_VertexAttribPointers(uint32_t attribBits)
|
|||
// don't just call LogComment, or we will get a call to va() every frame!
|
||||
GLimp_LogComment(va("--- GL_VertexAttribPointers( %s ) ---\n", glState.currentVBO->name));
|
||||
|
||||
if((attribBits & ATTR_POSITION) && !(glState.vertexAttribPointersSet & ATTR_POSITION))
|
||||
// position/normal/tangent/bitangent are always set in case of animation
|
||||
oldFrame = glState.vertexAttribsOldFrame;
|
||||
newFrame = glState.vertexAttribsNewFrame;
|
||||
animated = (oldFrame != newFrame) && (glState.vertexAttribsInterpolation > 0.0f);
|
||||
|
||||
if((attribBits & ATTR_POSITION) && (!(glState.vertexAttribPointersSet & ATTR_POSITION) || animated))
|
||||
{
|
||||
GLimp_LogComment("qglVertexAttribPointerARB( ATTR_INDEX_POSITION )\n");
|
||||
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_POSITION, 3, GL_FLOAT, 0, glState.currentVBO->stride_xyz, BUFFER_OFFSET(glState.currentVBO->ofs_xyz + glState.vertexAttribsNewFrame * glState.currentVBO->size_xyz));
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_POSITION, 3, GL_FLOAT, 0, glState.currentVBO->stride_xyz, BUFFER_OFFSET(glState.currentVBO->ofs_xyz + newFrame * glState.currentVBO->size_xyz));
|
||||
glState.vertexAttribPointersSet |= ATTR_POSITION;
|
||||
}
|
||||
|
||||
|
@ -1795,28 +1803,28 @@ void GLSL_VertexAttribPointers(uint32_t attribBits)
|
|||
glState.vertexAttribPointersSet |= ATTR_LIGHTCOORD;
|
||||
}
|
||||
|
||||
if((attribBits & ATTR_NORMAL) && !(glState.vertexAttribPointersSet & ATTR_NORMAL))
|
||||
if((attribBits & ATTR_NORMAL) && (!(glState.vertexAttribPointersSet & ATTR_NORMAL) || animated))
|
||||
{
|
||||
GLimp_LogComment("qglVertexAttribPointerARB( ATTR_INDEX_NORMAL )\n");
|
||||
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_NORMAL, 3, GL_FLOAT, 0, glState.currentVBO->stride_normal, BUFFER_OFFSET(glState.currentVBO->ofs_normal + glState.vertexAttribsNewFrame * glState.currentVBO->size_normal));
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_NORMAL, 3, GL_FLOAT, 0, glState.currentVBO->stride_normal, BUFFER_OFFSET(glState.currentVBO->ofs_normal + newFrame * glState.currentVBO->size_normal));
|
||||
glState.vertexAttribPointersSet |= ATTR_NORMAL;
|
||||
}
|
||||
|
||||
#ifdef USE_VERT_TANGENT_SPACE
|
||||
if((attribBits & ATTR_TANGENT) && !(glState.vertexAttribPointersSet & ATTR_TANGENT))
|
||||
if((attribBits & ATTR_TANGENT) && (!(glState.vertexAttribPointersSet & ATTR_TANGENT) || animated))
|
||||
{
|
||||
GLimp_LogComment("qglVertexAttribPointerARB( ATTR_INDEX_TANGENT )\n");
|
||||
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_TANGENT, 3, GL_FLOAT, 0, glState.currentVBO->stride_tangent, BUFFER_OFFSET(glState.currentVBO->ofs_tangent + glState.vertexAttribsNewFrame * glState.currentVBO->size_normal)); // FIXME
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_TANGENT, 3, GL_FLOAT, 0, glState.currentVBO->stride_tangent, BUFFER_OFFSET(glState.currentVBO->ofs_tangent + newFrame * glState.currentVBO->size_normal)); // FIXME
|
||||
glState.vertexAttribPointersSet |= ATTR_TANGENT;
|
||||
}
|
||||
|
||||
if((attribBits & ATTR_BITANGENT) && !(glState.vertexAttribPointersSet & ATTR_BITANGENT))
|
||||
if((attribBits & ATTR_BITANGENT) && (!(glState.vertexAttribPointersSet & ATTR_BITANGENT) || animated))
|
||||
{
|
||||
GLimp_LogComment("qglVertexAttribPointerARB( ATTR_INDEX_BITANGENT )\n");
|
||||
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_BITANGENT, 3, GL_FLOAT, 0, glState.currentVBO->stride_bitangent, BUFFER_OFFSET(glState.currentVBO->ofs_bitangent + glState.vertexAttribsNewFrame * glState.currentVBO->size_normal)); // FIXME
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_BITANGENT, 3, GL_FLOAT, 0, glState.currentVBO->stride_bitangent, BUFFER_OFFSET(glState.currentVBO->ofs_bitangent + newFrame * glState.currentVBO->size_normal)); // FIXME
|
||||
glState.vertexAttribPointersSet |= ATTR_BITANGENT;
|
||||
}
|
||||
#endif
|
||||
|
@ -1837,42 +1845,43 @@ void GLSL_VertexAttribPointers(uint32_t attribBits)
|
|||
glState.vertexAttribPointersSet |= ATTR_LIGHTDIRECTION;
|
||||
}
|
||||
|
||||
if((attribBits & ATTR_POSITION2) && !(glState.vertexAttribPointersSet & ATTR_POSITION2))
|
||||
if((attribBits & ATTR_POSITION2) && (!(glState.vertexAttribPointersSet & ATTR_POSITION2) || animated))
|
||||
{
|
||||
GLimp_LogComment("qglVertexAttribPointerARB( ATTR_INDEX_POSITION2 )\n");
|
||||
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_POSITION2, 3, GL_FLOAT, 0, glState.currentVBO->stride_xyz, BUFFER_OFFSET(glState.currentVBO->ofs_xyz + glState.vertexAttribsOldFrame * glState.currentVBO->size_xyz));
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_POSITION2, 3, GL_FLOAT, 0, glState.currentVBO->stride_xyz, BUFFER_OFFSET(glState.currentVBO->ofs_xyz + oldFrame * glState.currentVBO->size_xyz));
|
||||
glState.vertexAttribPointersSet |= ATTR_POSITION2;
|
||||
}
|
||||
|
||||
if((attribBits & ATTR_NORMAL2) && !(glState.vertexAttribPointersSet & ATTR_NORMAL2))
|
||||
if((attribBits & ATTR_NORMAL2) && (!(glState.vertexAttribPointersSet & ATTR_NORMAL2) || animated))
|
||||
{
|
||||
GLimp_LogComment("qglVertexAttribPointerARB( ATTR_INDEX_NORMAL2 )\n");
|
||||
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_NORMAL2, 3, GL_FLOAT, 0, glState.currentVBO->stride_normal, BUFFER_OFFSET(glState.currentVBO->ofs_normal + glState.vertexAttribsOldFrame * glState.currentVBO->size_normal));
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_NORMAL2, 3, GL_FLOAT, 0, glState.currentVBO->stride_normal, BUFFER_OFFSET(glState.currentVBO->ofs_normal + oldFrame * glState.currentVBO->size_normal));
|
||||
glState.vertexAttribPointersSet |= ATTR_NORMAL2;
|
||||
}
|
||||
|
||||
#ifdef USE_VERT_TANGENT_SPACE
|
||||
if((attribBits & ATTR_TANGENT2) && !(glState.vertexAttribPointersSet & ATTR_TANGENT2))
|
||||
if((attribBits & ATTR_TANGENT2) && (!(glState.vertexAttribPointersSet & ATTR_TANGENT2) || animated))
|
||||
{
|
||||
GLimp_LogComment("qglVertexAttribPointerARB( ATTR_INDEX_TANGENT2 )\n");
|
||||
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_TANGENT2, 3, GL_FLOAT, 0, glState.currentVBO->stride_tangent, BUFFER_OFFSET(glState.currentVBO->ofs_tangent + glState.vertexAttribsOldFrame * glState.currentVBO->size_normal)); // FIXME
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_TANGENT2, 3, GL_FLOAT, 0, glState.currentVBO->stride_tangent, BUFFER_OFFSET(glState.currentVBO->ofs_tangent + oldFrame * glState.currentVBO->size_normal)); // FIXME
|
||||
glState.vertexAttribPointersSet |= ATTR_TANGENT2;
|
||||
}
|
||||
|
||||
if((attribBits & ATTR_BITANGENT2) && !(glState.vertexAttribPointersSet & ATTR_BITANGENT2))
|
||||
if((attribBits & ATTR_BITANGENT2) && (!(glState.vertexAttribPointersSet & ATTR_BITANGENT2) || animated))
|
||||
{
|
||||
GLimp_LogComment("qglVertexAttribPointerARB( ATTR_INDEX_BITANGENT2 )\n");
|
||||
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_BITANGENT2, 3, GL_FLOAT, 0, glState.currentVBO->stride_bitangent, BUFFER_OFFSET(glState.currentVBO->ofs_bitangent + glState.vertexAttribsOldFrame * glState.currentVBO->size_normal)); // FIXME
|
||||
qglVertexAttribPointerARB(ATTR_INDEX_BITANGENT2, 3, GL_FLOAT, 0, glState.currentVBO->stride_bitangent, BUFFER_OFFSET(glState.currentVBO->ofs_bitangent + oldFrame * glState.currentVBO->size_normal)); // FIXME
|
||||
glState.vertexAttribPointersSet |= ATTR_BITANGENT2;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
shaderProgram_t *GLSL_GetGenericShaderProgram(int stage)
|
||||
{
|
||||
shaderStage_t *pStage = tess.xstages[stage];
|
||||
|
|
Loading…
Reference in a new issue