summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorcosmic-linden <111533034+cosmic-linden@users.noreply.github.com>2024-03-06 13:46:16 -0800
committerGitHub <noreply@github.com>2024-03-06 13:46:16 -0800
commit4195e355933fdba9c34040688e837e856763b81a (patch)
treea3894b2beaf4d4bb265d502f32a2a196bb07d9fc /indra/newview
parent89b48796271f48c8b89e7981095bed4acf825a0f (diff)
parent0cf4141d7dddfcaf5399bc99306a7426b561953c (diff)
Merge pull request #927 from secondlife/v-712
PBR Terrain UI second pass
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterregioninfo.cpp281
-rw-r--r--indra/newview/llfloaterregioninfo.h7
-rw-r--r--indra/newview/llvlcomposition.cpp36
-rw-r--r--indra/newview/llvlcomposition.h11
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_terrain.xml45
5 files changed, 212 insertions, 168 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 8b335d57d7..6e8e37621e 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -86,7 +86,6 @@
#include "llviewerstats.h"
#include "llviewertexteditor.h"
#include "llviewerwindow.h"
-#include "llvlcomposition.h"
#include "lltrans.h"
#include "llagentui.h"
#include "llmeshrepository.h"
@@ -100,7 +99,6 @@
#include "llavatarnamecache.h"
#include "llenvironment.h"
-const S32 TERRAIN_TEXTURE_COUNT = 4;
const S32 CORNER_COUNT = 4;
const U32 MAX_LISTED_NAMES = 100;
@@ -340,7 +338,6 @@ void LLFloaterRegionInfo::onRegionChanged()
}
}
-// static
void LLFloaterRegionInfo::requestRegionInfo()
{
LLTabContainer* tab = findChild<LLTabContainer>("region_panels");
@@ -605,24 +602,14 @@ LLPanelRegionEnvironment* LLFloaterRegionInfo::getPanelEnvironment()
return panel;
}
-enum class TerrainMaterialType
+LLTerrainMaterials::Type material_type_from_ctrl(LLCheckBoxCtrl* ctrl)
{
- TEXTURE,
- PBR_MATERIAL,
- COUNT
-};
+ return ctrl->get() ? LLTerrainMaterials::Type::PBR : LLTerrainMaterials::Type::TEXTURE;
+}
-TerrainMaterialType material_type_from_index(S32 index)
+void material_type_to_ctrl(LLCheckBoxCtrl* ctrl, LLTerrainMaterials::Type new_type)
{
- if (index == 0)
- {
- return TerrainMaterialType::TEXTURE;
- }
- if (index == 1)
- {
- return TerrainMaterialType::PBR_MATERIAL;
- }
- return TerrainMaterialType::COUNT;
+ ctrl->set(new_type == LLTerrainMaterials::Type::PBR);
}
// static
@@ -1327,19 +1314,16 @@ void LLPanelRegionDebugInfo::onClickDebugConsole(void* data)
BOOL LLPanelRegionTerrainInfo::validateTextureSizes()
{
- // *TODO: Don't early-exit in PBR material terrain editing mode, and
- // instead do some reasonable checks that the PBR material is compatible
- // with the terrain rendering pipeline. Err on the side of permissive.
- LLComboBox* material_type_ctrl = getChild<LLComboBox>("terrain_material_type");
+ LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type");
if (material_type_ctrl)
{
- const TerrainMaterialType material_type = material_type_from_index(material_type_ctrl->getCurrentIndex());
- const bool is_material_selected = material_type == TerrainMaterialType::PBR_MATERIAL;
+ const LLTerrainMaterials::Type material_type = material_type_from_ctrl(material_type_ctrl);
+ const bool is_material_selected = material_type == LLTerrainMaterials::Type::PBR;
if (is_material_selected) { return TRUE; }
}
static const S32 MAX_TERRAIN_TEXTURE_SIZE = 1024;
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
std::string buffer;
buffer = llformat("texture_detail_%d", i);
@@ -1401,6 +1385,21 @@ BOOL LLPanelRegionTerrainInfo::validateTextureHeights()
/////////////////////////////////////////////////////////////////////////////
// LLPanelRegionTerrainInfo
/////////////////////////////////////////////////////////////////////////////
+
+LLPanelRegionTerrainInfo::LLPanelRegionTerrainInfo()
+: LLPanelRegionInfo()
+{
+ const LLUUID (&default_textures)[LLVLComposition::ASSET_COUNT] = LLVLComposition::getDefaultTextures();
+ for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
+ {
+ mLastSetTextures[i] = default_textures[i];
+ }
+ for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
+ {
+ mLastSetMaterials[i] = LLUUID::null;
+ }
+}
+
// Initialize statics
BOOL LLPanelRegionTerrainInfo::postBuild()
@@ -1415,12 +1414,12 @@ BOOL LLPanelRegionTerrainInfo::postBuild()
std::string buffer;
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
buffer = llformat("texture_detail_%d", i);
initCtrl(buffer);
}
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
buffer = llformat("material_detail_%d", i);
initCtrl(buffer);
@@ -1446,57 +1445,27 @@ BOOL LLPanelRegionTerrainInfo::postBuild()
mRegionChangedSlot = gAgent.addRegionChangedCallback(boost::bind(&LLPanelRegionTerrainInfo::onRegionChanged,this));
}
- refresh();
-
return LLPanelRegionInfo::postBuild();
}
-// virtual
-void LLPanelRegionTerrainInfo::refresh()
+void LLPanelRegionTerrainInfo::onSelectMaterialType()
{
- static LLCachedControl<bool> feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false);
-
- LLTextBox* texture_text = getChild<LLTextBox>("detail_texture_text");
- if (texture_text) { texture_text->setVisible(!feature_pbr_terrain_enabled); }
-
- LLComboBox* material_type_ctrl = getChild<LLComboBox>("terrain_material_type");
- if (material_type_ctrl)
- {
- material_type_ctrl->setVisible(feature_pbr_terrain_enabled);
-
- bool has_material_assets = false;
-
- std::string buffer;
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- buffer = llformat("material_detail_%d", i);
- LLTextureCtrl* material_ctrl = getChild<LLTextureCtrl>(buffer);
- if (material_ctrl && material_ctrl->getImageAssetID().notNull())
- {
- has_material_assets = true;
- break;
- }
- }
-
- TerrainMaterialType material_type = material_type_from_index(material_type_ctrl->getCurrentIndex());
-
- if (!feature_pbr_terrain_enabled) { material_type = TerrainMaterialType::TEXTURE; }
-
- const bool is_material_selected = material_type == TerrainMaterialType::PBR_MATERIAL;
- material_type_ctrl->setEnabled(feature_pbr_terrain_enabled && !(is_material_selected && has_material_assets));
- }
+ updateForMaterialType();
+ onChangeAnything();
}
-void LLPanelRegionTerrainInfo::onSelectMaterialType()
+void LLPanelRegionTerrainInfo::updateForMaterialType()
{
- LLComboBox* material_type_ctrl = getChild<LLComboBox>("terrain_material_type");
+ LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type");
if (!material_type_ctrl) { return; }
- const TerrainMaterialType material_type = material_type_from_index(material_type_ctrl->getCurrentIndex());
- const bool show_texture_controls = material_type == TerrainMaterialType::TEXTURE;
- const bool show_material_controls = material_type == TerrainMaterialType::PBR_MATERIAL;
+ const LLTerrainMaterials::Type material_type = material_type_from_ctrl(material_type_ctrl);
+ const bool show_texture_controls = material_type == LLTerrainMaterials::Type::TEXTURE;
+ const bool show_material_controls = material_type == LLTerrainMaterials::Type::PBR;
+
+ // Toggle visibility of correct swatches
std::string buffer;
LLTextureCtrl* texture_ctrl;
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
buffer = llformat("texture_detail_%d", i);
texture_ctrl = getChild<LLTextureCtrl>(buffer);
@@ -1505,7 +1474,7 @@ void LLPanelRegionTerrainInfo::onSelectMaterialType()
texture_ctrl->setVisible(show_texture_controls);
}
}
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
+ for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
buffer = llformat("material_detail_%d", i);
texture_ctrl = getChild<LLTextureCtrl>(buffer);
@@ -1514,6 +1483,12 @@ void LLPanelRegionTerrainInfo::onSelectMaterialType()
texture_ctrl->setVisible(show_material_controls);
}
}
+
+ // Toggle visibility of labels
+ LLUICtrl* texture_label = getChild<LLUICtrl>("detail_texture_text");
+ if (texture_label) { texture_label->setVisible(show_texture_controls); }
+ LLUICtrl* material_label = getChild<LLUICtrl>("detail_material_text");
+ if (material_label) { material_label->setVisible(show_material_controls); }
}
void LLPanelRegionTerrainInfo::onRegionChanged()
@@ -1554,31 +1529,96 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
LLVLComposition* compp = region->getComposition();
- // Are these 4 texture IDs or 4 material IDs? Who knows! Let's set the IDs on both pickers for now.
+ static LLCachedControl<bool> feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false);
+
+ const bool textures_ready = compp->texturesReady(false, false);
+ const bool materials_ready = feature_pbr_terrain_enabled && compp->materialsReady(false, false);
+
+ bool set_texture_swatches;
+ bool set_material_swatches;
+ bool reset_texture_swatches;
+ bool reset_material_swatches;
+ LLTerrainMaterials::Type material_type;
+ if (!textures_ready && !materials_ready)
+ {
+ // Are these 4 texture IDs or 4 material IDs? Who knows! Let's set
+ // the IDs on both pickers for now.
+ material_type = LLTerrainMaterials::Type::TEXTURE;
+ set_texture_swatches = true;
+ set_material_swatches = true;
+ reset_texture_swatches = false;
+ reset_material_swatches = false;
+ }
+ else
+ {
+ material_type = compp->getMaterialType();
+ set_texture_swatches = material_type == LLTerrainMaterials::Type::TEXTURE;
+ set_material_swatches = !set_texture_swatches;
+ reset_texture_swatches = !set_texture_swatches;
+ reset_material_swatches = !set_material_swatches;
+ }
+
+ LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type");
+ if (material_type_ctrl) { material_type_to_ctrl(material_type_ctrl, material_type); }
+ updateForMaterialType();
+ material_type_ctrl->setVisible(feature_pbr_terrain_enabled);
+
LLTextureCtrl* asset_ctrl;
std::string buffer;
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- buffer = llformat("texture_detail_%d", i);
- asset_ctrl = getChild<LLTextureCtrl>(buffer);
- if(asset_ctrl)
- {
- LL_DEBUGS() << "Detail Texture " << i << ": "
- << compp->getDetailAssetID(i) << LL_ENDL;
- LLUUID tmp_id(compp->getDetailAssetID(i));
- asset_ctrl->setImageAssetID(tmp_id);
- }
- }
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- buffer = llformat("material_detail_%d", i);
- asset_ctrl = getChild<LLTextureCtrl>(buffer);
- if(asset_ctrl)
- {
- LLUUID tmp_id(compp->getDetailAssetID(i));
- asset_ctrl->setImageAssetID(tmp_id);
- }
- }
+ if (set_texture_swatches)
+ {
+ for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
+ {
+ buffer = llformat("texture_detail_%d", i);
+ asset_ctrl = getChild<LLTextureCtrl>(buffer);
+ if(asset_ctrl)
+ {
+ LL_DEBUGS() << "Detail Texture " << i << ": "
+ << compp->getDetailAssetID(i) << LL_ENDL;
+ LLUUID tmp_id(compp->getDetailAssetID(i));
+ asset_ctrl->setImageAssetID(tmp_id);
+ }
+ }
+ }
+ if (set_material_swatches)
+ {
+ for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
+ {
+ buffer = llformat("material_detail_%d", i);
+ asset_ctrl = getChild<LLTextureCtrl>(buffer);
+ if(asset_ctrl)
+ {
+ LL_DEBUGS() << "Detail Material " << i << ": "
+ << compp->getDetailAssetID(i) << LL_ENDL;
+ LLUUID tmp_id(compp->getDetailAssetID(i));
+ asset_ctrl->setImageAssetID(tmp_id);
+ }
+ }
+ }
+ if (reset_texture_swatches)
+ {
+ for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
+ {
+ buffer = llformat("texture_detail_%d", i);
+ asset_ctrl = getChild<LLTextureCtrl>(buffer);
+ if(asset_ctrl)
+ {
+ asset_ctrl->setImageAssetID(mLastSetTextures[i]);
+ }
+ }
+ }
+ if (reset_material_swatches)
+ {
+ for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
+ {
+ buffer = llformat("material_detail_%d", i);
+ asset_ctrl = getChild<LLTextureCtrl>(buffer);
+ if(asset_ctrl)
+ {
+ asset_ctrl->setImageAssetID(mLastSetMaterials[i]);
+ }
+ }
+ }
for(S32 i = 0; i < CORNER_COUNT; ++i)
{
@@ -1650,46 +1690,39 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
std::string id_str;
LLMessageSystem* msg = gMessageSystem;
- // Use material IDs instead of texture IDs if all material IDs are set, AND the mode is set to PBR materials.
- S32 materials_used = 0;
- LLComboBox* material_type_ctrl = getChild<LLComboBox>("terrain_material_type");
- if (material_type_ctrl)
+ // Send either material IDs instead of texture IDs depending on
+ // terrain_material_type - they both occupy the same slot.
+ LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type");
+ const LLTerrainMaterials::Type material_type = material_type_ctrl ? material_type_from_ctrl(material_type_ctrl) : LLTerrainMaterials::Type::TEXTURE;
+ for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
- const TerrainMaterialType material_type = material_type_from_index(material_type_ctrl->getCurrentIndex());
- const bool is_material_selected = material_type == TerrainMaterialType::PBR_MATERIAL;
- if (is_material_selected)
- {
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- buffer = llformat("material_detail_%d", i);
- asset_ctrl = getChild<LLTextureCtrl>(buffer);
- if(asset_ctrl && asset_ctrl->getImageAssetID().notNull())
- {
- ++materials_used;
- }
- }
- }
- }
- for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
- {
- if (materials_used == TERRAIN_TEXTURE_COUNT)
+ if (material_type == LLTerrainMaterials::Type::PBR)
{
buffer = llformat("material_detail_%d", i);
- asset_ctrl = getChild<LLTextureCtrl>(buffer);
}
else
{
buffer = llformat("texture_detail_%d", i);
- asset_ctrl = getChild<LLTextureCtrl>(buffer);
}
- if(asset_ctrl)
- {
- LLUUID tmp_id(asset_ctrl->getImageAssetID());
- tmp_id.toString(id_str);
- buffer = llformat("%d %s", i, id_str.c_str());
- strings.push_back(buffer);
- }
- }
+ asset_ctrl = getChild<LLTextureCtrl>(buffer);
+
+ if (!asset_ctrl) { continue; }
+
+ LLUUID tmp_id(asset_ctrl->getImageAssetID());
+ tmp_id.toString(id_str);
+ buffer = llformat("%d %s", i, id_str.c_str());
+ strings.push_back(buffer);
+
+ // Store asset for later terrain editing
+ if (material_type == LLTerrainMaterials::Type::PBR)
+ {
+ mLastSetMaterials[i] = tmp_id;
+ }
+ else
+ {
+ mLastSetTextures[i] = tmp_id;
+ }
+ }
sendEstateOwnerMessage(msg, "texturedetail", invoice, strings);
strings.clear();
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index 91e1f5b058..315c6aca0f 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -36,6 +36,7 @@
#include "llpanel.h"
#include "llextendedstatus.h"
#include "llpanelenvironment.h"
+#include "llvlcomposition.h"
#include "lleventcoro.h"
@@ -243,7 +244,7 @@ class LLPanelRegionTerrainInfo : public LLPanelRegionInfo
LOG_CLASS(LLPanelRegionTerrainInfo);
public:
- LLPanelRegionTerrainInfo() : LLPanelRegionInfo() {}
+ LLPanelRegionTerrainInfo();
~LLPanelRegionTerrainInfo() {}
BOOL postBuild() override;
@@ -258,8 +259,8 @@ public:
//static void onChangeAnything(LLUICtrl* ctrl, void* userData); // callback for any change, to enable commit button
- void refresh() override;
void onSelectMaterialType();
+ void updateForMaterialType();
static void onClickDownloadRaw(void*);
static void onClickUploadRaw(void*);
@@ -274,6 +275,8 @@ private:
bool mConfirmedTextureHeights;
bool mAskedTextureHeights;
boost::signals2::connection mRegionChangedSlot;
+ LLUUID mLastSetTextures[LLTerrainMaterials::ASSET_COUNT];
+ LLUUID mLastSetMaterials[LLTerrainMaterials::ASSET_COUNT];
};
/////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp
index 09b21e4e0a..506ab005c5 100644
--- a/indra/newview/llvlcomposition.cpp
+++ b/indra/newview/llvlcomposition.cpp
@@ -44,7 +44,6 @@
static const U32 BASE_SIZE = 128;
-
F32 bilinear(const F32 v00, const F32 v01, const F32 v10, const F32 v11, const F32 x_frac, const F32 y_frac)
{
// Not sure if this is the right math...
@@ -91,10 +90,10 @@ BOOL LLTerrainMaterials::generateMaterials()
LLUUID LLTerrainMaterials::getDetailAssetID(S32 asset)
{
llassert(mDetailTextures[asset] && mDetailMaterials[asset]);
- // *HACK: Assume both the the material and texture were fetched in the same
- // way using the same UUID. However, we may not know at this point which
- // one will load.
- return mDetailTextures[asset]->getID();
+ // Assume both the the material and texture were fetched in the same way
+ // using the same UUID. However, we may not know at this point which one
+ // will load.
+ return mDetailTextures[asset] ? mDetailTextures[asset]->getID() : LLUUID::null;
}
LLPointer<LLViewerFetchedTexture> fetch_terrain_texture(const LLUUID& id)
@@ -133,7 +132,7 @@ bool LLTerrainMaterials::texturesReady(bool boost, bool strict)
// *NOTE: Calls to textureReady may boost textures. Do not early-return.
for (S32 i = 0; i < ASSET_COUNT; i++)
{
- ready[i] = textureReady(mDetailTextures[i], boost);
+ ready[i] = mDetailTextures[i].notNull() && textureReady(mDetailTextures[i], boost);
}
bool one_ready = false;
@@ -250,6 +249,7 @@ bool LLTerrainMaterials::materialReady(LLPointer<LLFetchedGLTFMaterial> &mat, bo
// Material is loaded, but textures may not be
if (!textures_set)
{
+ textures_set = true;
// *NOTE: These can sometimes be set to to nullptr due to
// updateTEMaterialTextures. For the sake of robustness, we emulate
// that fetching behavior by setting textures of null IDs to nullptr.
@@ -257,9 +257,6 @@ bool LLTerrainMaterials::materialReady(LLPointer<LLFetchedGLTFMaterial> &mat, bo
mat->mNormalTexture = fetch_terrain_texture(mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL]);
mat->mMetallicRoughnessTexture = fetch_terrain_texture(mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS]);
mat->mEmissiveTexture = fetch_terrain_texture(mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE]);
- textures_set = true;
-
- return false;
}
// *NOTE: Calls to textureReady may boost textures. Do not early-return.
@@ -288,16 +285,29 @@ bool LLTerrainMaterials::materialReady(LLPointer<LLFetchedGLTFMaterial> &mat, bo
return true;
}
+// static
+const LLUUID (&LLVLComposition::getDefaultTextures())[ASSET_COUNT]
+{
+ const static LLUUID default_textures[LLVLComposition::ASSET_COUNT] =
+ {
+ TERRAIN_DIRT_DETAIL,
+ TERRAIN_GRASS_DETAIL,
+ TERRAIN_MOUNTAIN_DETAIL,
+ TERRAIN_ROCK_DETAIL
+ };
+ return default_textures;
+}
LLVLComposition::LLVLComposition(LLSurface *surfacep, const U32 width, const F32 scale) :
LLTerrainMaterials(),
LLViewerLayer(width, scale)
{
// Load Terrain Textures - Original ones
- setDetailAssetID(0, TERRAIN_DIRT_DETAIL);
- setDetailAssetID(1, TERRAIN_GRASS_DETAIL);
- setDetailAssetID(2, TERRAIN_MOUNTAIN_DETAIL);
- setDetailAssetID(3, TERRAIN_ROCK_DETAIL);
+ const LLUUID (&default_textures)[LLVLComposition::ASSET_COUNT] = LLVLComposition::getDefaultTextures();
+ for (S32 i = 0; i < ASSET_COUNT; ++i)
+ {
+ setDetailAssetID(i, default_textures[i]);
+ }
mSurfacep = surfacep;
diff --git a/indra/newview/llvlcomposition.h b/indra/newview/llvlcomposition.h
index 73bfca6ed4..7397ff1e8d 100644
--- a/indra/newview/llvlcomposition.h
+++ b/indra/newview/llvlcomposition.h
@@ -58,7 +58,7 @@ public:
BOOL generateMaterials();
- LLUUID getDetailAssetID(S32 asset);
+ virtual LLUUID getDetailAssetID(S32 asset);
virtual void setDetailAssetID(S32 asset, const LLUUID& id);
Type getMaterialType();
bool texturesReady(bool boost, bool strict);
@@ -82,6 +82,11 @@ extern LLTerrainMaterials gLocalTerrainMaterials;
class LLVLComposition : public LLTerrainMaterials, public LLViewerLayer
{
public:
+ // Heights map into textures (or materials) as 0-1 = first, 1-2 = second, etc.
+ // So we need to compress heights into this range.
+ static const S32 ASSET_COUNT = 4;
+ static const LLUUID (&getDefaultTextures())[ASSET_COUNT];
+
LLVLComposition(LLSurface *surfacep, const U32 width, const F32 scale);
/*virtual*/ ~LLVLComposition();
@@ -93,10 +98,6 @@ public:
// Generate texture from composition values.
BOOL generateMinimapTileLand(const F32 x, const F32 y, const F32 width, const F32 height);
- // Heights map into textures (or materials) as 0-1 = first, 1-2 = second, etc.
- // So we need to compress heights into this range.
- static const S32 ASSET_COUNT = 4;
-
// Use these as indeces ito the get/setters below that use 'corner'
enum ECorner
{
diff --git a/indra/newview/skins/default/xui/en/panel_region_terrain.xml b/indra/newview/skins/default/xui/en/panel_region_terrain.xml
index 88855ab739..f8d2c90d0a 100644
--- a/indra/newview/skins/default/xui/en/panel_region_terrain.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_terrain.xml
@@ -76,33 +76,17 @@
left="8"
top="30"
width="460" />
- <combo_box
- layout="topleft"
- left="10"
- top="105"
- follows="left|top"
- name="terrain_material_type"
- width="170">
- <combo_box.item
- label="Terrain Textures"
- name="Textures"
- value="Textures" />
- <combo_box.item
- label="Terrain PBR Materials"
- name="PBRMaterials"
- value="PBRMaterials" />
- </combo_box>
<text
type="string"
length="1"
- follows="left|top"
halign="left"
valign="center"
+ follows="left|top"
height="20"
layout="topleft"
name="detail_texture_text"
- top_delta="0"
- left_delta="0"
+ left="10"
+ top="105"
width="170">
Terrain Textures
</text>
@@ -114,12 +98,25 @@
follows="left|top"
height="20"
layout="topleft"
- top_delta="0"
- left_delta="180"
- name="detail_texture_limits_text"
- width="200">
- Maximum size: 1024x1024
+ name="detail_material_text"
+ left="10"
+ top="105"
+ width="170">
+ Terrain Materials
</text>
+ <check_box
+ height="20"
+ halign="left"
+ valign="center"
+ follows="left|top"
+ layout="topleft"
+ top_delta="1"
+ left_delta="180"
+ label="PBR Metallic Roughness"
+ name="terrain_material_type"
+ tool_tip="If checked, use PBR Metallic Roughness materials for terrain. Otherwise, use textures."
+ left_pad="2"
+ width="200" />
<texture_picker
follows="left|top"
height="100"