mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 17:20:12 +02:00
Fixing the skinning by simply reverting the change to the format for the inSkinIndex
This commit is contained in:
parent
caa5732e06
commit
44e7223547
6 changed files with 35 additions and 11 deletions
|
@ -88,7 +88,26 @@ static const int TYPE_SIZE[NUM_TYPES] = {
|
|||
1,
|
||||
1
|
||||
};
|
||||
// Array answering the question Does this type is integer or not
|
||||
static const bool TYPE_IS_INTEGER[NUM_TYPES] = {
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
};
|
||||
|
||||
// Dimension of an Element
|
||||
enum Dimension {
|
||||
|
@ -168,6 +187,7 @@ public:
|
|||
|
||||
Type getType() const { return (Type)_type; }
|
||||
bool isNormalized() const { return (getType() >= NFLOAT); }
|
||||
bool isInteger() const { return TYPE_IS_INTEGER[getType()]; }
|
||||
|
||||
uint32 getSize() const { return DIMENSION_COUNT[_dimension] * TYPE_SIZE[_type]; }
|
||||
|
||||
|
|
|
@ -215,8 +215,12 @@ void GLBackend::updateInput() {
|
|||
GLuint stride = strides[bufferNum];
|
||||
GLuint pointer = attrib._offset + offsets[bufferNum];
|
||||
GLboolean isNormalized = attrib._element.isNormalized();
|
||||
|
||||
glVertexAttribPointer(slot, count, type, isNormalized, stride,
|
||||
reinterpret_cast<GLvoid*>(pointer));
|
||||
|
||||
// TODO: Support properly the IAttrib version
|
||||
|
||||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
!>
|
||||
<@if not GPU_INPUTS_SLH@>
|
||||
<@def GPU_INPUTS_SLH@>
|
||||
layout(location = 0) in vec4 inPosition;
|
||||
layout(location = 1) in vec4 inNormal;
|
||||
layout(location = 2) in vec4 inColor;
|
||||
layout(location = 3) in vec4 inTexCoord0;
|
||||
layout(location = 4) in vec4 inTangent;
|
||||
layout(location = 5) in ivec4 inSkinClusterIndex;
|
||||
layout(location = 6) in vec4 inSkinClusterWeight;
|
||||
layout(location = 7) in vec4 inTexCoord1;
|
||||
in vec4 inPosition;
|
||||
in vec4 inNormal;
|
||||
in vec4 inColor;
|
||||
in vec4 inTexCoord0;
|
||||
in vec4 inTangent;
|
||||
in vec4 inSkinClusterIndex;
|
||||
in vec4 inSkinClusterWeight;
|
||||
in vec4 inTexCoord1;
|
||||
<@endif@>
|
||||
|
|
|
@ -34,7 +34,7 @@ void main(void) {
|
|||
vec4 position = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 interpolatedNormal = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
for (int i = 0; i < INDICES_PER_VERTEX; i++) {
|
||||
mat4 clusterMatrix = clusterMatrices[inSkinClusterIndex[i]];
|
||||
mat4 clusterMatrix = clusterMatrices[int(inSkinClusterIndex[i])];
|
||||
float clusterWeight = inSkinClusterWeight[i];
|
||||
position += clusterMatrix * inPosition * clusterWeight;
|
||||
interpolatedNormal += clusterMatrix * vec4(inNormal.xyz, 0.0) * clusterWeight;
|
||||
|
|
|
@ -36,7 +36,7 @@ void main(void) {
|
|||
vec4 interpolatedNormal = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 interpolatedTangent = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
for (int i = 0; i < INDICES_PER_VERTEX; i++) {
|
||||
mat4 clusterMatrix = clusterMatrices[inSkinClusterIndex[i]];
|
||||
mat4 clusterMatrix = clusterMatrices[int(inSkinClusterIndex[i])];
|
||||
float clusterWeight = inSkinClusterWeight[i];
|
||||
position += clusterMatrix * inPosition * clusterWeight;
|
||||
interpolatedNormal += clusterMatrix * vec4(inNormal.xyz, 0.0) * clusterWeight;
|
||||
|
|
|
@ -24,7 +24,7 @@ uniform mat4 clusterMatrices[MAX_CLUSTERS];
|
|||
void main(void) {
|
||||
vec4 position = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
for (int i = 0; i < INDICES_PER_VERTEX; i++) {
|
||||
mat4 clusterMatrix = clusterMatrices[inSkinClusterIndex[i]];
|
||||
mat4 clusterMatrix = clusterMatrices[int(inSkinClusterIndex[i])];
|
||||
float clusterWeight = inSkinClusterWeight[i];
|
||||
position += clusterMatrix * inPosition * clusterWeight;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue