diff options
| -rw-r--r-- | .pre-commit-config.yaml | 17 | ||||
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/newview/llfloatermap.cpp | 64 | ||||
| -rw-r--r-- | indra/newview/llnetmap.cpp | 20 | ||||
| -rw-r--r-- | indra/newview/llviewerparcelmgr.cpp | 2 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/newview/llviewerparceloverlay.cpp | 64 | ||||
| -rw-r--r-- | indra/newview/llviewerparceloverlay.h | 3 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/newview/llviewerregion.cpp | 9 | ||||
| -rw-r--r-- | indra/newview/llviewerregion.h | 2 | ||||
| -rw-r--r-- | indra/newview/skins/default/colors.xml | 3 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_map.xml | 48 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_world_map.xml | 3 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_mini_map.xml | 10 | 
13 files changed, 189 insertions, 67 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..6d296d7a24 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +repos: +  - repo: https://bitbucket.org/lindenlab/git-hooks.git  +    rev: v1.0.0-beta2 +    hooks: +      - id: opensource-license +      - id: jira-issue  +      - id: llsd +      - id: no-trigraphs +      - id: copyright +      - id: end-of-file +        files: \.(cpp|c|h|py|glsl|cmake|txt)$ +        exclude: language.txt +  - repo: https://github.com/pre-commit/pre-commit-hooks +    rev: v2.5.0 +    hooks: +      - id: check-xml +      - id: mixed-line-ending diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6c36fa6f09..3ecfa4ef9a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6821,6 +6821,17 @@        <key>Value</key>        <real>128.0</real>      </map> +    <key>MiniMapShowPropertyLines</key> +    <map> +      <key>Comment</key> +      <string>Whether or not to show parcel borders on the MiniMap.</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <real>1</real> +    </map>      <key>MouseSensitivity</key>      <map>        <key>Comment</key> diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index fc2da772f3..7a7ffb0c7e 100644..100755 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -51,7 +51,7 @@  // The minor cardinal direction labels are hidden if their height is more  // than this proportion of the map. -const F32 MAP_MINOR_DIR_THRESHOLD = 0.07f; +const F32 MAP_MINOR_DIR_THRESHOLD = 0.035f;  //  // Member functions @@ -97,6 +97,15 @@ BOOL LLFloaterMap::postBuild()  	mTextBoxSouthWest = getChild<LLTextBox> ("floater_map_southwest");  	mTextBoxNorthWest = getChild<LLTextBox> ("floater_map_northwest"); +    mTextBoxNorth->reshapeToFitText(); +    mTextBoxEast->reshapeToFitText(); +    mTextBoxWest->reshapeToFitText(); +    mTextBoxSouth->reshapeToFitText(); +    mTextBoxSouthEast->reshapeToFitText(); +    mTextBoxNorthEast->reshapeToFitText(); +    mTextBoxSouthWest->reshapeToFitText(); +    mTextBoxNorthWest->reshapeToFitText(); +  	updateMinorDirections();  	// Get the drag handle all the way in back @@ -138,23 +147,44 @@ BOOL LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask)  	return TRUE;  } -void LLFloaterMap::setDirectionPos( LLTextBox* text_box, F32 rotation ) +void LLFloaterMap::setDirectionPos(LLTextBox *text_box, F32 rotation)  { -	// Rotation is in radians. -	// Rotation of 0 means x = 1, y = 0 on the unit circle. - -	F32 map_half_height = (F32)(getRect().getHeight() / 2) - getHeaderHeight()/2; -	F32 map_half_width = (F32)(getRect().getWidth() / 2) ; -	F32 text_half_height = (F32)(text_box->getRect().getHeight() / 2); -	F32 text_half_width = (F32)(text_box->getRect().getWidth() / 2); -	F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width ); - -	// Inset by a little to account for position display. -	radius -= 8.f; - -	text_box->setOrigin(  -		ll_round(map_half_width - text_half_width + radius * cos( rotation )), -		ll_round(map_half_height - text_half_height + radius * sin( rotation )) ); +    // Rotation is in radians. +    // Rotation of 0 means x = 1, y = 0 on the unit circle. + +    F32 map_half_height  = (F32) (getRect().getHeight() / 2) - (getHeaderHeight() / 2); +    F32 map_half_width   = (F32) (getRect().getWidth() / 2); +    F32 text_half_height = (F32) (text_box->getRect().getHeight() / 2); +    F32 text_half_width  = (F32) (text_box->getRect().getWidth() / 2); +    F32 extra_padding    = (F32) (mTextBoxNorth->getRect().getWidth() / 2); +    F32 pos_half_height  = map_half_height - text_half_height - extra_padding; +    F32 pos_half_width   = map_half_width - text_half_width - extra_padding; + +    F32 corner_angle               = atan2(pos_half_height, pos_half_width); +    F32 rotation_mirrored_into_top = abs(fmodf(rotation, F_PI)); +    if (rotation < 0) +    { +        rotation_mirrored_into_top = F_PI - rotation_mirrored_into_top; +    } +    F32  rotation_mirrored_into_top_right = (F_PI_BY_TWO - abs(rotation_mirrored_into_top - F_PI_BY_TWO)); +    bool at_left_right_edge               = rotation_mirrored_into_top_right < corner_angle; + +    F32 part_x = cos(rotation); +    F32 part_y = sin(rotation); +    F32 y; +    F32 x; +    if (at_left_right_edge) +    { +        x = std::copysign(pos_half_width, part_x); +        y = x * part_y / part_x; +    } +    else +    { +        y = std::copysign(pos_half_height, part_y); +        x = y * part_x / part_y; +    } + +    text_box->setOrigin(ll_round(map_half_width + x - text_half_width), ll_round(map_half_height + y - text_half_height));  }  void LLFloaterMap::updateMinorDirections() diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 112da55682..80fac58a1e 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -154,6 +154,7 @@ void LLNetMap::draw()  	//static LLUIColor map_track_disabled_color = LLUIColorTable::instance().getColor("MapTrackDisabledColor", LLColor4::white);  	static LLUIColor map_frustum_color = LLUIColorTable::instance().getColor("MapFrustumColor", LLColor4::white);  	static LLUIColor map_frustum_rotating_color = LLUIColorTable::instance().getColor("MapFrustumRotatingColor", LLColor4::white); +	static LLUIColor map_parcel_outline_color = LLUIColorTable::instance().getColor("MapParcelOutlineColor", LLColor4(LLColor3(LLColor4::yellow), 0.5f));  	if (mObjectImagep.isNull())  	{ @@ -211,7 +212,8 @@ void LLNetMap::draw()  		}  		// figure out where agent is -		S32 region_width = ll_round(LLWorld::getInstance()->getRegionWidthInMeters()); +		const S32 region_width = ll_round(LLWorld::getInstance()->getRegionWidthInMeters()); +        const F32 scale_pixels_per_meter = mScale / region_width;  		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();  			 iter != LLWorld::getInstance()->getRegionList().end(); ++iter) @@ -220,8 +222,8 @@ void LLNetMap::draw()  			// Find x and y position relative to camera's center.  			LLVector3 origin_agent = regionp->getOriginAgent();  			LLVector3 rel_region_pos = origin_agent - gAgentCamera.getCameraPositionAgent(); -			F32 relative_x = (rel_region_pos.mV[0] / region_width) * mScale; -			F32 relative_y = (rel_region_pos.mV[1] / region_width) * mScale; +			F32 relative_x = rel_region_pos.mV[0] * scale_pixels_per_meter; +			F32 relative_y = rel_region_pos.mV[1] * scale_pixels_per_meter;  			// background region rectangle  			F32 bottom =	relative_y; @@ -244,6 +246,7 @@ void LLNetMap::draw()  			} +  			// Draw using texture.  			gGL.getTexUnit(0)->bind(regionp->getLand().getSTexture());  			gGL.begin(LLRender::QUADS); @@ -305,8 +308,8 @@ void LLNetMap::draw()  		LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);  		LLVector3 camera_position = gAgentCamera.getCameraPositionAgent();  		map_center_agent -= camera_position; -		map_center_agent.mV[VX] *= mScale/region_width; -		map_center_agent.mV[VY] *= mScale/region_width; +		map_center_agent.mV[VX] *= scale_pixels_per_meter; +		map_center_agent.mV[VY] *= scale_pixels_per_meter;  		gGL.getTexUnit(0)->bind(mObjectImagep);  		F32 image_half_width = 0.5f*mObjectMapPixels; @@ -322,6 +325,13 @@ void LLNetMap::draw()  			gGL.texCoord2f(1.f, 1.f);  			gGL.vertex2f(image_half_width + map_center_agent.mV[VX], image_half_height + map_center_agent.mV[VY]);  		gGL.end(); +         +		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); +			 iter != LLWorld::getInstance()->getRegionList().end(); ++iter) +		{ +			LLViewerRegion* regionp = *iter; +            regionp->renderPropertyLinesOnMinimap(scale_pixels_per_meter, map_parcel_outline_color.get().mV); +        }  		gGL.popMatrix(); diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 56370df751..a6f15489f4 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -1591,6 +1591,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use      else if (sequence_id == 0 || sequence_id > parcel_mgr.mAgentParcelSequenceID)      {          // new agent parcel +        // *TODO: Does it really make sense to set the agent parcel to this +        // parcel if the client doesn't know what kind of parcel data this is?          parcel_mgr.mAgentParcelSequenceID = sequence_id;          parcel = parcel_mgr.mAgentParcel;      } diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 7c3dd00e1a..c170a240a8 100644..100755 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -907,8 +907,8 @@ S32 LLViewerParcelOverlay::renderPropertyLines	()  	// Always fudge a little vertically.  	pull_toward_camera.mV[VZ] += 0.01f; -	gGL.matrixMode(LLRender::MM_MODELVIEW); -	gGL.pushMatrix(); +    gGL.matrixMode(LLRender::MM_MODELVIEW); +    gGL.pushMatrix();  	// Move to appropriate region coords  	LLVector3 origin = mRegion->getOriginAgent(); @@ -1013,7 +1013,65 @@ S32 LLViewerParcelOverlay::renderPropertyLines	()  	} -	gGL.popMatrix(); +    gGL.popMatrix();  	return drawn;  } + +// Draw half of a single cell (no fill) in a grid drawn from left to right and from bottom to top +void grid_2d_part_lines(const F32 left, const F32 top, const F32 right, const F32 bottom, bool has_left, bool has_bottom) +{ +    gGL.begin(LLRender::LINES); + +    if (has_left) +    { +        gGL.vertex2f(left, bottom); +        gGL.vertex2f(left, top); +    } +    if (has_bottom) +    { +        gGL.vertex2f(left, bottom); +        gGL.vertex2f(right, bottom); +    } + +    gGL.end(); +} + +void LLViewerParcelOverlay::renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, const F32 *parcel_outline_color) +{ +    if (!mOwnership) +    { +        return; +    } +    if (!gSavedSettings.getBOOL("MiniMapShowPropertyLines")) +    { +        return; +    } + +    LLVector3 origin_agent     = mRegion->getOriginAgent(); +    LLVector3 rel_region_pos   = origin_agent - gAgentCamera.getCameraPositionAgent(); +    F32       region_left      = rel_region_pos.mV[0] * scale_pixels_per_meter; +    F32       region_bottom    = rel_region_pos.mV[1] * scale_pixels_per_meter; +    F32       map_parcel_width = PARCEL_GRID_STEP_METERS * scale_pixels_per_meter; +    const S32 GRIDS_PER_EDGE   = mParcelGridsPerEdge; + +    gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); +    glLineWidth(1.0f); +    gGL.color4fv(parcel_outline_color); +    for (S32 i = 0; i < GRIDS_PER_EDGE + 1; i++) +    { +        F32 bottom = region_bottom + (i * map_parcel_width); +        F32 top    = bottom + map_parcel_width; +        for (S32 j = 0; j < GRIDS_PER_EDGE + 1; j++) +        { +            F32 left    = region_left + (j * map_parcel_width); +            F32 right   = left + map_parcel_width; +            U8  overlay = mOwnership[(i * GRIDS_PER_EDGE) + j]; +            // The property line vertices are three-dimensional, but here we only care about the x and y coordinates, as we are drawing on a +            // 2D map +            const bool has_left   = i != GRIDS_PER_EDGE && (j == GRIDS_PER_EDGE || (overlay & PARCEL_WEST_LINE)); +            const bool has_bottom = j != GRIDS_PER_EDGE && (i == GRIDS_PER_EDGE || (overlay & PARCEL_SOUTH_LINE)); +            grid_2d_part_lines(left, top, right, bottom, has_left, has_bottom); +        } +    } +} diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index e30dbf17b3..053f69ba4c 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -69,6 +69,7 @@ public:  	// Returns the number of vertices drawn  	S32				renderPropertyLines(); +    void			renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, const F32* parcel_outline_color);  	U8				ownership( const LLVector3& pos) const;  	U8				parcelLineFlags( const LLVector3& pos) const; @@ -82,7 +83,7 @@ public:  	void	idleUpdate(bool update_now = false);  	void	updateGL(); - +      private:  	// This is in parcel rows and columns, not grid rows and columns  	// Stored in bottom three bits. diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 27fbf39673..6ca416d0a8 100644..100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1035,6 +1035,15 @@ S32 LLViewerRegion::renderPropertyLines()  	}  } +void LLViewerRegion::renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, const F32 *parcel_outline_color) +{ +    if (mParcelOverlay) +    { +        mParcelOverlay->renderPropertyLinesOnMinimap(scale_pixels_per_meter, parcel_outline_color); +    } +} + +  // This gets called when the height field changes.  void LLViewerRegion::dirtyHeights()  { diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index fcbf56c81f..b6c8f5c583 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -154,6 +154,8 @@ public:  	// Draw lines in the dirt showing ownership. Return number of   	// vertices drawn.  	S32 renderPropertyLines(); +    void renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, const F32* parcel_outline_color); +  	// Call this whenever you change the height data in the region.  	// (Automatically called by LLSurfacePatch's update routine) diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index 7beb013fba..82e1942aa5 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -514,6 +514,9 @@       name="MapFrustumColor"       reference="White_10" />      <color +     name="MapParcelOutlineColor" +     value="1 1 0 0.5" /> +    <color       name="MapFrustumRotatingColor"       value="1 1 1 0.2" />      <color diff --git a/indra/newview/skins/default/xui/en/floater_map.xml b/indra/newview/skins/default/xui/en/floater_map.xml index b8893e11d9..18e7147136 100644 --- a/indra/newview/skins/default/xui/en/floater_map.xml +++ b/indra/newview/skins/default/xui/en/floater_map.xml @@ -37,105 +37,73 @@      <text       type="string"       length="1" -     bottom="218"       label="N"       layout="topleft" -     left="0"       name="floater_map_north" -     right="10" -     text_color="1 1 1 0.7" -     top="189"> +     text_color="1 1 1 0.7">          N      </text>      <text       type="string"       length="1" -     bottom="218"       label="E"       layout="topleft" -     left="0"       name="floater_map_east" -     right="10" -     text_color="1 1 1 0.7" -     top="189"> +     text_color="1 1 1 0.7">          E      </text>      <text       type="string"       length="1" -     bottom="205"       label="W"       layout="topleft" -     left="0"       name="floater_map_west" -     right="11" -     text_color="1 1 1 0.7" -     top="175"> +     text_color="1 1 1 0.7">          W      </text>      <text       type="string"       length="1" -     bottom="218"       label="S"       layout="topleft" -     left="0"       name="floater_map_south" -     right="10" -     text_color="1 1 1 0.7" -     top="189"> +     text_color="1 1 1 0.7">          S      </text>      <text       type="string"       length="1" -     bottom="218"       label="SE"       layout="topleft" -     left="0"       name="floater_map_southeast" -     right="20" -     text_color="1 1 1 0.7" -     top="189"> +     text_color="1 1 1 0.7">          SE      </text>      <text       type="string"       length="1" -     bottom="218"       label="NE"       layout="topleft" -     left="0"       name="floater_map_northeast" -     right="20" -     text_color="1 1 1 0.7" -     top="189"> +     text_color="1 1 1 0.7">          NE      </text>      <text       type="string"       length="1" -     bottom="218"       label="SW"       layout="topleft" -     left="0"       name="floater_map_southwest" -     right="20" -     text_color="1 1 1 0.7" -     top="189"> +     text_color="1 1 1 0.7">          SW      </text>      <text       type="string"       length="1" -     bottom="218"       label="NW"       layout="topleft" -     left="0"       name="floater_map_northwest" -     right="20" -     text_color="1 1 1 0.7" -     top="189"> +     text_color="1 1 1 0.7">          NW      </text>  </floater> diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml index 83407069d2..eb633e50e7 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -677,6 +677,7 @@       name="zoom_icon"       top_pad="7"       width="16" ></icon> +    <!-- NOTE: min_val for zoom slider is hardcoded for performance reasons -->      <slider       follows="left|bottom"       height="16" @@ -684,7 +685,7 @@       initial_value="-2"       left_pad="0"       layout="topleft" -     max_val="0" +     max_val="4"       min_val="-8"       name="zoom slider"       show_text="false" diff --git a/indra/newview/skins/default/xui/en/menu_mini_map.xml b/indra/newview/skins/default/xui/en/menu_mini_map.xml index ea263d05ce..c3899b35cd 100644 --- a/indra/newview/skins/default/xui/en/menu_mini_map.xml +++ b/indra/newview/skins/default/xui/en/menu_mini_map.xml @@ -63,6 +63,16 @@           function="Minimap.Tracker"           parameter="task_properties" />      </menu_item_call> +	<menu_item_separator /> +    <menu_item_check +     label="Show Property Lines" +     name="Show Property Lines"> +        <menu_item_check.on_check +         control="MiniMapShowPropertyLines" /> +        <menu_item_check.on_click +         function="ToggleControl" +         parameter="MiniMapShowPropertyLines" /> +    </menu_item_check>      <menu_item_separator />      <menu_item_call       label="World Map"  | 
