summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
authorGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-05-23 01:16:12 +0100
committerGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-05-23 01:16:12 +0100
commit439273c9c11ec5f3c186fd7d97a28d11419153cd (patch)
treef6e4f1566425921d71e40b9628011eb0f5f539f3 /indra/llmath
parent13536bb273b7413aa4461c8eeaf5a6a865f4234d (diff)
parent689beff6698fcb8582c44f58bb9896606850b149 (diff)
Merge
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llquaternion.cpp2
-rw-r--r--indra/llmath/llvolume.cpp58
-rw-r--r--indra/llmath/llvolume.h5
-rw-r--r--indra/llmath/m3math.cpp2
4 files changed, 53 insertions, 14 deletions
diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp
index a8d9eba2a0..a7ff707bb8 100644
--- a/indra/llmath/llquaternion.cpp
+++ b/indra/llmath/llquaternion.cpp
@@ -38,6 +38,8 @@
#include "m3math.h"
#include "llquantize.h"
+#pragma optimize("", off)
+
// WARNING: Don't use this for global const definitions! using this
// at the top of a *.cpp file might not give you what you think.
const LLQuaternion LLQuaternion::DEFAULT;
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 2bce4e9bd3..14b0f350b9 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -2927,28 +2927,54 @@ F32 LLVolume::sculptGetSurfaceArea()
return area;
}
-// create placeholder shape
-void LLVolume::sculptGeneratePlaceholder()
+// create empty placeholder shape
+void LLVolume::sculptGenerateEmptyPlaceholder()
{
S32 sizeS = mPathp->mPath.size();
S32 sizeT = mProfilep->mProfile.size();
-
+
S32 line = 0;
- // for now, this is a sphere.
for (S32 s = 0; s < sizeS; s++)
{
for (S32 t = 0; t < sizeT; t++)
{
S32 i = t + line;
LLVector4a& pt = mMesh[i];
+
+ F32* p = pt.getF32ptr();
-
- F32 u = (F32)s/(sizeS-1);
- F32 v = (F32)t/(sizeT-1);
+ p[0] = 0;
+ p[1] = 0;
+ p[2] = 0;
+
+ llassert(pt.isFinite3());
+ }
+ line += sizeT;
+ }
+}
+
+// create sphere placeholder shape
+void LLVolume::sculptGenerateSpherePlaceholder()
+{
+ S32 sizeS = mPathp->mPath.size();
+ S32 sizeT = mProfilep->mProfile.size();
+
+ S32 line = 0;
+
+ for (S32 s = 0; s < sizeS; s++)
+ {
+ for (S32 t = 0; t < sizeT; t++)
+ {
+ S32 i = t + line;
+ LLVector4a& pt = mMesh[i];
+
+
+ F32 u = (F32)s / (sizeS - 1);
+ F32 v = (F32)t / (sizeT - 1);
const F32 RADIUS = (F32) 0.3;
-
+
F32* p = pt.getF32ptr();
p[0] = (F32)(sin(F_PI * v) * cos(2.0 * F_PI * u) * RADIUS);
@@ -2956,7 +2982,6 @@ void LLVolume::sculptGeneratePlaceholder()
p[2] = (F32)(cos(F_PI * v) * RADIUS);
llassert(pt.isFinite3());
-
}
line += sizeT;
}
@@ -3119,9 +3144,9 @@ void sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 detail, S32
}
// sculpt replaces generate() for sculpted surfaces
-void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level)
+void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level, bool visible_placeholder)
{
- U8 sculpt_type = mParams.getSculptType();
+ U8 sculpt_type = mParams.getSculptType();
BOOL data_is_empty = FALSE;
@@ -3169,13 +3194,22 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
if (area < SCULPT_MIN_AREA || area > SCULPT_MAX_AREA)
{
data_is_empty = TRUE;
+ visible_placeholder = true;
}
}
}
if (data_is_empty)
{
- sculptGeneratePlaceholder();
+ if (visible_placeholder)
+ {
+ // Object should be visible since there will be nothing else to display
+ sculptGenerateSpherePlaceholder();
+ }
+ else
+ {
+ sculptGenerateEmptyPlaceholder();
+ }
}
diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h
index a8089f3709..4357b69b90 100644
--- a/indra/llmath/llvolume.h
+++ b/indra/llmath/llvolume.h
@@ -1059,7 +1059,7 @@ public:
U32 mFaceMask; // bit array of which faces exist in this volume
LLVector3 mLODScaleBias; // vector for biasing LOD based on scale
- void sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level);
+ void sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level, bool visible_placeholder);
void copyVolumeFaces(const LLVolume* volume);
void copyFacesTo(std::vector<LLVolumeFace> &faces) const;
void copyFacesFrom(const std::vector<LLVolumeFace> &faces);
@@ -1068,7 +1068,8 @@ public:
private:
void sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type);
F32 sculptGetSurfaceArea();
- void sculptGeneratePlaceholder();
+ void sculptGenerateEmptyPlaceholder();
+ void sculptGenerateSpherePlaceholder();
void sculptCalcMeshResolution(U16 width, U16 height, U8 type, S32& s, S32& t);
diff --git a/indra/llmath/m3math.cpp b/indra/llmath/m3math.cpp
index 65eb3348de..7e59e10bab 100644
--- a/indra/llmath/m3math.cpp
+++ b/indra/llmath/m3math.cpp
@@ -34,6 +34,8 @@
#include "m3math.h"
#include "llquaternion.h"
+#pragma optimize("", off)
+
// LLMatrix3
// ji