Commit 615f1346 authored by Rye Mutt's avatar Rye Mutt 🍞
Browse files

Merge branch 'xenhat/camera-tweaks' into 'master'

Camera options

See merge request !48
parents b0f87f1b 2acc811c
......@@ -13,6 +13,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>AlchemyCameraNoZoomLimit</key>
<map>
<key>Comment</key>
<string>Disables the minimum zoom distance, allowing more camera freedom</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>AlchemyChatCommandAnimationOverride</key>
<map>
<key>Comment</key>
......
......@@ -958,23 +958,27 @@ void LLAgentCamera::cameraZoomIn(const F32 fraction)
F32 current_distance = (F32)camera_offset_unit.normalize();
F32 new_distance = current_distance * fraction;
// Don't move through focus point
if (mFocusObject)
static LLCachedControl<bool> disable_camera_limits(gSavedSettings, "AlchemyCameraNoZoomLimit", false);
if (!disable_camera_limits)
{
LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]);
if (mFocusObject->isAvatar())
{
calcCameraMinDistance(min_zoom);
}
else
// Don't move through focus point
if (mFocusObject)
{
min_zoom = OBJECT_MIN_ZOOM;
LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]);
if (mFocusObject->isAvatar())
{
calcCameraMinDistance(min_zoom);
}
else
{
min_zoom = OBJECT_MIN_ZOOM;
}
}
new_distance = llmax(new_distance, min_zoom);
}
new_distance = llmax(new_distance, min_zoom);
F32 max_distance = getCameraMaxZoomDistance(true);
max_distance = llmin(max_distance, current_distance * 4.f); //Scaled max relative to current distance. MAINT-3154
......@@ -1032,22 +1036,27 @@ void LLAgentCamera::cameraOrbitIn(const F32 meters)
LLVector3d camera_offset_unit(mCameraFocusOffsetTarget);
F32 current_distance = (F32)camera_offset_unit.normalize();
F32 new_distance = current_distance - meters;
F32 min_zoom = LAND_MIN_ZOOM;
// Don't move through focus point
if (mFocusObject.notNull())
static LLCachedControl<bool> disable_camera_limits(gSavedSettings, "AlchemyCameraNoZoomLimit", false);
if (!disable_camera_limits)
{
if (mFocusObject->isAvatar())
{
min_zoom = AVATAR_MIN_ZOOM;
}
else
F32 min_zoom = LAND_MIN_ZOOM;
// Don't move through focus point
if (mFocusObject.notNull())
{
min_zoom = OBJECT_MIN_ZOOM;
if (mFocusObject->isAvatar())
{
min_zoom = AVATAR_MIN_ZOOM;
}
else
{
min_zoom = OBJECT_MIN_ZOOM;
}
}
}
new_distance = llmax(new_distance, min_zoom);
new_distance = llmax(new_distance, min_zoom);
}
F32 max_distance = getCameraMaxZoomDistance(true);
......@@ -1794,7 +1803,11 @@ F32 LLAgentCamera::calcCameraFOVZoomFactor()
{
// don't FOV zoom on mostly transparent objects
F32 obj_min_dist = 0.f;
calcCameraMinDistance(obj_min_dist);
static LLCachedControl<bool> disable_camera_limits(gSavedSettings, "AlchemyCameraNoZoomLimit", false);
if (!disable_camera_limits)
{
calcCameraMinDistance(obj_min_dist);
}
F32 current_distance = llmax(0.001f, camera_offset_dir.magVec());
mFocusObjectDist = obj_min_dist - current_distance;
......
......@@ -2074,6 +2074,16 @@ function="World.EnvPreset"
function="ToggleControl"
parameter="DisableCameraConstraints" />
</menu_item_check>
<menu_item_check
label="Disable Minimum Zoom Distance"
name="Disable Minimum Zoom Distance">
<menu_item_check.on_check
function="CheckControl"
parameter="AlchemyCameraNoZoomLimit" />
<menu_item_check.on_click
function="ToggleControl"
parameter="AlchemyCameraNoZoomLimit" />
</menu_item_check>
<menu_item_separator/>
......
......@@ -119,6 +119,16 @@
name="arrow_keys_move_avatar_check"
width="237"
top_pad="5"/>
<check_box
control_name="AlchemyMotionResetsCamera"
follows="left|top"
height="20"
label="Moving resets the camera position"
layout="topleft"
left_delta="0"
name="motion_reset_camera_check"
width="237"
top_pad="0"/>
<check_box
control_name="AllowTapTapHoldRun"
follows="left|top"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment