diff options
Diffstat (limited to 'indra/llmath')
| -rw-r--r-- | indra/llmath/llrigginginfo.cpp | 4 | ||||
| -rw-r--r-- | indra/llmath/llvolume.cpp | 95 | ||||
| -rw-r--r-- | indra/llmath/llvolume.h | 2 | ||||
| -rw-r--r-- | indra/llmath/v3math.cpp | 36 | ||||
| -rw-r--r-- | indra/llmath/v3math.h | 2 | 
5 files changed, 38 insertions, 101 deletions
| diff --git a/indra/llmath/llrigginginfo.cpp b/indra/llmath/llrigginginfo.cpp index 885acb7670..0de07950c1 100644 --- a/indra/llmath/llrigginginfo.cpp +++ b/indra/llmath/llrigginginfo.cpp @@ -27,10 +27,6 @@  #include "llmath.h"  #include "llrigginginfo.h" -//#if LL_WINDOWS -//#pragma optimize("", off) -//#endif -  //-----------------------------------------------------------------------------  // LLJointRiggingInfo  //----------------------------------------------------------------------------- diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 2654e204c2..ba284574c8 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -6411,101 +6411,6 @@ void LLVolumeFace::fillFromLegacyData(std::vector<LLVolumeFace::VertexData>& v,  	}  } -// AXON appendFace/appendFaces not used - referenced by corresponding functions in -// LLModel but these are not called anywhere. -void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMatrix4& norm_mat_in) -{ -	U16 offset = mNumVertices; - -	S32 new_count = face.mNumVertices + mNumVertices; - -	if (new_count > 65536) -	{ -		LL_ERRS() << "Cannot append face -- 16-bit overflow will occur." << LL_ENDL; -	} -	 -	if (face.mNumVertices == 0) -	{ -		LL_ERRS() << "Cannot append empty face." << LL_ENDL; -	} - -	U32 old_vsize = mNumVertices*16; -	U32 new_vsize = new_count * 16; -	U32 old_tcsize = (mNumVertices*sizeof(LLVector2)+0xF) & ~0xF; -	U32 new_tcsize = (new_count*sizeof(LLVector2)+0xF) & ~0xF; -	U32 new_size = new_vsize * 2 + new_tcsize; - -	//allocate new buffer space -	LLVector4a* old_buf = mPositions; -	mPositions = (LLVector4a*) ll_aligned_malloc<64>(new_size); -	mNormals = mPositions + new_count; -	mTexCoords = (LLVector2*) (mNormals+new_count); - -	mNumAllocatedVertices = new_count; - -	LLVector4a::memcpyNonAliased16((F32*) mPositions, (F32*) old_buf, old_vsize); -	LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) (old_buf+mNumVertices), old_vsize); -	LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) (old_buf+mNumVertices*2), old_tcsize); -	 -	mNumVertices = new_count; - -	//get destination address of appended face -	LLVector4a* dst_pos = mPositions+offset; -	LLVector2* dst_tc = mTexCoords+offset; -	LLVector4a* dst_norm = mNormals+offset; - -	//get source addresses of appended face -	const LLVector4a* src_pos = face.mPositions; -	const LLVector2* src_tc = face.mTexCoords; -	const LLVector4a* src_norm = face.mNormals; - -	//load aligned matrices -	LLMatrix4a mat, norm_mat; -	mat.loadu(mat_in); -	norm_mat.loadu(norm_mat_in); - -	for (U32 i = 0; i < face.mNumVertices; ++i) -	{ -		//transform appended face position and store -		mat.affineTransform(src_pos[i], dst_pos[i]); - -		//transform appended face normal and store -		norm_mat.rotate(src_norm[i], dst_norm[i]); -		dst_norm[i].normalize3fast(); - -		//copy appended face texture coordinate -		dst_tc[i] = src_tc[i]; - -		if (offset == 0 && i == 0) -		{ //initialize bounding box -			// VFExtents change -			mExtents[0] = mExtents[1] = dst_pos[i]; -		} -		else -		{ -			//stretch bounding box -			// VFExtents change -			update_min_max(mExtents[0], mExtents[1], dst_pos[i]); -		} -	} -    LL_DEBUGS("RiggedBox") << "appendFace got extents " << mExtents[0] << ", " << mExtents[1] << " from dst_pos " << LL_ENDL; - - -	new_count = mNumIndices + face.mNumIndices; - -	//allocate new index buffer -	mIndices = (U16*) ll_aligned_realloc_16(mIndices, (new_count*sizeof(U16)+0xF) & ~0xF, (mNumIndices*sizeof(U16)+0xF) & ~0xF); -	 -	//get destination address into new index buffer -	U16* dst_idx = mIndices+mNumIndices; -	mNumIndices = new_count; - -	for (U32 i = 0; i < face.mNumIndices; ++i) -	{ //copy indices, offsetting by old vertex count -		dst_idx[i] = face.mIndices[i]+offset; -	} -} -  BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  {  	LL_CHECK_MEMORY diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index f92b43e77d..1d6d35c432 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -872,8 +872,6 @@ public:  	BOOL create(LLVolume* volume, BOOL partial_build = FALSE);  	void createTangents(); -	void appendFace(const LLVolumeFace& face, LLMatrix4& transform, LLMatrix4& normal_tranform); -  	void resizeVertices(S32 num_verts);  	void allocateTangents(S32 num_verts);  	void allocateWeights(S32 num_verts); diff --git a/indra/llmath/v3math.cpp b/indra/llmath/v3math.cpp index e7107dee16..b04c67d926 100644 --- a/indra/llmath/v3math.cpp +++ b/indra/llmath/v3math.cpp @@ -369,3 +369,39 @@ BOOL LLVector3::parseVector3(const std::string& buf, LLVector3* value)  	return FALSE;  } + +// Displacement from query point to nearest neighbor point on bounding box. +// Returns zero vector for points within or on the box. +LLVector3 point_to_box_offset(LLVector3& pos, const LLVector3* box) +{ +    LLVector3 offset; +    for (S32 k=0; k<3; k++) +    { +        offset[k] = 0; +        if (pos[k] < box[0][k]) +        { +            offset[k] = pos[k] - box[0][k]; +        } +        else if (pos[k] > box[1][k]) +        { +            offset[k] = pos[k] - box[1][k]; +        } +    } +    return offset; +} + +bool box_valid_and_non_zero(const LLVector3* box) +{ +    if (!box[0].isFinite() || !box[1].isFinite()) +    { +        return false; +    } +    LLVector3 zero_vec; +    zero_vec.clear(); +    if ((box[0] != zero_vec) || (box[1] != zero_vec)) +    { +        return true; +    } +    return false; +} + diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index f3fbce4843..6f857d7061 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -163,6 +163,8 @@ LLVector3 inverse_projected_vec(const LLVector3 &a, const LLVector3 &b); // Retu  LLVector3 parallel_component(const LLVector3 &a, const LLVector3 &b); // Returns vector a projected on vector b (same as projected_vec)  LLVector3 orthogonal_component(const LLVector3 &a, const LLVector3 &b); // Returns component of vector a not parallel to vector b (same as projected_vec)  LLVector3 lerp(const LLVector3 &a, const LLVector3 &b, F32 u); // Returns a vector that is a linear interpolation between a and b +LLVector3 point_to_box_offset(LLVector3& pos, const LLVector3* box); // Displacement from query point to nearest point on bounding box. +bool box_valid_and_non_zero(const LLVector3* box);  inline LLVector3::LLVector3(void)  { | 
