diff options
| author | Matthew Breindel (Falcon) <falcon@lindenlab.com> | 2010-09-22 13:04:53 -0700 | 
|---|---|---|
| committer | Matthew Breindel (Falcon) <falcon@lindenlab.com> | 2010-09-22 13:04:53 -0700 | 
| commit | 569f3f4b06fc2f5a0fa658a49d519428983403f9 (patch) | |
| tree | 3fdafee487d0b922793ff864970ce73f223cd861 | |
| parent | 05c2f451dcbb7fdfb6d45d8b65ec71ba6b799af4 (diff) | |
| parent | 6d8e9cd8bde57bd033beeb9610f7094c19655ed1 (diff) | |
Merge
55 files changed, 908 insertions, 518 deletions
| diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index beb4f181b5..8b0864a539 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -38,7 +38,7 @@ if (WINDOWS)    set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /MP"        CACHE STRING "C++ compiler debug options" FORCE)    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO  -      "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP /Gm /INCREMENTAL" +      "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP /Gm"        CACHE STRING "C++ compiler release-with-debug options" FORCE)    set(CMAKE_CXX_FLAGS_RELEASE        "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP" diff --git a/indra/cmake/APR.cmake b/indra/cmake/APR.cmake index b6f1e06edd..180504d286 100644 --- a/indra/cmake/APR.cmake +++ b/indra/cmake/APR.cmake @@ -56,7 +56,7 @@ else (STANDALONE)    if (LINUX)      if (VIEWER) -      list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES}) +      list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES} uuid)      endif (VIEWER)      list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES} rt)    endif (LINUX) diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 428b151c11..9900a8fb45 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -236,6 +236,7 @@ elseif(LINUX)          libssl.so          libstacktrace.so          libtcmalloc.so +        libuuid.so.1          libssl.so.0.9.7         ) diff --git a/indra/cmake/GooglePerfTools.cmake b/indra/cmake/GooglePerfTools.cmake index 946fc6b375..dc6d013bf2 100644 --- a/indra/cmake/GooglePerfTools.cmake +++ b/indra/cmake/GooglePerfTools.cmake @@ -6,7 +6,7 @@ if (STANDALONE)  else (STANDALONE)    use_prebuilt_binary(google)    if (WINDOWS) -    use_prebuilt_binary(google-perftools) +    use_prebuilt_binary(tcmalloc)      set(TCMALLOC_LIBRARIES           debug libtcmalloc_minimal-debug          optimized libtcmalloc_minimal) @@ -29,12 +29,11 @@ if (GOOGLE_PERFTOOLS_FOUND)  endif (GOOGLE_PERFTOOLS_FOUND)  if (WINDOWS) -    # *TODO -reenable this once we get server usage sorted out -    #set(USE_GOOGLE_PERFTOOLS ON) +    set(USE_GOOGLE_PERFTOOLS ON)  endif (WINDOWS)  if (USE_GOOGLE_PERFTOOLS) -  set(TCMALLOC_FLAG -DLL_USE_TCMALLOC=1) +  set(TCMALLOC_FLAG -ULL_USE_TCMALLOC=1)    include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR})    set(GOOGLE_PERFTOOLS_LIBRARIES ${TCMALLOC_LIBRARIES} ${STACKTRACE_LIBRARIES} ${PROFILER_LIBRARIES})  else (USE_GOOGLE_PERFTOOLS) diff --git a/indra/cmake/ViewerMiscLibs.cmake b/indra/cmake/ViewerMiscLibs.cmake index 5710360de2..32c4bc81df 100644 --- a/indra/cmake/ViewerMiscLibs.cmake +++ b/indra/cmake/ViewerMiscLibs.cmake @@ -2,6 +2,7 @@  include(Prebuilt)  if (NOT STANDALONE) +  use_prebuilt_binary(libuuid)    use_prebuilt_binary(vivox)    use_prebuilt_binary(fontconfig)  endif(NOT STANDALONE) diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 73910ef98d..63adfa85b2 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -95,22 +95,30 @@ public:  	typedef LLOctreeNode<T>		oct_node;  	typedef LLOctreeListener<T>	oct_listener; +	/*void* operator new(size_t size) +	{ +		return ll_aligned_malloc_16(size); +	} + +	void operator delete(void* ptr) +	{ +		ll_aligned_free_16(ptr); +	}*/ +  	LLOctreeNode(	const LLVector4a& center,   					const LLVector4a& size,   					BaseType* parent,  -					S32 octant = -1) +					U8 octant = 255)  	:	mParent((oct_node*)parent),   		mOctant(octant)   	{  -		mD = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*4); - -		mD[CENTER] = center; -		mD[SIZE] = size; +		mCenter = center; +		mSize = size;  		updateMinMax(); -		if ((mOctant == -1) && mParent) +		if ((mOctant == 255) && mParent)  		{ -			mOctant = ((oct_node*) mParent)->getOctant(mD[CENTER]); +			mOctant = ((oct_node*) mParent)->getOctant(mCenter);  		}  		clearChildren(); @@ -124,30 +132,27 @@ public:  		{  			delete getChild(i);  		}  - -		ll_aligned_free_16(mD);  	}  	inline const BaseType* getParent()	const			{ return mParent; }  	inline void setParent(BaseType* parent)				{ mParent = (oct_node*) parent; } -	inline const LLVector4a& getCenter() const			{ return mD[CENTER]; } -	inline const LLVector4a& getSize() const			{ return mD[SIZE]; } -	inline void setCenter(const LLVector4a& center)		{ mD[CENTER] = center; } -	inline void setSize(const LLVector4a& size)			{ mD[SIZE] = size; } +	inline const LLVector4a& getCenter() const			{ return mCenter; } +	inline const LLVector4a& getSize() const			{ return mSize; } +	inline void setCenter(const LLVector4a& center)		{ mCenter = center; } +	inline void setSize(const LLVector4a& size)			{ mSize = size; }      inline oct_node* getNodeAt(T* data)					{ return getNodeAt(data->getPositionGroup(), data->getBinRadius()); } -	inline S32 getOctant() const						{ return mOctant; } -	inline void setOctant(S32 octant)					{ mOctant = octant; } +	inline U8 getOctant() const							{ return mOctant; }  	inline const oct_node*	getOctParent() const		{ return (const oct_node*) getParent(); }  	inline oct_node* getOctParent() 					{ return (oct_node*) getParent(); } -	S32 getOctant(const LLVector4a& pos) const			//get the octant pos is in +	U8 getOctant(const LLVector4a& pos) const			//get the octant pos is in  	{ -		return pos.greaterThan(mD[CENTER]).getGatheredBits() & 0x7; +		return (U8) (pos.greaterThan(mCenter).getGatheredBits() & 0x7);  	}  	inline bool isInside(const LLVector4a& pos, const F32& rad) const  	{ -		return rad <= mD[SIZE][0]*2.f && isInside(pos);  +		return rad <= mSize[0]*2.f && isInside(pos);   	}  	inline bool isInside(T* data) const			 @@ -157,13 +162,13 @@ public:  	bool isInside(const LLVector4a& pos) const  	{ -		S32 gt = pos.greaterThan(mD[MAX]).getGatheredBits() & 0x7; +		S32 gt = pos.greaterThan(mMax).getGatheredBits() & 0x7;  		if (gt)  		{  			return false;  		} -		S32 lt = pos.lessEqual(mD[MIN]).getGatheredBits() & 0x7; +		S32 lt = pos.lessEqual(mMin).getGatheredBits() & 0x7;  		if (lt)  		{  			return false; @@ -174,8 +179,8 @@ public:  	void updateMinMax()  	{ -		mD[MAX].setAdd(mD[CENTER], mD[SIZE]); -		mD[MIN].setSub(mD[CENTER], mD[SIZE]); +		mMax.setAdd(mCenter, mSize); +		mMin.setSub(mCenter, mSize);  	}  	inline oct_listener* getOctListener(U32 index)  @@ -195,7 +200,7 @@ public:  			return false;  		} -		F32 size = mD[SIZE][0]; +		F32 size = mSize[0];  		F32 p_size = size * 2.f;  		return (radius <= 0.001f && size <= 0.001f) || @@ -234,6 +239,29 @@ public:  	void accept(tree_traveler* visitor) const		{ visitor->visit(this); }  	void accept(oct_traveler* visitor) const		{ visitor->visit(this); } +	void validateChildMap() +	{ +		for (U32 i = 0; i < 8; i++) +		{ +			U8 idx = mChildMap[i]; +			if (idx != 255) +			{ +				LLOctreeNode<T>* child = mChild[idx]; + +				if (child->getOctant() != i) +				{ +					llerrs << "Invalid child map, bad octant data." << llendl; +				} + +				if (getOctant(child->getCenter()) != child->getOctant()) +				{ +					llerrs << "Invalid child octant compared to position data." << llendl; +				} +			} +		} +	} + +  	oct_node* getNodeAt(const LLVector4a& pos, const F32& rad)  	{   		LLOctreeNode<T>* node = this; @@ -241,25 +269,19 @@ public:  		if (node->isInside(pos, rad))  		{		  			//do a quick search by octant -			S32 octant = node->getOctant(pos); -			BOOL keep_going = TRUE; - +			U8 octant = node->getOctant(pos); +			  			//traverse the tree until we find a node that has no node  			//at the appropriate octant or is smaller than the object.    			//by definition, that node is the smallest node that contains   			// the data -			while (keep_going && node->getSize()[0] >= rad) +			U8 next_node = node->mChildMap[octant]; +			 +			while (next_node != 255 && node->getSize()[0] >= rad)  			{	 -				keep_going = FALSE; -				for (U32 i = 0; i < node->getChildCount() && !keep_going; i++) -				{ -					if (node->getChild(i)->getOctant() == octant) -					{ -						node = node->getChild(i); -						octant = node->getOctant(pos); -						keep_going = TRUE; -					} -				} +				node = node->getChild(next_node); +				octant = node->getOctant(pos); +				next_node = node->mChildMap[octant];  			}  		}  		else if (!node->contains(rad) && node->getParent()) @@ -439,6 +461,9 @@ public:  	void clearChildren()  	{  		mChild.clear(); + +		U32* foo = (U32*) mChildMap; +		foo[0] = foo[1] = 0xFFFFFFFF;  	}  	void validate() @@ -496,6 +521,8 @@ public:  		}  #endif +		mChildMap[child->getOctant()] = (U8) mChild.size(); +  		mChild.push_back(child);  		child->setParent(this); @@ -517,6 +544,8 @@ public:  			listener->handleChildRemoval(this, getChild(index));  		} +		 +  		if (destroy)  		{  			mChild[index]->destroy(); @@ -524,6 +553,15 @@ public:  		}  		mChild.erase(mChild.begin() + index); +		//rebuild child map +		U32* foo = (U32*) mChildMap; +		foo[0] = foo[1] = 0xFFFFFFFF; + +		for (U32 i = 0; i < mChild.size(); ++i) +		{ +			mChildMap[mChild[i]->getOctant()] = i; +		} +  		checkAlive();  	} @@ -562,15 +600,20 @@ protected:  		MIN = 3  	} eDName; -	LLVector4a* mD; +	LLVector4a mCenter; +	LLVector4a mSize; +	LLVector4a mMax; +	LLVector4a mMin;  	oct_node* mParent; -	S32 mOctant; +	U8 mOctant;  	child_list mChild; +	U8 mChildMap[8]; +  	element_list mData; -}; +};   //just like a regular node, except it might expand on insert and compress on balance  template <class T> @@ -613,6 +656,8 @@ public:  			//destroy child  			child->clearChildren();  			delete child; + +			return false;  		}  		return true; @@ -639,7 +684,7 @@ public:  		const LLVector4a& v = data->getPositionGroup();  		LLVector4a val; -		val.setSub(v, BaseType::mD[BaseType::CENTER]); +		val.setSub(v, BaseType::mCenter);  		val.setAbs(val);  		S32 lt = val.lessThan(MAX_MAG).getGatheredBits() & 0x7; diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index ab9f8c4c24..1f15d5465c 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -94,6 +94,17 @@ const F32 SKEW_MAX	=  0.95f;  const F32 SCULPT_MIN_AREA = 0.002f;  const S32 SCULPT_MIN_AREA_DETAIL = 1; +extern BOOL gDebugGL; + +void assert_aligned(void* ptr, U32 alignment) +{ +	U32 t = (U32) ptr; +	if (t%alignment != 0) +	{ +		llerrs << "WTF?" << llendl; +	} +} +  BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm)  {      	LLVector3 test = (pt2-pt1)%(pt3-pt2); @@ -308,22 +319,26 @@ public:  	}  	virtual void visit(const LLOctreeNode<LLVolumeTriangle>* branch) -	{ +	{ //this is a depth first traversal, so it's safe to assum all children have complete +		//bounding data +  		LLVolumeOctreeListener* node = (LLVolumeOctreeListener*) branch->getListener(0);  		LLVector4a& min = node->mExtents[0];  		LLVector4a& max = node->mExtents[1]; -		if (branch->getElementCount() != 0) -		{ +		if (!branch->getData().empty()) +		{ //node has data, find AABB that binds data set  			const LLVolumeTriangle* tri = *(branch->getData().begin()); -						 +			 +			//initialize min/max to first available vertex  			min = *(tri->mV[0]);  			max = *(tri->mV[0]);  			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter =   				branch->getData().begin(); iter != branch->getData().end(); ++iter) -			{ +			{ //for each triangle in node +  				//stretch by triangles in node  				tri = *iter; @@ -335,33 +350,27 @@ public:  				max.setMax(max, *tri->mV[1]);  				max.setMax(max, *tri->mV[2]);  			} - -			for (S32 i = 0; i < branch->getChildCount(); ++i) -			{  //stretch by child extents -				LLVolumeOctreeListener* child = (LLVolumeOctreeListener*) branch->getChild(i)->getListener(0); -				min.setMin(min, child->mExtents[0]); -				max.setMax(min, child->mExtents[1]); -			}  		} -		else if (branch->getChildCount() != 0) -		{ +		else if (!branch->getChildren().empty()) +		{ //no data, but child nodes exist  			LLVolumeOctreeListener* child = (LLVolumeOctreeListener*) branch->getChild(0)->getListener(0); +			//initialize min/max to extents of first child  			min = child->mExtents[0];  			max = child->mExtents[1]; - -			for (S32 i = 1; i < branch->getChildCount(); ++i) -			{  //stretch by child extents -				child = (LLVolumeOctreeListener*) branch->getChild(i)->getListener(0); -				min.setMin(min, child->mExtents[0]); -				max.setMax(max, child->mExtents[1]); -			}  		}  		else  		{  			llerrs << "WTF? Empty leaf" << llendl;  		} -		 + +		for (S32 i = 0; i < branch->getChildCount(); ++i) +		{  //stretch by child extents +			LLVolumeOctreeListener* child = (LLVolumeOctreeListener*) branch->getChild(i)->getListener(0); +			min.setMin(min, child->mExtents[0]); +			max.setMax(max, child->mExtents[1]); +		} +  		node->mBounds[0].setAdd(min, max);  		node->mBounds[0].mul(0.5f); @@ -370,7 +379,6 @@ public:  	}  }; -  //-------------------------------------------------------------------  // statics  //------------------------------------------------------------------- @@ -1991,7 +1999,7 @@ void LLVolumeFace::VertexData::init()  {  	if (!mData)  	{ -		mData = (LLVector4a*) ll_aligned_malloc_16(32); +		mData = (LLVector4a*) malloc(sizeof(LLVector4a)*2);  	}  } @@ -2012,7 +2020,7 @@ const LLVolumeFace::VertexData& LLVolumeFace::VertexData::operator=(const LLVolu  	if (this != &rhs)  	{  		init(); -		LLVector4a::memcpyNonAliased16((F32*) mData, (F32*) rhs.mData, 8*sizeof(F32)); +		LLVector4a::memcpyNonAliased16((F32*) mData, (F32*) rhs.mData, 2*sizeof(LLVector4a));  		mTexCoord = rhs.mTexCoord;  	}  	return *this; @@ -2020,7 +2028,8 @@ const LLVolumeFace::VertexData& LLVolumeFace::VertexData::operator=(const LLVolu  LLVolumeFace::VertexData::~VertexData()  { -	ll_aligned_free_16(mData); +	free(mData); +	mData = NULL;  }  LLVector4a& LLVolumeFace::VertexData::getPosition() @@ -2258,12 +2267,12 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)  					U32 cur_influence = 0;  					LLVector4 wght(0,0,0,0); -					while (joint != END_INFLUENCES) +					while (joint != END_INFLUENCES && idx < weights.size())  					{  						U16 influence = weights[idx++];  						influence |= ((U16) weights[idx++] << 8); -						F32 w = llmin((F32) influence / 65535.f, 0.99999f); +						F32 w = llclamp((F32) influence / 65535.f, 0.f, 0.99999f);  						wght.mV[cur_influence++] = (F32) joint + w;  						if (cur_influence >= 4) @@ -2570,24 +2579,21 @@ void LLVolume::makeTetrahedron()  	mIsTetrahedron = TRUE;  } -void LLVolume::copyVolumeFaces(LLVolume* volume) +void LLVolume::copyVolumeFaces(const LLVolume* volume)  {  	mVolumeFaces = volume->mVolumeFaces;  	mSculptLevel = 0;  	mIsTetrahedron = FALSE;  } -  S32	LLVolume::getNumFaces() const  { -#if LL_MESH_ENABLED  	U8 sculpt_type = (mParams.getSculptType() & LL_SCULPT_TYPE_MASK);  	if (sculpt_type == LL_SCULPT_TYPE_MESH)  	{  		return LL_SCULPT_MESH_MAX_FACES;  	} -#endif  	return (S32)mProfilep->mFaces.size();  } @@ -4168,12 +4174,10 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,  	normals.clear();  	segments.clear(); -#if LL_MESH_ENABLED  	if ((mParams.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)  	{  		return;  	} -#endif  	S32 cur_index = 0;  	//for each face @@ -5232,7 +5236,7 @@ LLVolumeFace::LLVolumeFace() :  	mWeights(NULL),  	mOctree(NULL)  { -	mExtents = (LLVector4a*) ll_aligned_malloc_16(48); +	mExtents = (LLVector4a*) malloc(sizeof(LLVector4a)*3);  	mCenter = mExtents+2;  } @@ -5253,7 +5257,7 @@ LLVolumeFace::LLVolumeFace(const LLVolumeFace& src)  	mWeights(NULL),  	mOctree(NULL)  {  -	mExtents = (LLVector4a*) ll_aligned_malloc_16(48); +	mExtents = (LLVector4a*) malloc(sizeof(LLVector4a)*3);  	mCenter = mExtents+2;  	*this = src;  } @@ -5281,15 +5285,15 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src)  	freeData(); -	LLVector4a::memcpyNonAliased16((F32*) mExtents, (F32*) src.mExtents, 12*sizeof(F32)); +	LLVector4a::memcpyNonAliased16((F32*) mExtents, (F32*) src.mExtents, 3*sizeof(LLVector4a));  	resizeVertices(src.mNumVertices);  	resizeIndices(src.mNumIndices);  	if (mNumVertices)  	{ -		S32 vert_size = mNumVertices*4*sizeof(F32); -		S32 tc_size = (mNumVertices*8+0xF) & ~0xF; +		S32 vert_size = mNumVertices*sizeof(LLVector4a); +		S32 tc_size = (mNumVertices*sizeof(LLVector2)+0xF) & ~0xF;  		LLVector4a::memcpyNonAliased16((F32*) mPositions, (F32*) src.mPositions, vert_size);  		LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) src.mNormals, vert_size); @@ -5303,7 +5307,7 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src)  		}  		else  		{ -			ll_aligned_free_16(mBinormals); +			free(mBinormals);  			mBinormals = NULL;  		} @@ -5314,14 +5318,14 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src)  		}  		else  		{ -			ll_aligned_free_16(mWeights); +			free(mWeights);  			mWeights = NULL;  		}  	}  	if (mNumIndices)  	{ -		S32 idx_size = (mNumIndices*2+0xF) & ~0xF; +		S32 idx_size = (mNumIndices*sizeof(U16)+0xF) & ~0xF;  		LLVector4a::memcpyNonAliased16((F32*) mIndices, (F32*) src.mIndices, idx_size);  	} @@ -5332,7 +5336,7 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src)  LLVolumeFace::~LLVolumeFace()  { -	ll_aligned_free_16(mExtents); +	free(mExtents);  	mExtents = NULL;  	freeData(); @@ -5340,17 +5344,17 @@ LLVolumeFace::~LLVolumeFace()  void LLVolumeFace::freeData()  { -	ll_aligned_free_16(mPositions); +	free(mPositions);  	mPositions = NULL; -	ll_aligned_free_16(mNormals); +	free( mNormals);  	mNormals = NULL; -	ll_aligned_free_16(mTexCoords); +	free(mTexCoords);  	mTexCoords = NULL; -	ll_aligned_free_16(mIndices); +	free(mIndices);  	mIndices = NULL; -	ll_aligned_free_16(mBinormals); +	free(mBinormals);  	mBinormals = NULL; -	ll_aligned_free_16(mWeights); +	free(mWeights);  	mWeights = NULL;  	delete mOctree; @@ -5404,13 +5408,14 @@ bool LLVolumeFace::VertexMapData::ComparePosition::operator()(const LLVector3& a  		return a.mV[1] < b.mV[1];  	} -	return a.mV[2] < b.mV[2];			 +	return a.mV[2] < b.mV[2];  }  void LLVolumeFace::optimize(F32 angle_cutoff)  {  	LLVolumeFace new_face; +	//map of points to vector of vertices at that point  	VertexMapData::PointMap point_map;  	//remove redundant vertices @@ -5463,56 +5468,73 @@ void LLVolumeFace::optimize(F32 angle_cutoff)  } -void LLVolumeFace::createOctree() +void LLVolumeFace::createOctree(F32 scaler, const LLVector4a& center, const LLVector4a& size)  { -	LLVector4a center; -	LLVector4a size; -	center.splat(0.f); -	size.splat(1.f); +	if (mOctree) +	{ +		return; +	}  	mOctree = new LLOctreeRoot<LLVolumeTriangle>(center, size, NULL);  	new LLVolumeOctreeListener(mOctree);  	for (U32 i = 0; i < mNumIndices; i+= 3) -	{ +	{ //for each triangle  		LLPointer<LLVolumeTriangle> tri = new LLVolumeTriangle();  		const LLVector4a& v0 = mPositions[mIndices[i]];  		const LLVector4a& v1 = mPositions[mIndices[i+1]];  		const LLVector4a& v2 = mPositions[mIndices[i+2]]; +		//store pointers to vertex data  		tri->mV[0] = &v0;  		tri->mV[1] = &v1;  		tri->mV[2] = &v2; +		//store indices  		tri->mIndex[0] = mIndices[i];  		tri->mIndex[1] = mIndices[i+1];  		tri->mIndex[2] = mIndices[i+2]; +		//get minimum point  		LLVector4a min = v0;  		min.setMin(min, v1);  		min.setMin(min, v2); +		//get maximum point  		LLVector4a max = v0;  		max.setMax(max, v1);  		max.setMax(max, v2); +		//compute center  		LLVector4a center;  		center.setAdd(min, max);  		center.mul(0.5f);  		*tri->mPositionGroup = center; +		//compute "radius"  		LLVector4a size;  		size.setSub(max,min); -		tri->mRadius = size.getLength3().getF32() * 0.5f; +		tri->mRadius = size.getLength3().getF32() * scaler; +		//insert  		mOctree->insert(tri);  	} +	//remove unneeded octree layers +	while (!mOctree->balance())	{ } + +	//calculate AABB for each node  	LLVolumeOctreeRebound rebound(this);  	rebound.traverse(mOctree); + +	if (gDebugGL) +	{ +		LLVolumeOctreeValidate validate; +		validate.traverse(mOctree); +	}  } @@ -6146,21 +6168,24 @@ void LLVolumeFace::createBinormals()  void LLVolumeFace::resizeVertices(S32 num_verts)  { -	ll_aligned_free_16(mPositions); -	ll_aligned_free_16(mNormals); -	ll_aligned_free_16(mBinormals); -	ll_aligned_free_16(mTexCoords); +	free(mPositions); +	free(mNormals); +	free(mBinormals); +	free(mTexCoords);  	mBinormals = NULL;  	if (num_verts)  	{ -		mPositions = (LLVector4a*) ll_aligned_malloc_16(num_verts*16); -		mNormals = (LLVector4a*) ll_aligned_malloc_16(num_verts*16); +		mPositions = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts); +		assert_aligned(mPositions, 16); +		mNormals = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts); +		assert_aligned(mNormals, 16);  		//pad texture coordinate block end to allow for QWORD reads -		S32 size = ((num_verts*8) + 0xF) & ~0xF; -		mTexCoords = (LLVector2*) ll_aligned_malloc_16(size); +		S32 size = ((num_verts*sizeof(LLVector2)) + 0xF) & ~0xF; +		mTexCoords = (LLVector2*) malloc(size); +		assert_aligned(mTexCoords, 16);  	}  	else  	{ @@ -6181,43 +6206,21 @@ 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; +//	S32 old_size = mNumVertices*16;  	//positions -	LLVector4a* dst = (LLVector4a*) ll_aligned_malloc_16(new_size); -	if (mPositions) -	{ -		LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mPositions, old_size); -		ll_aligned_free_16(mPositions); -	} -	mPositions = dst; - +	mPositions = (LLVector4a*) realloc(mPositions, new_size); +	  	//normals -	dst = (LLVector4a*) ll_aligned_malloc_16(new_size); -	if (mNormals) -	{ -		LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mNormals, old_size); -		ll_aligned_free_16(mNormals); -	} -	mNormals = dst; - +	mNormals = (LLVector4a*) realloc(mNormals, new_size); +	  	//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, old_size); -			ll_aligned_free_16(mTexCoords); -		} -	} -	mTexCoords = (LLVector2*) dst; +	mTexCoords = (LLVector2*) realloc(mTexCoords, new_size); +	  	//just clear binormals -	ll_aligned_free_16(mBinormals); +	free(mBinormals);  	mBinormals = NULL;  	mPositions[mNumVertices] = pos; @@ -6229,26 +6232,26 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con  void LLVolumeFace::allocateBinormals(S32 num_verts)  { -	ll_aligned_free_16(mBinormals); -	mBinormals = (LLVector4a*) ll_aligned_malloc_16(num_verts*16); +	free(mBinormals); +	mBinormals = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts);  }  void LLVolumeFace::allocateWeights(S32 num_verts)  { -	ll_aligned_free_16(mWeights); -	mWeights = (LLVector4a*) ll_aligned_malloc_16(num_verts*16); +	free(mWeights); +	mWeights = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts);  }  void LLVolumeFace::resizeIndices(S32 num_indices)  { -	ll_aligned_free_16(mIndices); - +	free(mIndices); +	  	if (num_indices)  	{  		//pad index block end to allow for QWORD reads -		S32 size = ((num_indices*2) + 0xF) & ~0xF; +		S32 size = ((num_indices*sizeof(U16)) + 0xF) & ~0xF; -		mIndices = (U16*) ll_aligned_malloc_16(size);	 +		mIndices = (U16*) malloc(size);  	}  	else  	{ @@ -6266,13 +6269,7 @@ void LLVolumeFace::pushIndex(const U16& idx)  	S32 old_size = ((mNumIndices*2)+0xF) & ~0xF;  	if (new_size != old_size)  	{ -		U16* dst = (U16*) ll_aligned_malloc_16(new_size); -		if (mIndices) -		{ -			LLVector4a::memcpyNonAliased16((F32*) dst, (F32*) mIndices, old_size); -			ll_aligned_free_16(mIndices); -		} -		mIndices = dst; +		mIndices = (U16*) realloc(mIndices, new_size);  	}  	mIndices[mNumIndices++] = idx; @@ -6313,28 +6310,13 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat  	}  	//allocate new buffer space -	LLVector4a* new_pos = (LLVector4a*) ll_aligned_malloc_16(new_count*16); -	LLVector4a* new_norm = (LLVector4a*) ll_aligned_malloc_16(new_count*16); -	LLVector2* new_tc = (LLVector2*) ll_aligned_malloc_16((new_count*8+0xF) & ~0xF); +	mPositions = (LLVector4a*) realloc(mPositions, new_count*sizeof(LLVector4a)); +	assert_aligned(mPositions, 16); +	mNormals = (LLVector4a*) realloc(mNormals, new_count*sizeof(LLVector4a)); +	assert_aligned(mNormals, 16); +	mTexCoords = (LLVector2*) realloc(mTexCoords, (new_count*sizeof(LLVector2)+0xF) & ~0xF); +	assert_aligned(mTexCoords, 16); - -	if (mNumVertices > 0) -	{ //copy old buffers -		LLVector4a::memcpyNonAliased16((F32*) new_pos, (F32*) mPositions, mNumVertices*4*sizeof(F32)); -		LLVector4a::memcpyNonAliased16((F32*) new_norm, (F32*) mNormals, mNumVertices*4*sizeof(F32)); -		LLVector4a::memcpyNonAliased16((F32*) new_tc, (F32*) mTexCoords, mNumVertices*2*sizeof(F32)); -	} - -	//free old buffer space -	ll_aligned_free_16(mPositions); -	ll_aligned_free_16(mNormals); -	ll_aligned_free_16(mTexCoords); - -	//point to new buffers -	mPositions = new_pos; -	mNormals = new_norm; -	mTexCoords = new_tc; -  	mNumVertices = new_count;  	//get destination address of appended face @@ -6379,19 +6361,8 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat  	new_count = mNumIndices + face.mNumIndices;  	//allocate new index buffer -	U16* new_indices = (U16*) ll_aligned_malloc_16((new_count*2+0xF) & ~0xF); -	if (mNumIndices > 0) -	{ //copy old index buffer -		S32 old_size = (mNumIndices*2+0xF) & ~0xF; -		LLVector4a::memcpyNonAliased16((F32*) new_indices, (F32*) mIndices, old_size); -	} - -	//free old index buffer -	ll_aligned_free_16(mIndices); - -	//point to new index buffer -	mIndices = new_indices; - +	mIndices = (U16*) realloc(mIndices, (new_count*sizeof(U16)+0xF) & ~0xF); +	  	//get destination address into new index buffer  	U16* dst_idx = mIndices+mNumIndices;  	mNumIndices = new_count; @@ -6433,14 +6404,10 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  		resizeVertices(num_vertices);  		resizeIndices(num_indices); -#if LL_MESH_ENABLED  		if ((volume->getParams().getSculptType() & LL_SCULPT_TYPE_MASK) != LL_SCULPT_TYPE_MESH)  		{  			mEdge.resize(num_indices);  		} -#else -		mEdge.resize(num_indices); -#endif  	}  	LLVector4a* pos = (LLVector4a*) mPositions; diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index af28337f57..b4b59fd402 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -41,8 +41,6 @@ class LLVolumeParams;  class LLProfile;  class LLPath; -#define LL_MESH_ENABLED 1 -  template <class T> class LLOctreeNode;  class LLVector4a; @@ -192,15 +190,9 @@ const U8 LL_SCULPT_TYPE_SPHERE    = 1;  const U8 LL_SCULPT_TYPE_TORUS     = 2;  const U8 LL_SCULPT_TYPE_PLANE     = 3;  const U8 LL_SCULPT_TYPE_CYLINDER  = 4; -#if LL_MESH_ENABLED  const U8 LL_SCULPT_TYPE_MESH      = 5; -  const U8 LL_SCULPT_TYPE_MASK      = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE |  	LL_SCULPT_TYPE_CYLINDER | LL_SCULPT_TYPE_MESH; -#else -const U8 LL_SCULPT_TYPE_MASK      = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE | -	LL_SCULPT_TYPE_CYLINDER; -#endif  const U8 LL_SCULPT_FLAG_INVERT    = 64;  const U8 LL_SCULPT_FLAG_MIRROR    = 128; @@ -882,7 +874,7 @@ public:  	};  	void optimize(F32 angle_cutoff = 2.f); -	void createOctree(); +	void createOctree(F32 scaler = 0.25f, const LLVector4a& center = LLVector4a(0,0,0), const LLVector4a& size = LLVector4a(0.5f,0.5f,0.5f));  	enum  	{ @@ -1044,7 +1036,7 @@ public:  	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 copyVolumeFaces(LLVolume* volume); +	void copyVolumeFaces(const LLVolume* volume);  private:  	void sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type); diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index 194b1faf81..cb6211f63c 100644 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -126,8 +126,8 @@ void LLOctreeTriangleRayIntersect::traverse(const LLOctreeNode<LLVolumeTriangle>  	const F32* center = vl->mBounds[0].getF32();  	const F32* size = vl->mBounds[1].getF32();*/ -	//if (LLLineSegmentBoxIntersect(mStart.getF32(), mEnd.getF32(), vl->mBounds[0].getF32(), vl->mBounds[1].getF32())) -	if (LLLineSegmentBoxIntersect(mStart, mEnd, vl->mBounds[0], vl->mBounds[1])) +	//if (LLLineSegmentBoxIntersect(mStart, mEnd, vl->mBounds[0], vl->mBounds[1])) +	if (LLLineSegmentBoxIntersect(mStart.getF32ptr(), mEnd.getF32ptr(), vl->mBounds[0].getF32ptr(), vl->mBounds[1].getF32ptr()))  	{  		node->accept(this);  		for (S32 i = 0; i < node->getChildCount(); ++i) @@ -206,3 +206,60 @@ const F32& LLVolumeTriangle::getBinRadius() const  } +//TEST CODE + +void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch) +{ +	LLVolumeOctreeListener* node = (LLVolumeOctreeListener*) branch->getListener(0); + +	//make sure bounds matches extents +	LLVector4a& min = node->mExtents[0]; +	LLVector4a& max = node->mExtents[1]; + +	LLVector4a& center = node->mBounds[0]; +	LLVector4a& size = node->mBounds[1]; + +	LLVector4a test_min, test_max; +	test_min.setSub(center, size); +	test_max.setAdd(center, size); + +	if (!test_min.equals3(min, 0.001f) || +		!test_max.equals3(max, 0.001f)) +	{ +		llerrs << "Bad bounding box data found." << llendl; +	} + +	test_min.sub(LLVector4a(0.001f)); +	test_max.add(LLVector4a(0.001f)); + +	for (U32 i = 0; i < branch->getChildCount(); ++i) +	{ +		LLVolumeOctreeListener* child = (LLVolumeOctreeListener*) branch->getChild(i)->getListener(0); + +		//make sure all children fit inside this node +		if (child->mExtents[0].lessThan(test_min).areAnySet(LLVector4Logical::MASK_XYZ) || +			child->mExtents[1].greaterThan(test_max).areAnySet(LLVector4Logical::MASK_XYZ)) +		{ +			llerrs << "Child protrudes from bounding box." << llendl; +		} +	} + +	//children fit, check data +	for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin();  +			iter != branch->getData().end(); ++iter) +	{ +		const LLVolumeTriangle* tri = *iter; + +		//validate triangle +		for (U32 i = 0; i < 3; i++) +		{ +			if (tri->mV[i]->greaterThan(test_max).areAnySet(LLVector4Logical::MASK_XYZ) || +				tri->mV[i]->lessThan(test_min).areAnySet(LLVector4Logical::MASK_XYZ)) +			{ +				llerrs << "Triangle protrudes from node." << llendl; +			} +		} +	} +} + + diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h index 0031626498..0a02a2c597 100644 --- a/indra/llmath/llvolumeoctree.h +++ b/indra/llmath/llvolumeoctree.h @@ -88,8 +88,6 @@ public:  	F32* mClosestT;  	bool mHitFace; -	LLOctreeTriangleRayIntersect() { }; -  	LLOctreeTriangleRayIntersect(const LLVector4a& start, const LLVector4a& dir,   								   const LLVolumeFace* face, F32* closest_t,  								   LLVector3* intersection,LLVector2* tex_coord, LLVector3* normal, LLVector3* bi_normal); @@ -134,5 +132,9 @@ public:  	virtual const F32& getBinRadius() const;  }; +class LLVolumeOctreeValidate : public LLOctreeTraveler<LLVolumeTriangle> +{ +	virtual void visit(const LLOctreeNode<LLVolumeTriangle>* branch); +};  #endif diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index e4b7cd80ce..349c844470 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -41,7 +41,6 @@  #include "dom/domMesh.h"  #include "zlib/zlib.h" -#if LL_MESH_ENABLED  std::string model_names[] =  { @@ -120,7 +119,7 @@ void load_face_from_dom_inputs(LLVolumeFace& face, const domInputLocalOffset_Arr  			{  				LLVector4a* norm = (LLVector4a*) face.mNormals + (j-min_idx);  				norm->set(n[j*3+0], n[j*3+1], n[j*3+2]); -				norm->normalize3fast(); +				norm->normalize3();  			}  		}  		else if (strcmp(COMMON_PROFILE_INPUT_TEXCOORD, inputs[j]->getSemantic()) == 0) @@ -1041,6 +1040,12 @@ void LLModel::smoothNormals(F32 angle_cutoff)  	{  		LLVolumeFace& vol_face = mVolumeFaces[j]; +		if (vol_face.mNumIndices > 65535) +		{ +			llwarns << "Too many vertices for normal generation to work." << llendl; +			continue; +		} +  		//create faceted copy of current face with no texture coordinates (step 1)  		LLVolumeFace faceted; @@ -1048,16 +1053,16 @@ void LLModel::smoothNormals(F32 angle_cutoff)  		//LLVector4a* src_norm = (LLVector4a*) vol_face.mNormals; -		//bake out triangles into temporary face, clearing normals and texture coordinates +		faceted.resizeVertices(vol_face.mNumIndices); +		faceted.resizeIndices(vol_face.mNumIndices); +		//bake out triangles into temporary face, clearing texture coordinates  		for (U32 i = 0; i < vol_face.mNumIndices; ++i)  		{  			U32 idx = vol_face.mIndices[i]; -			LLVolumeFace::VertexData v; -			v.setPosition(src_pos[idx]);  -			v.getNormal().clear(); -			v.mTexCoord.clear(); -			faceted.pushVertex(v); -			faceted.pushIndex(i); +		 +			faceted.mPositions[i] = src_pos[idx]; +			faceted.mTexCoords[i] = LLVector2(0,0); +			faceted.mIndices[i] = i;  		}  		//generate normals for temporary face @@ -1080,7 +1085,7 @@ void LLModel::smoothNormals(F32 angle_cutoff)  			rhs.setSub(p2, p0);  			n0.setCross3(lhs, rhs); -			n0.normalize3fast(); +			n0.normalize3();  			n1 = n0;  			n2 = n0;  		} @@ -1126,7 +1131,7 @@ void LLModel::smoothNormals(F32 angle_cutoff)  		for (U32 i = 0; i < faceted.mNumVertices; ++i)  		{ -			faceted.mNormals[i].normalize3fast(); +			faceted.mNormals[i].normalize3();  			LLVolumeFace::VertexMapData v;  			v.setPosition(faceted.mPositions[i]); @@ -1139,16 +1144,17 @@ void LLModel::smoothNormals(F32 angle_cutoff)  		LLVolumeFace new_face;  		//bake out triangles into new face +		new_face.resizeIndices(vol_face.mNumIndices); +		new_face.resizeVertices(vol_face.mNumIndices); +		  		for (U32 i = 0; i < vol_face.mNumIndices; ++i)  		{  			U32 idx = vol_face.mIndices[i];  			LLVolumeFace::VertexData v; -			v.setPosition(vol_face.mPositions[idx]); -			v.setNormal(vol_face.mNormals[idx]); -			v.mTexCoord = vol_face.mTexCoords[idx]; - -			new_face.pushVertex(v); -			new_face.pushIndex(i); +			new_face.mPositions[i] = vol_face.mPositions[idx]; +			new_face.mNormals[i].clear(); +			new_face.mTexCoords[i] = vol_face.mTexCoords[idx]; +			new_face.mIndices[i] = i;  		}  		//generate normals for new face @@ -1171,7 +1177,7 @@ void LLModel::smoothNormals(F32 angle_cutoff)  			rhs.setSub(p2, p0);  			n0.setCross3(lhs, rhs); -			n0.normalize3fast(); +			n0.normalize3();  			n1 = n0;  			n2 = n0;  		} @@ -1703,5 +1709,4 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)  	}					  } -#endif diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index a91c80d5b7..ea703d7228 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -36,8 +36,6 @@  #include "v4math.h"  #include "m4math.h" -#if LL_MESH_ENABLED -  class daeElement;  class domMesh; @@ -173,7 +171,4 @@ protected:  	virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh);  }; - -#endif -  #endif //LL_LLMODEL_H diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 71620feed3..66beb5f003 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -603,7 +603,7 @@ void LLVertexBuffer::createGLBuffer()  	{  		static int gl_buffer_idx = 0;  		mGLBuffer = ++gl_buffer_idx; -		mMappedData = (U8*) ll_aligned_malloc_16(size); +		mMappedData = (U8*) malloc(size);  	}  } @@ -637,7 +637,7 @@ void LLVertexBuffer::createGLIndices()  	}  	else  	{ -		mMappedIndexData = (U8*) ll_aligned_malloc_16(size); +		mMappedIndexData = (U8*) malloc(size);  		static int gl_buffer_idx = 0;  		mGLIndices = ++gl_buffer_idx;  	} @@ -658,7 +658,7 @@ void LLVertexBuffer::destroyGLBuffer()  		}  		else  		{ -			ll_aligned_free_16(mMappedData); +			free(mMappedData);  			mMappedData = NULL;  			mEmpty = TRUE;  		} @@ -685,7 +685,7 @@ void LLVertexBuffer::destroyGLIndices()  		}  		else  		{ -			ll_aligned_free_16(mMappedIndexData); +			free(mMappedIndexData);  			mMappedIndexData = NULL;  			mEmpty = TRUE;  		} @@ -818,8 +818,8 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)  			{  				if (!useVBOs())  				{ -					ll_aligned_free_16(mMappedData); -					mMappedData = (U8*) ll_aligned_malloc_16(newsize); +					free(mMappedData); +					mMappedData = (U8*) malloc(newsize);  				}  				mResized = TRUE;  			} @@ -839,8 +839,8 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)  			{  				if (!useVBOs())  				{ -					ll_aligned_free_16(mMappedIndexData); -					mMappedIndexData = (U8*) ll_aligned_malloc_16(new_index_size); +					free(mMappedIndexData); +					mMappedIndexData = (U8*) malloc(new_index_size);  				}  				mResized = TRUE;  			} diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp index 2b01288fd7..ddb76fb2ba 100644 --- a/indra/llvfs/llvfs.cpp +++ b/indra/llvfs/llvfs.cpp @@ -2041,11 +2041,9 @@ std::string get_extension(LLAssetType::EType type)  	case LLAssetType::AT_ANIMATION:  		extension = ".lla";  		break; -#if LL_MESH_ENABLED  	case LLAssetType::AT_MESH:  		extension = ".slm";  		break; -#endif  	default:  		// Just use the asset server filename extension in most cases  		extension += "."; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 87952fb47c..5ed4ad2259 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1424,9 +1424,7 @@ if (WINDOWS)      set_target_properties(${VIEWER_BINARY_NAME}          PROPERTIES -        # *TODO -reenable this once we get server usage sorted out -        #LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:\"__tcmalloc\"" -        LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS" +        LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:__tcmalloc"          LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO"          LINK_FLAGS_RELEASE ${release_flags}          ) @@ -1642,6 +1640,7 @@ if (WINDOWS)  endif (WINDOWS)  target_link_libraries(${VIEWER_BINARY_NAME} +	${GOOGLE_PERFTOOLS_LIBRARIES}      ${LLAUDIO_LIBRARIES}      ${LLCHARACTER_LIBRARIES}      ${LLIMAGE_LIBRARIES} @@ -1678,7 +1677,6 @@ target_link_libraries(${VIEWER_BINARY_NAME}      ${OPENSSL_LIBRARIES}      ${CRYPTO_LIBRARIES}      ${LLLOGIN_LIBRARIES} -    ${GOOGLE_PERFTOOLS_LIBRARIES}      ${LLCONVEXDECOMP_LIBRARY}      ) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f140547497..c07d891800 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1360,10 +1360,8 @@ bool LLAppViewer::cleanup()  	llinfos << "Cleaning Up" << llendflush; -#if LL_MESH_ENABLED  	// shut down mesh streamer  	gMeshRepo.shutdown(); -#endif  	// Must clean up texture references before viewer window is destroyed.  	LLHUDManager::getInstance()->updateEffects(); @@ -1761,10 +1759,8 @@ bool LLAppViewer::initThreads()  		mFastTimerLogThread->start();  	} -#if LL_MESH_ENABLED  	// Mesh streaming and caching  	gMeshRepo.init(); -#endif  	LLFilePickerThread::initClass(); diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index afb76735ec..d44fb84f14 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -305,7 +305,6 @@ void LLAssetUploadResponder::uploadComplete(const LLSD& content)  {  } -#if LL_MESH_ENABLED  LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(  	const LLSD& post_data,  	const LLUUID& vfile_id, @@ -427,7 +426,6 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)  	LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, content["new_asset"], TRUE);  } -#endif  LLSendTexLayerResponder::LLSendTexLayerResponder(const LLSD& post_data,  												 const LLUUID& vfile_id, @@ -677,7 +675,6 @@ void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content)  } -#if LL_MESH_ENABLED  /////////////////////////////////////////////////////  // LLNewAgentInventoryVariablePriceResponder::Impl //  ///////////////////////////////////////////////////// @@ -1145,5 +1142,5 @@ void LLNewAgentInventoryVariablePriceResponder::showConfirmationDialog(  				boost::intrusive_ptr<LLNewAgentInventoryVariablePriceResponder>(this)));  	}  } -#endif + diff --git a/indra/newview/llassetuploadresponders.h b/indra/newview/llassetuploadresponders.h index a85e84e9f8..268220d4a6 100644 --- a/indra/newview/llassetuploadresponders.h +++ b/indra/newview/llassetuploadresponders.h @@ -34,7 +34,6 @@  #define LL_LLASSETUPLOADRESPONDER_H  #include "llhttpclient.h" -#include "llvolume.h" //for LL_MESH_ENABLED  // Abstract class for supporting asset upload  // via capabilities @@ -62,7 +61,6 @@ protected:  	std::string mFileName;  }; -#if LL_MESH_ENABLED  // TODO*: Remove this once deprecated  class LLNewAgentInventoryResponder : public LLAssetUploadResponder  { @@ -116,7 +114,6 @@ private:  	class Impl;  	Impl* mImpl;  }; -#endif  struct LLBakedUploadData;  class LLSendTexLayerResponder : public LLAssetUploadResponder diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 68f52e04bc..efbb62011c 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -189,6 +189,11 @@ LLVOVolume* LLDrawable::getVOVolume() const  	}  } +const LLMatrix4& LLDrawable::getRenderMatrix() const +{  +	return isRoot() ? getWorldMatrix() : getParent()->getWorldMatrix(); +} +  BOOL LLDrawable::isLight() const  {  	LLViewerObject* objectp = mVObjp; @@ -713,8 +718,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)  		LLVOVolume* volume = getVOVolume();  		if (volume)  		{ -			volume->updateRelativeXform(); -			pos = volume->getRelativeXform().getTranslation(); +			pos.set(getPositionGroup().getF32ptr());  			if (isStatic())  			{  				pos += volume->getRegion()->getOriginAgent(); diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index fc90bc57c4..a17e2172aa 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -101,7 +101,7 @@ public:  	LLVOVolume*	getVOVolume() const; // cast mVObjp tp LLVOVolume if OK  	const LLMatrix4&      getWorldMatrix() const		{ return mXform.getWorldMatrix(); } -	const LLMatrix4&	  getRenderMatrix() const		{ return isRoot() ? getWorldMatrix() : getParent()->getWorldMatrix(); } +	const LLMatrix4&	  getRenderMatrix() const;  	void				  setPosition(LLVector3 v) const { }  	const LLVector3&	  getPosition() const			{ return mXform.getPosition(); }  	const LLVector3&      getWorldPosition() const		{ return mXform.getPositionW(); } @@ -250,35 +250,37 @@ public:  	typedef enum e_drawable_flags  	{ - 		IN_REBUILD_Q1	= 0x00000002, - 		IN_REBUILD_Q2	= 0x00000004, - 		IN_LIGHT_Q		= 0x00000008, -		EARLY_MOVE		= 0x00000010, -		MOVE_UNDAMPED	= 0x00000020, -		ON_MOVE_LIST	= 0x00000040, -		USE_BACKLIGHT	= 0x00000080, -		UV				= 0x00000100, -		UNLIT			= 0x00000200, -		LIGHT			= 0x00000400, -		LIGHTING_BUILT	= 0x00000800, -		REBUILD_VOLUME  = 0x00001000,	//volume changed LOD or parameters, or vertex buffer changed -		REBUILD_TCOORD	= 0x00002000,	//texture coordinates changed -		REBUILD_COLOR	= 0x00004000,	//color changed -		REBUILD_POSITION= 0x00010000,	//vertex positions/normals changed + 		IN_REBUILD_Q1	= 0x00000001, + 		IN_REBUILD_Q2	= 0x00000002, + 		IN_LIGHT_Q		= 0x00000004, +		EARLY_MOVE		= 0x00000008, +		MOVE_UNDAMPED	= 0x00000010, +		ON_MOVE_LIST	= 0x00000020, +		USE_BACKLIGHT	= 0x00000040, +		UV				= 0x00000080, +		UNLIT			= 0x00000100, +		LIGHT			= 0x00000200, +		LIGHTING_BUILT	= 0x00000400, +		REBUILD_VOLUME  = 0x00000800,	//volume changed LOD or parameters, or vertex buffer changed +		REBUILD_TCOORD	= 0x00001000,	//texture coordinates changed +		REBUILD_COLOR	= 0x00002000,	//color changed +		REBUILD_POSITION= 0x00004000,	//vertex positions/normals changed  		REBUILD_GEOMETRY= REBUILD_POSITION|REBUILD_TCOORD|REBUILD_COLOR,  		REBUILD_MATERIAL= REBUILD_TCOORD|REBUILD_COLOR,  		REBUILD_ALL		= REBUILD_GEOMETRY|REBUILD_VOLUME, -		ON_SHIFT_LIST	= 0x00100000, -		BLOCKER			= 0x00400000, -		ACTIVE			= 0x00800000, -		DEAD			= 0x01000000, -		INVISIBLE		= 0x02000000, // stay invisible until flag is cleared - 		NEARBY_LIGHT	= 0x04000000, // In gPipeline.mNearbyLightSet -		BUILT			= 0x08000000, -		FORCE_INVISIBLE = 0x10000000, // stay invis until CLEAR_INVISIBLE is set (set of orphaned) -		CLEAR_INVISIBLE = 0x20000000, // clear FORCE_INVISIBLE next draw frame -		REBUILD_SHADOW =  0x40000000, -		HAS_ALPHA		= 0x80000000, +		REBUILD_RIGGED	= 0x00008000, +		ON_SHIFT_LIST	= 0x00010000, +		BLOCKER			= 0x00020000, +		ACTIVE			= 0x00040000, +		DEAD			= 0x00080000, +		INVISIBLE		= 0x00100000, // stay invisible until flag is cleared + 		NEARBY_LIGHT	= 0x00200000, // In gPipeline.mNearbyLightSet +		BUILT			= 0x00400000, +		FORCE_INVISIBLE = 0x00800000, // stay invis until CLEAR_INVISIBLE is set (set of orphaned) +		CLEAR_INVISIBLE = 0x01000000, // clear FORCE_INVISIBLE next draw frame +		REBUILD_SHADOW =  0x02000000, +		HAS_ALPHA		= 0x04000000, +		RIGGED			= 0x08000000,  	} EDrawableFlags;  	LLXformMatrix       mXform; diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index ccc060f3fa..e09e40671d 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -105,7 +105,6 @@ S32 normal_channel = -1;  S32 specular_channel = -1;  S32 cube_channel = -1; -#if LL_MESH_ENABLED  static const U32 rigged_data_mask[] = {  	LLDrawPoolAvatar::RIGGED_SIMPLE_MASK,  	LLDrawPoolAvatar::RIGGED_FULLBRIGHT_MASK, @@ -117,7 +116,6 @@ static const U32 rigged_data_mask[] = {  	LLDrawPoolAvatar::RIGGED_DEFERRED_BUMP_MASK,						   	LLDrawPoolAvatar::RIGGED_DEFERRED_SIMPLE_MASK,  }; -#endif  static LLFastTimer::DeclareTimer FTM_SHADOW_AVATAR("Avatar Shadow"); @@ -198,14 +196,12 @@ void LLDrawPoolAvatar::beginDeferredPass(S32 pass)  	case 2:  		beginDeferredSkinned();  		break; -#if LL_MESH_ENABLED  	case 3:  		beginDeferredRiggedSimple();  		break;  	case 4:  		beginDeferredRiggedBump();  		break; -#endif  	}  } @@ -232,14 +228,12 @@ void LLDrawPoolAvatar::endDeferredPass(S32 pass)  	case 2:  		endDeferredSkinned();  		break; -#if LL_MESH_ENABLED  	case 3:  		endDeferredRiggedSimple();  		break;  	case 4:  		endDeferredRiggedBump();  		break; -#endif  	}  } @@ -250,11 +244,7 @@ void LLDrawPoolAvatar::renderDeferred(S32 pass)  S32 LLDrawPoolAvatar::getNumPostDeferredPasses()  { -#if LL_MESH_ENABLED  	return 6; -#else -	return 1; -#endif  }  void LLDrawPoolAvatar::beginPostDeferredPass(S32 pass) @@ -264,7 +254,6 @@ void LLDrawPoolAvatar::beginPostDeferredPass(S32 pass)  	case 0:  		beginPostDeferredAlpha();  		break; -#if LL_MESH_ENABLED  	case 1:  		beginRiggedFullbright();  		break; @@ -280,7 +269,6 @@ void LLDrawPoolAvatar::beginPostDeferredPass(S32 pass)  	case 5:  		beginRiggedGlow();  		break; -#endif  	}  } @@ -298,7 +286,6 @@ void LLDrawPoolAvatar::beginPostDeferredAlpha()  	enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);  } -#if LL_MESH_ENABLED  void LLDrawPoolAvatar::beginDeferredRiggedAlpha()  {  	sVertexProgram = &gDeferredSkinnedAlphaProgram; @@ -316,7 +303,6 @@ void LLDrawPoolAvatar::endDeferredRiggedAlpha()  	LLVertexBuffer::sWeight4Loc = -1;  	sVertexProgram = NULL;  } -#endif  void LLDrawPoolAvatar::endPostDeferredPass(S32 pass)  { @@ -325,7 +311,6 @@ void LLDrawPoolAvatar::endPostDeferredPass(S32 pass)  	case 0:  		endPostDeferredAlpha();  		break; -#if LL_MESH_ENABLED  	case 1:  		endRiggedFullbright();  		break; @@ -341,7 +326,6 @@ void LLDrawPoolAvatar::endPostDeferredPass(S32 pass)  	case 5:  		endRiggedGlow();  		break; -#endif  	}  } @@ -375,11 +359,7 @@ void LLDrawPoolAvatar::renderPostDeferred(S32 pass)  S32 LLDrawPoolAvatar::getNumShadowPasses()  { -#if LL_MESH_ENABLED  	return 2; -#else -	return 1; -#endif  }  void LLDrawPoolAvatar::beginShadowPass(S32 pass) @@ -470,7 +450,6 @@ void LLDrawPoolAvatar::renderShadow(S32 pass)  		avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE);  	} -#if LL_MESH_ENABLED  	else  	{  		renderRigged(avatarp, RIGGED_SIMPLE); @@ -480,12 +459,10 @@ void LLDrawPoolAvatar::renderShadow(S32 pass)  		renderRigged(avatarp, RIGGED_SHINY);  		renderRigged(avatarp, RIGGED_FULLBRIGHT_ALPHA);  	} -#endif  }  S32 LLDrawPoolAvatar::getNumPasses()  { -#if LL_MESH_ENABLED  	if (LLPipeline::sImpostorRender)  	{  		return 8; @@ -494,7 +471,6 @@ S32 LLDrawPoolAvatar::getNumPasses()  	{  		return 10;  	} -#else  	if (LLPipeline::sImpostorRender)  	{  		return 1; @@ -503,7 +479,6 @@ S32 LLDrawPoolAvatar::getNumPasses()  	{  		return 3;  	} -#endif  } @@ -554,7 +529,6 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass)  	case 2:  		beginSkinned();  		break; -#if LL_MESH_ENABLED  	case 3:  		beginRiggedSimple();  		break; @@ -576,7 +550,6 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass)  	case 9:  		beginRiggedGlow();  		break; -#endif  	}  } @@ -600,7 +573,6 @@ void LLDrawPoolAvatar::endRenderPass(S32 pass)  	case 2:  		endSkinned();  		break; -#if LL_MESH_ENABLED  	case 3:  		endRiggedSimple();  		break; @@ -622,7 +594,6 @@ void LLDrawPoolAvatar::endRenderPass(S32 pass)  	case 9:  		endRiggedGlow();  		break; -#endif  	}  } @@ -808,7 +779,6 @@ void LLDrawPoolAvatar::endSkinned()  	gGL.getTexUnit(0)->activate();  } -#if LL_MESH_ENABLED  void LLDrawPoolAvatar::beginRiggedSimple()  {  	if (sShaderLevel > 0) @@ -1056,7 +1026,6 @@ void LLDrawPoolAvatar::endDeferredRiggedBump()  	sDiffuseChannel = 0;  	sVertexProgram = NULL;  } -#endif  void LLDrawPoolAvatar::beginDeferredSkinned()  { @@ -1202,7 +1171,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)  		return;  	} -#if LL_MESH_ENABLED  	if (pass == 3)  	{  		if (is_deferred_render) @@ -1284,7 +1252,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)  		gGL.setSceneBlendType(LLRender::BT_ALPHA);  		return;  	} -#endif  	if (sShaderLevel > 0)  	{ @@ -1322,9 +1289,14 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)  	}  } -#if LL_MESH_ENABLED  void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* face, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face)  { +	LLVector4a* weight = vol_face.mWeights; +	if (!weight) +	{ +		return; +	} +  	LLVertexBuffer* buffer = face->mVertexBuffer;  	U32 data_mask = 0; @@ -1403,8 +1375,6 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*  			}  		} -		LLVector4a* weight = vol_face.mWeights; -  		LLMatrix4a bind_shape_matrix;  		bind_shape_matrix.loadu(skin->mBindShapeMatrix); @@ -1422,7 +1392,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*  			{  				F32 w = weight[j][k]; -				idx[k] = (S32) floorf(w); +				idx[k] = llclamp((S32) floorf(w), 0, 63);  				wght[k] = w - floorf(w);  				scale += wght[k];  			} @@ -1627,8 +1597,6 @@ void LLDrawPoolAvatar::renderRiggedGlow(LLVOAvatar* avatar)  {  	renderRigged(avatar, RIGGED_GLOW, true);  } -#endif -  //----------------------------------------------------------------------------- @@ -1729,7 +1697,6 @@ LLColor3 LLDrawPoolAvatar::getDebugColor() const  	return LLColor3(0.f, 1.f, 0.f);  } -#if LL_MESH_ENABLED  void LLDrawPoolAvatar::addRiggedFace(LLFace* facep, U32 type)  {  	if (facep->mRiggedIndex.empty()) @@ -1784,7 +1751,6 @@ void LLDrawPoolAvatar::removeRiggedFace(LLFace* facep)  		}  	}  } -#endif  LLVertexBufferAvatar::LLVertexBufferAvatar()  : LLVertexBuffer(sDataMask,  diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index d08ae04516..7d7f9319ed 100644 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -34,7 +34,6 @@  #define LL_LLDRAWPOOLAVATAR_H  #include "lldrawpool.h" -#include "llvolume.h" // for LL_MESH_ENABLED  class LLVOAvatar;  class LLGLSLShader; @@ -113,7 +112,6 @@ public:  	void beginPostDeferredAlpha();  	void endPostDeferredAlpha(); -#if LL_MESH_ENABLED  	void beginRiggedSimple();  	void beginRiggedFullbright();  	void beginRiggedFullbrightShiny(); @@ -205,7 +203,6 @@ public:  	void removeRiggedFace(LLFace* facep);   	std::vector<LLFace*> mRiggedFace[NUM_RIGGED_PASSES]; -#endif  	/*virtual*/ LLViewerTexture *getDebugTexture();  	/*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 7c24eb77cd..29edbc2b03 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -212,13 +212,11 @@ void LLFace::destroy()  	if (mDrawPoolp)  	{ -#if LL_MESH_ENABLED  		if (this->isState(LLFace::RIGGED) && mDrawPoolp->getType() == LLDrawPool::POOL_AVATAR)  		{  			((LLDrawPoolAvatar*) mDrawPoolp)->removeRiggedFace(this);  		}  		else -#endif  		{  			mDrawPoolp->removeFace(this);  		} @@ -556,8 +554,36 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)  		}  		glColor4fv(color.mV); -		mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); -		mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); +	 +		if (mDrawablep->isState(LLDrawable::RIGGED)) +		{ +			LLVOVolume* volume = mDrawablep->getVOVolume(); +			if (volume) +			{ +				LLRiggedVolume* rigged = volume->getRiggedVolume(); +				if (rigged) +				{ +					LLGLEnable offset(GL_POLYGON_OFFSET_FILL); +					glPolygonOffset(-1.f, -1.f); +					glMultMatrixf((F32*) volume->getRelativeXform().mMatrix); +					const LLVolumeFace& vol_face = rigged->getVolumeFace(getTEOffset()); +					LLVertexBuffer::unbind(); +					glVertexPointer(3, GL_FLOAT, 16, vol_face.mPositions); +					if (vol_face.mTexCoords) +					{ +						glEnableClientState(GL_TEXTURE_COORD_ARRAY); +						glTexCoordPointer(2, GL_FLOAT, 8, vol_face.mTexCoords); +					} +					glDrawElements(GL_TRIANGLES, vol_face.mNumIndices, GL_UNSIGNED_SHORT, vol_face.mIndices); +					glDisableClientState(GL_TEXTURE_COORD_ARRAY); +				} +			} +		} +		else +		{ +			mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); +			mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); +		}  		gGL.popMatrix();  	} @@ -720,7 +746,7 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,  	LLMemType mt1(LLMemType::MTYPE_DRAWABLE);  	//get bounding box -	if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION)) +	if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED))  	{  		//VECTORIZE THIS  		LLMatrix4a mat_vert; diff --git a/indra/newview/llfloaterimportcollada.cpp b/indra/newview/llfloaterimportcollada.cpp index 476c02cd46..000347f68c 100644 --- a/indra/newview/llfloaterimportcollada.cpp +++ b/indra/newview/llfloaterimportcollada.cpp @@ -74,8 +74,6 @@  // floater  // -#if LL_MESH_ENABLED -  LLFloaterImportCollada::LLFloaterImportCollada(const LLSD& key)  	: LLFloater(key)  { @@ -1113,4 +1111,3 @@ void LLImportCollada::onCommitCancel(LLUICtrl*, void*)  	getInstance()->endImport();  } -#endif diff --git a/indra/newview/llfloaterimportcollada.h b/indra/newview/llfloaterimportcollada.h index 818b19e403..4eb263901b 100644 --- a/indra/newview/llfloaterimportcollada.h +++ b/indra/newview/llfloaterimportcollada.h @@ -34,9 +34,6 @@  #define LL_LLFLOATERIMPORTCOLLADA_H  #include "llfloater.h" -#include "llvolume.h" //for LL_MESH_ENABLED - -#if LL_MESH_ENABLED  class LLFloaterImportCollada : public LLFloater  { @@ -138,6 +135,4 @@ private:  	LLMatrix4   mSceneTransformation;  }; -#endif -  #endif // LL_LLFLOATERIMPORTCOLLADA_H diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 85035fb961..088c9e6546 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -98,9 +98,6 @@  #include "glod/glod.h" - -#if LL_MESH_ENABLED -  //static  S32 LLFloaterModelPreview::sUploadAmount = 10;  LLFloaterModelPreview* LLFloaterModelPreview::sInstance = NULL; @@ -2603,6 +2600,9 @@ void LLModelPreview::genLODs(S32 which_lod)  			target_model->mInvBindMatrix = base->mInvBindMatrix;  			target_model->mBindShapeMatrix = base->mBindShapeMatrix; +			//copy material list +			target_model->mMaterialList = base->mMaterialList; +  			if (!validate_model(target_model))  			{  				llerrs << "Invalid model generated when creating LODs" << llendl; @@ -3434,5 +3434,3 @@ void LLModelPreview::textureLoadedCallback( BOOL success, LLViewerFetchedTexture  	preview->refresh();  } -#endif - diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 97e681a6a8..148687aecd 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -40,7 +40,6 @@  #include "llmodel.h"  #include "llthread.h" -#if LL_MESH_ENABLED  class LLComboBox;  class LLJoint;  class LLViewerJointMesh; @@ -272,6 +271,4 @@ protected:  	static S32		sUploadAmount;  }; -#endif -  #endif  // LL_LLFLOATERMODELPREVIEW_H diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index fa5d9b0892..653f838779 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -1016,10 +1016,12 @@ S32 LLFloaterTools::calcRenderCost()  		LLSelectNode *select_node = *selection_iter;  		if (select_node)  		{ -			LLVOVolume *viewer_volume = (LLVOVolume*)select_node->getObject(); -			if (viewer_volume) +			LLViewerObject *vobj = select_node->getObject(); +			if (vobj->getVolume())  			{ -				cost += viewer_volume->getRenderCost(textures); +				LLVOVolume* volume = (LLVOVolume*) vobj; + +				cost += volume->getRenderCost(textures);  				for (LLVOVolume::texture_cost_t::iterator iter = textures.begin(); iter != textures.end(); ++iter)  				{  					// add the cost of each individual texture in the linkset diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index b03947f54d..eb23ab95dd 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -920,7 +920,6 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,  			// Only should happen for broken links.  			new_listener = new LLLinkItemBridge(inventory, root, uuid);  			break; -#if LL_MESH_ENABLED  	    case LLAssetType::AT_MESH:  			if(!(inv_type == LLInventoryType::IT_MESH))  			{ @@ -928,7 +927,6 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,  			}  			new_listener = new LLMeshBridge(inventory, root, uuid);  			break; -#endif  		default:  			llinfos << "Unhandled asset type (llassetstorage.h): " @@ -2690,9 +2688,7 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,  		case DAD_ANIMATION:  		case DAD_GESTURE:  		case DAD_LINK: -#if LL_MESH_ENABLED  		case DAD_MESH: -#endif  			accept = dragItemIntoFolder((LLInventoryItem*)cargo_data,  										drop);  			break; @@ -3602,9 +3598,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,  			case DAD_BODYPART:  			case DAD_ANIMATION:  			case DAD_GESTURE: -#if LL_MESH_ENABLED  			case DAD_MESH: -#endif  			{  				LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;  				const LLPermissions& perm = inv_item->getPermissions(); @@ -4793,7 +4787,6 @@ void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)  	hide_context_entries(menu, items, disabled_items);  } -#if LL_MESH_ENABLED  // +=================================================+  // |        LLMeshBridge                             |  // +=================================================+ @@ -4850,7 +4843,6 @@ void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags)  	hide_context_entries(menu, items, disabled_items);  } -#endif  // +=================================================+  // |        LLLinkBridge                             | diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 4c6c3ab82f..e1bfff7e0c 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -40,7 +40,6 @@  #include "llinventoryobserver.h"  #include "llviewercontrol.h"  #include "llwearable.h" -#include "llvolume.h"  //for LL_MESH_ENABLED  class LLInventoryPanel;  class LLInventoryModel; @@ -530,7 +529,6 @@ protected:  }; -#if LL_MESH_ENABLED  class LLMeshBridge : public LLItemBridge  {  	friend class LLInvFVBridge; @@ -546,8 +544,6 @@ protected:  		     const LLUUID& uuid) :                         LLItemBridge(inventory, root, uuid) {}  }; -#endif -  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/newview/llmeshreduction.cpp b/indra/newview/llmeshreduction.cpp index e785784a32..f56d97abbf 100644 --- a/indra/newview/llmeshreduction.cpp +++ b/indra/newview/llmeshreduction.cpp @@ -37,8 +37,6 @@  #include "glod/glod.h" -#if LL_MESH_ENABLED -  static BOOL stop_gloderror()  {  	GLuint error = glodGetError(); @@ -287,5 +285,4 @@ LLPointer<LLModel> LLMeshReduction::reduce(LLModel* in_model, F32 limit, S32 mod  	return out_model;  } -#endif diff --git a/indra/newview/llmeshreduction.h b/indra/newview/llmeshreduction.h index d86696978d..9a7eaa082f 100644 --- a/indra/newview/llmeshreduction.h +++ b/indra/newview/llmeshreduction.h @@ -34,8 +34,6 @@  #include "llmodel.h" -#if LL_MESH_ENABLED -  class LLMeshReduction  {   public: @@ -54,6 +52,4 @@ private:  	U32 mCounter;  }; -#endif -  #endif  // LL_LLMESHREDUCTION_H diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 069642b711..ecf75415ab 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -68,8 +68,6 @@  #include <queue> -#if LL_MESH_ENABLED -  LLFastTimer::DeclareTimer FTM_MESH_UPDATE("Mesh Update");  LLFastTimer::DeclareTimer FTM_LOAD_MESH("Load Mesh"); @@ -2395,6 +2393,13 @@ LLSD LLMeshUploadThread::createObject(LLModelInstance& instance)  	extra_parameter["param_data"] = v;  	object_params["extra_parameters"].append(extra_parameter); +	LLPermissions perm; +	perm.setNextOwnerBits(gAgent.getID(), LLUUID::null, TRUE, LLFloaterPerms::getNextOwnerPerms()); +	perm.setGroupBits(gAgent.getID(), LLUUID::null, TRUE, LLFloaterPerms::getGroupPerms()); +	perm.setEveryoneBits(gAgent.getID(), LLUUID::null, TRUE, LLFloaterPerms::getEveryonePerms()); + +	object_params["permissions"] = ll_create_sd_from_permissions(perm); +  	return object_params;  } @@ -2696,5 +2701,4 @@ void LLPhysicsDecomp::run()  	mDone = true;  } -#endif diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index b26598ce31..a2f403e214 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -39,8 +39,6 @@  #include "llviewertexture.h"  #include "llvolume.h" -#if LL_MESH_ENABLED -  #define LLCONVEXDECOMPINTER_STATIC 1  #include "llconvexdecomposition.h" @@ -466,5 +464,3 @@ extern LLMeshRepository gMeshRepo;  #endif -#endif - diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 91166b0f5b..e900c0bdaf 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -159,9 +159,7 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,  		case DAD_ANIMATION:  		case DAD_GESTURE:  		case DAD_CALLINGCARD: -#if LL_MESH_ENABLED  		case DAD_MESH: -#endif  		{  			LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;  			if(gInventory.getItem(inv_item->getUUID()) diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index a2dd8b4d6d..87c3ee4552 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -818,9 +818,7 @@ BOOL LLTaskCategoryBridge::dragOrDrop(MASK mask, BOOL drop,  		case DAD_ANIMATION:  		case DAD_GESTURE:  		case DAD_CALLINGCARD: -#if LL_MESH_ENABLED  		case DAD_MESH: -#endif  			accept = LLToolDragAndDrop::isInventoryDropAcceptable(object, (LLViewerInventoryItem*)cargo_data);  			if(accept && drop)  			{ @@ -1246,7 +1244,6 @@ LLUIImagePtr LLTaskWearableBridge::getIcon() const  	return LLInventoryIcon::getIcon(mAssetType, mInventoryType, mFlags, FALSE );  } -#if LL_MESH_ENABLED  ///----------------------------------------------------------------------------  /// Class LLTaskMeshBridge  ///---------------------------------------------------------------------------- @@ -1358,8 +1355,6 @@ void LLTaskMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags)  	hide_context_entries(menu, items, disabled_items);  } -#endif -  ///----------------------------------------------------------------------------  /// LLTaskInvFVBridge impl  //---------------------------------------------------------------------------- @@ -1439,13 +1434,11 @@ LLTaskInvFVBridge* LLTaskInvFVBridge::createObjectBridge(LLPanelObjectInventory*  						 object->getUUID(),  						 object->getName());  		break; -#if LL_MESH_ENABLED  	case LLAssetType::AT_MESH:  		new_bridge = new LLTaskMeshBridge(panel,  										  object->getUUID(),  										  object->getName());  		break; -#endif  	default:  		llinfos << "Unhandled inventory type (llassetstorage.h): "  				<< (S32)type << llendl; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index ff2929695d..21f7e780e2 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5395,6 +5395,42 @@ BOOL LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power)  	return (mPermissions->allowOperationBy(op, proxy_agent_id, group_id));  } + +//helper function for pushing relevant vertices from drawable to GL +void pushWireframe(LLDrawable* drawable) +{ +	if (drawable->isState(LLDrawable::RIGGED)) +	{ //render straight from rigged volume if this is a rigged attachment +		LLVOVolume* vobj = drawable->getVOVolume(); +		if (vobj) +		{ +			vobj->updateRiggedVolume(); +			LLRiggedVolume* rigged_volume = vobj->getRiggedVolume(); +			if (rigged_volume) +			{ +				LLVertexBuffer::unbind(); +				gGL.pushMatrix(); +				glMultMatrixf((F32*) vobj->getRelativeXform().mMatrix); +				for (S32 i = 0; i < rigged_volume->getNumVolumeFaces(); ++i) +				{ +					const LLVolumeFace& face = rigged_volume->getVolumeFace(i); +					glVertexPointer(3, GL_FLOAT, 16, face.mPositions); +					glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices); +				} +				gGL.popMatrix(); +			} +		} +	} +	else +	{ +		for (S32 i = 0; i < drawable->getNumFaces(); ++i) +		{ +			LLFace* face = drawable->getFace(i); +			pushVerts(face, LLVertexBuffer::MAP_VERTEX); +		} +	} +} +  void LLSelectNode::renderOneWireframe(const LLColor4& color)  {  	LLViewerObject* objectp = getObject(); @@ -5442,11 +5478,7 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)  		gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);  		{  			glColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); -			for (S32 i = 0; i < drawable->getNumFaces(); ++i) -			{ -				LLFace* face = drawable->getFace(i); -				pushVerts(face, LLVertexBuffer::MAP_VERTEX); -			} +			pushWireframe(drawable);  		}  	} @@ -5455,13 +5487,9 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)  	glColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);  	LLGLEnable offset(GL_POLYGON_OFFSET_LINE); -	glPolygonOffset(3.f, 2.f); +	glPolygonOffset(3.f, 3.f);  	glLineWidth(3.f); -	for (S32 i = 0; i < drawable->getNumFaces(); ++i) -	{ -		LLFace* face = drawable->getFace(i); -		pushVerts(face, LLVertexBuffer::MAP_VERTEX); -	} +	pushWireframe(drawable);  	glLineWidth(1.f);  	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);  	gGL.popMatrix(); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 425fa42339..56be8af599 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2789,7 +2789,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)  	U32 data_mask = LLVertexBuffer::MAP_VERTEX; -#if LL_MESH_ENABLED  	if (volume->isMesh())  	{			  		LLUUID mesh_id = volume->getVolume()->getParams().getSculptID(); @@ -2826,7 +2825,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)  			return;  		}  	} -#endif //LL_MESH_ENABLED  	//push faces  	glColor3fv(color.mV); @@ -3035,11 +3033,11 @@ class LLRenderOctreeRaycast : public LLOctreeTriangleRayIntersect  {  public: -	LLRenderOctreeRaycast(const LLVector3& start, const LLVector3& end) +	 +	LLRenderOctreeRaycast(const LLVector4a& start, const LLVector4a& dir, F32* closest_t) +		: LLOctreeTriangleRayIntersect(start, dir, NULL, closest_t, NULL, NULL, NULL, NULL)  	{ -		mStart.load3(start.mV); -		mEnd.load3(end.mV); -		mDir.setSub(mEnd, mStart); +  	}  	void visit(const LLOctreeNode<LLVolumeTriangle>* branch) @@ -3047,9 +3045,22 @@ public:  		LLVolumeOctreeListener* vl = (LLVolumeOctreeListener*) branch->getListener(0);  		LLVector3 center, size; -		center.set(vl->mBounds[0].getF32ptr()); -		size.set(vl->mBounds[1].getF32ptr()); +		 +		if (branch->getData().empty()) +		{ +			gGL.color3f(1.f,0.2f,0.f); +			center.set(branch->getCenter().getF32ptr()); +			size.set(branch->getSize().getF32ptr()); +		} +		else +		{ +			gGL.color3f(0.75f, 1.f, 0.f); +			center.set(vl->mBounds[0].getF32ptr()); +			size.set(vl->mBounds[1].getF32ptr()); +		} +		drawBoxOutline(center, size);	 +		  		for (U32 i = 0; i < 2; i++)  		{  			LLGLDepthTest depth(GL_TRUE, GL_FALSE, i == 1 ? GL_LEQUAL : GL_GREATER); @@ -3061,9 +3072,14 @@ public:  			else  			{  				gGL.color4f(0,0.5f,0.5f, 0.25f); +				drawBoxOutline(center, size); +			} +			 +			if (i == 1) +			{ +				gGL.flush(); +				glLineWidth(3.f);  			} - -			drawBoxOutline(center, size);  			gGL.begin(LLRender::TRIANGLES);  			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin(); @@ -3077,6 +3093,12 @@ public:  				gGL.vertex3fv(tri->mV[2]->getF32ptr());  			}	  			gGL.end(); + +			if (i == 1) +			{ +				gGL.flush(); +				glLineWidth(1.f); +			}  		}  	}  }; @@ -3096,26 +3118,63 @@ void renderRaycast(LLDrawable* drawablep)  			LLVOVolume* vobj = drawablep->getVOVolume();  			LLVolume* volume = vobj->getVolume(); -			for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) + +			bool transform = true; +			if (drawablep->isState(LLDrawable::RIGGED))  			{ -				const LLVolumeFace& face = volume->getVolumeFace(i); -				if (!face.mOctree) +				volume = vobj->getRiggedVolume(); +				transform = false; +			} + +			if (volume) +			{ +				for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)  				{ -					((LLVolumeFace*) &face)->createOctree();  -				} +					const LLVolumeFace& face = volume->getVolumeFace(i); +					if (!face.mOctree) +					{ +						((LLVolumeFace*) &face)->createOctree();  +					} -				gGL.pushMatrix(); -				glMultMatrixf((F32*) vobj->getRelativeXform().mMatrix); -				LLVector3 start, end; -				start = vobj->agentPositionToVolume(gDebugRaycastStart); -				end = vobj->agentPositionToVolume(gDebugRaycastEnd); +					gGL.pushMatrix(); +					glMultMatrixf((F32*) vobj->getRelativeXform().mMatrix); -				LLRenderOctreeRaycast render(start, end); -				gGL.flush(); -				glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); -				render.traverse(face.mOctree); -				gGL.popMatrix();		 -				glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); +					LLVector3 start, end; +					if (transform) +					{ +						start = vobj->agentPositionToVolume(gDebugRaycastStart); +						end = vobj->agentPositionToVolume(gDebugRaycastEnd); +					} +					else +					{ +						start = gDebugRaycastStart; +						end = gDebugRaycastEnd; +					} + +					LLVector4a starta, enda; +					starta.load3(start.mV); +					enda.load3(end.mV); +					LLVector4a dir; +					dir.setSub(enda, starta); + +					F32 t = 1.f; + +					LLRenderOctreeRaycast render(starta, dir, &t); +					gGL.flush(); +					glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + +					{ +						//render face positions +						LLVertexBuffer::unbind(); +						glColor4f(0,1,1,0.5f); +						glVertexPointer(3, GL_FLOAT, sizeof(LLVector4a), face.mPositions); +						glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices); +					} +						 +					render.traverse(face.mOctree); +					gGL.popMatrix();		 +					glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); +				}  			}  		}  		else if (drawablep->isAvatar()) diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 3aaf5f0c9f..3d290b7875 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -295,10 +295,8 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(  {  	BOOL handled = FALSE; -	bool is_mesh = false; -#if LL_MESH_ENABLED -	is_mesh = cargo_type == DAD_MESH; -#endif +	bool is_mesh = cargo_type == DAD_MESH; +  	if ((cargo_type == DAD_TEXTURE) || is_mesh)  	{  		LLInventoryItem *item = (LLInventoryItem *)cargo_data; @@ -1214,10 +1212,8 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,  	// returns true, then the cast was valid, and we can perform  	// the third test without problems.  	LLInventoryItem* item = (LLInventoryItem*)cargo_data;  -	bool is_mesh = false; -#if LL_MESH_ENABLED -	is_mesh = cargo_type == DAD_MESH; -#endif +	bool is_mesh = cargo_type == DAD_MESH; +  	if (getEnabled() &&  		((cargo_type == DAD_TEXTURE) || is_mesh) &&  		 allowDrop(item)) diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index b7dc624beb..6f38b0cd65 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -331,9 +331,7 @@ LLToolDragAndDrop::LLDragAndDropDictionary::LLDragAndDropDictionary()  	addEntry(DAD_ANIMATION, 	new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dGiveInventory,		&LLToolDragAndDrop::dad3dUpdateInventory,			&LLToolDragAndDrop::dad3dNULL));  	addEntry(DAD_GESTURE, 		new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dActivateGesture,		&LLToolDragAndDrop::dad3dGiveInventory,		&LLToolDragAndDrop::dad3dUpdateInventory,			&LLToolDragAndDrop::dad3dNULL));  	addEntry(DAD_LINK, 			new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dNULL,						&LLToolDragAndDrop::dad3dNULL)); -#if LL_MESH_ENABLED  	addEntry(DAD_MESH, 			new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dGiveInventory,		&LLToolDragAndDrop::dad3dMeshObject,			&LLToolDragAndDrop::dad3dNULL)); -#endif  	// TODO: animation on self could play it?  edit it?  	// TODO: gesture on self could play it?  edit it?  }; @@ -1037,7 +1035,6 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,  	hit_obj->sendTEUpdate();  } -#if LL_MESH_ENABLED  void LLToolDragAndDrop::dropMesh(LLViewerObject* hit_obj,  								 LLInventoryItem* item,  								 LLToolDragAndDrop::ESource source, @@ -1062,7 +1059,6 @@ void LLToolDragAndDrop::dropMesh(LLViewerObject* hit_obj,  	dialog_refresh_all();  } -#endif  /*  void LLToolDragAndDrop::dropTextureOneFaceAvatar(LLVOAvatar* avatar, S32 hit_face, LLInventoryItem* item) @@ -1505,9 +1501,7 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_  	case DAD_ANIMATION:  	case DAD_GESTURE:  	case DAD_CALLINGCARD: -#if LL_MESH_ENABLED  	case DAD_MESH: -#endif  	{  		LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;  		if(gInventory.getItem(inv_item->getUUID()) @@ -1864,12 +1858,10 @@ EAcceptance LLToolDragAndDrop::dad3dApplyToObject(  				dropTextureOneFace(obj, face, item, mSource, mSourceID);  			}  		} -#if LL_MESH_ENABLED  		else if (cargo_type == DAD_MESH)  		{  			dropMesh(obj, item, mSource, mSourceID);  		} -#endif  		else  		{  			llwarns << "unsupported asset type" << llendl; @@ -1894,15 +1886,11 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject(  	return dad3dApplyToObject(obj, face, mask, drop, DAD_TEXTURE);  } -#if LL_MESH_ENABLED  EAcceptance LLToolDragAndDrop::dad3dMeshObject(  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)  {  	return dad3dApplyToObject(obj, face, mask, drop, DAD_MESH);  } -#endif - -  /* diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 09da4c2955..596cc2ee88 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -43,7 +43,6 @@  #include "llpermissions.h"  #include "llwindow.h"  #include "llviewerinventory.h" -#include "llvolume.h" //for LL_MESH_ENABLED  class LLToolDragAndDrop;  class LLViewerRegion; @@ -155,10 +154,8 @@ protected:  							   MASK mask, BOOL drop);  	EAcceptance dad3dTextureObject(LLViewerObject* obj, S32 face,  								   MASK mask, BOOL drop); -#if LL_MESH_ENABLED  	EAcceptance dad3dMeshObject(LLViewerObject* obj, S32 face,  								   MASK mask, BOOL drop); -#endif  //	EAcceptance dad3dTextureSelf(LLViewerObject* obj, S32 face,  //								 MASK mask, BOOL drop);  	EAcceptance dad3dWearItem(LLViewerObject* obj, S32 face, @@ -245,12 +242,10 @@ public:  									LLInventoryItem* item,  									ESource source,  									const LLUUID& src_id); -#if LL_MESH_ENABLED  	static void dropMesh(LLViewerObject* hit_obj,  						 LLInventoryItem* item,  						 ESource source,  						 const LLUUID& src_id); -#endif  	//static void	dropTextureOneFaceAvatar(LLVOAvatar* avatar,S32 hit_face,  	//									 LLInventoryItem* item) diff --git a/indra/newview/llviewerassettype.cpp b/indra/newview/llviewerassettype.cpp index 370767002a..4c088a72b7 100644 --- a/indra/newview/llviewerassettype.cpp +++ b/indra/newview/llviewerassettype.cpp @@ -85,9 +85,7 @@ LLViewerAssetDictionary::LLViewerAssetDictionary()  	addEntry(LLViewerAssetType::AT_LINK, 				new ViewerAssetEntry(DAD_LINK));  	addEntry(LLViewerAssetType::AT_LINK_FOLDER, 		new ViewerAssetEntry(DAD_LINK)); -#if LL_MESH_ENABLED  	addEntry(LLViewerAssetType::AT_MESH, 				new ViewerAssetEntry(DAD_MESH)); -#endif  	addEntry(LLViewerAssetType::AT_NONE, 				new ViewerAssetEntry(DAD_NONE));  }; diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index e165837209..eface0f61d 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -176,9 +176,7 @@ void LLViewerFloaterReg::registerFloaters()  	LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHUD>);  	LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIMFloater>); -#if LL_MESH_ENABLED  	LLFloaterReg::add("import_collada", "floater_import_collada.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterImportCollada>); -#endif  	LLFloaterReg::add("im_container", "floater_im_container.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIMFloaterContainer>);  	LLFloaterReg::add("im_well_window", "floater_sys_well.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIMWellWindow>);  	LLFloaterReg::add("incoming_call", "floater_incoming_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIncomingCallDialog>); @@ -258,9 +256,7 @@ void LLViewerFloaterReg::registerFloaters()  	LLFloaterReg::add("upload_anim", "floater_animation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAnimPreview>, "upload");  	LLFloaterReg::add("upload_image", "floater_image_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterImagePreview>, "upload");  	LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundPreview>, "upload"); -#if LL_MESH_ENABLED  	LLFloaterReg::add("upload_model", "floater_model_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterModelPreview>, "upload"); -#endif  	LLFloaterReg::add("voice_controls", "floater_voice_controls.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLCallFloater>);  	LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterVoiceEffect>); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 20de01b78a..0460ac0988 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -350,7 +350,6 @@ class LLFileUploadImage : public view_listener_t  	}  }; -#if LL_MESH_ENABLED  class LLFileUploadScene : public view_listener_t  {  	bool handleEvent(const LLSD& userdata) @@ -377,7 +376,6 @@ class LLFileUploadModel : public view_listener_t  		return TRUE;  	}  }; -#endif  class LLFileUploadSound : public view_listener_t  { @@ -1186,7 +1184,6 @@ void upload_new_resource(  	lldebugs << "Folder: " << gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type) << llendl;  	lldebugs << "Asset Type: " << LLAssetType::lookup(asset_type) << llendl; -#if LL_MESH_ENABLED  	std::string url = gAgent.getRegion()->getCapability(  		"NewFileAgentInventory"); @@ -1216,7 +1213,6 @@ void upload_new_resource(  		LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type));  	}  	else -#endif  	{  		llinfos << "NewAgentInventory capability not found, new agent inventory via asset system." << llendl;  		// check for adequate funds @@ -1264,7 +1260,6 @@ void upload_new_resource(  	}  } -#if LL_MESH_ENABLED  BOOL upload_new_variable_price_resource(  	const LLTransactionID &tid,   	LLAssetType::EType asset_type, @@ -1336,7 +1331,6 @@ BOOL upload_new_variable_price_resource(  		return FALSE;  	}  } -#endif  LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid)  { @@ -1407,10 +1401,8 @@ void init_menu_file()  	view_listener_t::addCommit(new LLFileUploadImage(), "File.UploadImage");  	view_listener_t::addCommit(new LLFileUploadSound(), "File.UploadSound");  	view_listener_t::addCommit(new LLFileUploadAnim(), "File.UploadAnim"); -#if LL_MESH_ENABLED  	view_listener_t::addCommit(new LLFileUploadModel(), "File.UploadModel");  	view_listener_t::addCommit(new LLFileUploadScene(), "File.UploadScene"); -#endif  	view_listener_t::addCommit(new LLFileUploadBulk(), "File.UploadBulk");  	view_listener_t::addCommit(new LLFileCloseWindow(), "File.CloseWindow");  	view_listener_t::addCommit(new LLFileCloseAllWindows(), "File.CloseAllWindows"); diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index bb7cfce862..08444551a9 100644 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -74,7 +74,6 @@ void upload_new_resource(  	S32 expected_upload_cost,  	void *userdata); -#if LL_MESH_ENABLED  // TODO* : Move all uploads to use this new function  // since at some point, that upload path will be deprecated and no longer  // used @@ -92,7 +91,6 @@ BOOL upload_new_variable_price_resource(  	U32 everyone_perms,  	const std::string& display_name,  	const LLSD& asset_resources); -#endif  LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid);  void increase_new_upload_stats(LLAssetType::EType asset_type); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index fd2212f25d..4c1a1958e8 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -3279,6 +3279,15 @@ const LLVector3 LLViewerObject::getPositionEdit() const  const LLVector3 LLViewerObject::getRenderPosition() const  { +	if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED)) +	{ +		LLVOAvatar* avatar = getAvatar(); +		if (avatar) +		{ +			return avatar->getPositionAgent(); +		} +	} +  	if (mDrawable.isNull() || mDrawable->getGeneration() < 0)  	{  		return getPositionAgent(); @@ -3297,6 +3306,11 @@ const LLVector3 LLViewerObject::getPivotPositionAgent() const  const LLQuaternion LLViewerObject::getRenderRotation() const  {  	LLQuaternion ret; +	if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED)) +	{ +		return ret; +	} +	  	if (mDrawable.isNull() || mDrawable->isStatic())  	{  		ret = getRotationEdit(); diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 84a42611a4..109add5552 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -543,9 +543,7 @@ LLUIImagePtr LLEmbeddedItems::getItemImage(llwchar ext_char) const  			case LLAssetType::AT_BODYPART:		img_name = "Inv_Skin";		break;  			case LLAssetType::AT_ANIMATION:		img_name = "Inv_Animation";	break;  			case LLAssetType::AT_GESTURE:		img_name = "Inv_Gesture";	break; -#if LL_MESH_ENABLED  			case LLAssetType::AT_MESH:          img_name = "Inv_Mesh";	    break; -#endif  			default: llassert(0);  		} diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 430f83307a..28bcdff7bd 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -604,10 +604,8 @@ public:  		if (gSavedSettings.getBOOL("DebugShowUploadCost"))  		{ -#if LL_MESH_ENABLED  			addText(xpos, ypos, llformat("       Meshes: L$%d", gPipeline.mDebugMeshUploadCost));  			ypos += y_inc/2; -#endif  			addText(xpos, ypos, llformat("    Sculpties: L$%d", gPipeline.mDebugSculptUploadCost));  			ypos += y_inc/2;  			addText(xpos, ypos, llformat("     Textures: L$%d", gPipeline.mDebugTextureUploadCost)); @@ -617,7 +615,6 @@ public:  			ypos += y_inc;  		} -#if LL_MESH_ENABLED  		//temporary hack to give feedback on mesh upload progress  		if (!gMeshRepo.mUploads.empty())  		{ @@ -647,7 +644,6 @@ public:  			ypos += y_inc;  		} -#endif  	}  	void draw() diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 5448e7dcd9..4ef050e71f 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -41,9 +41,11 @@  #include "llviewercontrol.h"  #include "lldir.h"  #include "llflexibleobject.h" +#include "llfloatertools.h"  #include "llmaterialtable.h"  #include "llprimitive.h"  #include "llvolume.h" +#include "llvolumeoctree.h"  #include "llvolumemgr.h"  #include "llvolumemessage.h"  #include "material_codes.h" @@ -70,6 +72,7 @@  #include "llselectmgr.h"  #include "pipeline.h"  #include "llsdutil.h" +#include "llmatrix4a.h"  #include "llmediaentry.h"  #include "llmediadataclient.h"  #include "llmeshrepository.h" @@ -943,7 +946,6 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms, const S32 detail, bool  	BOOL is404 = FALSE; -#if LL_MESH_ENABLED  	if (isSculpted())  	{  		// if it's a mesh @@ -963,7 +965,6 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms, const S32 detail, bool  			}  		}  	} -#endif  	// Check if we need to change implementations  	bool is_flexible = (volume_params.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE); @@ -1012,7 +1013,6 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms, const S32 detail, bool  		if (isSculpted())  		{  			updateSculptTexture(); -#if LL_MESH_ENABLED  			// if it's a mesh  			if ((volume_params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)  			{ @@ -1028,7 +1028,6 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms, const S32 detail, bool  				}  			}  			else // otherwise is sculptie -#endif  			{  				if (mSculptTexture.notNull())  				{ @@ -1355,7 +1354,14 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global)  	LLVector4a min,max; -	BOOL rebuild = mDrawable->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION); +	BOOL rebuild = mDrawable->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED); + +//	bool rigged = false; +	LLVolume* volume = mRiggedVolume; +	if (!volume) +	{ +		volume = getVolume(); +	}  	for (S32 i = 0; i < getVolume()->getNumVolumeFaces(); i++)  	{ @@ -1364,7 +1370,7 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global)  		{  			continue;  		} -		res &= face->genVolumeBBoxes(*getVolume(), i, +		res &= face->genVolumeBBoxes(*volume, i,  										mRelativeXform, mRelativeXformInvTrans,  										(mVolumeImpl && mVolumeImpl->isVolumeGlobal()) || force_global); @@ -1415,7 +1421,21 @@ void LLVOVolume::updateRelativeXform()  	LLDrawable* drawable = mDrawable; -	if (drawable->isActive()) +	if (drawable->isState(LLDrawable::RIGGED) && mRiggedVolume.notNull()) +	{ //rigged volume (which is in agent space) is used for generating bounding boxes etc +	  //inverse of render matrix should go to partition space +		mRelativeXform = getRenderMatrix(); + +		F32* dst = (F32*) mRelativeXformInvTrans.mMatrix; +		F32* src = (F32*) mRelativeXform.mMatrix; +		dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; +		dst[3] = src[4]; dst[4] = src[5]; dst[5] = src[6]; +		dst[6] = src[8]; dst[7] = src[9]; dst[8] = src[10]; +		 +		mRelativeXform.invert(); +		mRelativeXformInvTrans.transpose(); +	} +	else if (drawable->isActive())  	{				  		// setup relative transforms  		LLQuaternion delta_rot; @@ -1497,11 +1517,22 @@ void LLVOVolume::updateRelativeXform()  static LLFastTimer::DeclareTimer FTM_GEN_FLEX("Generate Flexies");  static LLFastTimer::DeclareTimer FTM_UPDATE_PRIMITIVES("Update Primitives"); +static LLFastTimer::DeclareTimer FTM_UPDATE_RIGGED_VOLUME("Update Rigged");  BOOL LLVOVolume::updateGeometry(LLDrawable *drawable)  {  	LLFastTimer t(FTM_UPDATE_PRIMITIVES); +	if (mDrawable->isState(LLDrawable::REBUILD_RIGGED)) +	{ +		{ +			LLFastTimer t(FTM_UPDATE_RIGGED_VOLUME); +			updateRiggedVolume(); +		} +		genBBoxes(FALSE); +		mDrawable->clearState(LLDrawable::REBUILD_RIGGED); +	} +  	if (mVolumeImpl != NULL)  	{  		BOOL res; @@ -1597,7 +1628,7 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable)  	{  		LLPipeline::sCompiles++;  	} -	 +		  	mVolumeChanged = FALSE;  	mLODChanged = FALSE;  	mSculptChanged = FALSE; @@ -2690,7 +2721,6 @@ BOOL LLVOVolume::isSculpted() const  BOOL LLVOVolume::isMesh() const  { -#if LL_MESH_ENABLED  	if (isSculpted())  	{  		LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); @@ -2702,8 +2732,6 @@ BOOL LLVOVolume::isMesh() const  			return TRUE;	  		}  	} -#endif -  	return FALSE;  } @@ -2724,6 +2752,11 @@ BOOL LLVOVolume::isVolumeGlobal() const  	{  		return mVolumeImpl->isVolumeGlobal() ? TRUE : FALSE;  	} +	else if (mRiggedVolume.notNull()) +	{ +		return TRUE; +	} +  	return FALSE;  } @@ -3218,7 +3251,6 @@ F32 LLVOVolume::getBinRadius()  	F32 scale = 1.f; -#if LL_MESH_ENABLED  	if (isSculpted())  	{  		LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); @@ -3240,7 +3272,6 @@ F32 LLVOVolume::getBinRadius()  			scale = 1.f/llmax(vert_count/1024.f, 1.f);  		}  	} -#endif  	const LLVector4a* ext = mDrawable->getSpatialExtents(); @@ -3390,12 +3421,37 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e  	BOOL ret = FALSE;  	LLVolume* volume = getVolume(); + +	bool transform = true; + +	if (mDrawable->isState(LLDrawable::RIGGED)) +	{ +		if (LLFloater::isVisible(gFloaterTools) && getAvatar()->isSelf()) +		{ +			gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_RIGGED, TRUE); +			volume = mRiggedVolume; +			transform = false; +		} +		else +		{ //cannot pick rigged attachments on other avatars or when not in build mode +			return FALSE; +		} +	} +	  	if (volume)  	{	  		LLVector3 v_start, v_end, v_dir; -		v_start = agentPositionToVolume(start); -		v_end = agentPositionToVolume(end); +		if (transform) +		{ +			v_start = agentPositionToVolume(start); +			v_end = agentPositionToVolume(end); +		} +		else +		{ +			v_start = start; +			v_end = end; +		}  		LLVector3 p;  		LLVector3 n; @@ -3455,18 +3511,40 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e  					if (intersection != NULL)  					{ -						*intersection = volumePositionToAgent(p);  // must map back to agent space +						if (transform) +						{ +							*intersection = volumePositionToAgent(p);  // must map back to agent space +						} +						else +						{ +							*intersection = p; +						}  					}  					if (normal != NULL)  					{ -						*normal = volumeDirectionToAgent(n); +						if (transform) +						{ +							*normal = volumeDirectionToAgent(n); +						} +						else +						{ +							*normal = n; +						} +  						(*normal).normVec();  					}  					if (bi_normal != NULL)  					{ -						*bi_normal = volumeDirectionToAgent(bn); +						if (transform) +						{ +							*bi_normal = volumeDirectionToAgent(bn); +						} +						else +						{ +							*bi_normal = bn; +						}  						(*bi_normal).normVec();  					} @@ -3484,6 +3562,201 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e  	return ret;  } +bool LLVOVolume::treatAsRigged() +{ +	return LLFloater::isVisible(gFloaterTools) &&  +			isAttachment() &&  +			getAvatar() && +			getAvatar()->isSelf() && +			mDrawable.notNull() && +			mDrawable->isState(LLDrawable::RIGGED); +} + +LLRiggedVolume* LLVOVolume::getRiggedVolume() +{ +	return mRiggedVolume; +} + +void LLVOVolume::clearRiggedVolume() +{ +	if (mRiggedVolume.notNull()) +	{ +		mRiggedVolume = NULL; +		updateRelativeXform(); +	} +} + +void LLVOVolume::updateRiggedVolume() +{ +	//Update mRiggedVolume to match current animation frame of avatar.  +	//Also update position/size in octree.   + +	if (!treatAsRigged()) +	{ +		clearRiggedVolume(); +		 +		return; +	} + +	LLVolume* volume = getVolume(); + +	const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(volume->getParams().getSculptID()); + +	if (!skin) +	{ +		clearRiggedVolume(); +		return; +	} + +	LLVOAvatar* avatar = getAvatar(); + +	if (!avatar) +	{ +		clearRiggedVolume(); +		return; +	} + +	if (!mRiggedVolume) +	{ +		LLVolumeParams p; +		mRiggedVolume = new LLRiggedVolume(p); +		updateRelativeXform(); +	} + +	mRiggedVolume->update(skin, avatar, volume); + +} + +static LLFastTimer::DeclareTimer FTM_SKIN_RIGGED("Skin"); +static LLFastTimer::DeclareTimer FTM_RIGGED_OCTREE("Octree"); + +void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, const LLVolume* volume) +{ +	bool copy = false; +	if (volume->getNumVolumeFaces() != getNumVolumeFaces()) +	{  +		copy = true; +	} + +	for (S32 i = 0; i < volume->getNumVolumeFaces() && !copy; ++i) +	{ +		const LLVolumeFace& src_face = volume->getVolumeFace(i); +		const LLVolumeFace& dst_face = getVolumeFace(i); + +		if (src_face.mNumIndices != dst_face.mNumIndices || +			src_face.mNumVertices != dst_face.mNumVertices) +		{ +			copy = true; +		} +	} + +	if (copy) +	{ +		copyVolumeFaces(volume);	 +	} + +	//build matrix palette +	LLMatrix4a mp[64]; +	LLMatrix4* mat = (LLMatrix4*) mp; +	 +	for (U32 j = 0; j < skin->mJointNames.size(); ++j) +	{ +		LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); +		if (joint) +		{ +			mat[j] = skin->mInvBindMatrix[j]; +			mat[j] *= joint->getWorldMatrix(); +		} +	} + +	for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) +	{ +		const LLVolumeFace& vol_face = volume->getVolumeFace(i); +		 +		LLVolumeFace& dst_face = mVolumeFaces[i]; +		 +		LLVector4a* weight = vol_face.mWeights; + +		LLMatrix4a bind_shape_matrix; +		bind_shape_matrix.loadu(skin->mBindShapeMatrix); + +		LLVector4a* pos = dst_face.mPositions; + +		{ +			LLFastTimer t(FTM_SKIN_RIGGED); + +			for (U32 j = 0; j < dst_face.mNumVertices; ++j) +			{ +				LLMatrix4a final_mat; +				final_mat.clear(); + +				S32 idx[4]; + +				LLVector4 wght; + +				F32 scale = 0.f; +				for (U32 k = 0; k < 4; k++) +				{ +					F32 w = weight[j][k]; + +					idx[k] = (S32) floorf(w); +					wght[k] = w - floorf(w); +					scale += wght[k]; +				} + +				wght *= 1.f/scale; + +				for (U32 k = 0; k < 4; k++) +				{ +					F32 w = wght[k]; + +					LLMatrix4a src; +					src.setMul(mp[idx[k]], w); + +					final_mat.add(src); +				} + +				 +				LLVector4a& v = vol_face.mPositions[j]; +				LLVector4a t; +				LLVector4a dst; +				bind_shape_matrix.affineTransform(v, t); +				final_mat.affineTransform(t, dst); +				pos[j] = dst; +			} + +			//update bounding box +			LLVector4a& min = dst_face.mExtents[0]; +			LLVector4a& max = dst_face.mExtents[1]; + +			min = pos[0]; +			max = pos[1]; + +			for (U32 j = 1; j < dst_face.mNumVertices; ++j) +			{ +				min.setMin(min, pos[j]); +				max.setMax(max, pos[j]); +			} + +			dst_face.mCenter->setAdd(dst_face.mExtents[0], dst_face.mExtents[1]); +			dst_face.mCenter->mul(0.5f); + +		} + +		{ +			LLFastTimer t(FTM_RIGGED_OCTREE); +			delete dst_face.mOctree; +			dst_face.mOctree = NULL; + +			LLVector4a size; +			size.setSub(dst_face.mExtents[1], dst_face.mExtents[0]); +			size.splat(size.getLength3().getF32()*0.5f); +			 +			dst_face.createOctree(1.f); +		} +	} +} +  U32 LLVOVolume::getPartitionType() const  {  	if (isHUDAttachment()) @@ -3630,7 +3903,6 @@ void LLVolumeGeometryManager::getGeometry(LLSpatialGroup* group)  static LLFastTimer::DeclareTimer FTM_REBUILD_VOLUME_VB("Volume");  static LLFastTimer::DeclareTimer FTM_REBUILD_VBO("VBO Rebuilt"); -#if LL_MESH_ENABLED  static LLDrawPoolAvatar* get_avatar_drawpool(LLViewerObject* vobj)  {  	LLVOAvatar* avatar = vobj->getAvatar(); @@ -3657,7 +3929,6 @@ static LLDrawPoolAvatar* get_avatar_drawpool(LLViewerObject* vobj)  	return NULL;  } -#endif		  void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  { @@ -3724,14 +3995,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  		drawablep->clearState(LLDrawable::HAS_ALPHA); -#if LL_MESH_ENABLED  		bool rigged = vobj->isAttachment() &&   					vobj->isMesh() &&   					gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID()); -#endif  		bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic(); +		bool is_rigged = false; +  		//for each face  		for (S32 i = 0; i < drawablep->getNumFaces(); i++)  		{ @@ -3739,7 +4010,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  			drawablep->updateFaceSize(i);  			LLFace* facep = drawablep->getFace(i); -#if LL_MESH_ENABLED  			if (rigged)   			{  				if (!facep->isState(LLFace::RIGGED)) @@ -3747,8 +4017,9 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  					facep->mVertexBuffer = NULL;  					facep->mLastVertexBuffer = NULL;  				} -				 +		  				facep->setState(LLFace::RIGGED); +				is_rigged = true;  				//get drawpool of avatar with rigged face  				LLDrawPoolAvatar* pool = get_avatar_drawpool(vobj); @@ -3844,7 +4115,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  					facep->clearState(LLFace::RIGGED);  				}  			} -#endif  			if (cur_total > max_total || facep->getIndicesCount() <= 0 || facep->getGeomCount() <= 0)  			{ @@ -3958,6 +4228,15 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  				facep->mLastVertexBuffer = NULL;  			}		  		} + +		if (is_rigged) +		{ +			drawablep->setState(LLDrawable::RIGGED); +		} +		else +		{ +			drawablep->clearState(LLDrawable::RIGGED); +		}  	}  	group->mBufferUsage = useage; diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index eeb98726c9..f058710a27 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -46,6 +46,8 @@ class LLDrawPool;  class LLSelectNode;  class LLObjectMediaDataClient;  class LLObjectMediaNavigateClient; +class LLVOAvatar; +class LLMeshSkinInfo;  typedef std::vector<viewer_media_t> media_list_t; @@ -54,6 +56,18 @@ enum LLVolumeInterfaceType  	INTERFACE_FLEXIBLE = 1,  }; + +class LLRiggedVolume : public LLVolume +{ +public: +	LLRiggedVolume(const LLVolumeParams& params) +		: LLVolume(params, 0.f) +	{ +	} + +	void update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, const LLVolume* src_volume); +}; +  // Base class for implementations of the volume - Primitive, Flexible Object, etc.  class LLVolumeInterface  { @@ -289,6 +303,21 @@ public:  	void removeMDCImpl() { --mMDCImplCount; }  	S32 getMDCImplCount() { return mMDCImplCount; } + +	//rigged volume update (for raycasting) +	void updateRiggedVolume(); +	LLRiggedVolume* getRiggedVolume(); + +	//returns true if volume should be treated as a rigged volume +	// - Build tools are open +	// - object is an attachment +	// - object is attached to self +	// - object is rendered as rigged +	bool treatAsRigged(); + +	//clear out rigged volume and revert back to non-rigged state for picking/LOD/distance updates +	void clearRiggedVolume(); +  protected:  	S32	computeLODDetail(F32	distance, F32 radius);  	BOOL calcLOD(); @@ -322,6 +351,9 @@ private:  	S32			mLastFetchedMediaVersion; // as fetched from the server, starts as -1  	S32 mIndexInTex;  	S32 mMDCImplCount; + +	LLPointer<LLRiggedVolume> mRiggedVolume; +  	// statics  public:  	static F32 sLODSlopDistanceFactor;// Changing this to zero, effectively disables the LOD transition slop  diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8b4feac3cd..9ad1df02b8 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2039,9 +2039,7 @@ void LLPipeline::rebuildPriorityGroups()  	assertInitialized(); -#if LL_MESH_ENABLED  	gMeshRepo.notifyLoadedMeshes(); -#endif  	// Iterate through all drawables on the priority build queue,  	for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin(); @@ -3857,7 +3855,6 @@ void LLPipeline::renderDebug()  		gPipeline.mDebugTextureUploadCost = textures.size() * 10;  		gPipeline.mDebugSculptUploadCost = sculpts.size()*10; -#if LL_MESH_ENABLED  		U32 mesh_cost = 0;  		for (std::set<LLUUID>::iterator iter = meshes.begin(); iter != meshes.end(); ++iter) @@ -3866,7 +3863,6 @@ void LLPipeline::renderDebug()  		}  		gPipeline.mDebugMeshUploadCost = mesh_cost; -#endif  	}  	for (LLCullResult::bridge_list_t::const_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index bed4155d15..cddcfc2132 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -45,7 +45,6 @@  #include "llgl.h"  #include "lldrawable.h"  #include "llrendertarget.h" -#include "llmodel.h" //for LL_MESH_ENaBLED  #include <stack> @@ -67,9 +66,7 @@ class LLVOAvatar;  class LLGLSLShader;  class LLCurlRequest; -#if LL_MESH_ENABLED  class LLMeshResponder; -#endif  typedef enum e_avatar_skinning_method  { @@ -475,9 +472,7 @@ public:  	S32						 mDebugTextureUploadCost;  	S32						 mDebugSculptUploadCost; -#if LL_MESH_ENABLED  	S32						 mDebugMeshUploadCost; -#endif  	S32						 mLightingChanges;  	S32						 mGeometryChanges; diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index bd07c473de..6b2b5d7d7e 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -2163,6 +2163,10 @@ even though the user gets a free copy.                   label="Cylinder"                   name="Cylinder"                   value="Cylinder" /> +              <combo_box.item +                 label="Mesh" +                 name="Mesh" +                 value="Mesh" />              </combo_box>          </panel>          <panel diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 2da5aff8d6..8296c28e80 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -930,6 +930,7 @@ class Linux_i686Manifest(LinuxManifest):              self.path("libexpat.so.1")              self.path("libglod.so")              self.path("libssl.so.0.9.7") +            self.path("libuuid.so.1")              self.path("libSDL-1.2.so.0")              self.path("libELFIO.so")              self.path("libopenjpeg.so.1.3.0", "libopenjpeg.so.1.3") diff --git a/install.xml b/install.xml index cd116a4ae2..f2f4a1b92c 100644 --- a/install.xml +++ b/install.xml @@ -56,16 +56,16 @@            <key>darwin</key>            <map>              <key>md5sum</key> -            <string>ab78835bafcad3bb7223eaeecb5a6a4b</string> +            <string>cc3a93782ac74982eb74aa5dbcd923f0</string>              <key>url</key> -            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/GLOD-1.0pre4-darwin-20090918.tar.bz2</uri> +            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/glod-1.0pre4-darwin-20100922.tar.bz2</uri>            </map>            <key>linux</key>            <map>              <key>md5sum</key> -            <string>cb9409ee84d5f33db14335ed5bfd7ca7</string> +            <string>ca7368e9a1baf266b82d910fa8f821bd</string>              <key>url</key> -            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/glod-1.0pre4-linux-20100910.tar.bz2</uri> +            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/glod-1.0pre4-linux-20100920a.tar.bz2</uri>            </map>            <key>windows</key>            <map> @@ -630,12 +630,12 @@            </map>          </map>        </map> -      <key>google-perftools</key> +      <key>tcmalloc</key>        <map>          <key>copyright</key>          <string>Copyright (c) 2005, Google Inc.</string>          <key>description</key> -        <string>Heap performance and validity checking tools from google. Includes TCMalloc, heap-checker, heap-profiler and cpu-profiler.</string> +        <string>High performance memory allocator.</string>          <key>license</key>          <string>bsd</string>          <key>packages</key> @@ -643,9 +643,9 @@            <key>windows</key>            <map>              <key>md5sum</key> -            <string>32dba32ddd460a08e082898ebba6315c</string> +            <string>8b11a7d3caee8a4ba70da41d6a5ee131</string>              <key>url</key> -            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/google-perftools-1.0-windows-20090406.tar.bz2</uri> +            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/tcmalloc-1.6-windows-20100916b.tar.bz2</uri>            </map>          </map>        </map> @@ -957,6 +957,25 @@ anguage Infrstructure (CLI) international standard</string>            </map>          </map>        </map> +      <key>libuuid</key> +      <map> +        <key>copyright</key> +        <string>Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/></string> +        <key>description</key> +        <string>Generates UUIDs under Linux. Originally a part of the ext2fs filesystem. Also see lluuid.cpp for all platforms. Part of the e2fsprogs package.</string> +        <key>license</key> +        <string>lgpl</string> +        <key>packages</key> +        <map> +          <key>linux</key> +          <map> +            <key>md5sum</key> +            <string>91b194aed4b38bc23493b198009a8c6a</string> +            <key>url</key> +            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/libuuid-linux-20090417.tar.bz2</uri> +          </map> +        </map> +      </map>        <key>libxml</key>        <map>          <key>license</key> @@ -1006,9 +1025,9 @@ anguage Infrstructure (CLI) international standard</string>            <key>darwin</key>            <map>              <key>md5sum</key> -            <string>b9fe5149a23cbc55a341867c2f6abb8e</string> +            <string>a6969a966e83ac3f0dc652df3e499797</string>              <key>url</key> -            <uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/llconvexdecomposition-0.1-darwin-20100626.tar.bz2</uri> +            <uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/llconvexdecomposition-0.1-darwin-20100914.tar.bz2</uri>            </map>                    </map>        </map> | 
