dessie linden avatar dessie linden committed f6c8af1 Merge

Merged from viewer-public

Comments (0)

Files changed (15)

 glob:indra/newview/search_history.txt
 glob:indra/newview/filters.xml
 glob:indra/newview/avatar_icons_cache.txt
+glob:indra/newview/avatar_lad.log

indra/llrender/llrendersphere.cpp

 }
 
 
-// lat = 0 is Z-axis
-// lon = 0, lat = 90 at X-axis
-void lat2xyz(LLVector3 * result, F32 lat, F32 lon)
-{
-	// Convert a latitude and longitude to x,y,z on a normal sphere and return it in result
-	F32 r;
-	result->mV[VX] = (F32) (cos(lon * DEG_TO_RAD) * sin(lat * DEG_TO_RAD));
-	result->mV[VY] = (F32) (sin(lon * DEG_TO_RAD) * sin(lat * DEG_TO_RAD));
-	r = (F32) pow(result->mV[VX] * result->mV[VX] + result->mV[VY] * result->mV[VY], 0.5f);
-	if (r == 1.0f) 
-	{
-		result->mV[VZ] = 0.0f;
-	}
-	else
-	{
-		result->mV[VZ] = (F32) pow(1 - r*r, 0.5f);
-		if (lat > 90.01)
-		{
-			result->mV[VZ] *= -1.0;
-		}
-	}
-}
-
-void lat2xyz_rad(LLVector3 * result, F32 lat, F32 lon)
-{
-	// Convert a latitude and longitude to x,y,z on a normal sphere and return it in result
-	F32 r;
-	result->mV[VX] = (F32) (cos(lon) * sin(lat));
-	result->mV[VY] = (F32) (sin(lon) * sin(lat));
-	r = (F32) pow(result->mV[VX] * result->mV[VX] + result->mV[VY] * result->mV[VY], 0.5f);
-	if (r == 1.0f) 
-		result->mV[VZ] = 0.0f;
-	else
-	{
-		result->mV[VZ] = (F32) pow(1 - r*r, 0.5f);
-		if (lat > F_PI_BY_TWO) result->mV[VZ] *= -1.0;
-	}
-}
-
 // A couple thoughts on sphere drawing:
 // 1) You need more slices than stacks, but little less than 2:1
 // 2) At low LOD, setting stacks to an odd number avoids a "band" around the equator, making things look smoother
 {
 	glCallList(mDList[0]);
 }
+
+inline LLVector3 polar_to_cart(F32 latitude, F32 longitude)
+{
+	return LLVector3(sin(F_TWO_PI * latitude) * cos(F_TWO_PI * longitude),
+					 sin(F_TWO_PI * latitude) * sin(F_TWO_PI * longitude),
+					 cos(F_TWO_PI * latitude));
+}
+
+
+void LLRenderSphere::renderGGL()
+{
+	S32 const LATITUDE_SLICES = 20;
+	S32 const LONGITUDE_SLICES = 30;
+
+	if (mSpherePoints.empty())
+	{
+		mSpherePoints.resize(LATITUDE_SLICES + 1);
+		for (S32 lat_i = 0; lat_i < LATITUDE_SLICES + 1; lat_i++)
+		{
+			mSpherePoints[lat_i].resize(LONGITUDE_SLICES + 1);
+			for (S32 lon_i = 0; lon_i < LONGITUDE_SLICES + 1; lon_i++)
+			{
+				F32 lat = (F32)lat_i / LATITUDE_SLICES;
+				F32 lon = (F32)lon_i / LONGITUDE_SLICES;
+
+				mSpherePoints[lat_i][lon_i] = polar_to_cart(lat, lon);
+			}
+		}
+	}
+	
+	gGL.begin(LLRender::TRIANGLES);
+
+	for (S32 lat_i = 0; lat_i < LATITUDE_SLICES; lat_i++)
+	{
+		for (S32 lon_i = 0; lon_i < LONGITUDE_SLICES; lon_i++)
+		{
+			gGL.vertex3fv(mSpherePoints[lat_i][lon_i].mV);
+			gGL.vertex3fv(mSpherePoints[lat_i][lon_i+1].mV);
+			gGL.vertex3fv(mSpherePoints[lat_i+1][lon_i].mV);
+
+			gGL.vertex3fv(mSpherePoints[lat_i+1][lon_i].mV);
+			gGL.vertex3fv(mSpherePoints[lat_i][lon_i+1].mV);
+			gGL.vertex3fv(mSpherePoints[lat_i+1][lon_i+1].mV);
+		}
+	}
+	gGL.end();
+}

indra/llrender/llrendersphere.h

 	void cleanupGL();
 	void render(F32 pixel_area);		// of a box of size 1.0 at that position
 	void render();						// render at highest LOD
+	void renderGGL();                   // render using LLRender
+
+private:
+	std::vector< std::vector<LLVector3> > mSpherePoints;
 };
 
 extern LLRenderSphere gSphere;

indra/llui/llfloater.cpp

 		addChild(mDragHandle);
 	}
 	layoutDragHandle();
+	applyTitle();
 }
 
 void LLFloater::layoutDragHandle()
 	}
 	mDragHandle->setRect(rect);
 	updateTitleButtons();
-	applyTitle();
 }
 
 void LLFloater::addResizeCtrls()
 
 void LLFloaterView::syncFloaterTabOrder()
 {
-	// look for a visible modal dialog, starting from first (should be only one)
+	// look for a visible modal dialog, starting from first
 	LLModalDialog* modal_dialog = NULL;
 	for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
 	{

indra/llui/llscrolllistctrl.cpp

 //virtual 
 void LLScrollListCtrl::setFocus(BOOL b)
 {
-	mSearchString.clear();
 	// for tabbing into pristine scroll lists (Finder)
 	if (!getFirstSelected())
 	{
 	{
 		gFocusMgr.setMouseCapture(NULL);
 	}
+
+	mSearchString.clear();
+
 	LLUICtrl::onFocusLost();
 }
 

indra/llui/lltextbase.cpp

 {
 	if (width != getRect().getWidth() || height != getRect().getHeight())
 	{
-		//EXT-4288
-		//to keep consistance scrolling behaviour 
-		//when scrolling from top and from bottom...
-		bool is_scrolled_to_end = (mScroller!=NULL) && scrolledToEnd();
-		
+		bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false;
+
 		LLUICtrl::reshape( width, height, called_from_parent );
-	
-		if (is_scrolled_to_end)
+
+		if (mScroller && scrolled_to_bottom && mTrackEnd)
 		{
-			deselect();
-			endOfDoc();
-		}		
+			// keep bottom of text buffer visible
+			// do this here as well as in reflow to handle case
+			// where shrinking from top, which causes buffer to temporarily 
+			// not be scrolled to the bottom, since the scroll index
+			// specified the _top_ of the visible document region
+			mScroller->goToBottom();
+		}
 
 		// do this first after reshape, because other things depend on
 		// up-to-date mVisibleTextRect
 
 	updateSegments();
 
+	if (mReflowIndex == S32_MAX)
+	{
+		return;
+	}
+
+	bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false;
+
+	LLRect cursor_rect = getLocalRectFromDocIndex(mCursorPos);
+	bool follow_selection = getLocalRect().overlaps(cursor_rect); // cursor is (potentially) visible
+
+	// store in top-left relative coordinates to avoid issues with horizontal scrollbar appearing and disappearing
+	cursor_rect.mTop = mVisibleTextRect.mTop - cursor_rect.mTop;
+	cursor_rect.mBottom = mVisibleTextRect.mTop - cursor_rect.mBottom;
+
+	S32 first_line = getFirstVisibleLine();
+
+	// if scroll anchor not on first line, update it to first character of first line
+	if (!mLineInfoList.empty()
+		&&	(mScrollIndex <  mLineInfoList[first_line].mDocIndexStart
+			||	mScrollIndex >= mLineInfoList[first_line].mDocIndexEnd))
+	{
+		mScrollIndex = mLineInfoList[first_line].mDocIndexStart;
+	}
+	LLRect first_char_rect = getLocalRectFromDocIndex(mScrollIndex);
+	// store in top-left relative coordinates to avoid issues with horizontal scrollbar appearing and disappearing
+	first_char_rect.mTop = mVisibleTextRect.mTop - first_char_rect.mTop;
+	first_char_rect.mBottom = mVisibleTextRect.mTop - first_char_rect.mBottom;
+
 	S32 reflow_count = 0;
 	while(mReflowIndex < S32_MAX)
 	{
 			lldebugs << "Breaking out of reflow due to possible infinite loop in " << getName() << llendl;
 			break;
 		}
+	
 		S32 start_index = mReflowIndex;
 		mReflowIndex = S32_MAX;
 
 		// to force inlined widgets with follows set to shrink
 		mDocumentView->reshape(mVisibleTextRect.getWidth(), mDocumentView->getRect().getHeight());
 
-		bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false;
-
-		LLRect old_cursor_rect = getLocalRectFromDocIndex(mCursorPos);
-		bool follow_selection = mVisibleTextRect.overlaps(old_cursor_rect); // cursor is visible
-		old_cursor_rect.translate(-mVisibleTextRect.mLeft, -mVisibleTextRect.mBottom);
-
-		S32 first_line = getFirstVisibleLine();
-
-		// if scroll anchor not on first line, update it to first character of first line
-		if (!mLineInfoList.empty()
-			&&	(mScrollIndex <  mLineInfoList[first_line].mDocIndexStart
-				||	mScrollIndex >= mLineInfoList[first_line].mDocIndexEnd))
-		{
-			mScrollIndex = mLineInfoList[first_line].mDocIndexStart;
-		}
-		LLRect first_char_rect = getLocalRectFromDocIndex(mScrollIndex);
-		// subtract off effect of horizontal scrollbar from local position of first char
-		first_char_rect.translate(-mVisibleTextRect.mLeft, -mVisibleTextRect.mBottom);
-
 		S32 cur_top = 0;
 
 		segment_set_t::iterator seg_iter = mSegments.begin();
 			segmentp->updateLayout(*this);
 
 		}
-
-		// apply scroll constraints after reflowing text
-		if (!hasMouseCapture() && mScroller)
+	}
+
+	// apply scroll constraints after reflowing text
+	if (!hasMouseCapture() && mScroller)
+	{
+		if (scrolled_to_bottom && mTrackEnd)
 		{
-			if (scrolled_to_bottom && mTrackEnd)
-			{
-				// keep bottom of text buffer visible
-				endOfDoc();
-			}
-			else if (hasSelection() && follow_selection)
-			{
-				// keep cursor in same vertical position on screen when selecting text
-				LLRect new_cursor_rect_doc = getDocRectFromDocIndex(mCursorPos);
-				mScroller->scrollToShowRect(new_cursor_rect_doc, old_cursor_rect);
-			}
-			else
-			{
-				// keep first line of text visible
-				LLRect new_first_char_rect = getDocRectFromDocIndex(mScrollIndex);
-				mScroller->scrollToShowRect(new_first_char_rect, first_char_rect);
-			}
+			// keep bottom of text buffer visible
+			endOfDoc();
 		}
-
-		// reset desired x cursor position
-		updateCursorXPos();
+		else if (hasSelection() && follow_selection)
+		{
+			// keep cursor in same vertical position on screen when selecting text
+			LLRect new_cursor_rect_doc = getDocRectFromDocIndex(mCursorPos);
+			LLRect old_cursor_rect = cursor_rect;
+			old_cursor_rect.mTop = mVisibleTextRect.mTop - cursor_rect.mTop;
+			old_cursor_rect.mBottom = mVisibleTextRect.mTop - cursor_rect.mBottom;
+
+			mScroller->scrollToShowRect(new_cursor_rect_doc, old_cursor_rect);
+		}
+		else
+		{
+			// keep first line of text visible
+			LLRect new_first_char_rect = getDocRectFromDocIndex(mScrollIndex);
+
+			// pass in desired rect in the coordinate frame of the document viewport
+			LLRect old_first_char_rect = first_char_rect;
+			old_first_char_rect.mTop = mVisibleTextRect.mTop - first_char_rect.mTop;
+			old_first_char_rect.mBottom = mVisibleTextRect.mTop - first_char_rect.mBottom;
+
+			mScroller->scrollToShowRect(new_first_char_rect, old_first_char_rect);
+		}
 	}
+
+	// reset desired x cursor position
+	updateCursorXPos();
 }
 
 LLRect LLTextBase::getTextBoundingRect()
 			pos = segment_line_start;
 			break;
 		}
-		if (local_x < start_x + text_width			// cursor to left of right edge of text
+		if (local_x < start_x + text_width						// cursor to left of right edge of text
 			|| newline)								// or this line ends with a newline, set doc pos to newline char
 		{
 			// Figure out which character we're nearest to.
 
 LLRect LLTextBase::getLocalRectFromDocIndex(S32 pos) const
 {
+	LLRect content_window_rect = mScroller ? mScroller->getContentWindowRect() : getLocalRect();
+	if (mBorderVisible)
+	{
+		content_window_rect.stretch(-1);
+	}
+
 	LLRect local_rect;
+
 	if (mLineInfoList.empty()) 
 	{ 
 		// return default height rect in upper left
-		local_rect = mVisibleTextRect;
+		local_rect = content_window_rect;
 		local_rect.mBottom = local_rect.mTop - (S32)(mDefaultFont->getLineHeight());
 		return local_rect;
 	}
 	// compensate for scrolled, inset view of doc
 	LLRect scrolled_view_rect = getVisibleDocumentRect();
 	local_rect = doc_rect;
-	local_rect.translate(mVisibleTextRect.mLeft - scrolled_view_rect.mLeft, 
-						mVisibleTextRect.mBottom - scrolled_view_rect.mBottom);
+	local_rect.translate(content_window_rect.mLeft - scrolled_view_rect.mLeft, 
+						content_window_rect.mBottom - scrolled_view_rect.mBottom);
 
 	return local_rect;
 }

indra/newview/featuretable.txt

 RenderAnisotropic			1	0
 RenderAvatarCloth			1	1
 RenderAvatarLODFactor		1	1.0
+RenderAvatarMaxVisible      1   35
 RenderAvatarVP				1	1
 RenderCubeMap				1	1
 RenderDelayVBUpdate			1	0

indra/newview/featuretable_linux.txt

 RenderAnisotropic			1	0
 RenderAvatarCloth			1	1
 RenderAvatarLODFactor		1	1.0
+RenderAvatarMaxVisible      1   35
 RenderAvatarVP				1	1
 RenderCubeMap				1	1
 RenderDelayVBUpdate			1	0

indra/newview/featuretable_mac.txt

 RenderAnisotropic				1	0
 RenderAvatarCloth				0	0
 RenderAvatarLODFactor			1	1.0
+RenderAvatarMaxVisible          1   35
 RenderAvatarVP					1	0
 RenderCubeMap					1	1
 RenderDelayVBUpdate				1	0

indra/newview/llchathistory.cpp

 
 	LLUICtrl::draw();
 }
-
-void LLChatHistory::reshape(S32 width, S32 height, BOOL called_from_parent)
-{
-	bool is_scrolled_to_end = mEditor->scrolledToEnd();
-	LLUICtrl::reshape( width, height, called_from_parent );
-	// update scroll
-	if (is_scrolled_to_end)
-		mEditor->setCursorAndScrollToEnd();
-}

indra/newview/llchathistory.h

 		 */
 		void appendMessage(const LLChat& chat, const LLSD &args = LLSD(), const LLStyle::Params& input_append_params = LLStyle::Params());
 		/*virtual*/ void clear();
-		/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 
 	private:
 		std::string mLastFromName;

indra/newview/lldrawpoolavatar.cpp

 
 	if (!single_avatar && !avatarp->isFullyLoaded() )
 	{
-		if (pass==1 && (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) || LLViewerPartSim::getMaxPartCount() <= 0))
+		if (pass==0 && (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) || LLViewerPartSim::getMaxPartCount() <= 0))
 		{
 			// debug code to draw a sphere in place of avatar
 			gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
 			gGL.translatef((F32)(pos.mV[VX]),	 
 						   (F32)(pos.mV[VY]),	 
 							(F32)(pos.mV[VZ]));	 
-			 gGL.scalef(0.15f, 0.15f, 0.3f);	 
-			 gSphere.render();	 
+			 gGL.scalef(0.15f, 0.15f, 0.3f);
+
+			 gSphere.renderGGL();
+				 
 			 gGL.popMatrix();
 			 gGL.setColorMask(true, false);
 		}

indra/newview/lltexlayer.cpp

 	mNeedsUpdate(TRUE),
 	mNeedsUpload(FALSE),
 	mUploadPending(FALSE), // Not used for any logic here, just to sync sending of updates
-	mNeedsLowResUpload(TRUE),
+	mDebugNumLowresUploads(0),
 	mTexLayerSet(owner)
 {
 	LLTexLayerSetBuffer::sGLByteCount += getSize();
 	// If we requested a new upload but haven't even uploaded
 	// a low res version of our last upload request, then
 	// keep the timer ticking instead of resetting it.
-	if (mNeedsUpload && mNeedsLowResUpload)
+	if (mNeedsUpload && (mDebugNumLowresUploads == 0))
 	{
 		mNeedsUploadTimer.reset();
 	}
 	mNeedsUpload = TRUE;
-	mNeedsLowResUpload = TRUE;
+	mDebugNumLowresUploads = 0;
 	mUploadPending = TRUE;
 	mNeedsUploadTimer.unpause();
 }
 		// If we hit our timeout and have textures available at even lower resolution, then upload.
 		const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout;
 		const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable();
-		if (has_lower_lod && is_upload_textures_timeout && mNeedsLowResUpload) return TRUE; 
+		if (has_lower_lod && is_upload_textures_timeout) return TRUE; 
 	}
 	return FALSE;
 }
 		
 				if (highest_lod)
 				{
+					// Got the final LOD for the baked texture.
+					// All done, pause the upload timer so we know how long it took.
 					mNeedsUpload = FALSE;
 					mNeedsUploadTimer.pause();
 				}
 				else
 				{
-					mNeedsLowResUpload = FALSE;
+					// Got a lower level LOD for the baked texture.
+					// Restart the upload timer.
+					mDebugNumLowresUploads++;
+					mNeedsUploadTimer.unpause();
+					mNeedsUploadTimer.reset();
 				}
 			}
 			else
 	if (!isAgentAvatarValid()) return "";
 
 	const BOOL is_high_res = !mNeedsUpload;
-	const BOOL is_low_res = !mNeedsLowResUpload;
+	const U32 num_low_res = mDebugNumLowresUploads;
 	const U32 upload_time = (U32)mNeedsUploadTimer.getElapsedTimeF32();
 	const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(mTexLayerSet);
 	std::string text = llformat("[ HiRes:%d LoRes:%d Timer:%d ] %s",
-								is_high_res, is_low_res, upload_time, 
+								is_high_res, num_low_res, upload_time, 
 								local_texture_info.c_str());
 	return text;
 }

indra/newview/lltexlayer.h

 
 	BOOL					mNeedsUpdate; // Whether we need to update our baked textures
 	BOOL					mNeedsUpload; // Whether we need to send our baked textures to the server
-	BOOL					mNeedsLowResUpload; // Whether we have sent a lowres version of our baked textures to the server
+	U32						mDebugNumLowresUploads; // Number of times we've sent a lowres version of our baked textures to the server
 	BOOL					mUploadPending; // Whether we have received back the new baked textures
 	LLUUID					mUploadID; // Identifies the current upload process (null if none).  Used to avoid overlaps (eg, when the user rapidly makes two changes outside of Face Edit)
 

indra/newview/lltoast.cpp

 		{
 			mTimer->start();
 		}
-		LLModalDialog::setFrontmost(FALSE);
+		if (!getVisible())
+		{
+			LLModalDialog::setFrontmost(FALSE);
+		}
 	}
 	else
 	{
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.