Merge branch 'master' of git://github.com/Shyotl/SingularityViewer
This commit is contained in:
@@ -1288,7 +1288,7 @@ public:
|
|||||||
LL_CONT << "slowest framerate for last " << int(prevSize * MEM_INFO_THROTTLE)
|
LL_CONT << "slowest framerate for last " << int(prevSize * MEM_INFO_THROTTLE)
|
||||||
<< " seconds ";
|
<< " seconds ";
|
||||||
}
|
}
|
||||||
LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n'
|
LL_CONT << std::fixed << std::setprecision(1) << framerate << std::setprecision(6) << '\n'
|
||||||
<< LLMemoryInfo() << LL_ENDL;
|
<< LLMemoryInfo() << LL_ENDL;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2065,14 +2065,14 @@ bool LLVertexBuffer::getWeightStrider(LLStrider<F32>& strider, S32 index, S32 co
|
|||||||
return VertexBufferStrider<F32,TYPE_WEIGHT>::get(*this, strider, index, count, map_range);
|
return VertexBufferStrider<F32,TYPE_WEIGHT>::get(*this, strider, index, count, map_range);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LLVertexBuffer::getWeight4Strider(LLStrider<LLVector4>& strider, S32 index, S32 count, bool map_range)
|
bool LLVertexBuffer::getWeight4Strider(LLStrider<LLVector4a>& strider, S32 index, S32 count, bool map_range)
|
||||||
{
|
{
|
||||||
return VertexBufferStrider<LLVector4,TYPE_WEIGHT4>::get(*this, strider, index, count, map_range);
|
return VertexBufferStrider<LLVector4a,TYPE_WEIGHT4>::get(*this, strider, index, count, map_range);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index, S32 count, bool map_range)
|
bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4a>& strider, S32 index, S32 count, bool map_range)
|
||||||
{
|
{
|
||||||
return VertexBufferStrider<LLVector4,TYPE_CLOTHWEIGHT>::get(*this, strider, index, count, map_range);
|
return VertexBufferStrider<LLVector4a,TYPE_CLOTHWEIGHT>::get(*this, strider, index, count, map_range);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -255,8 +255,8 @@ public:
|
|||||||
bool getColorStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
bool getColorStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getEmissiveStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
bool getEmissiveStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getWeightStrider(LLStrider<F32>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
bool getWeightStrider(LLStrider<F32>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getWeight4Strider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
bool getWeight4Strider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
bool getClothWeightStrider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
|
|
||||||
|
|
||||||
bool useVBOs() const;
|
bool useVBOs() const;
|
||||||
|
|||||||
@@ -635,7 +635,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
|
|||||||
LLCoordScreen windowPos(x,y);
|
LLCoordScreen windowPos(x,y);
|
||||||
LLCoordScreen windowSize(window_rect.right - window_rect.left,
|
LLCoordScreen windowSize(window_rect.right - window_rect.left,
|
||||||
window_rect.bottom - window_rect.top);
|
window_rect.bottom - window_rect.top);
|
||||||
if (!switchContext(mFullscreen, windowSize, TRUE, &windowPos))
|
if (!switchContext(mFullscreen, windowSize, vsync_mode, &windowPos))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1654,21 +1654,21 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, co
|
|||||||
{
|
{
|
||||||
if (vsync_mode == 0)
|
if (vsync_mode == 0)
|
||||||
{
|
{
|
||||||
LL_DEBUGS("Window") << "Disabling vertical sync" << LL_ENDL;
|
LL_INFOS("Window") << "Disabling vertical sync" << LL_ENDL;
|
||||||
wglSwapIntervalEXT(0);
|
wglSwapIntervalEXT(0);
|
||||||
}
|
}
|
||||||
else if(vsync_mode == -1)
|
else if(vsync_mode == -1)
|
||||||
{
|
{
|
||||||
LL_DEBUGS("Window") << "Enabling adaptive vertical sync" << LL_ENDL;
|
LL_INFOS("Window") << "Enabling adaptive vertical sync" << LL_ENDL;
|
||||||
if(wglSwapIntervalEXT(-1) == 0)
|
if(wglSwapIntervalEXT(-1) == 0)
|
||||||
{
|
{
|
||||||
LL_DEBUGS("Window") << "Failed to enable adaptive vertical sync. Disabling vsync." << LL_ENDL;
|
LL_INFOS("Window") << "Failed to enable adaptive vertical sync. Disabling vsync." << LL_ENDL;
|
||||||
wglSwapIntervalEXT(0);
|
wglSwapIntervalEXT(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LL_DEBUGS("Window") << "Enabling vertical sync" << LL_ENDL;
|
LL_INFOS("Window") << "Enabling vertical sync" << LL_ENDL;
|
||||||
wglSwapIntervalEXT(1);
|
wglSwapIntervalEXT(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,16 @@
|
|||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define FLT_MAX 3.402823466e+38
|
||||||
|
|
||||||
ATTRIBUTE vec4 weight4;
|
ATTRIBUTE vec4 weight4;
|
||||||
|
|
||||||
uniform mat3 matrixPalette[52];
|
uniform mat3 matrixPalette[52];
|
||||||
uniform vec3 translationPalette[52];
|
uniform vec3 translationPalette[52];
|
||||||
uniform float maxWeight;
|
uniform float maxWeight;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mat4 getObjectSkinnedTransform()
|
mat4 getObjectSkinnedTransform()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -38,14 +42,14 @@ mat4 getObjectSkinnedTransform()
|
|||||||
index = min(index, vec4(maxWeight));
|
index = min(index, vec4(maxWeight));
|
||||||
index = max(index, vec4( 0.0));
|
index = max(index, vec4( 0.0));
|
||||||
|
|
||||||
float scale = 1.0/(w.x+w.y+w.z+w.w);
|
float sum = (w.x+w.y+w.z+w.w);
|
||||||
w *= scale;
|
|
||||||
|
|
||||||
int i1 = int(index.x);
|
int i1 = int(index.x);
|
||||||
int i2 = int(index.y);
|
int i2 = int(index.y);
|
||||||
int i3 = int(index.z);
|
int i3 = int(index.z);
|
||||||
int i4 = int(index.w);
|
int i4 = int(index.w);
|
||||||
|
|
||||||
|
|
||||||
mat3 mat = matrixPalette[i1]*w.x;
|
mat3 mat = matrixPalette[i1]*w.x;
|
||||||
mat += matrixPalette[i2]*w.y;
|
mat += matrixPalette[i2]*w.y;
|
||||||
mat += matrixPalette[i3]*w.z;
|
mat += matrixPalette[i3]*w.z;
|
||||||
@@ -58,10 +62,10 @@ mat4 getObjectSkinnedTransform()
|
|||||||
|
|
||||||
mat4 ret;
|
mat4 ret;
|
||||||
|
|
||||||
ret[0] = vec4(mat[0], 0);
|
ret[0] = vec4(mat[0].xyz, 0);
|
||||||
ret[1] = vec4(mat[1], 0);
|
ret[1] = vec4(mat[1].xyz, 0);
|
||||||
ret[2] = vec4(mat[2], 0);
|
ret[2] = vec4(mat[2].xyz, 0);
|
||||||
ret[3] = vec4(trans, 1.0);
|
ret[3] = vec4(trans, sum);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK;
|
|||||||
static U32 sBufferUsage = GL_STREAM_DRAW_ARB;
|
static U32 sBufferUsage = GL_STREAM_DRAW_ARB;
|
||||||
static U32 sShaderLevel = 0;
|
static U32 sShaderLevel = 0;
|
||||||
|
|
||||||
#define JOINT_COUNT 52
|
|
||||||
|
|
||||||
LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL;
|
LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL;
|
||||||
BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE;
|
BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE;
|
||||||
BOOL LLDrawPoolAvatar::sSkipTransparent = FALSE;
|
BOOL LLDrawPoolAvatar::sSkipTransparent = FALSE;
|
||||||
@@ -1550,93 +1548,8 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sShaderLevel <= 0 && face->mLastSkinTime < avatar->getLastSkinTime())
|
if (sShaderLevel <= 0 && face->mLastSkinTime < avatar->getLastSkinTime())
|
||||||
{ //perform software vertex skinning for this face
|
{
|
||||||
LLStrider<LLVector3> position;
|
avatar->updateSoftwareSkinnedVertices(skin, weight, vol_face, buffer);
|
||||||
LLStrider<LLVector3> normal;
|
|
||||||
|
|
||||||
bool has_normal = buffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
|
|
||||||
buffer->getVertexStrider(position);
|
|
||||||
|
|
||||||
if (has_normal)
|
|
||||||
{
|
|
||||||
buffer->getNormalStrider(normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLVector4a* pos = (LLVector4a*) position.get();
|
|
||||||
|
|
||||||
LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL;
|
|
||||||
|
|
||||||
//build matrix palette
|
|
||||||
LLMatrix4a mp[JOINT_COUNT];
|
|
||||||
LLMatrix4* mat = (LLMatrix4*) mp;
|
|
||||||
|
|
||||||
U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT);
|
|
||||||
|
|
||||||
for (U32 j = 0; j < count; ++j)
|
|
||||||
{
|
|
||||||
LLJoint* joint = avatar->getJoint(skin->mJointNames[j]);
|
|
||||||
if(!joint)
|
|
||||||
{
|
|
||||||
joint = avatar->getJoint("mRoot");
|
|
||||||
}
|
|
||||||
if (joint)
|
|
||||||
{
|
|
||||||
mat[j] = skin->mInvBindMatrix[j];
|
|
||||||
mat[j] *= joint->getWorldMatrix();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LLMatrix4a bind_shape_matrix;
|
|
||||||
bind_shape_matrix.loadu(skin->mBindShapeMatrix);
|
|
||||||
|
|
||||||
for (U32 j = 0; j < (U32)buffer->getNumVerts(); ++j)
|
|
||||||
{
|
|
||||||
LLMatrix4a final_mat;
|
|
||||||
final_mat.clear();
|
|
||||||
|
|
||||||
S32 idx[4];
|
|
||||||
|
|
||||||
LLVector4 wght;
|
|
||||||
|
|
||||||
F32 scale = 0.f;
|
|
||||||
for (U32 k = 0; k < 4; k++)
|
|
||||||
{
|
|
||||||
F32 w = weight[j][k];
|
|
||||||
|
|
||||||
idx[k] = llclamp((S32) floorf(w), 0, S32(count-1));
|
|
||||||
wght[k] = w - floorf(w);
|
|
||||||
scale += wght[k];
|
|
||||||
}
|
|
||||||
|
|
||||||
wght *= 1.f/scale;
|
|
||||||
|
|
||||||
for (U32 k = 0; k < 4; k++)
|
|
||||||
{
|
|
||||||
F32 w = wght[k];
|
|
||||||
|
|
||||||
LLMatrix4a src;
|
|
||||||
src.setMul(mp[idx[k]], w);
|
|
||||||
|
|
||||||
final_mat.add(src);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LLVector4a& v = vol_face.mPositions[j];
|
|
||||||
LLVector4a t;
|
|
||||||
LLVector4a dst;
|
|
||||||
bind_shape_matrix.affineTransform(v, t);
|
|
||||||
final_mat.affineTransform(t, dst);
|
|
||||||
pos[j] = dst;
|
|
||||||
|
|
||||||
if (norm)
|
|
||||||
{
|
|
||||||
LLVector4a& n = vol_face.mNormals[j];
|
|
||||||
bind_shape_matrix.rotate(n, t);
|
|
||||||
final_mat.rotate(t, dst);
|
|
||||||
dst.normalize3fast();
|
|
||||||
norm[j] = dst;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class LLMeshSkinInfo;
|
|||||||
class LLVolume;
|
class LLVolume;
|
||||||
class LLVolumeFace;
|
class LLVolumeFace;
|
||||||
|
|
||||||
|
const U32 JOINT_COUNT = 52;
|
||||||
|
|
||||||
class LLDrawPoolAvatar : public LLFacePool
|
class LLDrawPoolAvatar : public LLFacePool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ U16 LLFace::getGeometryAvatar(
|
|||||||
LLStrider<LLVector3> &normals,
|
LLStrider<LLVector3> &normals,
|
||||||
LLStrider<LLVector2> &tex_coords,
|
LLStrider<LLVector2> &tex_coords,
|
||||||
LLStrider<F32> &vertex_weights,
|
LLStrider<F32> &vertex_weights,
|
||||||
LLStrider<LLVector4> &clothing_weights)
|
LLStrider<LLVector4a> &clothing_weights)
|
||||||
{
|
{
|
||||||
if (mVertexBuffer.notNull())
|
if (mVertexBuffer.notNull())
|
||||||
{
|
{
|
||||||
@@ -1143,11 +1143,11 @@ void LLFace::cacheFaceInVRAM(const LLVolumeFace& vf)
|
|||||||
|
|
||||||
if (vf.mWeights)
|
if (vf.mWeights)
|
||||||
{
|
{
|
||||||
LLStrider<LLVector4> f_wght;
|
LLStrider<LLVector4a> f_wght;
|
||||||
buff->getWeight4Strider(f_wght);
|
buff->getWeight4Strider(f_wght);
|
||||||
for (U32 i = 0; i < (U32)vf.mNumVertices; ++i)
|
for (U32 i = 0; i < (U32)vf.mNumVertices; ++i)
|
||||||
{
|
{
|
||||||
(*f_wght++).set(vf.mWeights[i].getF32ptr());
|
(*f_wght++) = vf.mWeights[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1253,7 +1253,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||||||
LLStrider<LLColor4U> colors;
|
LLStrider<LLColor4U> colors;
|
||||||
LLStrider<LLVector3> tangent;
|
LLStrider<LLVector3> tangent;
|
||||||
LLStrider<U16> indicesp;
|
LLStrider<U16> indicesp;
|
||||||
LLStrider<LLVector4> wght;
|
LLStrider<LLVector4a> wght;
|
||||||
|
|
||||||
BOOL full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME);
|
BOOL full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME);
|
||||||
|
|
||||||
@@ -2126,8 +2126,10 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||||||
{
|
{
|
||||||
LLFastTimer t(FTM_FACE_GEOM_WEIGHTS);
|
LLFastTimer t(FTM_FACE_GEOM_WEIGHTS);
|
||||||
mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount, map_range);
|
mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount, map_range);
|
||||||
F32* weights = (F32*) wght.get();
|
for(S32 i=0;i<num_vertices;++i)
|
||||||
LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32));
|
{
|
||||||
|
*(wght++) = vf.mWeights[i];
|
||||||
|
}
|
||||||
if (map_range)
|
if (map_range)
|
||||||
{
|
{
|
||||||
mVertexBuffer->flush();
|
mVertexBuffer->flush();
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ public:
|
|||||||
LLStrider<LLVector3> &normals,
|
LLStrider<LLVector3> &normals,
|
||||||
LLStrider<LLVector2> &texCoords,
|
LLStrider<LLVector2> &texCoords,
|
||||||
LLStrider<F32> &vertex_weights,
|
LLStrider<F32> &vertex_weights,
|
||||||
LLStrider<LLVector4> &clothing_weights);
|
LLStrider<LLVector4a> &clothing_weights);
|
||||||
|
|
||||||
// For volumes, etc.
|
// For volumes, etc.
|
||||||
U16 getGeometry(LLStrider<LLVector3> &vertices,
|
U16 getGeometry(LLStrider<LLVector3> &vertices,
|
||||||
|
|||||||
@@ -4737,7 +4737,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
|
|||||||
LLStrider<LLVector3> normal_strider;
|
LLStrider<LLVector3> normal_strider;
|
||||||
LLStrider<LLVector2> tc_strider;
|
LLStrider<LLVector2> tc_strider;
|
||||||
LLStrider<U16> index_strider;
|
LLStrider<U16> index_strider;
|
||||||
LLStrider<LLVector4> weights_strider;
|
LLStrider<LLVector4a> weights_strider;
|
||||||
|
|
||||||
vb->getVertexStrider(vertex_strider);
|
vb->getVertexStrider(vertex_strider);
|
||||||
vb->getIndexStrider(index_strider);
|
vb->getIndexStrider(index_strider);
|
||||||
@@ -4780,7 +4780,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
|
|||||||
w.mV[i] = joint + wght;
|
w.mV[i] = joint + wght;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(weights_strider++) = w;
|
(*(weights_strider++)).loadua(w.mV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5417,71 +5417,11 @@ BOOL LLModelPreview::render()
|
|||||||
for (U32 i = 0; i < mVertexBuffer[mPreviewLOD][model].size(); ++i)
|
for (U32 i = 0; i < mVertexBuffer[mPreviewLOD][model].size(); ++i)
|
||||||
{
|
{
|
||||||
LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i];
|
LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i];
|
||||||
|
|
||||||
const LLVolumeFace& face = model->getVolumeFace(i);
|
const LLVolumeFace& face = model->getVolumeFace(i);
|
||||||
|
LLStrider<LLVector4a> weight;
|
||||||
LLStrider<LLVector3> position;
|
|
||||||
buffer->getVertexStrider(position);
|
|
||||||
|
|
||||||
LLStrider<LLVector4> weight;
|
|
||||||
buffer->getWeight4Strider(weight);
|
buffer->getWeight4Strider(weight);
|
||||||
|
|
||||||
//quick 'n dirty software vertex skinning
|
getPreviewAvatar()->updateSoftwareSkinnedVertices(&model->mSkinInfo, weight.get(), face, buffer);
|
||||||
|
|
||||||
//build matrix palette
|
|
||||||
|
|
||||||
LLMatrix4 mat[64];
|
|
||||||
for (U32 j = 0; j < model->mSkinInfo.mJointNames.size(); ++j)
|
|
||||||
{
|
|
||||||
LLJoint* joint = getPreviewAvatar()->getJoint(model->mSkinInfo.mJointNames[j]);
|
|
||||||
if (joint)
|
|
||||||
{
|
|
||||||
mat[j] = model->mSkinInfo.mInvBindMatrix[j];
|
|
||||||
mat[j] *= joint->getWorldMatrix();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (S32 j = 0; j < buffer->getNumVerts(); ++j)
|
|
||||||
{
|
|
||||||
LLMatrix4 final_mat;
|
|
||||||
final_mat.mMatrix[0][0] = final_mat.mMatrix[1][1] = final_mat.mMatrix[2][2] = final_mat.mMatrix[3][3] = 0.f;
|
|
||||||
|
|
||||||
LLVector4 wght;
|
|
||||||
S32 idx[4];
|
|
||||||
|
|
||||||
F32 scale = 0.f;
|
|
||||||
for (U32 k = 0; k < 4; k++)
|
|
||||||
{
|
|
||||||
F32 w = weight[j].mV[k];
|
|
||||||
|
|
||||||
idx[k] = (S32) floorf(w);
|
|
||||||
wght.mV[k] = w - floorf(w);
|
|
||||||
scale += wght.mV[k];
|
|
||||||
}
|
|
||||||
|
|
||||||
wght *= 1.f/scale;
|
|
||||||
|
|
||||||
for (U32 k = 0; k < 4; k++)
|
|
||||||
{
|
|
||||||
F32* src = (F32*) mat[idx[k]].mMatrix;
|
|
||||||
F32* dst = (F32*) final_mat.mMatrix;
|
|
||||||
|
|
||||||
F32 w = wght.mV[k];
|
|
||||||
|
|
||||||
for (U32 l = 0; l < 16; l++)
|
|
||||||
{
|
|
||||||
dst[l] += src[l]*w;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//VECTORIZE THIS
|
|
||||||
LLVector3 v(face.mPositions[j].getF32ptr());
|
|
||||||
|
|
||||||
v = v * model->mSkinInfo.mBindShapeMatrix;
|
|
||||||
v = v * final_mat;
|
|
||||||
|
|
||||||
position[j] = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string& binding = instance.mModel->mMaterialList[i];
|
const std::string& binding = instance.mModel->mMaterialList[i];
|
||||||
const LLImportMaterial& material = instance.mMaterial[binding];
|
const LLImportMaterial& material = instance.mMaterial[binding];
|
||||||
|
|||||||
@@ -865,11 +865,20 @@ void LLPanelDisplay::apply()
|
|||||||
{
|
{
|
||||||
U32 fsaa_value = childGetValue("fsaa").asInteger();
|
U32 fsaa_value = childGetValue("fsaa").asInteger();
|
||||||
S32 vsync_value = childGetValue("vsync").asInteger();
|
S32 vsync_value = childGetValue("vsync").asInteger();
|
||||||
|
bool fbo_value = childGetValue("fbo").asBoolean();
|
||||||
|
|
||||||
|
LLWindow* window = gViewerWindow->getWindow();
|
||||||
|
|
||||||
if(vsync_value == -1 && !gGLManager.mHasAdaptiveVsync)
|
if(vsync_value == -1 && !gGLManager.mHasAdaptiveVsync)
|
||||||
vsync_value = 0;
|
vsync_value = 0;
|
||||||
|
|
||||||
bool apply_fsaa_change = !gSavedSettings.getBOOL("RenderUseFBO") && (mFSAASamples != fsaa_value);
|
bool apply_fsaa_change = fbo_value ? false : (mFSAASamples != fsaa_value);
|
||||||
|
|
||||||
|
if(!apply_fsaa_change && (bool)mUseFBO != fbo_value)
|
||||||
|
{
|
||||||
|
apply_fsaa_change = fsaa_value != 0 || mFSAASamples != 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
bool apply_vsync_change = vsync_value != mVsyncMode;
|
bool apply_vsync_change = vsync_value != mVsyncMode;
|
||||||
|
|
||||||
gSavedSettings.setU32("RenderFSAASamples", fsaa_value);
|
gSavedSettings.setU32("RenderFSAASamples", fsaa_value);
|
||||||
@@ -889,7 +898,6 @@ void LLPanelDisplay::apply()
|
|||||||
if(apply_fsaa_change || apply_vsync_change)
|
if(apply_fsaa_change || apply_vsync_change)
|
||||||
{
|
{
|
||||||
bool logged_in = (LLStartUp::getStartupState() >= STATE_STARTED);
|
bool logged_in = (LLStartUp::getStartupState() >= STATE_STARTED);
|
||||||
LLWindow* window = gViewerWindow->getWindow();
|
|
||||||
LLCoordScreen size;
|
LLCoordScreen size;
|
||||||
window->getSize(&size);
|
window->getSize(&size);
|
||||||
LLGLState::checkStates();
|
LLGLState::checkStates();
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w
|
|||||||
LLStrider<LLVector3> normalsp;
|
LLStrider<LLVector3> normalsp;
|
||||||
LLStrider<LLVector2> tex_coordsp;
|
LLStrider<LLVector2> tex_coordsp;
|
||||||
LLStrider<F32> vertex_weightsp;
|
LLStrider<F32> vertex_weightsp;
|
||||||
LLStrider<LLVector4> clothing_weightsp;
|
LLStrider<LLVector4a> clothing_weightsp;
|
||||||
LLStrider<U16> indicesp;
|
LLStrider<U16> indicesp;
|
||||||
|
|
||||||
// Copy data into the faces from the polymesh data.
|
// Copy data into the faces from the polymesh data.
|
||||||
|
|||||||
@@ -1654,7 +1654,7 @@ LLViewerWindow::LLViewerWindow(
|
|||||||
vsync_mode,
|
vsync_mode,
|
||||||
!gNoRender,
|
!gNoRender,
|
||||||
ignore_pixel_depth,
|
ignore_pixel_depth,
|
||||||
gSavedSettings.getBOOL("RenderUseFBO") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
|
LLRenderTarget::sUseFBO ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
|
||||||
|
|
||||||
if (!LLViewerShaderMgr::sInitialized)
|
if (!LLViewerShaderMgr::sInitialized)
|
||||||
{ //immediately initialize shaders
|
{ //immediately initialize shaders
|
||||||
@@ -5500,7 +5500,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
|
U32 fsaa = LLRenderTarget::sUseFBO ? 0 : gSavedSettings.getU32("RenderFSAASamples"); //don't use window level anti-aliasing if FBOs are enabled
|
||||||
U32 old_fsaa = mWindow->getFSAASamples();
|
U32 old_fsaa = mWindow->getFSAASamples();
|
||||||
|
|
||||||
// going from windowed to windowed
|
// going from windowed to windowed
|
||||||
@@ -5512,7 +5512,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
|
|||||||
mWindow->setSize(size);
|
mWindow->setSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fsaa == old_fsaa && vsync_mode == mWindow->getFSAASamples())
|
if (fsaa == old_fsaa && vsync_mode == mWindow->getVsyncMode())
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8819,6 +8819,100 @@ void LLVOAvatar::updateLODRiggedAttachments( void )
|
|||||||
updateLOD();
|
updateLOD();
|
||||||
rebuildRiggedAttachments();
|
rebuildRiggedAttachments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLVOAvatar::updateSoftwareSkinnedVertices(const LLMeshSkinInfo* skin, const LLVector4a* weight, const LLVolumeFace& vol_face, LLVertexBuffer *buffer)
|
||||||
|
{
|
||||||
|
//perform software vertex skinning for this face
|
||||||
|
LLStrider<LLVector3> position;
|
||||||
|
LLStrider<LLVector3> normal;
|
||||||
|
|
||||||
|
bool has_normal = buffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
|
||||||
|
buffer->getVertexStrider(position);
|
||||||
|
|
||||||
|
if (has_normal)
|
||||||
|
{
|
||||||
|
buffer->getNormalStrider(normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLVector4a* pos = (LLVector4a*) position.get();
|
||||||
|
|
||||||
|
LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL;
|
||||||
|
|
||||||
|
//build matrix palette
|
||||||
|
LLMatrix4a mp[JOINT_COUNT];
|
||||||
|
LLMatrix4* mat = (LLMatrix4*) mp;
|
||||||
|
|
||||||
|
U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT);
|
||||||
|
|
||||||
|
llassert_always(count);
|
||||||
|
|
||||||
|
for (U32 j = 0; j < count; ++j)
|
||||||
|
{
|
||||||
|
LLJoint* joint = getJoint(skin->mJointNames[j]);
|
||||||
|
if(!joint)
|
||||||
|
{
|
||||||
|
joint = getJoint("mRoot");
|
||||||
|
}
|
||||||
|
if (joint)
|
||||||
|
{
|
||||||
|
mat[j] = skin->mInvBindMatrix[j];
|
||||||
|
mat[j] *= joint->getWorldMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LLMatrix4a bind_shape_matrix;
|
||||||
|
bind_shape_matrix.loadu(skin->mBindShapeMatrix);
|
||||||
|
|
||||||
|
for (U32 j = 0; j < (U32)buffer->getNumVerts(); ++j)
|
||||||
|
{
|
||||||
|
LLMatrix4a final_mat;
|
||||||
|
final_mat.clear();
|
||||||
|
|
||||||
|
S32 idx[4];
|
||||||
|
|
||||||
|
LLVector4 wght;
|
||||||
|
|
||||||
|
F32 scale = 0.f;
|
||||||
|
for (U32 k = 0; k < 4; k++)
|
||||||
|
{
|
||||||
|
F32 w = weight[j][k];
|
||||||
|
|
||||||
|
idx[k] = (S32) floorf(w);
|
||||||
|
wght[k] = w - floorf(w);
|
||||||
|
scale += wght[k];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(scale > 0.f)
|
||||||
|
wght *= 1.f/scale;
|
||||||
|
else
|
||||||
|
wght = LLVector4(F32_MAX,F32_MAX,F32_MAX,F32_MAX);
|
||||||
|
|
||||||
|
for (U32 k = 0; k < 4; k++)
|
||||||
|
{
|
||||||
|
F32 w = wght[k];
|
||||||
|
LLMatrix4a src;
|
||||||
|
src.setMul(mp[idx[k]], w);
|
||||||
|
|
||||||
|
final_mat.add(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLVector4a& v = vol_face.mPositions[j];
|
||||||
|
LLVector4a t;
|
||||||
|
LLVector4a dst;
|
||||||
|
bind_shape_matrix.affineTransform(v, t);
|
||||||
|
final_mat.affineTransform(t, dst);
|
||||||
|
pos[j] = dst;
|
||||||
|
|
||||||
|
if (norm)
|
||||||
|
{
|
||||||
|
LLVector4a& n = vol_face.mNormals[j];
|
||||||
|
bind_shape_matrix.rotate(n, t);
|
||||||
|
final_mat.rotate(t, dst);
|
||||||
|
dst.normalize3fast();
|
||||||
|
norm[j] = dst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
U32 LLVOAvatar::getPartitionType() const
|
U32 LLVOAvatar::getPartitionType() const
|
||||||
{
|
{
|
||||||
// Avatars merely exist as drawables in the bridge partition
|
// Avatars merely exist as drawables in the bridge partition
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ class LLHUDEffectSpiral;
|
|||||||
class LLTexGlobalColor;
|
class LLTexGlobalColor;
|
||||||
class LLViewerJoint;
|
class LLViewerJoint;
|
||||||
struct LLAppearanceMessageContents;
|
struct LLAppearanceMessageContents;
|
||||||
|
class LLMeshSkinInfo;
|
||||||
|
|
||||||
class SHClientTagMgr : public LLSingleton<SHClientTagMgr>, public boost::signals2::trackable
|
class SHClientTagMgr : public LLSingleton<SHClientTagMgr>, public boost::signals2::trackable
|
||||||
{
|
{
|
||||||
@@ -181,6 +182,7 @@ public:
|
|||||||
/*virtual*/ BOOL updateLOD();
|
/*virtual*/ BOOL updateLOD();
|
||||||
BOOL updateJointLODs();
|
BOOL updateJointLODs();
|
||||||
void updateLODRiggedAttachments( void );
|
void updateLODRiggedAttachments( void );
|
||||||
|
void updateSoftwareSkinnedVertices(const LLMeshSkinInfo* skin, const LLVector4a* weight, const LLVolumeFace& vol_face, LLVertexBuffer *buffer);
|
||||||
/*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
|
/*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
|
||||||
S32 totalTextureMemForUUIDS(std::set<LLUUID>& ids);
|
S32 totalTextureMemForUUIDS(std::set<LLUUID>& ids);
|
||||||
bool allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const;
|
bool allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const;
|
||||||
|
|||||||
@@ -3916,15 +3916,20 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
//build matrix palette
|
//build matrix palette
|
||||||
static const size_t kMaxJoints = 64;
|
LLMatrix4a mp[JOINT_COUNT];
|
||||||
|
|
||||||
LLMatrix4a mp[kMaxJoints];
|
|
||||||
LLMatrix4* mat = (LLMatrix4*) mp;
|
LLMatrix4* mat = (LLMatrix4*) mp;
|
||||||
|
|
||||||
U32 maxJoints = llmin(skin->mJointNames.size(), kMaxJoints);
|
U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT);
|
||||||
for (U32 j = 0; j < maxJoints; ++j)
|
|
||||||
|
llassert_always(count);
|
||||||
|
|
||||||
|
for (U32 j = 0; j < count; ++j)
|
||||||
{
|
{
|
||||||
LLJoint* joint = avatar->getJoint(skin->mJointNames[j]);
|
LLJoint* joint = avatar->getJoint(skin->mJointNames[j]);
|
||||||
|
if(!joint)
|
||||||
|
{
|
||||||
|
joint = avatar->getJoint("mRoot");
|
||||||
|
}
|
||||||
if (joint)
|
if (joint)
|
||||||
{
|
{
|
||||||
mat[j] = skin->mInvBindMatrix[j];
|
mat[j] = skin->mInvBindMatrix[j];
|
||||||
@@ -3973,17 +3978,17 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
|
|||||||
scale += wght[k];
|
scale += wght[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
wght *= 1.f/scale;
|
if(scale > 0.f)
|
||||||
|
wght *= 1.f/scale;
|
||||||
|
else
|
||||||
|
wght = LLVector4(F32_MAX,F32_MAX,F32_MAX,F32_MAX);
|
||||||
|
|
||||||
for (U32 k = 0; k < 4; k++)
|
for (U32 k = 0; k < 4; k++)
|
||||||
{
|
{
|
||||||
F32 w = wght[k];
|
F32 w = wght[k];
|
||||||
|
|
||||||
LLMatrix4a src;
|
LLMatrix4a src;
|
||||||
// Ensure ref'd bone is in our clamped array of mats
|
src.setMul(mp[idx[k]], w);
|
||||||
llassert(idx[k] < kMaxJoints);
|
|
||||||
// clamp k to kMaxJoints to avoid reading garbage off stack in release
|
|
||||||
src.setMul(mp[idx[(k < kMaxJoints) ? k : 0]], w);
|
|
||||||
final_mat.add(src);
|
final_mat.add(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -428,6 +428,9 @@ void LLPipeline::init()
|
|||||||
{
|
{
|
||||||
refreshCachedSettings();
|
refreshCachedSettings();
|
||||||
|
|
||||||
|
bool can_defer = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred");
|
||||||
|
LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderUseFBO") || (gSavedSettings.getBOOL("RenderDeferred") && can_defer);
|
||||||
|
|
||||||
gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity");
|
gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity");
|
||||||
gOctreeReserveCapacity = llmin(gSavedSettings.getU32("OctreeReserveNodeCapacity"),U32(512));
|
gOctreeReserveCapacity = llmin(gSavedSettings.getU32("OctreeReserveNodeCapacity"),U32(512));
|
||||||
sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD");
|
sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD");
|
||||||
|
|||||||
Reference in New Issue
Block a user