// static
void LLUrlEntryParcel::processParcelInfo(const LLParcelData& parcel_data)
{
	std::string label(LLStringUtil::null);
	if (!parcel_data.name.empty())
	{
		label = parcel_data.name;
	}
	// If parcel name is empty use Sim_name (x, y, z) for parcel label.
	else if (!parcel_data.sim_name.empty())
	{
		S32 region_x = ll_round(parcel_data.global_x) % REGION_WIDTH_UNITS;
		S32 region_y = ll_round(parcel_data.global_y) % REGION_WIDTH_UNITS;
		S32 region_z = ll_round(parcel_data.global_z);

		label = llformat("%s (%d, %d, %d)",
				parcel_data.sim_name.c_str(), region_x, region_y, region_z);
	}

	for (std::set<LLUrlEntryParcel*>::iterator iter = sParcelInfoObservers.begin();
			iter != sParcelInfoObservers.end();
			++iter)
	{
		LLUrlEntryParcel* url_entry = *iter;
		if (url_entry)
		{
			url_entry->onParcelInfoReceived(parcel_data.parcel_id.asString(), label);
		}
	}
}
std::string LLSLURL::getLoginString() const
{

	std::stringstream unescaped_start;
	switch(mType)
	{
	case LOCATION:
		unescaped_start << "uri:"
		                << mRegion << "&"
		                << ll_round(mPosition[VX]) << "&"
		                << ll_round(mPosition[VY]) << "&"
		                << ll_round(mPosition[VZ]);
		break;
	case HOME_LOCATION:
		unescaped_start << "home";
		break;
	case LAST_LOCATION:
		unescaped_start << "last";
		break;
	default:
		LL_WARNS("AppInit") << "Unexpected SLURL type for login string" << (int)mType << LL_ENDL;
		break;
	}
	return  xml_escape_string(unescaped_start.str());
}
Beispiel #3
0
void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, 
							BOOL draw_arrow )
{
	LLVector3 pos_local = globalPosToView(pos_global);
	if( (pos_local.mV[VX] < 0) ||
		(pos_local.mV[VY] < 0) ||
		(pos_local.mV[VX] >= getRect().getWidth()) ||
		(pos_local.mV[VY] >= getRect().getHeight()) )
	{
		if (draw_arrow)
		{
			S32 x = ll_round( pos_local.mV[VX] );
			S32 y = ll_round( pos_local.mV[VY] );
			LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10 );
			LLWorldMapView::drawTrackingArrow( getRect(), x, y, color );
		}
	}
	else
	{
		LLWorldMapView::drawTrackingDot(pos_local.mV[VX], 
										pos_local.mV[VY], 
										color,
										pos_local.mV[VZ]);
	}
}
Beispiel #4
0
bool LLVolumeMessage::packProfileParams(
	const LLProfileParams* params,
	LLMessageSystem *mesgsys)
{
	// Default to cylinder
	static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U16(0), U16(0), U16(0));
	
	if (!params)
		params = &defaultparams;
	
	U8 tempU8;
	U16 tempU16;
	
	tempU8 = params->getCurveType();
	mesgsys->addU8Fast(_PREHASH_ProfileCurve, tempU8);

	tempU16 = (U16) ll_round( params->getBegin() / CUT_QUANTA);
	mesgsys->addU16Fast(_PREHASH_ProfileBegin, tempU16);

	tempU16 = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA);
	mesgsys->addU16Fast(_PREHASH_ProfileEnd, tempU16);

	tempU16 = (U16) ll_round(params->getHollow() / HOLLOW_QUANTA);
	mesgsys->addU16Fast(_PREHASH_ProfileHollow, tempU16);

	return true;
}
Beispiel #5
0
bool LLVolumeMessage::packProfileParams(
	const LLProfileParams* params,
	LLDataPacker &dp)
{
	// Default to cylinder
	static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U16(0), U16(0), U16(0));
	
	if (!params)
		params = &defaultparams;
	
	U8 tempU8;
	U16 tempU16;
	
	tempU8 = params->getCurveType();
	dp.packU8(tempU8, "Curve");

	tempU16 = (U16) ll_round( params->getBegin() / CUT_QUANTA);
	dp.packU16(tempU16, "Begin");

	tempU16 = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA);
	dp.packU16(tempU16, "End");

	tempU16 = (U16) ll_round(params->getHollow() / HOLLOW_QUANTA);
	dp.packU16(tempU16, "Hollow");
	return true;
}
// static
std::string LLPanelClassifiedInfo::createLocationText(
	const std::string& original_name, 
	const std::string& sim_name, 
	const LLVector3d& pos_global)
{
	std::string location_text;
	
	location_text.append(original_name);

	if (!sim_name.empty())
	{
		if (!location_text.empty()) 
			location_text.append(", ");
		location_text.append(sim_name);
	}

	if (!location_text.empty()) 
		location_text.append(" ");

	if (!pos_global.isNull())
	{
		S32 region_x = ll_round((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS;
		S32 region_y = ll_round((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;
		S32 region_z = ll_round((F32)pos_global.mdV[VZ]);
		location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z));
	}

	return location_text;
}
std::string LLSLURL::getLocationString() const
{
	return llformat("%s/%d/%d/%d",
	                mRegion.c_str(),
	                (S32)ll_round(mPosition[VX]),
	                (S32)ll_round(mPosition[VY]),
	                (S32)ll_round(mPosition[VZ]));
}
//static 
void LLUI::setMousePositionScreen(S32 x, S32 y)
{
	S32 screen_x, screen_y;
	screen_x = ll_round((F32)x * getScaleFactor().mV[VX]);
	screen_y = ll_round((F32)y * getScaleFactor().mV[VY]);
	
	LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert());
}
//static 
void LLUI::getMousePositionScreen(S32 *x, S32 *y)
{
	LLCoordWindow cursor_pos_window;
	getWindow()->getCursorPosition(&cursor_pos_window);
	LLCoordGL cursor_pos_gl(cursor_pos_window.convert());
	*x = ll_round((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]);
	*y = ll_round((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]);
}
void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height)
{
	overlay_width = mImageOverlay->getWidth();
	overlay_height = mImageOverlay->getHeight();

	F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f);
	overlay_width = ll_round((F32)overlay_width * scale_factor);
	overlay_height = ll_round((F32)overlay_height * scale_factor);
}
LLMediaCtrl::LLMediaCtrl( const Params& p) :
	LLPanel( p.name, p.rect, FALSE),
	LLInstanceTracker<LLMediaCtrl, LLUUID>(LLUUID::generateNewID()),
	mTextureDepthBytes( 4 ),
	mBorder(NULL),
	mFrequentUpdates( true ),
	mForceUpdate( false ),
	mHomePageUrl( "" ),
	mAlwaysRefresh( false ),
	mMediaSource( 0 ),
	mTakeFocusOnClick( p.focus_on_click ),
	mCurrentNavUrl( "about:blank" ),
	mStretchToFill( true ),
	mMaintainAspectRatio ( true ),
	mDecoupleTextureSize ( false ),
	mTextureWidth ( 1024 ),
	mTextureHeight ( 1024 ),
	mClearCache(false),
	mHomePageMimeType(p.initial_mime_type),
	mErrorPageURL(p.error_page_url),
	mTrusted(p.trusted_content),
	mHoverTextChanged(false),
	mContextMenu()
{
	{
		LLColor4 color = p.caret_color().get();
		setCaretColor( (unsigned int)color.mV[0], (unsigned int)color.mV[1], (unsigned int)color.mV[2] );
	}

	setHomePageUrl(p.start_url, p.initial_mime_type);
	
	setBorderVisible(p.border_visible);
	
	setDecoupleTextureSize(p.decouple_texture_size);
	
	setTextureSize(p.texture_width, p.texture_height);

	if(!getDecoupleTextureSize())
	{
		S32 screen_width = ll_round((F32)getRect().getWidth() * LLUI::getScaleFactor().mV[VX]);
		S32 screen_height = ll_round((F32)getRect().getHeight() * LLUI::getScaleFactor().mV[VY]);
			
		setTextureSize(screen_width, screen_height);
	}
	
	mMediaTextureID = getKey();
	
	// We don't need to create the media source up front anymore unless we have a non-empty home URL to navigate to.
	/*if(!mHomePageUrl.empty())
	{
		navigateHome();
	}*/
		

	//LLRect border_rect( 0, getRect().getHeight() + 2, getRect().getWidth() + 2, 0 );
}
void render_ui_2d()
{
	LLGLSUIDefault gls_ui;

	/////////////////////////////////////////////////////////////
	//
	// Render 2D UI elements that overlay the world (no z compare)

	//  Disable wireframe mode below here, as this is HUD/menus
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

	//  Menu overlays, HUD, etc
	gViewerWindow->setup2DRender();

	F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor();
	S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion();

	if (zoom_factor > 1.f)
	{
		//decompose subregion number to x and y values
		int pos_y = sub_region / llceil(zoom_factor);
		int pos_x = sub_region - (pos_y*llceil(zoom_factor));
		// offset for this tile
		LLFontGL::sCurOrigin.mX -= ll_round((F32)gViewerWindow->getWindowWidthScaled() * (F32)pos_x / zoom_factor);
		LLFontGL::sCurOrigin.mY -= ll_round((F32)gViewerWindow->getWindowHeightScaled() * (F32)pos_y / zoom_factor);
	}

	stop_glerror();
	//gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);

	// render outline for HUD
	if (isAgentAvatarValid() && gAgentCamera.mHUDCurZoom < 0.98f)
	{
		gGL.pushMatrix();
		S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2);
		S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2);
		gGL.scalef(LLUI::getScaleFactor().mV[0], LLUI::getScaleFactor().mV[1], 1.f);
		gGL.translatef((F32)half_width, (F32)half_height, 0.f);
		F32 zoom = gAgentCamera.mHUDCurZoom;
		gGL.scalef(zoom,zoom,1.f);
		gGL.color4fv(LLColor4::white.mV);
		gl_rect_2d(-half_width, half_height, half_width, -half_height, FALSE);
		gGL.popMatrix();
		stop_glerror();
	}
	if(gDebugGL)check_blend_funcs();
	gViewerWindow->draw();
	if(gDebugGL)check_blend_funcs();

	// reset current origin for font rendering, in case of tiling render
	LLFontGL::sCurOrigin.set(0, 0);
}
// create a slurl from a global position
LLSLURL::LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position, bool hyper)
: mHypergrid(hyper)
{
// <FS:CR> Aurora-sim var region teleports
	//*this = LLSLURL(grid,
	//	  region, LLVector3(global_position.mdV[VX],
	//			    global_position.mdV[VY],
	//			    global_position.mdV[VZ]));
	S32 x = ll_round( (F32)fmod( (F32)global_position.mdV[VX], (F32)REGION_WIDTH_METERS ) );
	S32 y = ll_round( (F32)fmod( (F32)global_position.mdV[VY], (F32)REGION_WIDTH_METERS ) );
	S32 z = ll_round( (F32)global_position.mdV[VZ] );

	*this = LLSLURL(grid, region, LLVector3(x, y, z));
// </FS:CR>
}
std::string LLSLURL::getSLURLString() const
{
	switch(mType)
	{
	case HOME_LOCATION:
		return SIM_LOCATION_HOME;
	case LAST_LOCATION:
		return SIM_LOCATION_LAST;
	case LOCATION:
	{
		// lookup the grid
		S32 x = ll_round( (F32)mPosition[VX] );
		S32 y = ll_round( (F32)mPosition[VY] );
		S32 z = ll_round( (F32)mPosition[VZ] );
		std::string ret = LLGridManager::getInstance()->getSLURLBase(mGrid);
// 				ret.append(LLURI::escape(mRegion));
// 				ret.append(llformat("/%d/%d/%d",x,y,z));
// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.0d) | Added: RLVa-1.2.0d
		ret.append( ( ((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) || (!RlvUtil::isNearbyRegion(mRegion)))
					 ? (LLURI::escape(mRegion) + llformat("/%d/%d/%d",x,y,z))
					 : RlvStrings::getString(RLV_STRING_HIDDEN_REGION) ));
// [/RLVa:KB]
		LL_DEBUGS("SLURL") << "Location: " << ret << LL_ENDL;
		return ret;

	}

	case APP:
	{
		std::ostringstream app_url;
		app_url << LLGridManager::getInstance()->getAppSLURLBase() << "/" << mAppCmd;
		for(LLSD::array_const_iterator i = mAppPath.beginArray();
		        i != mAppPath.endArray();
		        i++)
		{
			app_url << "/" << i->asString();
		}
		if(mAppQuery.length() > 0)
		{
			app_url << "?" << mAppQuery;
		}
		return app_url.str();
	}
	default:
		LL_WARNS("AppInit") << "Unexpected SLURL type for SLURL string" << (int)mType << LL_ENDL;
		return std::string();
	}
}
Beispiel #15
0
S32	LLFontGL::firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_len, S32 start_pos, S32 max_chars) const
{
	if (!wchars || !wchars[0] || max_chars == 0)
	{
		return 0;
	}
	
	F32 total_width = 0.0;
	S32 drawable_chars = 0;

	F32 scaled_max_pixels =	max_pixels * sScaleX;

	S32 start = llmin(start_pos, text_len - 1);
	for (S32 i = start; i >= 0; i--)
	{
		llwchar wch = wchars[i];

		const LLFontGlyphInfo* fgi= mFontFreetype->getGlyphInfo(wch);

		// last character uses character width, since the whole character needs to be visible
		// other characters just use advance
		F32 width = (i == start) 
			? (F32)(fgi->mWidth + fgi->mXBearing)  	// use actual width for last character
			: fgi->mXAdvance;						// use advance for all other characters										

		if( scaled_max_pixels < (total_width + width) )
		{
			break;
		}

		total_width += width;
		drawable_chars++;

		if( max_chars >= 0 && drawable_chars >= max_chars )
		{
			break;
		}

		if ( i > 0 )
		{
			// kerning
			total_width += mFontFreetype->getXKerning(wchars[i-1], wch);
		}

		// Round after kerning.
		total_width = ll_round(total_width);
	}

	if (drawable_chars == 0)
	{
		return start_pos; // just draw last character
	}
	else
	{
		// if only 1 character is drawable, we want to return start_pos as the first character to draw
		// if 2 are drawable, return start_pos and character before start_pos, etc.
		return start_pos + 1 - drawable_chars;
	}
	
}
Beispiel #16
0
void LLNetMap::createObjectImage()
{
	// Find the size of the side of a square that surrounds the circle that surrounds getRect().
	// ... which is, the diagonal of the rect.
	F32 width = (F32)getRect().getWidth();
	F32 height = (F32)getRect().getHeight();
	S32 square_size = ll_round( sqrt(width*width + height*height) );

	// Find the least power of two >= the minimum size.
	const S32 MIN_SIZE = 64;
	const S32 MAX_SIZE = 256;
	S32 img_size = MIN_SIZE;
	while( (img_size*2 < square_size ) && (img_size < MAX_SIZE) )
	{
		img_size <<= 1;
	}

	if( mObjectImagep.isNull() ||
		(mObjectImagep->getWidth() != img_size) ||
		(mObjectImagep->getHeight() != img_size) )
	{
		mObjectRawImagep = new LLImageRaw(img_size, img_size, 4);
		U8* data = mObjectRawImagep->getData();
		memset( data, 0, img_size * img_size * 4 );
		mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), FALSE);
	}
	setScale(mScale);
	mUpdateNow = true;
}
S32 LLLayoutPanel::getVisibleDim() const
{
	F32 min_dim = getRelevantMinDim();
	return ll_round(mVisibleAmt
					* (min_dim
						+ (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt))));
}
void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent )
{
	if(!getDecoupleTextureSize())
	{
		S32 screen_width = ll_round((F32)width * LLUI::getScaleFactor().mV[VX]);
		S32 screen_height = ll_round((F32)height * LLUI::getScaleFactor().mV[VY]);

		// when floater is minimized, these sizes are negative
		if ( screen_height > 0 && screen_width > 0 )
		{
			setTextureSize(screen_width, screen_height);
		}
	}
	
	LLUICtrl::reshape( width, height, called_from_parent );
}
Beispiel #19
0
void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius_meters )
{
	LLVector3 local_pos;
	local_pos.setVec( pos - mObjectImageCenterGlobal );

	S32 diameter_pixels = ll_round(2 * radius_meters * mObjectMapTPM);
	renderPoint( local_pos, color, diameter_pixels );
}
LLRect get_whole_screen_region()
{
	LLRect whole_screen = gViewerWindow->getWorldViewRectScaled();
	
	// apply camera zoom transform (for high res screenshots)
	F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor();
	S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion();
	if (zoom_factor > 1.f)
	{
		S32 num_horizontal_tiles = llceil(zoom_factor);
		S32 tile_width = ll_round((F32)gViewerWindow->getWorldViewWidthScaled() / zoom_factor);
		S32 tile_height = ll_round((F32)gViewerWindow->getWorldViewHeightScaled() / zoom_factor);
		int tile_y = sub_region / num_horizontal_tiles;
		int tile_x = sub_region - (tile_y * num_horizontal_tiles);
			
		whole_screen.setLeftTopAndSize(tile_x * tile_width, gViewerWindow->getWorldViewHeightScaled() - (tile_y * tile_height), tile_width, tile_height);
	}
	return whole_screen;
}
// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare
BOOL LLFacebookPhotoPanel::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value)
{
	S32 w = width ;
	S32 h = height ;

	if(previewp && previewp->mKeepAspectRatio)
	{
		if(gViewerWindow->getWindowWidthRaw() < 1 || gViewerWindow->getWindowHeightRaw() < 1)
		{
			return FALSE ;
		}

		//aspect ratio of the current window
		F32 aspect_ratio = (F32)gViewerWindow->getWindowWidthRaw() / gViewerWindow->getWindowHeightRaw() ;

		//change another value proportionally
		if(isWidthChanged)
		{
			height = ll_round(width / aspect_ratio) ;
		}
		else
		{
			width = ll_round(height * aspect_ratio) ;
		}

		//bound w/h by the max_value
		if(width > max_value || height > max_value)
		{
			if(width > height)
			{
				width = max_value ;
				height = (S32)(width / aspect_ratio) ;
			}
			else
			{
				height = max_value ;
				width = (S32)(height * aspect_ratio) ;
			}
		}
	}

	return (w != width || h != height) ;
}
void LLMediaCtrl::convertInputCoords(S32& x, S32& y)
{
	bool coords_opengl = false;
	
	if(mMediaSource && mMediaSource->hasMedia())
	{
		coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL();
	}
	
	x = ll_round((F32)x * LLUI::getScaleFactor().mV[VX]);
	if ( ! coords_opengl )
	{
		y = ll_round((F32)(y) * LLUI::getScaleFactor().mV[VY]);
	}
	else
	{
		y = ll_round((F32)(getRect().getHeight() - y) * LLUI::getScaleFactor().mV[VY]);
	};
}
Beispiel #23
0
F32 LLFontGL::getWidthF32(const llwchar* wchars, S32 begin_offset, S32 max_chars) const
{
	const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL;

	F32 cur_x = 0;
	const S32 max_index = begin_offset + max_chars;

	const LLFontGlyphInfo* next_glyph = NULL;

	F32 width_padding = 0.f;
	for (S32 i = begin_offset; i < max_index && wchars[i] != 0; i++)
	{
		llwchar wch = wchars[i];

		const LLFontGlyphInfo* fgi = next_glyph;
		next_glyph = NULL;
		if(!fgi)
		{
			fgi = mFontFreetype->getGlyphInfo(wch);
		}

		F32 advance = mFontFreetype->getXAdvance(fgi);

		// for the last character we want to measure the greater of its width and xadvance values
		// so keep track of the difference between these values for the each character we measure
		// so we can fix things up at the end
		width_padding = llmax(	0.f,											// always use positive padding amount
								width_padding - advance,						// previous padding left over after advance of current character
								(F32)(fgi->mWidth + fgi->mXBearing) - advance);	// difference between width of this character and advance to next character

		cur_x += advance;
		llwchar next_char = wchars[i+1];

		if (((i + 1) < begin_offset + max_chars) 
			&& next_char 
			&& (next_char < LAST_CHARACTER))
		{
			// Kern this puppy.
			next_glyph = mFontFreetype->getGlyphInfo(next_char);
			cur_x += mFontFreetype->getXKerning(fgi, next_glyph);
		}
		// Round after kerning.
		cur_x = (F32)ll_round(cur_x);
	}

	// add in extra pixels for last character's width past its xadvance
	cur_x += width_padding;

	return cur_x / sScaleX;
}
void LLLayoutPanel::setOrientation( LLView::EOrientation orientation )
{
	mOrientation = orientation;
	S32 layout_dim = ll_round((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
		? getRect().getWidth()
		: getRect().getHeight()));

	if (mAutoResize == FALSE 
		&& mUserResize == TRUE 
		&& mMinDim == -1 )
	{
		setMinDim(layout_dim);
	}
	mTargetDim = llmax(layout_dim, getMinDim());
}
// create a slurl given the position.  The position will be modded with the region
// width handling global positions as well
LLSLURL::LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position, bool hyper)
: mHypergrid(hyper)
{
	mGrid = grid;
	mRegion = region;
// <FS:CR> FIRE-8063 - Aurora sim var region teleports
	//S32 x = ll_round( (F32)fmod( position[VX], (F32)REGION_WIDTH_METERS ) );
	//S32 y = ll_round( (F32)fmod( position[VY], (F32)REGION_WIDTH_METERS ) );
	//S32 z = ll_round( (F32)position[VZ] );
	mPosition = position;
// </FS:CR>
	mType = LOCATION;
// <FS:CR> FIRE-8063 - Aurora sim var region teleports
	//mPosition = LLVector3(x, y, z);

	if(!LLGridManager::getInstance()->isInOpenSim())
	{
		S32 x = ll_round( (F32)fmod( position[VX], (F32)REGION_WIDTH_METERS ) );
		S32 y = ll_round( (F32)fmod( position[VY], (F32)REGION_WIDTH_METERS ) );
		S32 z = ll_round( (F32)position[VZ] );
		mPosition = LLVector3(x, y, z);
	}
// </FS:CR>
}
Beispiel #26
0
LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y )
{
	x -= ll_round(getRect().getWidth() / 2 + mCurPan.mV[VX]);
	y -= ll_round(getRect().getHeight() / 2 + mCurPan.mV[VY]);

	LLVector3 pos_local( (F32)x, (F32)y, 0 );

	F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );

	static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
	if( rotate_map )
	{
		LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f));
		pos_local.rotVec( rot );
	}

	pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / mScale );
	
	LLVector3d pos_global;
	pos_global.setVec( pos_local );
	pos_global += gAgentCamera.getCameraPositionGlobal();

	return pos_global;
}
Beispiel #27
0
// virtual
void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data)
{
	if(parcel_data.snapshot_id.notNull())
	{
		mSnapshotCtrl->setImageAssetID(parcel_data.snapshot_id);
	}

	if(!parcel_data.sim_name.empty())
	{
		mRegionName->setText(parcel_data.sim_name);
	}
	else
	{
		mRegionName->setText(LLStringUtil::null);
	}

	if(!parcel_data.desc.empty())
	{
		mDescEditor->setText(parcel_data.desc);
	}
	else
	{
		mDescEditor->setText(getString("not_available"));
	}

	S32 region_x;
	S32 region_y;
	S32 region_z;

	// If the region position is zero, grab position from the global
	if(mPosRegion.isExactlyZero())
	{
		region_x = ll_round(parcel_data.global_x) % REGION_WIDTH_UNITS;
		region_y = ll_round(parcel_data.global_y) % REGION_WIDTH_UNITS;
		region_z = ll_round(parcel_data.global_z);
	}
	else
	{
		region_x = ll_round(mPosRegion.mV[VX]);
		region_y = ll_round(mPosRegion.mV[VY]);
		region_z = ll_round(mPosRegion.mV[VZ]);
	}

	if (!parcel_data.name.empty())
	{
		mParcelTitle = parcel_data.name;

		mParcelName->setText(llformat("%s (%d, %d, %d)",
							 mParcelTitle.c_str(), region_x, region_y, region_z));
	}
	else
	{
		mParcelName->setText(getString("not_available"));
	}
}
static void agent_slide_leftright( EKeystate s, S32 direction, LLAgent::EDoubleTapRunMode mode )
{
	agent_handle_doubletap_run(s, mode);
	if( KEYSTATE_UP == s ) return;
	F32 time = gKeyboard->getCurKeyElapsedTime();
	S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount());

	if( time < NUDGE_TIME || frame_count <= NUDGE_FRAMES)
	{
		gAgent.moveLeftNudge(direction);
	}
	else
	{
		gAgent.moveLeft(direction);
	}
}
void agent_jump( EKeystate s )
{
	if( KEYSTATE_UP == s  ) return;
	static LLCachedControl<bool> sAutomaticFly(gSavedSettings, "AutomaticFly");
	F32 time = gKeyboard->getCurKeyElapsedTime();
	S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount());

	if( time < FLY_TIME 
		|| frame_count <= FLY_FRAMES 
		|| gAgent.upGrabbed()
		|| !sAutomaticFly())
	{
		gAgent.moveUp(1);
	}
	else
	{
		gAgent.setFlying(TRUE);
		gAgent.moveUp(1);
	}
}
void LLDragHandleTop::reshapeTitleBox()
{
	if( ! getTitleBox())
	{
		return;
	}
	const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF );
	S32 title_width = font->getWidth( getTitleBox()->getText() ) + TITLE_PAD;
	if (getMaxTitleWidth() > 0)
		title_width = llmin(title_width, getMaxTitleWidth());
	S32 title_height = ll_round(font->getLineHeight());
	LLRect title_rect;
	title_rect.setLeftTopAndSize( 
		LEFT_PAD, 
		getRect().getHeight() - BORDER_PAD,
		getRect().getWidth() - LEFT_PAD - RIGHT_PAD,
		title_height);

	// calls reshape on mTitleBox
	getTitleBox()->setShape( title_rect );
}