summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/app_settings/settings.xml193
-rw-r--r--indra/newview/llfloatermodelpreview.cpp20
-rw-r--r--indra/newview/llmodelpreview.cpp70
-rw-r--r--indra/newview/llmodelpreview.h1
4 files changed, 41 insertions, 243 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index c1a2c0ff7a..b2d1d2e589 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -6661,188 +6661,6 @@
<key>Value</key>
<integer>600</integer>
</map>
- <key>MeshPreviewCanvasColor</key>
- <map>
- <key>Comment</key>
- <string>Canvas colour for the Mesh uploader</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Color4</string>
- <key>Value</key>
- <array>
- <real>0.169</real>
- <real>0.169</real>
- <real>0.169</real>
- <real>1.0</real>
- </array>
- </map>
- <key>MeshPreviewEdgeColor</key>
- <map>
- <key>Comment</key>
- <string>Edge colour for the Mesh uploader preview</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Color4</string>
- <key>Value</key>
- <array>
- <real>0.4</real>
- <real>0.4</real>
- <real>0.4</real>
- <real>1.0</real>
- </array>
- </map>
- <key>MeshPreviewBaseColor</key>
- <map>
- <key>Comment</key>
- <string>base diffuse colour for the Mesh uploader</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Color4</string>
- <key>Value</key>
- <array>
- <real>1.0</real>
- <real>1.0</real>
- <real>1.0</real>
- <real>1.0</real>
- </array>
- </map>
- <key>MeshPreviewBrightnessColor</key>
- <map>
- <key>Comment</key>
- <string>Brightness modifier</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Color3</string>
- <key>Value</key>
- <array>
- <real>0.9</real>
- <real>0.9</real>
- <real>0.9</real>
- </array>
- </map>
- <key>MeshPreviewEdgeWidth</key>
- <map>
- <key>Comment</key>
- <string>line thickness used when display edges is selected in mesh preview</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>1.0</real>
- </map>
- <key>MeshPreviewPhysicsEdgeColor</key>
- <map>
- <key>Comment</key>
- <string>Edge colour for the Mesh uploader physics preview</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Color4</string>
- <key>Value</key>
- <array>
- <real>0.0</real>
- <real>0.25</real>
- <real>0.5</real>
- <real>0.25</real>
- </array>
- </map>
- <key>MeshPreviewPhysicsFillColor</key>
- <map>
- <key>Comment</key>
- <string>Fill colour for the Mesh uploader physics preview</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Color4</string>
- <key>Value</key>
- <array>
- <real>0.0</real>
- <real>0.5</real>
- <real>1.0</real>
- <real>0.5</real>
- </array>
- </map>
- <key>MeshPreviewPhysicsEdgeWidth</key>
- <map>
- <key>Comment</key>
- <string>line thickness used when display physics is selected in mesh preview</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>1.0</real>
- </map>
- <key>MeshPreviewDegenerateEdgeColor</key>
- <map>
- <key>Comment</key>
- <string>Edge colour for the Mesh uploader Degenerate preview</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Color4</string>
- <key>Value</key>
- <array>
- <real>1.0</real>
- <real>0.0</real>
- <real>0.0</real>
- <real>1.0</real>
- </array>
- </map>
- <key>MeshPreviewDegenerateFillColor</key>
- <map>
- <key>Comment</key>
- <string>Fill colour for the Mesh uploader Degenerate preview</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Color4</string>
- <key>Value</key>
- <array>
- <real>1.0</real>
- <real>0.0</real>
- <real>0.0</real>
- <real>0.5</real>
- </array>
- </map>
- <key>MeshPreviewDegenerateEdgeWidth</key>
- <map>
- <key>Comment</key>
- <string>line thickness used when display Degenerate is selected in mesh preview</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>3.0</real>
- </map>
- <key>MeshPreviewDegeneratePointSize</key>
- <map>
- <key>Comment</key>
- <string>Large point size used to highlight degenerate triangle vertices in Mesh preview</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>8.0</real>
- </map>
- <key>MeshPreviewZoomLimit</key>
- <map>
- <key>Comment</key>
- <string>Maximum Zoom level in preview</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>10.0</real>
- </map>
<key>MigrateCacheDirectory</key>
<map>
<key>Comment</key>
@@ -8094,17 +7912,6 @@
<key>Value</key>
<integer>13</integer>
</map>
- <key>PreviewRenderSize</key>
- <map>
- <key>Comment</key>
- <string>Resolution of the image rendered for the mesh upload preview (must be a power of 2)</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>S32</string>
- <key>Value</key>
- <integer>1024</integer>
- </map>
<key>PreviewAmbientColor</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 9c62680dde..5df3139d0d 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -41,8 +41,6 @@
#include "llbutton.h"
#include "llcombobox.h"
#include "llfocusmgr.h"
-#include "llmatrix4a.h"
-#include "llmenubutton.h"
#include "llmeshrepository.h"
#include "llnotificationsutil.h"
#include "llsdutil_math.h"
@@ -50,23 +48,17 @@
#include "lltextbox.h"
#include "lltoolmgr.h"
#include "llui.h"
-#include "llvector4a.h"
#include "llviewerwindow.h"
#include "pipeline.h"
#include "llviewercontrol.h"
-#include "llviewermenufile.h"
+#include "llviewermenufile.h" //LLFilePickerThread
#include "llstring.h"
#include "llbutton.h"
#include "llcheckboxctrl.h"
-#include "llradiogroup.h"
-#include "llsdserialize.h"
#include "llsliderctrl.h"
#include "llspinctrl.h"
#include "lltabcontainer.h"
-#include "lltoggleablemenu.h"
#include "lltrans.h"
-#include "llvfile.h"
-#include "llvfs.h"
#include "llcallbacklist.h"
#include "llviewertexteditor.h"
#include "llviewernetwork.h"
@@ -88,6 +80,8 @@ const double RETAIN_COEFFICIENT = 100;
// 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;
class LLMeshFilePicker : public LLFilePickerThread
{
@@ -314,9 +308,9 @@ void LLFloaterModelPreview::initModelPreview()
S32 tex_width = 512;
S32 tex_height = 512;
- S32 max_width = llmin(gSavedSettings.getS32("PreviewRenderSize"), (S32)gPipeline.mScreenWidth);
- S32 max_height = llmin(gSavedSettings.getS32("PreviewRenderSize"), (S32)gPipeline.mScreenHeight);
-
+ S32 max_width = llmin(PREVIEW_RENDER_SIZE, (S32)gPipeline.mScreenWidth);
+ S32 max_height = llmin(PREVIEW_RENDER_SIZE, (S32)gPipeline.mScreenHeight);
+
while ((tex_width << 1) < max_width)
{
tex_width <<= 1;
@@ -327,7 +321,7 @@ void LLFloaterModelPreview::initModelPreview()
}
mModelPreview = new LLModelPreview(tex_width, tex_height, this);
- mModelPreview->setPreviewTarget(16.f);
+ mModelPreview->setPreviewTarget(PREVIEW_CAMERA_DISTANCE);
mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5));
mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::modelUpdated, this, _1));
}
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index 96af3b37d9..9260699985 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -26,17 +26,12 @@
#include "llviewerprecompiledheaders.h"
+#include "llmodelpreview.h"
+
#include "llmodelloader.h"
#include "lldaeloader.h"
#include "llfloatermodelpreview.h"
-#include "llmodelpreview.h"
-
-#include "llimagebmp.h"
-#include "llimagetga.h"
-#include "llimagejpeg.h"
-#include "llimagepng.h"
-
#include "llagent.h"
#include "llanimationstates.h"
#include "llcallbacklist.h"
@@ -76,6 +71,22 @@
bool LLModelPreview::sIgnoreLoadedCallback = false;
+// Extra configurability, to be exposed later in xml (LLModelPreview probably
+// should become UI control at some point or get split into preview control)
+static const LLColor4 PREVIEW_CANVAS_COL(0.169f, 0.169f, 0.169f, 1.f);
+static const LLColor4 PREVIEW_EDGE_COL(0.4f, 0.4f, 0.4f, 1.0);
+static const LLColor4 PREVIEW_BASE_COL(1.f, 1.f, 1.f, 1.f);
+static const LLColor3 PREVIEW_BRIGHTNESS(0.9f, 0.9f, 0.9f);
+static const F32 PREVIEW_EDGE_WIDTH(1.f);
+static const LLColor4 PREVIEW_PSYH_EDGE_COL(0.f, 0.25f, 0.5f, 0.25f);
+static const LLColor4 PREVIEW_PSYH_FILL_COL(0.f, 0.5f, 1.0f, 0.5f);
+static const F32 PREVIEW_PSYH_EDGE_WIDTH(1.f);
+static const LLColor4 PREVIEW_DEG_EDGE_COL(1.f, 0.f, 0.f, 1.f);
+static const LLColor4 PREVIEW_DEG_FILL_COL(1.f, 0.f, 0.f, 0.5f);
+static const F32 PREVIEW_DEG_EDGE_WIDTH(3.f);
+static const F32 PREVIEW_DEG_POINT_SIZE(8.f);
+static const F32 PREVIEW_ZOOM_LIMIT(10.f);
+
const F32 SKIN_WEIGHT_CAMERA_DISTANCE = 16.f;
BOOL stop_gloderror()
@@ -2677,20 +2688,6 @@ BOOL LLModelPreview::render()
bool textures = mViewOption["show_textures"];
bool physics = mViewOption["show_physics"];
- // Extra configurability, to be exposed later as controls?
- static LLCachedControl<LLColor4> canvas_col(gSavedSettings, "MeshPreviewCanvasColor");
- static LLCachedControl<LLColor4> edge_col(gSavedSettings, "MeshPreviewEdgeColor");
- static LLCachedControl<LLColor4> base_col(gSavedSettings, "MeshPreviewBaseColor");
- static LLCachedControl<LLColor3> brightness(gSavedSettings, "MeshPreviewBrightnessColor");
- static LLCachedControl<F32> edge_width(gSavedSettings, "MeshPreviewEdgeWidth");
- static LLCachedControl<LLColor4> phys_edge_col(gSavedSettings, "MeshPreviewPhysicsEdgeColor");
- static LLCachedControl<LLColor4> phys_fill_col(gSavedSettings, "MeshPreviewPhysicsFillColor");
- static LLCachedControl<F32> phys_edge_width(gSavedSettings, "MeshPreviewPhysicsEdgeWidth");
- static LLCachedControl<LLColor4> deg_edge_col(gSavedSettings, "MeshPreviewDegenerateEdgeColor");
- static LLCachedControl<LLColor4> deg_fill_col(gSavedSettings, "MeshPreviewDegenerateFillColor");
- static LLCachedControl<F32> deg_edge_width(gSavedSettings, "MeshPreviewDegenerateEdgeWidth");
- static LLCachedControl<F32> deg_point_size(gSavedSettings, "MeshPreviewDegeneratePointSize");
-
S32 width = getWidth();
S32 height = getHeight();
@@ -2714,7 +2711,7 @@ BOOL LLModelPreview::render()
gGL.pushMatrix();
gGL.loadIdentity();
- gGL.color4fv(static_cast<LLColor4>(canvas_col).mV);
+ gGL.color4fv(PREVIEW_CANVAS_COL.mV);
gl_rect_2d_simple(width, height);
gGL.matrixMode(LLRender::MM_PROJECTION);
@@ -2884,7 +2881,7 @@ BOOL LLModelPreview::render()
stop_glerror();
gGL.pushMatrix();
- gGL.color4fv(edge_col().mV);
+ gGL.color4fv(PREVIEW_EDGE_COL.mV);
const U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
@@ -2969,15 +2966,15 @@ BOOL LLModelPreview::render()
}
else
{
- gGL.diffuseColor4fv(static_cast<LLColor4>(base_col).mV);
+ gGL.diffuseColor4fv(PREVIEW_BASE_COL.mV);
}
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.diffuseColor4fv(static_cast<LLColor4>(edge_col).mV);
+ gGL.diffuseColor4fv(PREVIEW_EDGE_COL.mV);
if (edges)
{
- glLineWidth(edge_width);
+ glLineWidth(PREVIEW_EDGE_WIDTH);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -3088,13 +3085,13 @@ BOOL LLModelPreview::render()
LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i];
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.diffuseColor4fv(phys_fill_col().mV);
+ gGL.diffuseColor4fv(PREVIEW_PSYH_FILL_COL.mV);
buffer->setBuffer(type_mask & buffer->getTypeMask());
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0);
- gGL.diffuseColor4fv(phys_edge_col().mV);
- glLineWidth(phys_edge_width);
+ gGL.diffuseColor4fv(PREVIEW_PSYH_EDGE_COL.mV);
+ glLineWidth(PREVIEW_PSYH_EDGE_WIDTH);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0);
@@ -3109,8 +3106,8 @@ BOOL LLModelPreview::render()
// only do this if mDegenerate was set in the preceding mesh checks [Check this if the ordering ever breaks]
if (pass > 0 && mHasDegenerate)
{
- glLineWidth(deg_edge_width);
- glPointSize(deg_point_size);
+ glLineWidth(PREVIEW_DEG_EDGE_WIDTH);
+ glPointSize(PREVIEW_DEG_POINT_SIZE);
gPipeline.enableLightsFullbright();
//show degenerate triangles
LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
@@ -3174,11 +3171,11 @@ BOOL LLModelPreview::render()
if (ll_is_degenerate(v1, v2, v3))
{
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- gGL.diffuseColor3fv(deg_edge_col().mV);
+ gGL.diffuseColor3fv(PREVIEW_DEG_EDGE_COL.mV);
buffer->drawRange(LLRender::TRIANGLES, 0, 2, 3, indices_offset);
buffer->drawRange(LLRender::POINTS, 0, 2, 3, indices_offset);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- gGL.diffuseColor3fv(deg_fill_col().mV);
+ gGL.diffuseColor3fv(PREVIEW_DEG_FILL_COL.mV);
buffer->drawRange(LLRender::TRIANGLES, 0, 2, 3, indices_offset);
}
}
@@ -3326,8 +3323,8 @@ BOOL LLModelPreview::render()
if (edges)
{
- gGL.diffuseColor4fv(edge_col().mV);
- glLineWidth(edge_width);
+ gGL.diffuseColor4fv(PREVIEW_EDGE_COL.mV);
+ glLineWidth(PREVIEW_EDGE_WIDTH);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -3403,8 +3400,7 @@ void LLModelPreview::zoom(F32 zoom_amt)
{
F32 new_zoom = mCameraZoom + zoom_amt;
// TODO: stop clamping in render
- static LLCachedControl<F32> zoom_limit(gSavedSettings, "MeshPreviewZoomLimit");
- mCameraZoom = llclamp(new_zoom, 1.f, zoom_limit());
+ mCameraZoom = llclamp(new_zoom, 1.f, PREVIEW_ZOOM_LIMIT);
}
void LLModelPreview::pan(F32 right, F32 up)
diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h
index 7a7b8615f9..4c03849d6b 100644
--- a/indra/newview/llmodelpreview.h
+++ b/indra/newview/llmodelpreview.h
@@ -31,6 +31,7 @@
#include "lldynamictexture.h"
#include "llfloatermodelpreview.h"
#include "llmeshrepository.h"
+#include "llmodelloader.h" //NUM_LOD
#include "llmodel.h"
class LLJoint;