Trying to fix the skinning issue

This commit is contained in:
Sam Gateau 2014-11-03 13:20:12 -08:00
parent ac02746587
commit 48769928c5
4 changed files with 8 additions and 5 deletions

View file

@ -201,7 +201,9 @@ void GLBackend::do_drawIndexed(Batch& batch, uint32 paramOffset) {
uint32 numIndices = batch._params[paramOffset + 1]._uint;
uint32 startIndex = batch._params[paramOffset + 0]._uint;
glDrawElements(mode, numIndices, GL_UNSIGNED_INT, (GLvoid*)(startIndex + _indexBufferOffset));
GLenum glType = _elementTypeToGLType[_indexBufferType];
glDrawElements(mode, numIndices, glType, (GLvoid*)(startIndex + _indexBufferOffset));
CHECK_GL_ERROR();
}
@ -408,7 +410,7 @@ void GLBackend::updateInput() {
void GLBackend::do_setIndexBuffer(Batch& batch, uint32 paramOffset) {
GLenum type = _elementTypeToGLType[ batch._params[paramOffset + 2]._uint ];
_indexBufferType = (Element::Type) batch._params[paramOffset + 2]._uint;
BufferPtr indexBuffer = batch._buffers.get(batch._params[paramOffset + 1]._uint);
_indexBufferOffset = batch._params[paramOffset + 0]._uint;
_indexBuffer = indexBuffer;

View file

@ -63,6 +63,7 @@ protected:
BufferPtr _indexBuffer;
Offset _indexBufferOffset;
Element::Type _indexBufferType;
typedef std::bitset<MAX_NUM_ATTRIBUTES> InputActivationCache;
InputActivationCache _inputAttributeActivation;

View file

@ -27,11 +27,11 @@ public:
enum Slot {
SLOT_POSITION = 0,
SLOT_NORMAL,
SLOT_TEXCOORD,
SLOT_COLOR,
SLOT_TEXCOORD,
SLOT_TANGENT,
SLOT_SKIN_CLUSTER_WEIGHT,
SLOT_SKIN_CLUSTER_INDEX,
SLOT_SKIN_CLUSTER_WEIGHT,
NUM_SLOTS,
};

View file

@ -1939,7 +1939,7 @@ int Model::renderMeshes(gpu::Batch& batch, RenderMode mode, bool translucent, fl
*/
// _blendedVertexBuffers[i].bind();
// GLBATCH(glBindBuffer)(GL_ARRAY_BUFFER, _blendedVertexBuffers[i].bufferId());
GLBATCH(glBindBuffer)(GL_ARRAY_BUFFER, gpu::GLBackend::getBufferID(*_blendedVertexBuffers2[i]));
// GLBATCH(glBindBuffer)(GL_ARRAY_BUFFER, gpu::GLBackend::getBufferID(*_blendedVertexBuffers2[i]));
batch.setInputBuffer(0, _blendedVertexBuffers2[i], 0, 0);
batch.setInputBuffer(1, _blendedVertexBuffers2[i], vertexCount * sizeof(glm::vec3), 0);