summaryrefslogtreecommitdiff
path: root/indra/llmath/llvolume.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-31 21:25:47 +0800
committerErik Kundiman <erik@megapahit.org>2024-09-01 20:43:42 +0800
commit95582654e49422d51b55665c3f2821c848ad1cb8 (patch)
treed6d03a887b8e1b6c3be1b139d63b1638c5d0fdcd /indra/llmath/llvolume.cpp
parentab3f483a3e5ed213882a83b882095cfdb6a4de57 (diff)
parentb0fefd62adbf51f32434ba077e9f52d8a9241d15 (diff)
Merge remote-tracking branch 'secondlife/release/2024.08-DeltaFPS' into 2024.08-DeltaFPS
Diffstat (limited to 'indra/llmath/llvolume.cpp')
-rw-r--r--indra/llmath/llvolume.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 8bcfd591b4..ede5327f51 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -738,7 +738,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))
{
@@ -1220,7 +1220,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 };
@@ -1456,7 +1456,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))
{
@@ -2033,7 +2033,7 @@ LLVolume::~LLVolume()
bool LLVolume::generate()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
LL_CHECK_MEMORY
llassert_always(mProfilep);
@@ -2293,7 +2293,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
@@ -2349,11 +2349,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;
@@ -2542,7 +2542,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;
@@ -2780,7 +2780,7 @@ S32 LLVolume::getNumFaces() const
void LLVolume::createVolumeFaces()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
if (mGenerateSingleFace)
{
@@ -3745,7 +3745,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);
@@ -4874,7 +4874,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();
@@ -5466,7 +5466,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)
{
@@ -5549,7 +5553,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())
{
@@ -6560,7 +6564,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;
@@ -7094,7 +7098,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));