Massive deferred update...
Plus renamed setupViewport to setup[2|3]DViewport. Migrated mWindowRect to mWindowRectRaw, mVirtualWindowRect to mWindowRectScaled. Slowly updating getwindow/getworldview calls to new v2 variants as I run across them. Cleaned up ascent-related code in llmanip.cpp. Impostor update tweaks. Edgepatch water occlusion changes. (no patch flickering on edges of screen while moving camera)
This commit is contained in:
@@ -70,11 +70,7 @@ S32 LLManip::sMaxTimesShowHelpText = 5;
|
||||
F32 LLManip::sGridMaxSubdivisionLevel = 32.f;
|
||||
F32 LLManip::sGridMinSubdivisionLevel = 1.f;
|
||||
LLVector2 LLManip::sTickLabelSpacing(60.f, 25.f);
|
||||
bool LLManip::sActualRoot = false;// going to set these up in the main entry
|
||||
bool LLManip::sPivotPerc = false;
|
||||
F32 LLManip::sPivotX = 0.f;
|
||||
F32 LLManip::sPivotY = 0.f;
|
||||
F32 LLManip::sPivotZ = 0.f;
|
||||
|
||||
|
||||
//static
|
||||
void LLManip::rebuild(LLViewerObject* vobj)
|
||||
@@ -106,53 +102,6 @@ LLManip::LLManip( const std::string& name, LLToolComposite* composite )
|
||||
mHighlightedPart(LL_NO_PART),
|
||||
mManipPart(LL_NO_PART)
|
||||
{
|
||||
initPivot();
|
||||
|
||||
gSavedSettings.getControl("AscentBuildPrefs_ActualRoot")->getSignal()->connect(boost::bind(&updateActualRoot));
|
||||
gSavedSettings.getControl("AscentBuildPrefs_PivotIsPercent")->getSignal()->connect(boost::bind(&updatePivotIsPercent));
|
||||
gSavedSettings.getControl("AscentBuildPrefs_PivotX")->getSignal()->connect(boost::bind(&updatePivotX));
|
||||
gSavedSettings.getControl("AscentBuildPrefs_PivotY")->getSignal()->connect(boost::bind(&updatePivotY));
|
||||
gSavedSettings.getControl("AscentBuildPrefs_PivotZ")->getSignal()->connect(boost::bind(&updatePivotZ));
|
||||
}
|
||||
//static
|
||||
void LLManip::initPivot()
|
||||
{
|
||||
sActualRoot = (bool)gSavedSettings.getBOOL("AscentBuildPrefs_ActualRoot");
|
||||
sPivotPerc = (bool)gSavedSettings.getBOOL("AscentBuildPrefs_PivotIsPercent");
|
||||
sPivotX = gSavedSettings.getF32("AscentBuildPrefs_PivotX");
|
||||
sPivotY = gSavedSettings.getF32("AscentBuildPrefs_PivotY");
|
||||
sPivotZ = gSavedSettings.getF32("AscentBuildPrefs_PivotZ");
|
||||
}
|
||||
//static
|
||||
bool LLManip::updateActualRoot()
|
||||
{
|
||||
//sActualRoot = (bool)data.asBoolean();
|
||||
sActualRoot = gSavedSettings.getBOOL("AscentBuildPrefs_ActualRoot");
|
||||
return true;
|
||||
}
|
||||
//static
|
||||
bool LLManip::updatePivotIsPercent()
|
||||
{
|
||||
sPivotPerc = gSavedSettings.getBOOL("AscentBuildPrefs_PivotIsPercent");
|
||||
return true;
|
||||
}
|
||||
//static
|
||||
bool LLManip::updatePivotX()
|
||||
{
|
||||
sPivotX = gSavedSettings.getF32("AscentBuildPrefs_PivotX");
|
||||
return true;
|
||||
}
|
||||
//static
|
||||
bool LLManip::updatePivotY()
|
||||
{
|
||||
sPivotY = gSavedSettings.getF32("AscentBuildPrefs_PivotY");
|
||||
return true;
|
||||
}
|
||||
//static
|
||||
bool LLManip::updatePivotZ()
|
||||
{
|
||||
sPivotZ = gSavedSettings.getF32("AscentBuildPrefs_PivotZ");
|
||||
return true;
|
||||
}
|
||||
|
||||
void LLManip::getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 &normal)
|
||||
@@ -317,8 +266,8 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect
|
||||
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidth() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom;
|
||||
F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeight() - 0.5f) / gAgentCamera.mHUDCurZoom;
|
||||
F32 mouse_x = ((F32)x / gViewerWindow->getWorldViewWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom;
|
||||
F32 mouse_y = ((F32)y / gViewerWindow->getWorldViewHeightScaled() - 0.5f) / gAgentCamera.mHUDCurZoom;
|
||||
|
||||
LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin);
|
||||
LLVector3 mouse_pos = LLVector3(0.f, -mouse_x, mouse_y);
|
||||
@@ -356,8 +305,8 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co
|
||||
|
||||
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
|
||||
{
|
||||
F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom;
|
||||
F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeight()) - 0.5f) / gAgentCamera.mHUDCurZoom;
|
||||
F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidthScaled()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom;
|
||||
F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeightScaled()) - 0.5f) / gAgentCamera.mHUDCurZoom;
|
||||
a1 = LLVector3(llmin(b1.mV[VX] - 0.1f, b2.mV[VX] - 0.1f, 0.f), -mouse_x, mouse_y);
|
||||
a2 = a1 + LLVector3(1.f, 0.f, 0.f);
|
||||
}
|
||||
@@ -404,43 +353,22 @@ LLVector3 LLManip::getSavedPivotPoint() const
|
||||
|
||||
LLVector3 LLManip::getPivotPoint()
|
||||
{
|
||||
LLVector3 pos;
|
||||
LLVector3 scale;
|
||||
LLQuaternion rot;// = mObjectSelection->getFirstObject()->getRotation();
|
||||
if (mObjectSelection->getFirstRootObject(TRUE) && (mObjectSelection->getObjectCount() == 1 || sActualRoot) && mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
|
||||
static LLCachedControl<bool> actual_root("AscentBuildPrefs_ActualRoot");
|
||||
static LLCachedControl<bool> pivot_as_percent("AscentBuildPrefs_PivotIsPercent");
|
||||
static LLCachedControl<F32> pivot_x("AscentBuildPrefs_PivotX");
|
||||
static LLCachedControl<F32> pivot_y("AscentBuildPrefs_PivotY");
|
||||
static LLCachedControl<F32> pivot_z("AscentBuildPrefs_PivotZ");
|
||||
LLVector3 offset(pivot_x,pivot_y,pivot_z);
|
||||
|
||||
if (mObjectSelection->getFirstRootObject(TRUE) && (mObjectSelection->getObjectCount() == 1 || actual_root) && mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
|
||||
{
|
||||
pos = mObjectSelection->getFirstRootObject(TRUE)->getPivotPositionAgent();
|
||||
scale = mObjectSelection->getFirstRootObject(TRUE)->getScale();
|
||||
rot = mObjectSelection->getFirstRootObject(TRUE)->getRotation();
|
||||
}else
|
||||
{
|
||||
pos = LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent();
|
||||
scale = LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal();
|
||||
rot = LLSelectMgr::getInstance()->getBBoxOfSelection().getRotation();
|
||||
if(pivot_as_percent)
|
||||
offset = ((offset * .01f) - LLVector3(.5f,.5f,.5f)).scaleVec(mObjectSelection->getFirstRootObject(TRUE)->getScale());
|
||||
return mObjectSelection->getFirstObject()->getPivotPositionAgent() + offset * mObjectSelection->getFirstRootObject(TRUE)->getRotation();
|
||||
}
|
||||
if(sPivotPerc)
|
||||
{
|
||||
|
||||
LLVector3 add(
|
||||
(-scale[VX]*0.5) + (scale[VX]*(sPivotX*0.01)),
|
||||
(-scale[VY]*0.5) + (scale[VY]*(sPivotY*0.01)),
|
||||
(-scale[VZ]*0.5) + (scale[VZ]*(sPivotZ*0.01)));
|
||||
add = add * rot;
|
||||
pos = pos + add;
|
||||
}else
|
||||
{
|
||||
//pos[VX] = pos[VX] + gSavedSettings.getF32("EmeraldBuildPrefs_PivotX");
|
||||
//pos[VY] = pos[VY] + gSavedSettings.getF32("EmeraldBuildPrefs_PivotY");
|
||||
//pos[VZ] = pos[VZ] + gSavedSettings.getF32("EmeraldBuildPrefs_PivotZ");
|
||||
LLVector3 add(
|
||||
sPivotX,
|
||||
sPivotY,
|
||||
sPivotZ);
|
||||
add = add * rot;
|
||||
pos = pos + add;
|
||||
}
|
||||
//pos = pos * rot;
|
||||
return pos;
|
||||
if(pivot_as_percent)
|
||||
offset = ((offset * .01f) - LLVector3(.5f,.5f,.5f)).scaleVec(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal());
|
||||
return LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent() + offset * LLSelectMgr::getInstance()->getBBoxOfSelection().getRotation();
|
||||
}
|
||||
|
||||
|
||||
@@ -514,17 +442,17 @@ void LLManip::renderXYZ(const LLVector3 &vec)
|
||||
const S32 PAD = 10;
|
||||
std::string feedback_string;
|
||||
LLVector3 camera_pos = LLViewerCamera::getInstance()->getOrigin() + LLViewerCamera::getInstance()->getAtAxis();
|
||||
S32 window_center_x = gViewerWindow->getWindowWidth() / 2;
|
||||
S32 window_center_y = gViewerWindow->getWindowHeight() / 2;
|
||||
S32 vertical_offset = window_center_y - VERTICAL_OFFSET;
|
||||
S32 window_center_x = gViewerWindow->getWorldViewRectScaled().getWidth() / 2;
|
||||
S32 window_center_y = gViewerWindow->getWorldViewRectScaled().getHeight() / 2;
|
||||
S32 vertical_offset = window_center_y - VERTICAL_OFFSET;
|
||||
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
gGL.pushMatrix();
|
||||
{
|
||||
LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga");
|
||||
gViewerWindow->setup2DRender();
|
||||
const LLVector2& display_scale = gViewerWindow->getDisplayScale();
|
||||
glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f);
|
||||
gGL.scalef(display_scale.mV[VX], display_scale.mV[VY], 1.f);
|
||||
gGL.color4f(0.f, 0.f, 0.f, 0.7f);
|
||||
|
||||
imagep->draw(
|
||||
@@ -534,7 +462,7 @@ void LLManip::renderXYZ(const LLVector3 &vec)
|
||||
PAD * 2 + 10,
|
||||
LLColor4(0.f, 0.f, 0.f, 0.7f) );
|
||||
}
|
||||
glPopMatrix();
|
||||
gGL.popMatrix();
|
||||
|
||||
gViewerWindow->setup3DRender();
|
||||
|
||||
@@ -586,9 +514,9 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons
|
||||
// render shadow first
|
||||
LLColor4 shadow_color = LLColor4::black;
|
||||
shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f;
|
||||
gViewerWindow->setupViewport(1, -1);
|
||||
gViewerWindow->setup3DViewport(1, -1);
|
||||
hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
|
||||
gViewerWindow->setupViewport();
|
||||
gViewerWindow->setup3DViewport();
|
||||
hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
|
||||
|
||||
glPopMatrix();
|
||||
@@ -648,19 +576,19 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string
|
||||
{
|
||||
fraction_string = llformat("%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix.c_str());
|
||||
|
||||
gViewerWindow->setupViewport(1, -1);
|
||||
gViewerWindow->setup3DViewport(1, -1);
|
||||
hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -1.f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection);
|
||||
hud_render_utf8text(fraction_string, render_pos, *small_fontp, LLFontGL::NORMAL, 1.f, 3.f, shadow_color, hud_selection);
|
||||
|
||||
gViewerWindow->setupViewport();
|
||||
gViewerWindow->setup3DViewport();
|
||||
hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -1.f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection);
|
||||
hud_render_utf8text(fraction_string, render_pos, *small_fontp, LLFontGL::NORMAL, 1.f, 3.f, color, hud_selection);
|
||||
}
|
||||
else
|
||||
{
|
||||
gViewerWindow->setupViewport(1, -1);
|
||||
gViewerWindow->setup3DViewport(1, -1);
|
||||
hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection);
|
||||
gViewerWindow->setupViewport();
|
||||
gViewerWindow->setup3DViewport();
|
||||
hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection);
|
||||
}
|
||||
glPopMatrix();
|
||||
@@ -679,14 +607,14 @@ LLColor4 LLManip::setupSnapGuideRenderPass(S32 pass)
|
||||
{
|
||||
case 0:
|
||||
// shadow
|
||||
gViewerWindow->setupViewport(1, -1);
|
||||
gViewerWindow->setup3DViewport(1, -1);
|
||||
line_color = grid_color_shadow;
|
||||
line_color.mV[VALPHA] *= line_alpha;
|
||||
LLUI::setLineWidth(2.f);
|
||||
break;
|
||||
case 1:
|
||||
// hidden lines
|
||||
gViewerWindow->setupViewport();
|
||||
gViewerWindow->setup3DViewport();
|
||||
line_color = grid_color_bg;
|
||||
line_color.mV[VALPHA] *= line_alpha;
|
||||
LLUI::setLineWidth(1.f);
|
||||
|
||||
Reference in New Issue
Block a user