summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llcalcparser.h2
-rw-r--r--indra/llmath/llquaternion.h8
-rw-r--r--indra/llmath/llsimdtypes.h18
-rw-r--r--indra/llmath/llvolume.cpp455
-rw-r--r--indra/llmath/llvolume.h15
-rw-r--r--indra/llmath/llvolumeoctree.h2
-rw-r--r--indra/llmath/v3color.h12
-rw-r--r--indra/llmath/v4color.h8
-rw-r--r--indra/llmath/v4math.h8
9 files changed, 286 insertions, 242 deletions
diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h
index e8fdcc9ae3..ea71752ebc 100644
--- a/indra/llmath/llcalcparser.h
+++ b/indra/llmath/llcalcparser.h
@@ -175,7 +175,7 @@ private:
F32 _exp(const F32& a) const { return exp(a); }
F32 _fabs(const F32& a) const { return fabs(a); }
F32 _floor(const F32& a) const { return (F32)llfloor(a); }
- F32 _ceil(const F32& a) const { return llceil(a); }
+ F32 _ceil(const F32& a) const { return (F32)llceil(a); }
F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); }
LLCalc::calc_map_t* mConstants;
diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h
index 6136c59ed1..762d13eded 100644
--- a/indra/llmath/llquaternion.h
+++ b/indra/llmath/llquaternion.h
@@ -186,10 +186,10 @@ inline LLSD LLQuaternion::getValue() const
inline void LLQuaternion::setValue(const LLSD& sd)
{
- mQ[0] = sd[0].asReal();
- mQ[1] = sd[1].asReal();
- mQ[2] = sd[2].asReal();
- mQ[3] = sd[3].asReal();
+ mQ[0] = (F32)sd[0].asReal();
+ mQ[1] = (F32)sd[1].asReal();
+ mQ[2] = (F32)sd[2].asReal();
+ mQ[3] = (F32)sd[3].asReal();
}
// checker
diff --git a/indra/llmath/llsimdtypes.h b/indra/llmath/llsimdtypes.h
index 11462170fb..a407f51029 100644
--- a/indra/llmath/llsimdtypes.h
+++ b/indra/llmath/llsimdtypes.h
@@ -33,20 +33,6 @@
typedef __m128 LLQuad;
-
-#if LL_WINDOWS
-#pragma warning(push)
-#pragma warning( disable : 4800 3 ) // Disable warning about casting int to bool for this class.
-#if defined(_MSC_VER) && (_MSC_VER < 1500)
-// VC++ 2005 is missing these intrinsics
-// __forceinline is MSVC specific and attempts to override compiler inlining judgment. This is so
-// even in debug builds this call is a NOP.
-__forceinline const __m128 _mm_castsi128_ps( const __m128i a ) { return reinterpret_cast<const __m128&>(a); }
-__forceinline const __m128i _mm_castps_si128( const __m128 a ) { return reinterpret_cast<const __m128i&>(a); }
-#endif // _MSC_VER
-
-#endif // LL_WINDOWS
-
class LLBool32
{
public:
@@ -63,10 +49,6 @@ private:
int m_bool{ 0 };
};
-#if LL_WINDOWS
-#pragma warning(pop)
-#endif
-
class LLSimdScalar
{
public:
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index f3db9424d9..700e61467b 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -734,7 +734,7 @@ S32 LLProfile::getNumPoints(const LLProfileParams& params, bool path_open,F32 de
bool LLProfile::generate(const LLProfileParams& params, bool path_open,F32 detail, S32 split,
bool is_sculpted, S32 sculpt_size)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
if ((!mDirty) && (!is_sculpted))
{
@@ -1216,7 +1216,7 @@ S32 LLPath::getNumNGonPoints(const LLPathParams& params, S32 sides, F32 startOff
void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 end_scale, F32 twist_scale)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
// Generates a circular path, starting at (1, 0, 0), counterclockwise along the xz plane.
constexpr F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f };
@@ -1452,7 +1452,7 @@ S32 LLPath::getNumPoints(const LLPathParams& params, F32 detail)
bool LLPath::generate(const LLPathParams& params, F32 detail, S32 split,
bool is_sculpted, S32 sculpt_size)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
if ((!mDirty) && (!is_sculpted))
{
@@ -2029,7 +2029,7 @@ LLVolume::~LLVolume()
bool LLVolume::generate()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
LL_CHECK_MEMORY
llassert_always(mProfilep);
@@ -2289,7 +2289,7 @@ bool LLVolumeFace::VertexData::compareNormal(const LLVolumeFace::VertexData& rhs
bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
//input stream is now pointing at a zlib compressed block of LLSD
//decompress block
@@ -2345,11 +2345,11 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
continue;
}
- LLSD::Binary pos = mdl[i]["Position"];
- LLSD::Binary norm = mdl[i]["Normal"];
- LLSD::Binary tangent = mdl[i]["Tangent"];
- LLSD::Binary tc = mdl[i]["TexCoord0"];
- LLSD::Binary idx = mdl[i]["TriangleList"];
+ const LLSD::Binary& pos = mdl[i]["Position"].asBinary();
+ const LLSD::Binary& norm = mdl[i]["Normal"].asBinary();
+ const LLSD::Binary& tangent = mdl[i]["Tangent"].asBinary();
+ const LLSD::Binary& tc = mdl[i]["TexCoord0"].asBinary();
+ const LLSD::Binary& idx = mdl[i]["TriangleList"].asBinary();
//copy out indices
auto num_indices = idx.size() / 2;
@@ -2538,7 +2538,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
continue;
}
- LLSD::Binary weights = mdl[i]["Weights"];
+ const LLSD::Binary& weights = mdl[i]["Weights"].asBinary();
U32 idx = 0;
@@ -2710,7 +2710,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
}
-bool LLVolume::isMeshAssetLoaded()
+bool LLVolume::isMeshAssetLoaded() const
{
return mIsMeshAssetLoaded;
}
@@ -2733,7 +2733,7 @@ void LLVolume::setMeshAssetUnavaliable(bool unavaliable)
}
}
-bool LLVolume::isMeshAssetUnavaliable()
+bool LLVolume::isMeshAssetUnavaliable() const
{
return mIsMeshAssetUnavaliable;
}
@@ -2776,7 +2776,7 @@ S32 LLVolume::getNumFaces() const
void LLVolume::createVolumeFaces()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
if (mGenerateSingleFace)
{
@@ -3730,6 +3730,207 @@ S32 LLVolume::getNumTriangles(S32* vcount) const
return triangle_count;
}
+void LLVolumeFace::generateSilhouetteEdge(const LLVolume* volume, std::vector<S32>& edge) const
+{
+ llassert(edge.empty()); // edge is supposed to be a scratch array
+
+ if (volume->isMeshAssetLoaded()) { return; }
+
+ if (mTypeMask & CAP_MASK)
+ {
+ // Logic copied from LLVolumeFace::createCap - indicates a face created via
+ // createUnCutCubeCap.
+ if (!(mTypeMask & HOLLOW_MASK) &&
+ !(mTypeMask & OPEN_MASK) &&
+ ((volume->getParams().getPathParams().getBegin()==0.0f)&&
+ (volume->getParams().getPathParams().getEnd()==1.0f))&&
+ (volume->getParams().getProfileParams().getCurveType()==LL_PCODE_PROFILE_SQUARE &&
+ volume->getParams().getPathParams().getCurveType()==LL_PCODE_PATH_LINE)
+ )
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_VOLUME("llvfgse - CAP_MASK");
+
+ const LLAlignedArray<LLVector4a,64>& profile = volume->getProfile().mProfile;
+ S32 grid_size = (profile.size()-1)/4;
+ edge.resize(mNumIndices);
+ llassert(edge.size() == 6*grid_size*grid_size);
+
+ S32 cur_edge = 0;
+ for(S32 gx = 0;gx<grid_size;gx++)
+ {
+ for(S32 gy = 0;gy<grid_size;gy++)
+ {
+ if (mTypeMask & TOP_MASK)
+ {
+
+ S32 edge_value = grid_size * 2 * gy + gx * 2;
+
+ if (gx > 0)
+ {
+ edge[cur_edge++] = edge_value;
+ }
+ else
+ {
+ edge[cur_edge++] = -1; // Mark face to higlight it
+ }
+
+ if (gy < grid_size - 1)
+ {
+ edge[cur_edge++] = edge_value;
+ }
+ else
+ {
+ edge[cur_edge++] = -1;
+ }
+
+ edge[cur_edge++] = edge_value;
+
+ if (gx < grid_size - 1)
+ {
+ edge[cur_edge++] = edge_value;
+ }
+ else
+ {
+ edge[cur_edge++] = -1;
+ }
+
+ if (gy > 0)
+ {
+ edge[cur_edge++] = edge_value;
+ }
+ else
+ {
+ edge[cur_edge++] = -1;
+ }
+
+ edge[cur_edge++] = edge_value;
+ }
+ else
+ {
+ S32 edge_value = grid_size * 2 * gy + gx * 2;
+
+ if (gy > 0)
+ {
+ edge[cur_edge++] = edge_value;
+ }
+ else
+ {
+ edge[cur_edge++] = -1;
+ }
+
+ if (gx < grid_size - 1)
+ {
+ edge[cur_edge++] = edge_value;
+ }
+ else
+ {
+ edge[cur_edge++] = -1;
+ }
+
+ edge[cur_edge++] = edge_value;
+
+ if (gy < grid_size - 1)
+ {
+ edge[cur_edge++] = edge_value;
+ }
+ else
+ {
+ edge[cur_edge++] = -1;
+ }
+
+ if (gx > 0)
+ {
+ edge[cur_edge++] = edge_value;
+ }
+ else
+ {
+ edge[cur_edge++] = -1;
+ }
+
+ edge[cur_edge++] = edge_value;
+ }
+ }
+ }
+ }
+ }
+ else if ((mTypeMask & END_MASK) || (mTypeMask & SIDE_MASK))
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_VOLUME("llvfgse - END_MASK or SIDE_MASK");
+
+ edge.resize(mNumIndices);
+ llassert(edge.size() == 6*(mNumS-1)*(mNumT-1));
+
+ S32 cur_edge = 0;
+ const bool flat_face = mTypeMask & FLAT_MASK;
+ for (S32 t = 0; t < (mNumT-1); t++)
+ {
+ for (S32 s = 0; s < (mNumS-1); s++)
+ {
+ // bottom left/top right neighbor face
+ edge[cur_edge++] = (mNumS-1)*2*t+s*2+1;
+
+ if (t < mNumT-2)
+ { // top right/top left neighbor face
+ edge[cur_edge++] = (mNumS-1)*2*(t+1)+s*2+1;
+ }
+ else if (mNumT <= 3 || volume->getPath().isOpen())
+ { // no neighbor
+ edge[cur_edge++] = -1;
+ }
+ else
+ { // wrap on T
+ edge[cur_edge++] = s*2+1;
+ }
+
+ if (s > 0)
+ { // top left/bottom left neighbor face
+ edge[cur_edge++] = (mNumS-1)*2*t+s*2-1;
+ }
+ else if (flat_face || volume->getProfile().isOpen())
+ { // no neighbor
+ edge[cur_edge++] = -1;
+ }
+ else
+ { // wrap on S
+ edge[cur_edge++] = (mNumS-1)*2*t+(mNumS-2)*2+1;
+ }
+
+ if (t > 0)
+ { // bottom left/bottom right neighbor face
+ edge[cur_edge++] = (mNumS-1)*2*(t-1)+s*2;
+ }
+ else if (mNumT <= 3 || volume->getPath().isOpen())
+ { // no neighbor
+ edge[cur_edge++] = -1;
+ }
+ else
+ { // wrap on T
+ edge[cur_edge++] = (mNumS-1)*2*(mNumT-2)+s*2;
+ }
+
+ if (s < mNumS-2)
+ { // bottom right/top right neighbor face
+ edge[cur_edge++] = (mNumS-1)*2*t+(s+1)*2;
+ }
+ else if (flat_face || volume->getProfile().isOpen())
+ { // no neighbor
+ edge[cur_edge++] = -1;
+ }
+ else
+ { // wrap on S
+ edge[cur_edge++] = (mNumS-1)*2*t;
+ }
+
+ // top right/bottom left neighbor face
+ edge[cur_edge++] = (mNumS-1)*2*t+s*2;
+ }
+ }
+ }
+ else
+ {
+ LL_ERRS() << "Unknown/uninitialized face type!" << LL_ENDL;
+ }
+}
//-----------------------------------------------------------------------------
// generateSilhouetteVertices()
@@ -3741,7 +3942,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
const LLMatrix3& norm_mat_in,
S32 face_mask)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
LLMatrix4a mat;
mat.loadu(mat_in);
@@ -3761,6 +3962,13 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
}
S32 cur_index = 0;
+ // Scratch array for per-face silhouette edge information. This also has a
+ // lot of dev-only debug information that we might not care about anymore.
+ // (see DEBUG_SILHOUETTE_EDGE_MAP)
+ // *TODO: Consider removing the debug associated with
+ // DEBUG_SILHOUETTE_EDGE_MAP, and remove its associated computational
+ // overhead in generateSilhouetteEdge.
+ std::vector<S32> edge;
//for each face
for (face_list_t::iterator iter = mVolumeFaces.begin();
iter != mVolumeFaces.end(); ++iter)
@@ -3768,7 +3976,16 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
LLVolumeFace& face = *iter;
if (!(face_mask & (0x1 << cur_index++)) ||
- face.mNumIndices == 0 || face.mEdge.empty())
+ face.mNumIndices == 0)
+ {
+ continue;
+ }
+ // Attempt to generate "edge" info for this silhouette, which is used
+ // for some prims. If the edge array remains empty, then this
+ // silhouette generation method is not supported for this face.
+ edge.clear();
+ face.generateSilhouetteEdge(this, edge);
+ if (edge.empty())
{
continue;
}
@@ -3782,7 +3999,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
{
for (S32 k = 0; k < 3; k++)
{
- S32 index = face.mEdge[j * 3 + k];
+ S32 index = edge[j * 3 + k];
if (index == -1)
{
@@ -3834,7 +4051,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
//for each edge
for (S32 k = 0; k < 3; k++) {
- S32 nIndex = face.mEdge[j*3+k];
+ S32 nIndex = edge[j*3+k];
if (nIndex <= -1) {
continue;
}
@@ -3949,7 +4166,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
// *FIX IF NEEDED: this does not deal with neighboring degenerate faces
for (S32 k = 0; k < 3; k++)
{
- S32 index = face.mEdge[j*3+k];
+ S32 index = edge[j*3+k];
if (index != -1)
{
fFacing[j] = fFacing[index];
@@ -3961,10 +4178,10 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
//for each edge
for (S32 k = 0; k < 3; k++) {
- S32 index = face.mEdge[j*3+k];
+ S32 index = edge[j*3+k];
if (index != -1 && fFacing[index] == (AWAY | TOWARDS)) {
//our neighbor is degenerate, make him face our direction
- fFacing[face.mEdge[j*3+k]] = fFacing[j];
+ fFacing[edge[j*3+k]] = fFacing[j];
continue;
}
@@ -4870,7 +5087,7 @@ void LLVolumeFace::freeData()
bool LLVolumeFace::create(LLVolume* volume, bool partial_build)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
//tree for this face is no longer valid
destroyOctree();
@@ -5462,7 +5679,11 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
U32 stream_count = data.w.empty() ? 4 : 5;
- S32 vert_count = static_cast<S32>(meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count));
+ S32 vert_count = 0;
+ if (!data.p.empty())
+ {
+ vert_count = static_cast<S32>(meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count));
+ }
if (vert_count < 65535 && vert_count != 0)
{
@@ -5545,7 +5766,7 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
void LLVolumeFace::createOctree(F32 scaler, const LLVector4a& center, const LLVector4a& size)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
if (getOctree())
{
@@ -5771,30 +5992,16 @@ bool LLVolumeFace::createUnCutCubeCap(LLVolume* volume, bool partial_build)
if (!partial_build)
{
+ LL_PROFILE_ZONE_NAMED_CATEGORY_VOLUME("llvfcuccm - generate indices");
+
resizeIndices(grid_size*grid_size*6);
- if (!volume->isMeshAssetLoaded())
- {
- S32 size = grid_size * grid_size * 6;
- try
- {
- mEdge.resize(size);
- }
- catch (std::bad_alloc&)
- {
- LL_WARNS("LLVOLUME") << "Resize of mEdge to " << size << " failed" << LL_ENDL;
- return false;
- }
- }
U16* out = mIndices;
S32 idxs[] = {0,1,(grid_size+1)+1,(grid_size+1)+1,(grid_size+1),0};
- int cur_edge = 0;
-
for(S32 gx = 0;gx<grid_size;gx++)
{
-
for(S32 gy = 0;gy<grid_size;gy++)
{
if (mTypeMask & TOP_MASK)
@@ -5804,47 +6011,6 @@ bool LLVolumeFace::createUnCutCubeCap(LLVolume* volume, bool partial_build)
*out++ = ((gy*(grid_size+1))+gx+idxs[i]);
}
- S32 edge_value = grid_size * 2 * gy + gx * 2;
-
- if (gx > 0)
- {
- mEdge[cur_edge++] = edge_value;
- }
- else
- {
- mEdge[cur_edge++] = -1; // Mark face to higlight it
- }
-
- if (gy < grid_size - 1)
- {
- mEdge[cur_edge++] = edge_value;
- }
- else
- {
- mEdge[cur_edge++] = -1;
- }
-
- mEdge[cur_edge++] = edge_value;
-
- if (gx < grid_size - 1)
- {
- mEdge[cur_edge++] = edge_value;
- }
- else
- {
- mEdge[cur_edge++] = -1;
- }
-
- if (gy > 0)
- {
- mEdge[cur_edge++] = edge_value;
- }
- else
- {
- mEdge[cur_edge++] = -1;
- }
-
- mEdge[cur_edge++] = edge_value;
}
else
{
@@ -5852,48 +6018,6 @@ bool LLVolumeFace::createUnCutCubeCap(LLVolume* volume, bool partial_build)
{
*out++ = ((gy*(grid_size+1))+gx+idxs[i]);
}
-
- S32 edge_value = grid_size * 2 * gy + gx * 2;
-
- if (gy > 0)
- {
- mEdge[cur_edge++] = edge_value;
- }
- else
- {
- mEdge[cur_edge++] = -1;
- }
-
- if (gx < grid_size - 1)
- {
- mEdge[cur_edge++] = edge_value;
- }
- else
- {
- mEdge[cur_edge++] = -1;
- }
-
- mEdge[cur_edge++] = edge_value;
-
- if (gy < grid_size - 1)
- {
- mEdge[cur_edge++] = edge_value;
- }
- else
- {
- mEdge[cur_edge++] = -1;
- }
-
- if (gx > 0)
- {
- mEdge[cur_edge++] = edge_value;
- }
- else
- {
- mEdge[cur_edge++] = -1;
- }
-
- mEdge[cur_edge++] = edge_value;
}
}
}
@@ -6373,6 +6497,8 @@ void LLVolumeFace::createTangents()
void LLVolumeFace::resizeVertices(S32 num_verts)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
+
ll_aligned_free<64>(mPositions);
//DO NOT free mNormals and mTexCoords as they are part of mPositions buffer
ll_aligned_free_16(mTangents);
@@ -6495,6 +6621,8 @@ void LLVolumeFace::allocateJointIndices(S32 num_verts)
void LLVolumeFace::resizeIndices(S32 num_indices)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
+
ll_aligned_free_16(mIndices);
llassert(num_indices % 3 == 0);
@@ -6556,7 +6684,7 @@ void LLVolumeFace::fillFromLegacyData(std::vector<LLVolumeFace::VertexData>& v,
bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
LL_CHECK_MEMORY
bool flat = mTypeMask & FLAT_MASK;
@@ -6587,19 +6715,6 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
{
resizeVertices(num_vertices);
resizeIndices(num_indices);
-
- if (!volume->isMeshAssetLoaded())
- {
- try
- {
- mEdge.resize(num_indices);
- }
- catch (std::bad_alloc&)
- {
- LL_WARNS("LLVOLUME") << "Resize of mEdge to " << num_indices << " failed" << LL_ENDL;
- return false;
- }
- }
}
LL_CHECK_MEMORY
@@ -6614,6 +6729,7 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
bool test = (mTypeMask & INNER_MASK) && (mTypeMask & FLAT_MASK) && mNumS > 2;
// Copy the vertices into the array
+ { LL_PROFILE_ZONE_NAMED_CATEGORY_VOLUME("llvfcs - copy verts");
for (t = mBeginT; t < end_t; t++)
{
tt = path_data[t].mTexT;
@@ -6698,6 +6814,7 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
cur_vertex++;
}
}
+ }
LL_CHECK_MEMORY
mCenter->clear();
@@ -6751,11 +6868,11 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
mCenter->mul(0.5f);
S32 cur_index = 0;
- S32 cur_edge = 0;
- bool flat_face = mTypeMask & FLAT_MASK;
if (!partial_build)
{
+ LL_PROFILE_ZONE_NAMED_CATEGORY_VOLUME("llvfcs - generate indices");
+
// Now we generate the indices.
for (t = 0; t < (mNumT-1); t++)
{
@@ -6767,64 +6884,6 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
mIndices[cur_index++] = s + mNumS*t; //bottom left
mIndices[cur_index++] = s+1 + mNumS*t; //bottom right
mIndices[cur_index++] = s+1 + mNumS*(t+1); //top right
-
- // bottom left/top right neighbor face
- mEdge[cur_edge++] = (mNumS-1)*2*t+s*2+1;
-
- if (t < mNumT-2)
- { // top right/top left neighbor face
- mEdge[cur_edge++] = (mNumS-1)*2*(t+1)+s*2+1;
- }
- else if (mNumT <= 3 || volume->getPath().isOpen())
- { // no neighbor
- mEdge[cur_edge++] = -1;
- }
- else
- { // wrap on T
- mEdge[cur_edge++] = s*2+1;
- }
-
- if (s > 0)
- { // top left/bottom left neighbor face
- mEdge[cur_edge++] = (mNumS-1)*2*t+s*2-1;
- }
- else if (flat_face || volume->getProfile().isOpen())
- { // no neighbor
- mEdge[cur_edge++] = -1;
- }
- else
- { // wrap on S
- mEdge[cur_edge++] = (mNumS-1)*2*t+(mNumS-2)*2+1;
- }
-
- if (t > 0)
- { // bottom left/bottom right neighbor face
- mEdge[cur_edge++] = (mNumS-1)*2*(t-1)+s*2;
- }
- else if (mNumT <= 3 || volume->getPath().isOpen())
- { // no neighbor
- mEdge[cur_edge++] = -1;
- }
- else
- { // wrap on T
- mEdge[cur_edge++] = (mNumS-1)*2*(mNumT-2)+s*2;
- }
-
- if (s < mNumS-2)
- { // bottom right/top right neighbor face
- mEdge[cur_edge++] = (mNumS-1)*2*t+(s+1)*2;
- }
- else if (flat_face || volume->getProfile().isOpen())
- { // no neighbor
- mEdge[cur_edge++] = -1;
- }
- else
- { // wrap on S
- mEdge[cur_edge++] = (mNumS-1)*2*t;
- }
-
- // top right/bottom left neighbor face
- mEdge[cur_edge++] = (mNumS-1)*2*t+s*2;
}
}
}
@@ -7090,7 +7149,7 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
void LLCalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVector4a *normal,
const LLVector2 *texcoord, U32 triangleCount, const U16* index_array, LLVector4a *tangent)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
//LLVector4a *tan1 = new LLVector4a[vertexCount * 2];
LLVector4a* tan1 = (LLVector4a*) ll_aligned_malloc_16(vertexCount*2*sizeof(LLVector4a));
diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h
index bbb2a16b0b..27c5fc5a49 100644
--- a/indra/llmath/llvolume.h
+++ b/indra/llmath/llvolume.h
@@ -918,6 +918,15 @@ public:
// Get a reference to the octree, which may be null
const LLVolumeOctree* getOctree() const;
+ // Part of silhouette generation (used by selection outlines)
+ // Populates the provided edge array with numbers corresponding to
+ // *partial* logic of whether a particular index should be rendered
+ // as a silhouette edge. -1 indicates the index should be rendered as a
+ // silhouette edge. See generateSilhouetteVertices for the full logic.
+ // Silhouette edges can only be generated for some types of prims. If a
+ // silhouette edge cannot be generated, the edge array will be left empty.
+ void generateSilhouetteEdge(const LLVolume* volume, std::vector<S32>& edge) const;
+
enum
{
SINGLE_MASK = 0x0001,
@@ -963,8 +972,6 @@ public:
// indexes for mPositions/mNormals/mTexCoords
U16* mIndices;
- std::vector<S32> mEdge;
-
//list of skin weights for rigged volumes
// format is mWeights[vertex_index].mV[influence] = <joint_index>.<weight>
// mWeights.size() should be empty or match mVertices.size()
@@ -1113,9 +1120,9 @@ private:
public:
virtual void setMeshAssetLoaded(bool loaded);
- virtual bool isMeshAssetLoaded();
+ virtual bool isMeshAssetLoaded() const;
virtual void setMeshAssetUnavaliable(bool unavaliable);
- virtual bool isMeshAssetUnavaliable();
+ virtual bool isMeshAssetUnavaliable() const;
protected:
bool mUnique;
diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h
index 05d45f7b5f..1d74644715 100644
--- a/indra/llmath/llvolumeoctree.h
+++ b/indra/llmath/llvolumeoctree.h
@@ -143,7 +143,7 @@ public:
virtual void visit(const LLOctreeNode<LLVolumeTriangle, LLVolumeTriangle*>* branch)
{ //this is a depth first traversal, so it's safe to assum all children have complete
//bounding data
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
LLVolumeOctreeListener* node = (LLVolumeOctreeListener*)branch->getListener(0);
diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h
index 7b92f85a0c..f7af469e66 100644
--- a/indra/llmath/v3color.h
+++ b/indra/llmath/v3color.h
@@ -209,10 +209,6 @@ inline LLColor3::LLColor3(const F32 *vec)
mV[VBLUE] = vec[VBLUE];
}
-#if LL_WINDOWS
-# pragma warning( disable : 4996 ) // strncpy teh sux0r
-#endif
-
inline LLColor3::LLColor3(const char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF
{
if (strlen(color_string) < 6) /* Flawfinder: ignore */
@@ -517,9 +513,9 @@ inline const LLVector3 linearColor3v(const T& a) {
template<typename T>
const LLColor3& LLColor3::set(const std::vector<T>& v)
{
- for (S32 i = 0; i < llmin((S32)v.size(), 3); ++i)
+ for (size_t i = 0; i < llmin(v.size(), 3); ++i)
{
- mV[i] = v[i];
+ mV[i] = (F32)v[i];
}
return *this;
@@ -530,9 +526,9 @@ const LLColor3& LLColor3::set(const std::vector<T>& v)
template<typename T>
void LLColor3::write(std::vector<T>& v) const
{
- for (int i = 0; i < llmin((S32)v.size(), 3); ++i)
+ for (size_t i = 0; i < llmin(v.size(), 3); ++i)
{
- v[i] = mV[i];
+ v[i] = (T)mV[i];
}
}
diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h
index e9bb6a07ba..cafdbd9d7c 100644
--- a/indra/llmath/v4color.h
+++ b/indra/llmath/v4color.h
@@ -702,9 +702,9 @@ inline const LLColor4 linearColor4(const LLColor4 &a)
template<typename T>
const LLColor4& LLColor4::set(const std::vector<T>& v)
{
- for (S32 i = 0; i < llmin((S32)v.size(), 4); ++i)
+ for (size_t i = 0; i < llmin(v.size(), 4); ++i)
{
- mV[i] = v[i];
+ mV[i] = (F32)v[i];
}
return *this;
@@ -713,9 +713,9 @@ const LLColor4& LLColor4::set(const std::vector<T>& v)
template<typename T>
void LLColor4::write(std::vector<T>& v) const
{
- for (int i = 0; i < llmin((S32)v.size(), 4); ++i)
+ for (size_t i = 0; i < llmin(v.size(), 4); ++i)
{
- v[i] = mV[i];
+ v[i] = (T)mV[i];
}
}
diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h
index 7ed22212d3..a5b6f506d7 100644
--- a/indra/llmath/v4math.h
+++ b/indra/llmath/v4math.h
@@ -67,10 +67,10 @@ class LLVector4
void setValue(const LLSD& sd)
{
- mV[0] = sd[0].asReal();
- mV[1] = sd[1].asReal();
- mV[2] = sd[2].asReal();
- mV[3] = sd[3].asReal();
+ mV[0] = (F32)sd[0].asReal();
+ mV[1] = (F32)sd[1].asReal();
+ mV[2] = (F32)sd[2].asReal();
+ mV[3] = (F32)sd[3].asReal();
}