From 3b932c27b7b1009ef404da5a7e0613d9cd3e7bf5 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 3 Jan 2019 00:35:38 +0200 Subject: SL-10288 Mesh uploader changes from Firestorm --- indra/newview/app_settings/settings.xml | 199 ++++++++++++++++++++- .../shaders/class1/objects/previewV.glsl | 8 +- 2 files changed, 199 insertions(+), 8 deletions(-) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3ad8b6cded..a58fa2d7a0 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6628,8 +6628,189 @@ Value 600 - MigrateCacheDirectory - + MeshPreviewCanvasColor + + Comment + Canvas colour for the Mesh uploader + Persist + 1 + Type + Color4 + Value + + 0.169 + 0.169 + 0.169 + 1.0 + + + MeshPreviewEdgeColor + + Comment + Edge colour for the Mesh uploader preview + Persist + 1 + Type + Color4 + Value + + 0.4 + 0.4 + 0.4 + 1.0 + + + MeshPreviewBaseColor + + Comment + base diffuse colour for the Mesh uploader + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + MeshPreviewBrightnessColor + + Comment + Brightness modifier + Persist + 1 + Type + Color3 + Value + + 0.9 + 0.9 + 0.9 + + + MeshPreviewEdgeWidth + + Comment + line thickness used when display edges is selected in mesh preview + Persist + 1 + Type + F32 + Value + 1.0 + + MeshPreviewPhysicsEdgeColor + + Comment + Edge colour for the Mesh uploader physics preview + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.25 + 0.5 + 0.25 + + + MeshPreviewPhysicsFillColor + + Comment + Fill colour for the Mesh uploader physics preview + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.5 + 1.0 + 0.5 + + + MeshPreviewPhysicsEdgeWidth + + Comment + line thickness used when display physics is selected in mesh preview + Persist + 1 + Type + F32 + Value + 1.0 + + MeshPreviewDegenerateEdgeColor + + Comment + Edge colour for the Mesh uploader Degenerate preview + Persist + 1 + Type + Color4 + Value + + 1.0 + 0.0 + 0.0 + 1.0 + + + MeshPreviewDegenerateFillColor + + Comment + Fill colour for the Mesh uploader Degenerate preview + Persist + 1 + Type + Color4 + Value + + 1.0 + 0.0 + 0.0 + 0.5 + + + MeshPreviewDegenerateEdgeWidth + + Comment + line thickness used when display Degenerate is selected in mesh preview + Persist + 1 + Type + F32 + Value + 3.0 + + MeshPreviewDegeneratePointSize + + Comment + Large point size used to highlight degenerate triangle vertices in Mesh preview + Persist + 1 + Type + F32 + Value + 8.0 + + MeshPreviewZoomLimit + + Comment + Maximum Zoom level in preview + Persist + 1 + Type + F32 + Value + 10.0 + + Comment Check for old version of disk cache to migrate to current location Persist @@ -7868,7 +8049,17 @@ Value 13 - + PreviewRenderSize + + Comment + Resolution of the image rendered for the mesh upload preview + Persist + 1 + Type + S32 + Value + 1024 + PreviewAmbientColor Comment @@ -7885,8 +8076,6 @@ 1.0 - - PreviewDiffuse0 Comment diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl index 7f3f84398b..3424613e94 100644 --- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -91,8 +91,10 @@ void main() // Collect normal lights (need to be divided by two, as we later multiply by 2) col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz); - col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z); - col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z); - +// col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z); + col.rgb += light_diffuse[2].rgb * calcDirectionalLight(norm, light_position[2].xyz); +// col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z); + col.rgb += light_diffuse[3].rgb * calcDirectionalLight(norm, light_position[3].xyz); + col /= 2.0; vertex_color = col*color; } -- cgit v1.3 From c9d0222526c422ee7a5bff140b034e88aa5d0b39 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 3 Jan 2019 01:19:41 +0200 Subject: SL-10288 settings.xml fix --- indra/newview/app_settings/settings.xml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a58fa2d7a0..091992d1ab 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6810,6 +6810,7 @@ Value 10.0 + MigrateCacheDirectory Comment Check for old version of disk cache to migrate to current location @@ -16469,3 +16470,4 @@ + -- cgit v1.3 From dd3a3693729cc700872a6e94e0ae4898cf25c3fb Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 3 Jan 2019 14:30:01 +0200 Subject: SL-10288 comments cleanup --- .../shaders/class1/objects/previewV.glsl | 2 - indra/newview/lldynamictexture.cpp | 15 +-- indra/newview/llfloatermodelpreview.cpp | 118 ++++----------------- 3 files changed, 21 insertions(+), 114 deletions(-) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl index 3424613e94..de2ea2a065 100644 --- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -91,9 +91,7 @@ void main() // Collect normal lights (need to be divided by two, as we later multiply by 2) col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz); -// col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z); col.rgb += light_diffuse[2].rgb * calcDirectionalLight(norm, light_position[2].xyz); -// col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z); col.rgb += light_diffuse[3].rgb * calcDirectionalLight(norm, light_position[3].xyz); col /= 2.0; vertex_color = col*color; diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index af6977d3cd..e180d91461 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -125,17 +125,11 @@ BOOL LLViewerDynamicTexture::render() //----------------------------------------------------------------------------- void LLViewerDynamicTexture::preRender(BOOL clear_depth) { - // changes to support higher resolution rendering in the preview - ////only images up to 512x512 are supported - //llassert(mFullHeight <= 512); - //llassert(mFullWidth <= 512); gPipeline.allocatePhysicsBuffer(); llassert(mFullWidth <= static_cast(gPipeline.mPhysicsDisplay.getWidth())); llassert(mFullHeight <= static_cast(gPipeline.mPhysicsDisplay.getHeight())); -// if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI) if (gGLManager.mHasFramebufferObject && gPipeline.mPhysicsDisplay.isComplete() && !gGLManager.mIsATI) -// { //using offscreen render target, just use the bottom left corner mOrigin.set(0, 0); } @@ -221,15 +215,13 @@ BOOL LLViewerDynamicTexture::updateAllInstances() { return TRUE; } - // changes to support higher resolution rendering in the preview - // bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI; + bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mPhysicsDisplay.isComplete() && !gGLManager.mIsATI; if (use_fbo) { -// gPipeline.mWaterDis.bindTarget(); gPipeline.mPhysicsDisplay.bindTarget(); } - // + LLGLSLShader::bindNoShader(); LLVertexBuffer::unbind(); @@ -265,10 +257,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances() if (use_fbo) { - // changes to support higher resolution rendering in the preview - // gPipeline.mWaterDis.flush(); gPipeline.mPhysicsDisplay.flush(); - // } return ret; diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 78d97753d3..ffc993e868 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -427,11 +427,8 @@ void LLFloaterModelPreview::initModelPreview() { delete mModelPreview; } - // mesh uploader changes to allow higher resolution render - // mModelPreview = new LLModelPreview(512, 512, this); auto size = gSavedSettings.getS32("PreviewRenderSize"); mModelPreview = new LLModelPreview(size, size, this ); - // mModelPreview->setPreviewTarget(16.f); mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5)); mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, _1)); @@ -441,8 +438,6 @@ void LLFloaterModelPreview::onViewOptionChecked(LLUICtrl* ctrl) { if (mModelPreview) { - // only show explode when phsyics is on - // mModelPreview->mViewOption[ctrl->getName()] = !mModelPreview->mViewOption[ctrl->getName()]; auto name = ctrl->getName(); mModelPreview->mViewOption[name] = !mModelPreview->mViewOption[name]; if (name == "show_physics") @@ -664,7 +659,6 @@ void LLFloaterModelPreview::onLODParamCommit(S32 lod, bool enforce_tri_limit) } } -// extracted method to simplify changes in layout void LLFloaterModelPreview::draw3dPreview() { gGL.color3f(1.f, 1.f, 1.f); @@ -1266,7 +1260,7 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) , mResetJoints( false ) , mModelNoErrors( true ) , mLastJointUpdate( false ) -, mHasDegenerate( false ) // +, mHasDegenerate( false ) { mNeedsUpdate = TRUE; mCameraDistance = 0.f; @@ -2759,7 +2753,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim void LLModelPreview::updateStatusMessages() { -// bit mask values for physics errors. used to prevent overwrite of single line status +// bit mask values for physics errors. used to prevent overwrite of single line status // TODO: use this to provied multiline status enum PhysicsError { @@ -2769,10 +2763,10 @@ void LLModelPreview::updateStatusMessages() TOOMANYHULLS=4, TOOMANYVERTSINHULL=8 }; -// + assert_main_thread(); - U32 has_physics_error{ PhysicsError::NONE }; // physics error bitmap + U32 has_physics_error{ PhysicsError::NONE }; // physics error bitmap //triangle/vertex/submesh count for each mesh asset for each lod std::vector tris[LLModel::NUM_LODS]; std::vector verts[LLModel::NUM_LODS]; @@ -2861,38 +2855,25 @@ void LLModelPreview::updateStatusMessages() { mMaxTriangleLimit = total_tris[LLModel::LOD_HIGH]; } - // make has_degenerate a member so that we can use it in the render method - // has_degenerate = false + mHasDegenerate = false; {//check for degenerate triangles in physics mesh U32 lod = LLModel::LOD_PHYSICS; const LLVector4a scale(0.5f); - for (U32 i = 0; i < mModel[lod].size() && !mHasDegenerate; ++i)// make has_degenerate a member + for (U32 i = 0; i < mModel[lod].size() && !mHasDegenerate; ++i) { //for each model in the lod if (mModel[lod][i] && mModel[lod][i]->mPhysics.mHull.empty()) { //no decomp exists S32 cur_submeshes = mModel[lod][i]->getNumVolumeFaces(); - for (S32 j = 0; j < cur_submeshes && !mHasDegenerate; ++j)// make has_degenerate a member + for (S32 j = 0; j < cur_submeshes && !mHasDegenerate; ++j) { //for each submesh (face), add triangles and vertices to current total LLVolumeFace& face = mModel[lod][i]->getVolumeFace(j); - for (S32 k = 0; (k < face.mNumIndices) && !mHasDegenerate; )// make has_degenerate a member + for (S32 k = 0; (k < face.mNumIndices) && !mHasDegenerate; ) { U16 index_a = face.mIndices[k + 0]; U16 index_b = face.mIndices[k + 1]; U16 index_c = face.mIndices[k + 2]; - // FIRE-23367/23387 - Allow forced empty triangle placeholders created by the LOD processing. - // LLVector4a v1; v1.setMul(face.mPositions[index_a], scale); - // LLVector4a v2; v2.setMul(face.mPositions[index_b], scale); - // LLVector4a v3; v3.setMul(face.mPositions[index_c], scale); - - // if (ll_is_degenerate(v1, v2, v3)) - // { - // mHasDegenerate = true;// make has_degenerate a member - // } - // else - // { - // k += 3; - // } + if (index_c == 0 && index_b == 0 && index_a == 0) // test in reverse as 3rd index is less likely to be 0 in a normal case { LL_DEBUGS("MeshValidation") << "Empty placeholder triangle (3 identical index 0 verts) ignored" << LL_ENDL; @@ -2904,7 +2885,7 @@ void LLModelPreview::updateStatusMessages() LLVector4a v3; v3.setMul(face.mPositions[index_c], scale); if (ll_is_degenerate(v1, v2, v3)) { - mHasDegenerate = true;// make has_degenerate a member + mHasDegenerate = true; } } k += 3; @@ -2914,7 +2895,7 @@ void LLModelPreview::updateStatusMessages() } } - // flag degenerates here rather than deferring to a MAV error later + // flag degenerates here rather than deferring to a MAV error later mFMP->childSetVisible("physics_status_message_text", mHasDegenerate); //display or clear auto degenerateIcon = mFMP->getChild("physics_status_message_icon"); degenerateIcon->setVisible(mHasDegenerate); @@ -2925,7 +2906,6 @@ void LLModelPreview::updateStatusMessages() LLUIImagePtr img = LLUI::getUIImage("ModelImport_Status_Error"); degenerateIcon->setImage(img); } - // mFMP->childSetTextArg("submeshes_info", "[SUBMESHES]", llformat("%d", total_submeshes[LLModel::LOD_HIGH])); @@ -3095,12 +3075,7 @@ void LLModelPreview::updateStatusMessages() mModelNoErrors = false; } } - // Improve the error checking the TO DO here is no longer applicable but not an FS comment so edited to stop it being picked up - //// To do investigate use of has_degenerate and include into mModelNoErrors upload blocking mechanics - //// current use of has_degenerate won't block upload permanently - later checks will restore the button - //if (!mModelNoErrors || mHasDegenerate) - //{ - // mFMP->childDisable("ok_btn"); + if (!mModelNoErrors || mHasDegenerate) { mFMP->childDisable("ok_btn"); @@ -3725,7 +3700,7 @@ BOOL LLModelPreview::render() bool textures = mViewOption["show_textures"]; bool physics = mViewOption["show_physics"]; - // Extra configurability, to be exposed later as controls? + // Extra configurability, to be exposed later as controls? static LLCachedControl canvas_col(gSavedSettings, "MeshPreviewCanvasColor"); static LLCachedControl edge_col(gSavedSettings, "MeshPreviewEdgeColor"); static LLCachedControl base_col(gSavedSettings, "MeshPreviewBaseColor"); @@ -3738,16 +3713,12 @@ BOOL LLModelPreview::render() static LLCachedControl deg_fill_col(gSavedSettings, "MeshPreviewDegenerateFillColor"); static LLCachedControl deg_edge_width(gSavedSettings, "MeshPreviewDegenerateEdgeWidth"); static LLCachedControl deg_point_size(gSavedSettings, "MeshPreviewDegeneratePointSize"); - // + S32 width = getWidth(); S32 height = getHeight(); LLGLSUIDefault def; LLGLDisable no_blend(GL_BLEND); -// Clean up render of mesh preview -// LLGLEnable blend(GL_BLEND); -// gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); -// LLGLEnable cull(GL_CULL_FACE); LLGLDepthTest depth(GL_TRUE); @@ -3767,8 +3738,7 @@ BOOL LLModelPreview::render() gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); gGL.loadIdentity(); - // uploader improvements - //gGL.color4f(0.169f, 0.169f, 0.169f, 1.f); + gGL.color4fv(static_cast(canvas_col).mV); gl_rect_2d_simple( width, height ); @@ -3917,11 +3887,7 @@ BOOL LLModelPreview::render() stop_glerror(); gGL.pushMatrix(); - // mesh uploader improvements configurable brightness - //const F32 BRIGHTNESS = 0.9f; - //gGL.color3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS); gGL.color4fv(edge_col().mV); - // const U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0; @@ -4006,19 +3972,12 @@ BOOL LLModelPreview::render() } else { - // improved mesh uploader - // gGL.diffuseColor4f(1,1,1,1); gGL.diffuseColor4fv(static_cast(base_col).mV); - // - } buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - // improved mesh uploader - //gGL.diffuseColor3f(0.4f, 0.4f, 0.4f); gGL.diffuseColor4fv(static_cast(edge_col).mV); - // if (edges) { glLineWidth(edge_width); @@ -4033,25 +3992,10 @@ BOOL LLModelPreview::render() if (physics) { - // model upload improvements - use the settings - ////Vector4a physicsFillColour(0.4, 0.4, 0.4, 0.4); - //const LLColor4 physicsFillColour(0.0, 0.5, 1.0, 0.5); - ////LLVector4a physicsEdgeColour(1.0, 1.0, 0.0, 1.0); - //const LLColor4 physicsEdgeColour=physicsFillColour*0.5; - //const LLColor4 degenerateFill(1.0, 0.0, 0.0, 0.5); - //const LLColor4 degenerateEdge(1.0,0.0,0.0,1.0); - // - glClear(GL_DEPTH_BUFFER_BIT); - // refactor to remove silly variable names - // for (U32 i = 0; i < 2; i++) for (U32 pass = 0; pass < 2; pass++) - // { - // refactor to remove silly variable names - //if (i == 0) if (pass == 0) - // { //depth only pass gGL.setColorMask(false, false); } @@ -4061,10 +4005,7 @@ BOOL LLModelPreview::render() } //enable alpha blending on second pass but not first pass - // refactor to remove silly variable names - //LLGLState blend(GL_BLEND, i); LLGLState blend(GL_BLEND, pass); - // gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); @@ -4168,16 +4109,11 @@ BOOL LLModelPreview::render() gGL.popMatrix(); } - // refactor to remove silly variable names - // also only do this if mDegenerate was set in the preceding mesh checks [Check this if the ordering ever breaks] - //if (i > 0) + // 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); -// This single line is why the degenerate triangles display has been crap forever. -// gPipeline.enableLightsFullbright(LLColor4::white); //show degenerate triangles LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); LLGLDisable cull(GL_CULL_FACE); @@ -4215,13 +4151,10 @@ BOOL LLModelPreview::render() } auto num_degenerate = 0; - // More nested i variable silliness - // for (U32 i = 0; i < mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); ++i) auto num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); for (U32 v = 0; v < num_models; ++v) { LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][v]; - // if(buffer->getNumVerts() < 3)continue; buffer->setBuffer(type_mask & buffer->getTypeMask()); @@ -4234,7 +4167,6 @@ BOOL LLModelPreview::render() buffer->getIndexStrider(idx, 0); LLVector4a v1, v2, v3; - // rename inner most i to avoid merge confusion for (U32 indices_offset = 0; indices_offset < buffer->getNumIndices(); indices_offset += 3) { v1.setMul(pos[*idx++], scale); @@ -4345,8 +4277,6 @@ BOOL LLModelPreview::render() } buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0); - // configurable colour and width - //gGL.diffuseColor3f(0.4f, 0.4f, 0.4f); if (edges) { @@ -4357,7 +4287,6 @@ BOOL LLModelPreview::render() glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glLineWidth(1.f); } - // } } } @@ -4415,11 +4344,9 @@ void LLModelPreview::rotate(F32 yaw_radians, F32 pitch_radians) void LLModelPreview::zoom(F32 zoom_amt) { F32 new_zoom = mCameraZoom+zoom_amt; - // add configurable zoom TODO: stop clamping in render - // mCameraZoom = llclamp(new_zoom, 1.f, 10.f); + // TODO: stop clamping in render static LLCachedControl zoom_limit(gSavedSettings, "MeshPreviewZoomLimit"); mCameraZoom = llclamp(new_zoom, 1.f, zoom_limit()); - // } void LLModelPreview::pan(F32 right, F32 up) @@ -4625,12 +4552,6 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible) childSetTextArg("server_weight", "[SIM]", tbd); childSetTextArg("physics_weight", "[PH]", tbd); childSetTextArg("upload_fee", "[FEE]", tbd); - // add extended info fields - //childSetTextArg("price_breakdown", "[STREAMING]", dashes); - //childSetTextArg("price_breakdown", "[PHYSICS]", dashes); - //childSetTextArg("price_breakdown", "[INSTANCES]", dashes); - //childSetTextArg("price_breakdown", "[TEXTURES]", dashes); - //childSetTextArg("price_breakdown", "[MODEL]", dashes); std::string dashes = hasString("--") ? getString("--") : "--"; childSetTextArg("price_breakdown", "[STREAMING]", dashes); childSetTextArg("price_breakdown", "[PHYSICS]", dashes); @@ -4640,7 +4561,6 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible) childSetTextArg("physics_breakdown", "[PCH]", dashes); childSetTextArg("physics_breakdown", "[PM]", dashes); childSetTextArg("physics_breakdown", "[PHU]", dashes); - // } } @@ -4690,7 +4610,7 @@ void LLFloaterModelPreview::handleModelPhysicsFeeReceived() childSetTextArg("price_breakdown", "[INSTANCES]", llformat("%d", result["upload_price_breakdown"]["mesh_instance"].asInteger())); childSetTextArg("price_breakdown", "[TEXTURES]", llformat("%d", result["upload_price_breakdown"]["texture"].asInteger())); childSetTextArg("price_breakdown", "[MODEL]", llformat("%d", result["upload_price_breakdown"]["model"].asInteger())); -// Updates for enhanced Mesh feedback at upload + childSetTextArg("physics_breakdown", "[PCH]", llformat("%0.3f", result["model_physics_cost"]["hull"].asReal())); childSetTextArg("physics_breakdown", "[PM]", llformat("%0.3f", result["model_physics_cost"]["mesh"].asReal())); childSetTextArg("physics_breakdown", "[PHU]", llformat("%0.3f", result["model_physics_cost"]["decomposition"].asReal())); @@ -4699,7 +4619,7 @@ void LLFloaterModelPreview::handleModelPhysicsFeeReceived() childSetTextArg("streaming_breakdown", "[STR_MED]", llformat("%d", result["streaming_params"]["medium_lod"].asInteger())); childSetTextArg("streaming_breakdown", "[STR_LOW]", llformat("%d", result["streaming_params"]["low_lod"].asInteger())); childSetTextArg("streaming_breakdown", "[STR_LOWEST]", llformat("%d", result["streaming_params"]["lowest_lod"].asInteger())); -// + childSetVisible("upload_fee", true); childSetVisible("price_breakdown", true); mUploadBtn->setEnabled(isModelUploadAllowed()); -- cgit v1.3 From e906af7c3c6e4efd84b344c9572167f6ddf836fc Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 11 Jan 2019 17:39:26 +0200 Subject: SL-10327 FIXED Scalable preview of mesh model is shown with black bar on top in the Upload Model menu --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llfloatermodelpreview.cpp | 19 +++++++++++++++++-- .../skins/default/xui/en/floater_model_preview.xml | 8 +++----- 3 files changed, 21 insertions(+), 8 deletions(-) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 091992d1ab..76cfc03b53 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8053,7 +8053,7 @@ PreviewRenderSize Comment - Resolution of the image rendered for the mesh upload preview + Resolution of the image rendered for the mesh upload preview (must be a power of 2) Persist 1 Type diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index ffc993e868..62157306b1 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -427,8 +427,23 @@ void LLFloaterModelPreview::initModelPreview() { delete mModelPreview; } - auto size = gSavedSettings.getS32("PreviewRenderSize"); - mModelPreview = new LLModelPreview(size, size, this ); + + 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); + + while ((tex_width << 1) <= max_width) + { + tex_width <<= 1; + } + while ((tex_height << 1) <= max_height) + { + tex_height <<= 1; + } + + mModelPreview = new LLModelPreview(tex_width, tex_height, this); mModelPreview->setPreviewTarget(16.f); mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5)); mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, _1)); diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index ec9104d5e7..1b038a0244 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -1520,7 +1520,6 @@ Analysed: name="right_panel" top="0" left="640" - background_visible="true" width="375"> Preview Spread: @@ -1624,8 +1622,8 @@ Analysed: name="physics_explode" follows="right|bottom" valign="center" - top="15" - left="80" + left="105" + top_delta="-3" min_val="0.0" max_val="3.0" height="20" -- cgit v1.3 From d38fd1e7c3a48260f670e135501bba68d9d4dc51 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 21 Apr 2020 18:55:29 +0300 Subject: SL-13081 Model is unnaturally grey --- indra/newview/app_settings/shaders/class1/objects/previewV.glsl | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl index 2cf17acf6b..4bb588335a 100644 --- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -93,6 +93,5 @@ void main() col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz); col.rgb += light_diffuse[2].rgb*calcLocalLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z); col.rgb += light_diffuse[3].rgb*calcLocalLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z); - col /= 2.0; vertex_color = col*color; } -- cgit v1.3 From 72ba7f1dad43306a761b35dc984734dae04c1c6d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 22 Apr 2020 20:55:57 +0300 Subject: SL-13077 remove floater specific variables from settings.xml --- indra/newview/app_settings/settings.xml | 193 -------------------------------- indra/newview/llfloatermodelpreview.cpp | 20 ++-- indra/newview/llmodelpreview.cpp | 70 ++++++------ indra/newview/llmodelpreview.h | 1 + 4 files changed, 41 insertions(+), 243 deletions(-) (limited to 'indra/newview/app_settings') 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 @@ Value 600 - MeshPreviewCanvasColor - - Comment - Canvas colour for the Mesh uploader - Persist - 1 - Type - Color4 - Value - - 0.169 - 0.169 - 0.169 - 1.0 - - - MeshPreviewEdgeColor - - Comment - Edge colour for the Mesh uploader preview - Persist - 1 - Type - Color4 - Value - - 0.4 - 0.4 - 0.4 - 1.0 - - - MeshPreviewBaseColor - - Comment - base diffuse colour for the Mesh uploader - Persist - 1 - Type - Color4 - Value - - 1.0 - 1.0 - 1.0 - 1.0 - - - MeshPreviewBrightnessColor - - Comment - Brightness modifier - Persist - 1 - Type - Color3 - Value - - 0.9 - 0.9 - 0.9 - - - MeshPreviewEdgeWidth - - Comment - line thickness used when display edges is selected in mesh preview - Persist - 1 - Type - F32 - Value - 1.0 - - MeshPreviewPhysicsEdgeColor - - Comment - Edge colour for the Mesh uploader physics preview - Persist - 1 - Type - Color4 - Value - - 0.0 - 0.25 - 0.5 - 0.25 - - - MeshPreviewPhysicsFillColor - - Comment - Fill colour for the Mesh uploader physics preview - Persist - 1 - Type - Color4 - Value - - 0.0 - 0.5 - 1.0 - 0.5 - - - MeshPreviewPhysicsEdgeWidth - - Comment - line thickness used when display physics is selected in mesh preview - Persist - 1 - Type - F32 - Value - 1.0 - - MeshPreviewDegenerateEdgeColor - - Comment - Edge colour for the Mesh uploader Degenerate preview - Persist - 1 - Type - Color4 - Value - - 1.0 - 0.0 - 0.0 - 1.0 - - - MeshPreviewDegenerateFillColor - - Comment - Fill colour for the Mesh uploader Degenerate preview - Persist - 1 - Type - Color4 - Value - - 1.0 - 0.0 - 0.0 - 0.5 - - - MeshPreviewDegenerateEdgeWidth - - Comment - line thickness used when display Degenerate is selected in mesh preview - Persist - 1 - Type - F32 - Value - 3.0 - - MeshPreviewDegeneratePointSize - - Comment - Large point size used to highlight degenerate triangle vertices in Mesh preview - Persist - 1 - Type - F32 - Value - 8.0 - - MeshPreviewZoomLimit - - Comment - Maximum Zoom level in preview - Persist - 1 - Type - F32 - Value - 10.0 - MigrateCacheDirectory Comment @@ -8094,17 +7912,6 @@ Value 13 - PreviewRenderSize - - Comment - Resolution of the image rendered for the mesh upload preview (must be a power of 2) - Persist - 1 - Type - S32 - Value - 1024 - PreviewAmbientColor Comment 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 canvas_col(gSavedSettings, "MeshPreviewCanvasColor"); - static LLCachedControl edge_col(gSavedSettings, "MeshPreviewEdgeColor"); - static LLCachedControl base_col(gSavedSettings, "MeshPreviewBaseColor"); - static LLCachedControl brightness(gSavedSettings, "MeshPreviewBrightnessColor"); - static LLCachedControl edge_width(gSavedSettings, "MeshPreviewEdgeWidth"); - static LLCachedControl phys_edge_col(gSavedSettings, "MeshPreviewPhysicsEdgeColor"); - static LLCachedControl phys_fill_col(gSavedSettings, "MeshPreviewPhysicsFillColor"); - static LLCachedControl phys_edge_width(gSavedSettings, "MeshPreviewPhysicsEdgeWidth"); - static LLCachedControl deg_edge_col(gSavedSettings, "MeshPreviewDegenerateEdgeColor"); - static LLCachedControl deg_fill_col(gSavedSettings, "MeshPreviewDegenerateFillColor"); - static LLCachedControl deg_edge_width(gSavedSettings, "MeshPreviewDegenerateEdgeWidth"); - static LLCachedControl 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(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(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(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 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; -- cgit v1.3