summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatermodelpreview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rw-r--r--indra/newview/llfloatermodelpreview.cpp61
1 files changed, 33 insertions, 28 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index ab5766f260..b5489d2dd8 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -75,15 +75,15 @@ LLFloaterModelPreview* LLFloaterModelPreview::sInstance = NULL;
// should be represented by Retain spinner with values from 1 to 100 by 1.
// To achieve this, RETAIN_COEFFICIENT is used while creating spinner
// and when value is requested from spinner.
-const double RETAIN_COEFFICIENT = 100;
+constexpr double RETAIN_COEFFICIENT = 100;
// "Cosine%" decomp parameter has values from 0.9 to 1 by 0.001
// But according to the UI spec for upload model floater, this parameter
// should be represented by Smooth combobox with only 10 values.
// So this const is used as a size of Smooth combobox list.
-const S32 SMOOTH_VALUES_NUMBER = 10;
-const S32 PREVIEW_RENDER_SIZE = 1024;
-const F32 PREVIEW_CAMERA_DISTANCE = 16.f;
+constexpr S32 SMOOTH_VALUES_NUMBER = 10;
+constexpr S32 PREVIEW_RENDER_SIZE = 1024;
+constexpr F32 PREVIEW_CAMERA_DISTANCE = 16.f;
class LLMeshFilePicker : public LLFilePickerThread
{
@@ -148,11 +148,11 @@ mAvatarTabIndex(0)
//-----------------------------------------------------------------------------
// postBuild()
//-----------------------------------------------------------------------------
-BOOL LLFloaterModelPreview::postBuild()
+bool LLFloaterModelPreview::postBuild()
{
if (!LLFloater::postBuild())
{
- return FALSE;
+ return false;
}
childSetCommitCallback("cancel_btn", onCancel, this);
@@ -283,14 +283,14 @@ BOOL LLFloaterModelPreview::postBuild()
mCalculateBtn->setEnabled(false);
}
- return TRUE;
+ return true;
}
//-----------------------------------------------------------------------------
// reshape()
//-----------------------------------------------------------------------------
-void LLFloaterModelPreview::reshape(S32 width, S32 height, BOOL called_from_parent)
+void LLFloaterModelPreview::reshape(S32 width, S32 height, bool called_from_parent)
{
LLFloaterModelUploadBase::reshape(width, height, called_from_parent);
@@ -782,16 +782,21 @@ void LLFloaterModelPreview::draw3dPreview()
gGL.getTexUnit(0)->bind(mModelPreview);
- gGL.begin( LLRender::QUADS );
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.texCoord2f(0.f, 1.f);
- gGL.vertex2i(mPreviewRect.mLeft+1, mPreviewRect.mTop-1);
+ gGL.vertex2i(mPreviewRect.mLeft + 1, mPreviewRect.mTop - 1);
gGL.texCoord2f(0.f, 0.f);
- gGL.vertex2i(mPreviewRect.mLeft+1, mPreviewRect.mBottom+1);
+ gGL.vertex2i(mPreviewRect.mLeft + 1, mPreviewRect.mBottom + 1);
gGL.texCoord2f(1.f, 0.f);
- gGL.vertex2i(mPreviewRect.mRight-1, mPreviewRect.mBottom+1);
+ gGL.vertex2i(mPreviewRect.mRight - 1, mPreviewRect.mBottom + 1);
+
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2i(mPreviewRect.mRight - 1, mPreviewRect.mBottom + 1);
gGL.texCoord2f(1.f, 1.f);
- gGL.vertex2i(mPreviewRect.mRight-1, mPreviewRect.mTop-1);
+ gGL.vertex2i(mPreviewRect.mRight - 1, mPreviewRect.mTop - 1);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2i(mPreviewRect.mLeft + 1, mPreviewRect.mTop - 1);
}
gGL.end();
@@ -849,7 +854,7 @@ void LLFloaterModelPreview::draw()
//-----------------------------------------------------------------------------
// handleMouseDown()
//-----------------------------------------------------------------------------
-BOOL LLFloaterModelPreview::handleMouseDown(S32 x, S32 y, MASK mask)
+bool LLFloaterModelPreview::handleMouseDown(S32 x, S32 y, MASK mask)
{
if (mPreviewRect.pointInRect(x, y))
{
@@ -858,7 +863,7 @@ BOOL LLFloaterModelPreview::handleMouseDown(S32 x, S32 y, MASK mask)
gViewerWindow->hideCursor();
mLastMouseX = x;
mLastMouseY = y;
- return TRUE;
+ return true;
}
return LLFloater::handleMouseDown(x, y, mask);
@@ -867,9 +872,9 @@ BOOL LLFloaterModelPreview::handleMouseDown(S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
// handleMouseUp()
//-----------------------------------------------------------------------------
-BOOL LLFloaterModelPreview::handleMouseUp(S32 x, S32 y, MASK mask)
+bool LLFloaterModelPreview::handleMouseUp(S32 x, S32 y, MASK mask)
{
- gFocusMgr.setMouseCapture(FALSE);
+ gFocusMgr.setMouseCapture(nullptr);
gViewerWindow->showCursor();
return LLFloater::handleMouseUp(x, y, mask);
}
@@ -877,7 +882,7 @@ BOOL LLFloaterModelPreview::handleMouseUp(S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
// handleHover()
//-----------------------------------------------------------------------------
-BOOL LLFloaterModelPreview::handleHover (S32 x, S32 y, MASK mask)
+bool LLFloaterModelPreview::handleHover (S32 x, S32 y, MASK mask)
{
MASK local_mask = mask & ~MASK_ALT;
@@ -928,13 +933,13 @@ BOOL LLFloaterModelPreview::handleHover (S32 x, S32 y, MASK mask)
gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN);
}
- return TRUE;
+ return true;
}
//-----------------------------------------------------------------------------
// handleScrollWheel()
//-----------------------------------------------------------------------------
-BOOL LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
+bool LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
if (mPreviewRect.pointInRect(x, y) && mModelPreview)
{
@@ -945,7 +950,7 @@ BOOL LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
LLFloaterModelUploadBase::handleScrollWheel(x, y, clicks);
}
- return TRUE;
+ return true;
}
/*virtual*/
@@ -1198,7 +1203,7 @@ void LLFloaterModelPreview::initDecompControls()
else if (LLSpinCtrl* spinner = dynamic_cast<LLSpinCtrl*>(ctrl))
{
bool is_retain_ctrl = "Retain%" == name;
- double coefficient = is_retain_ctrl ? RETAIN_COEFFICIENT : 1.f;
+ float coefficient = is_retain_ctrl ? (F32)RETAIN_COEFFICIENT : 1.f;
spinner->setMinValue(param[i].mDetails.mRange.mLow.mFloat * coefficient);
spinner->setMaxValue(param[i].mDetails.mRange.mHigh.mFloat * coefficient);
@@ -1238,10 +1243,10 @@ void LLFloaterModelPreview::initDecompControls()
LLUICtrl* ctrl = getChild<LLUICtrl>(name);
if (LLSliderCtrl* slider = dynamic_cast<LLSliderCtrl*>(ctrl))
{
- slider->setMinValue(param[i].mDetails.mRange.mLow.mIntOrEnumValue);
- slider->setMaxValue(param[i].mDetails.mRange.mHigh.mIntOrEnumValue);
- slider->setIncrement(param[i].mDetails.mRange.mDelta.mIntOrEnumValue);
- slider->setValue(param[i].mDefault.mIntOrEnumValue);
+ slider->setMinValue((F32)param[i].mDetails.mRange.mLow.mIntOrEnumValue);
+ slider->setMaxValue((F32)param[i].mDetails.mRange.mHigh.mIntOrEnumValue);
+ slider->setIncrement((F32)param[i].mDetails.mRange.mDelta.mIntOrEnumValue);
+ slider->setValue((F32)param[i].mDefault.mIntOrEnumValue);
slider->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
}
else if (LLComboBox* combo_box = dynamic_cast<LLComboBox*>(ctrl))
@@ -1420,7 +1425,7 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)
LLModel* model = instance.mModel;
const LLMeshSkinInfo *skin = &model->mSkinInfo;
U32 joint_count = LLSkinningUtil::getMeshJointCount(skin);
- U32 bind_count = highlight_overrides ? skin->mAlternateBindMatrix.size() : 0; // simply do not include overrides if data is not needed
+ U32 bind_count = highlight_overrides ? static_cast<U32>(skin->mAlternateBindMatrix.size()) : 0; // simply do not include overrides if data is not needed
if (bind_count > 0 && bind_count != joint_count)
{
std::ostringstream out;
@@ -1544,7 +1549,7 @@ void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash
}
LLWString text = utf8str_to_wstring(str);
- S32 add_text_len = text.length() + 1; // newline
+ S32 add_text_len = static_cast<S32>(text.length()) + 1; // newline
S32 editor_max_len = mUploadLogText->getMaxTextLength();
if (add_text_len > editor_max_len)
{