From 1ff79683128f09baf6dbaf081092fda7e5f2fe65 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 28 Mar 2011 23:50:23 -0500 Subject: SH-1225 Add skinning info to import path of .slm files. --- indra/llmath/llvolume.cpp | 50 ----------------------------------------------- indra/llmath/llvolume.h | 2 -- 2 files changed, 52 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 7a2f06da8f..dc360818d6 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2143,56 +2143,6 @@ bool LLVolumeFace::VertexData::compareNormal(const LLVolumeFace::VertexData& rhs return retval; } -BOOL LLVolume::createVolumeFacesFromFile(const std::string& file_name) -{ - std::ifstream is; - - is.open(file_name.c_str(), std::ifstream::in | std::ifstream::binary); - - BOOL success = createVolumeFacesFromStream(is); - - is.close(); - - return success; -} - -BOOL LLVolume::createVolumeFacesFromStream(std::istream& is) -{ - mSculptLevel = -1; // default is an error occured - - LLSD header; - { - if (!LLSDSerialize::fromBinary(header, is, 1024*1024*1024)) - { - llwarns << "Mesh header parse error. Not a valid mesh asset!" << llendl; - return FALSE; - } - } - - std::string nm[] = - { - "lowest_lod", - "low_lod", - "medium_lod", - "high_lod", - "physics_shape", - }; - - const S32 MODEL_LODS = 5; - - S32 lod = llclamp((S32) mDetail, 0, MODEL_LODS); - - if (header[nm[lod]]["offset"].asInteger() == -1 || - header[nm[lod]]["size"].asInteger() == 0 ) - { //cannot load requested LOD - return FALSE; - } - - is.seekg(header[nm[lod]]["offset"].asInteger(), std::ios_base::cur); - - return unpackVolumeFaces(is, header[nm[lod]]["size"].asInteger()); -} - bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) { //input stream is now pointing at a zlib compressed block of LLSD diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 60b64b1285..01bfbd858b 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -1048,8 +1048,6 @@ protected: BOOL generate(); void createVolumeFaces(); public: - virtual BOOL createVolumeFacesFromFile(const std::string& file_name); - virtual BOOL createVolumeFacesFromStream(std::istream& is); virtual bool unpackVolumeFaces(std::istream& is, S32 size); virtual void makeTetrahedron(); -- cgit v1.2.3 From f90eb750f1e8c3e300d1a079fe99d15f35201072 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 7 Apr 2011 00:29:02 -0500 Subject: SH-1292 Remove outliers from graphs in scene console to make a more useful view. --- indra/llmath/llmath.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'indra/llmath') diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 25b29ac1a8..97001b4062 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -29,6 +29,7 @@ #include #include +#include #include "lldefs.h" //#include "llstl.h" // *TODO: Remove when LLString is gone //#include "llstring.h" // *TODO: Remove when LLString is gone @@ -497,6 +498,44 @@ inline F32 llgaussian(F32 x, F32 o) return 1.f/(F_SQRT_TWO_PI*o)*powf(F_E, -(x*x)/(2*o*o)); } +//helper function for removing outliers +template +inline void ll_remove_outliers(std::vector& data, F32 k) +{ + if (data.size() < 100) + { //not enough samples + return; + } + + VEC_TYPE Q1 = data[data.size()/4]; + VEC_TYPE Q3 = data[data.size()-data.size()/4-1]; + + VEC_TYPE min = Q1-k*(Q3-Q1); + VEC_TYPE max = Q3+k*(Q3-Q1); + + U32 i = 0; + while (i < data.size() && data[i] < min) + { + i++; + } + + S32 j = data.size()-1; + while (j > 0 && data[j] > max) + { + j--; + } + + if (j < data.size()-1) + { + data.erase(data.begin()+j, data.end()); + } + + if (i > 0) + { + data.erase(data.begin(), data.begin()+i); + } +} + // Include simd math header #include "llsimdmath.h" -- cgit v1.2.3 From 8807496ed78b36658f488d901842852d63f73cb9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 8 Apr 2011 02:11:46 -0500 Subject: attempted fix for linux build --- indra/llmath/llmath.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 97001b4062..eea7c977fb 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -510,8 +510,8 @@ inline void ll_remove_outliers(std::vector& data, F32 k) VEC_TYPE Q1 = data[data.size()/4]; VEC_TYPE Q3 = data[data.size()-data.size()/4-1]; - VEC_TYPE min = Q1-k*(Q3-Q1); - VEC_TYPE max = Q3+k*(Q3-Q1); + VEC_TYPE min = (VEC_TYPE) ((F32) Q1-k * (F32) (Q3-Q1)); + VEC_TYPE max = (VEC_TYPE) ((F32) Q3+k * (F32) (Q3-Q1)); U32 i = 0; while (i < data.size() && data[i] < min) -- cgit v1.2.3