llmath merge
This commit is contained in:
@@ -71,6 +71,9 @@ public:
|
|||||||
void quantize8(F32 lower, F32 upper); // changes the vector to reflect quatization
|
void quantize8(F32 lower, F32 upper); // changes the vector to reflect quatization
|
||||||
void loadIdentity(); // Loads the quaternion that represents the identity rotation
|
void loadIdentity(); // Loads the quaternion that represents the identity rotation
|
||||||
|
|
||||||
|
bool isEqualEps(const LLQuaternion &quat, F32 epsilon) const;
|
||||||
|
bool isNotEqualEps(const LLQuaternion &quat, F32 epsilon) const;
|
||||||
|
|
||||||
const LLQuaternion& set(F32 x, F32 y, F32 z, F32 w); // Sets Quaternion to normalize(x, y, z, w)
|
const LLQuaternion& set(F32 x, F32 y, F32 z, F32 w); // Sets Quaternion to normalize(x, y, z, w)
|
||||||
const LLQuaternion& set(const LLQuaternion &quat); // Copies Quaternion
|
const LLQuaternion& set(const LLQuaternion &quat); // Copies Quaternion
|
||||||
const LLQuaternion& set(const F32 *q); // Sets Quaternion to normalize(quat[VX], quat[VY], quat[VZ], quat[VW])
|
const LLQuaternion& set(const F32 *q); // Sets Quaternion to normalize(quat[VX], quat[VY], quat[VZ], quat[VW])
|
||||||
@@ -239,6 +242,21 @@ inline void LLQuaternion::loadIdentity()
|
|||||||
mQ[VW] = 1.0f;
|
mQ[VW] = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool LLQuaternion::isEqualEps(const LLQuaternion &quat, F32 epsilon) const
|
||||||
|
{
|
||||||
|
return ( fabs(mQ[VX] - quat.mQ[VX]) < epsilon
|
||||||
|
&& fabs(mQ[VY] - quat.mQ[VY]) < epsilon
|
||||||
|
&& fabs(mQ[VZ] - quat.mQ[VZ]) < epsilon
|
||||||
|
&& fabs(mQ[VS] - quat.mQ[VS]) < epsilon );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool LLQuaternion::isNotEqualEps(const LLQuaternion &quat, F32 epsilon) const
|
||||||
|
{
|
||||||
|
return ( fabs(mQ[VX] - quat.mQ[VX]) > epsilon
|
||||||
|
|| fabs(mQ[VY] - quat.mQ[VY]) > epsilon
|
||||||
|
|| fabs(mQ[VZ] - quat.mQ[VZ]) > epsilon
|
||||||
|
|| fabs(mQ[VS] - quat.mQ[VS]) > epsilon );
|
||||||
|
}
|
||||||
|
|
||||||
inline const LLQuaternion& LLQuaternion::set(F32 x, F32 y, F32 z, F32 w)
|
inline const LLQuaternion& LLQuaternion::set(F32 x, F32 y, F32 z, F32 w)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2532,6 +2532,8 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
|
|||||||
|
|
||||||
U32 cur_influence = 0;
|
U32 cur_influence = 0;
|
||||||
LLVector4 wght(0,0,0,0);
|
LLVector4 wght(0,0,0,0);
|
||||||
|
U32 joints[4] = {0,0,0,0};
|
||||||
|
LLVector4 joints_with_weights(0,0,0,0);
|
||||||
|
|
||||||
while (joint != END_INFLUENCES && idx < weights.size())
|
while (joint != END_INFLUENCES && idx < weights.size())
|
||||||
{
|
{
|
||||||
@@ -2539,7 +2541,9 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
|
|||||||
influence |= ((U16) weights[idx++] << 8);
|
influence |= ((U16) weights[idx++] << 8);
|
||||||
|
|
||||||
F32 w = llclamp((F32) influence / 65535.f, 0.f, 0.99999f);
|
F32 w = llclamp((F32) influence / 65535.f, 0.f, 0.99999f);
|
||||||
wght.mV[cur_influence++] = (F32) joint + w;
|
wght.mV[cur_influence] = w;
|
||||||
|
joints[cur_influence] = joint;
|
||||||
|
cur_influence++;
|
||||||
|
|
||||||
if (cur_influence >= 4)
|
if (cur_influence >= 4)
|
||||||
{
|
{
|
||||||
@@ -2550,8 +2554,16 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
|
|||||||
joint = weights[idx++];
|
joint = weights[idx++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
F32 wsum = wght.mV[VX] + wght.mV[VY] + wght.mV[VZ] + wght.mV[VW];
|
||||||
face.mWeights[cur_vertex].loadua(wght.mV);
|
if (wsum <= 0.f)
|
||||||
|
{
|
||||||
|
wght = LLVector4(0.99999f,0.f,0.f,0.f);
|
||||||
|
}
|
||||||
|
for (U32 k=0; k<4; k++)
|
||||||
|
{
|
||||||
|
joints_with_weights[k] = (F32) joints[k] + wght[k];
|
||||||
|
}
|
||||||
|
face.mWeights[cur_vertex].loadua(joints_with_weights.mV);
|
||||||
|
|
||||||
cur_vertex++;
|
cur_vertex++;
|
||||||
}
|
}
|
||||||
@@ -6311,6 +6323,8 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
|||||||
num_vertices = mNumS*mNumT;
|
num_vertices = mNumS*mNumT;
|
||||||
num_indices = (mNumS-1)*(mNumT-1)*6;
|
num_indices = (mNumS-1)*(mNumT-1)*6;
|
||||||
|
|
||||||
|
partial_build = (num_vertices > mNumVertices || num_indices > mNumIndices) ? FALSE : partial_build;
|
||||||
|
|
||||||
if (!partial_build)
|
if (!partial_build)
|
||||||
{
|
{
|
||||||
resizeVertices(num_vertices);
|
resizeVertices(num_vertices);
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ void LLVolumeMgr::useMutex()
|
|||||||
{
|
{
|
||||||
if (!mDataMutex)
|
if (!mDataMutex)
|
||||||
{
|
{
|
||||||
mDataMutex = new LLMutex;
|
mDataMutex = new LLMutex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -274,6 +274,19 @@ const LLMatrix4& LLMatrix4::invert(void)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convenience func for simplifying comparison-heavy code by
|
||||||
|
// intentionally stomping values in [-FLT_EPS,FLT_EPS] to 0.0f
|
||||||
|
//
|
||||||
|
void LLMatrix4::condition(void)
|
||||||
|
{
|
||||||
|
U32 i;
|
||||||
|
U32 j;
|
||||||
|
for (i = 0; i < 3;i++)
|
||||||
|
for (j = 0; j < 3;j++)
|
||||||
|
mMatrix[i][j] = ((mMatrix[i][j] > -FLT_EPSILON)
|
||||||
|
&& (mMatrix[i][j] < FLT_EPSILON)) ? 0.0f : mMatrix[i][j];
|
||||||
|
}
|
||||||
|
|
||||||
LLVector4 LLMatrix4::getFwdRow4() const
|
LLVector4 LLMatrix4::getFwdRow4() const
|
||||||
{
|
{
|
||||||
return LLVector4(mMatrix[VX][VX], mMatrix[VX][VY], mMatrix[VX][VZ], mMatrix[VX][VW]);
|
return LLVector4(mMatrix[VX][VX], mMatrix[VX][VY], mMatrix[VX][VZ], mMatrix[VX][VW]);
|
||||||
|
|||||||
@@ -180,6 +180,11 @@ public:
|
|||||||
const LLMatrix4& setTranslation(const LLVector4 &translation);
|
const LLMatrix4& setTranslation(const LLVector4 &translation);
|
||||||
const LLMatrix4& setTranslation(const LLVector3 &translation);
|
const LLMatrix4& setTranslation(const LLVector3 &translation);
|
||||||
|
|
||||||
|
// Convenience func for simplifying comparison-heavy code by
|
||||||
|
// intentionally stomping values [-FLT_EPS,FLT_EPS] to 0.0
|
||||||
|
//
|
||||||
|
void condition(void);
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
//
|
//
|
||||||
// Get properties of a matrix
|
// Get properties of a matrix
|
||||||
|
|||||||
Reference in New Issue
Block a user