SL-205 WIP - support for 152-joint rigged meshes with both hardware and software skinning.

master
Brad Payne (Vir Linden) 2015-08-26 10:49:02 -04:00
parent 0f9700af5b
commit 2ea8df0593
5 changed files with 13 additions and 6 deletions

View File

@ -40,6 +40,7 @@
#include "xform.h"
const S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15;
// BENTO JOINT COUNT LIMIT
const U32 LL_CHARACTER_MAX_JOINTS = 152; // must be divisible by 4!
// FIXME BENTO - these should be higher than the joint_num of any
// other joint, to avoid conflicts in updateMotionsByType()

View File

@ -1762,6 +1762,7 @@ LLSD LLModel::writeModel(
S32 count = 0;
for (weight_list::iterator iter = weights.begin(); iter != weights.end(); ++iter)
{
// BENTO JOINT COUNT LIMIT 255?
if (iter->mJointIdx < 255 && iter->mJointIdx >= 0)
{
U8 idx = (U8) iter->mJointIdx;

View File

@ -24,8 +24,11 @@
ATTRIBUTE vec4 weight4;
uniform mat3 matrixPalette[52];
uniform vec3 translationPalette[52];
/* BENTO JOINT COUNT LIMITS
* Note that the value in these two lines also needs to be updated to value-1 several places below.
*/
uniform mat3 matrixPalette[152];
uniform vec3 translationPalette[152];
mat4 getObjectSkinnedTransform()
{
@ -34,7 +37,7 @@ mat4 getObjectSkinnedTransform()
vec4 w = fract(weight4);
vec4 index = floor(weight4);
index = min(index, vec4(51.0));
index = min(index, vec4(151.0));
index = max(index, vec4( 0.0));
float scale = 1.0/(w.x+w.y+w.z+w.w);
@ -68,8 +71,8 @@ mat4 getObjectSkinnedTransform()
// If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
mat3 dummy1 = matrixPalette[0];
vec3 dummy2 = translationPalette[0];
mat3 dummy3 = matrixPalette[51];
vec3 dummy4 = translationPalette[51];
mat3 dummy3 = matrixPalette[151];
vec3 dummy4 = translationPalette[151];
#endif
}

View File

@ -55,7 +55,8 @@ static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK;
static U32 sBufferUsage = GL_STREAM_DRAW_ARB;
static U32 sShaderLevel = 0;
#define JOINT_COUNT 52
// BENTO JOINT COUNT LIMIT
#define JOINT_COUNT 152
LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL;
BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE;

View File

@ -4163,6 +4163,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
}
//build matrix palette
// BENTO JOINT COUNT LIMIT
static const size_t kMaxJoints = 64;
LLMatrix4a mp[kMaxJoints];