diff options
| author | Dave Parks <davep@lindenlab.com> | 2010-07-13 12:02:14 -0500 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2010-07-13 12:02:14 -0500 | 
| commit | 2dd3a6be720ed6ce7c17415fc8d81869cf46f3a0 (patch) | |
| tree | 54e3dfc541bca50b4907efb406e8dd423a8a1a19 | |
| parent | 7f0dd53794b843e7ce659f75ccda1f5edb079186 (diff) | |
Fix for mesh upload, consolidate generating bad indices, and normal generation.
| -rw-r--r-- | indra/llcommon/llassettype.cpp | 3 | ||||
| -rw-r--r-- | indra/llinventory/llinventorytype.cpp | 5 | ||||
| -rw-r--r-- | indra/llmath/llvolume.cpp | 36 | ||||
| -rw-r--r-- | indra/llmath/llvolume.h | 2 | 
4 files changed, 28 insertions, 18 deletions
| diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 476a23ec64..bdd115364e 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -99,10 +99,7 @@ LLAssetDictionary::LLAssetDictionary()  	addEntry(LLAssetType::AT_LINK, 				new AssetEntry("LINK",				"link",		"sym link",			false,		false,		true));  	addEntry(LLAssetType::AT_LINK_FOLDER, 		new AssetEntry("FOLDER_LINK",		"link_f", 	"sym folder link",	false,		false,		true)); -#if LL_MESH_ENABLED  	addEntry(LLAssetType::AT_MESH,              new AssetEntry("MESH",              "mesh",     "mesh",             false, false, false)); -#endif -	  	addEntry(LLAssetType::AT_NONE, 				new AssetEntry("NONE",				"-1",		NULL,		  		FALSE,		FALSE,		FALSE));  }; diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index 82cd22a832..5c5500b6f4 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -89,10 +89,7 @@ LLInventoryDictionary::LLInventoryDictionary()  	addEntry(LLInventoryType::IT_WEARABLE,            new InventoryEntry("wearable",  "wearable",      2, LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART));  	addEntry(LLInventoryType::IT_ANIMATION,           new InventoryEntry("animation", "animation",     1, LLAssetType::AT_ANIMATION));    	addEntry(LLInventoryType::IT_GESTURE,             new InventoryEntry("gesture",   "gesture",       1, LLAssetType::AT_GESTURE));  -#if LL_MESH_ENABLED  	addEntry(LLInventoryType::IT_MESH,                new InventoryEntry("mesh",      "mesh",          1, LLAssetType::AT_MESH)); -#endif -  } @@ -152,9 +149,7 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =  	LLInventoryType::IT_NONE,			// AT_NONE  	LLInventoryType::IT_NONE,			// AT_NONE  	LLInventoryType::IT_NONE,			// AT_NONE -#if LL_MESH_ENABLED  	LLInventoryType::IT_MESH            // AT_MESH -#endif  };  // static diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 38944d3855..51bcfb38d4 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -5369,7 +5369,17 @@ bool LLVolumeFace::VertexMapData::operator==(const LLVolumeFace::VertexData& rhs  bool LLVolumeFace::VertexMapData::ComparePosition::operator()(const LLVector3& a, const LLVector3& b) const  { -	return a < b;			 +	if (a.mV[0] != b.mV[0]) +	{ +		return a.mV[0] < b.mV[0]; +	} +	 +	if (a.mV[1] != b.mV[1]) +	{ +		return a.mV[1] < b.mV[1]; +	} +	 +	return a.mV[2] < b.mV[2];			  }  void LLVolumeFace::optimize(F32 angle_cutoff) @@ -6145,12 +6155,13 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con  {  	S32 new_verts = mNumVertices+1;  	S32 new_size = new_verts*16; -	 +	S32 old_size = mNumVertices*16; +  	//positions  	LLVector4a* dst = (LLVector4a*) ll_aligned_malloc_16(new_size);  	if (mPositions)  	{ -		LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mPositions, new_size/4); +		LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mPositions, old_size/4);  		ll_aligned_free_16(mPositions);  	}  	mPositions = dst; @@ -6159,22 +6170,25 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con  	dst = (LLVector4a*) ll_aligned_malloc_16(new_size);  	if (mNormals)  	{ -		LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mNormals, new_size/4); +		LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mNormals, old_size/4);  		ll_aligned_free_16(mNormals);  	}  	mNormals = dst;  	//tex coords  	new_size = ((new_verts*8)+0xF) & ~0xF; +	old_size = ((mNumVertices*8)+0xF) & ~0xF; +	dst = (LLVector4a*) ll_aligned_malloc_16(new_size);  	{  		LLVector2* dst = (LLVector2*) ll_aligned_malloc_16(new_size);  		if (mTexCoords)  		{ -			LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mTexCoords, new_size/4); +			LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mTexCoords, old_size/4);  			ll_aligned_free_16(mTexCoords);  		}  	} +	mTexCoords = (LLVector2*) dst;  	//just clear binormals  	ll_aligned_free_16(mBinormals); @@ -6223,12 +6237,15 @@ void LLVolumeFace::pushIndex(const U16& idx)  	S32 new_count = mNumIndices + 1;  	S32 new_size = ((new_count*2)+0xF) & ~0xF; -	S32 old_size = (mNumIndices+0xF) & ~0xF; +	S32 old_size = ((mNumIndices*2)+0xF) & ~0xF;  	if (new_size != old_size)  	{  		U16* dst = (U16*) ll_aligned_malloc_16(new_size); -		LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mIndices, new_size/4); -		ll_aligned_free_16(mIndices); +		if (mIndices) +		{ +			LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mIndices, old_size/4); +			ll_aligned_free_16(mIndices); +		}  		mIndices = dst;  	} @@ -6339,7 +6356,8 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat  	U16* new_indices = (U16*) ll_aligned_malloc_16((new_count*2+0xF) & ~0xF);  	if (mNumIndices > 0)  	{ //copy old index buffer -		LLVector4a::memcpyNonAliased16((F32*) new_indices, (F32*) mIndices, llmax(mNumIndices/2, 4)); +		S32 old_size = (mNumIndices*2+0xF) & ~0xF; +		LLVector4a::memcpyNonAliased16((F32*) new_indices, (F32*) mIndices, old_size/4);  	}  	//free old index buffer diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 9cce94e6cf..af28337f57 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -41,7 +41,7 @@ class LLVolumeParams;  class LLProfile;  class LLPath; -#define LL_MESH_ENABLED 0 +#define LL_MESH_ENABLED 1  template <class T> class LLOctreeNode; | 
