Add global blendDepth slider and update default blendDepth for mats

This commit is contained in:
Lukas Aldershaab 2021-01-03 01:26:19 +01:00
parent db496fa0c4
commit 60a10f4334
5 changed files with 62 additions and 13 deletions

View file

@ -803,7 +803,14 @@ bool TerrainCellMaterial::setupPass( const SceneRenderState *state,
mConsts->set( mFogDataConst, fogData );
}
mConsts->setSafe( mBlendDepthConst, Con::getFloatVariable("$Terrain::BlendDepth", 0.2f) );
if (String::isEmpty(Con::getVariable("$Terrain::BlendDepth")))
{
mConsts->setSafe(mBlendDepthConst, 0.2f);
}
else
{
mConsts->setSafe(mBlendDepthConst, Con::getFloatVariable("$Terrain::BlendDepth"));
}
mConsts->setSafe( mFogColorConst, sceneData.fogColor );

View file

@ -68,7 +68,7 @@ TerrainMaterial::TerrainMaterial()
mMacroStrength( 0.7f ),
mMacroDistance( 500.0f ),
mParallaxScale( 0.0f ),
mBlendDepth( 0.5f ),
mBlendDepth( 0.0f ),
mBlendContrast( 1.0f ),
mIsSRGB(false),
mInvertRoughness(false)

View file

@ -12,6 +12,7 @@ function Core_Rendering::onCreate(%this)
$pref::ReflectionProbes::BakeResolution = ProjectSettings.value("Rendering/ProbeCaptureResolution", "64");
$Terrain::LerpBlend = ProjectSettings.value("Terrain/LerpBlend");
$Terrain::BlendDepth = ProjectSettings.value("Terrain/BlendDepth");
$Terrain::DetailTextureSize = ProjectSettings.value("Terrain/DetailTextureSize");
$Terrain::MacroTextureSize = ProjectSettings.value("Terrain/MacroTextureSize");
@ -24,6 +25,7 @@ function Core_Rendering::onCreate(%this)
$Terrain::OrmTextureFormat = ProjectSettings.value("Terrain/OrmTextureFormat");
exec("./scripts/graphicsOptions.cs");
exec("./scripts/terrainSettings.cs");
exec("./scripts/renderManager.cs");
exec("./scripts/gfxData/clouds.cs");
exec("./scripts/gfxData/commonMaterialData.cs");
@ -32,6 +34,8 @@ function Core_Rendering::onCreate(%this)
exec("./scripts/gfxData/terrainBlock.cs");
exec("./scripts/gfxData/water.cs");
exec("./scripts/gfxData/warningTerrainMat.cs");
loadTerrainSettings();
}
function Core_Rendering::onDestroy(%this)

View file

@ -61,13 +61,44 @@
};
new GuiControl() {
position = "20 80";
position = "20 70";
profile = "ToolsGuiDefaultProfile";
extent = "300 20";
new GuiTextCtrl() {
text = "Global Blend Depth:";
profile = "ToolsGuiTextProfile";
tooltipProfile = "ToolsGuiToolTipProfile";
tooltip = "Controls the general level of bleding across all textures, has no effect if Lerp Blend is enabled.";
position = "0 0";
extent = "120 20";
};
new GuiSliderCtrl() {
internalName = "blendDepthSlider";
profile = "ToolsGuiSliderProfile";
command = "TerrainTextureSettingsDlg.apply();";
altCommand = "TerrainTextureSettingsDlg.updateBlendDepth();";
position = "130 0";
extent = "170 20";
range = "0.01 1.0";
};
};
new GuiControl() {
position = "20 100";
profile = "ToolsGuiDefaultProfile";
extent = "300 20";
new GuiTextCtrl() {
text = "Detail Texture Size:";
profile = "ToolsGuiTextProfile";
command = "TerrainTextureSettingsDlg.apply();";
position = "0 0";
extent = "120 20";
@ -85,7 +116,7 @@
};
new GuiControl() {
position = "20 110";
position = "20 130";
profile = "ToolsGuiDefaultProfile";
extent = "300 20";
@ -109,7 +140,7 @@
};
new GuiControl() {
position = "20 140";
position = "20 160";
profile = "ToolsGuiDefaultProfile";
extent = "300 20";
@ -133,7 +164,7 @@
};
new GuiControl() {
position = "20 170";
position = "20 190";
profile = "ToolsGuiDefaultProfile";
extent = "300 20";
@ -157,7 +188,7 @@
};
new GuiControl() {
position = "20 200";
position = "20 220";
profile = "ToolsGuiDefaultProfile";
extent = "300 20";
@ -181,7 +212,7 @@
};
new GuiControl() {
position = "20 230";
position = "20 250";
profile = "ToolsGuiDefaultProfile";
extent = "300 20";
@ -205,7 +236,7 @@
};
new GuiControl() {
position = "20 260";
position = "20 280";
profile = "ToolsGuiDefaultProfile";
extent = "300 20";
@ -227,7 +258,7 @@
};
new GuiControl() {
position = "20 290";
position = "20 310";
profile = "ToolsGuiDefaultProfile";
extent = "300 20";
@ -258,9 +289,9 @@
profile = "ToolsGuiButtonProfile";
position = "0 0";
extent = "145 30";
command = "TerrainTextureSettingsDlg.applyAndSave();";
extent = "145 30";
};
new GuiButtonCtrl() {

View file

@ -31,12 +31,12 @@ $TerrainTextureSettingsDlg::TerrainTextureFormat =
function TerrainTextureSettingsDlg::show( %this )
{
//%this.onWake();
Canvas.pushDialog( %this );
}
function TerrainTextureSettingsDlg::onWake( %this ) {
%this-->lerpBlendCheckBox.setStateOn(ProjectSettings.value("Terrain/LerpBlend"));
%this-->blendDepthSlider.setValue(ProjectSettings.value("Terrain/BlendDepth"));
%this-->detailTextureFormatPopUpMenu.clear();
%this-->macroTextureFormatPopUpMenu.clear();
@ -63,8 +63,13 @@ function TerrainTextureSettingsDlg::onWake( %this ) {
%this-->ormTextureSizeTextEdit.setText(ProjectSettings.value("Terrain/OrmTextureSize"));
}
function TerrainTextureSettingsDlg::updateBlendDepth( %this ) {
$Terrain::BlendDepth = %this-->blendDepthSlider.getValue();
}
function TerrainTextureSettingsDlg::apply( %this ) {
$Terrain::LerpBlend = %this-->lerpBlendCheckBox.isStateOn();
$Terrain::BlendDepth = %this-->blendDepthSlider.getValue();
$Terrain::DetailTextureFormat = %this-->detailTextureFormatPopUpMenu.getSelected();
$Terrain::MacroTextureFormat = %this-->macroTextureFormatPopUpMenu.getSelected();
@ -112,6 +117,7 @@ function TerrainTextureSettingsDlg::validate( %this ) {
function TerrainTextureSettingsDlg::cancel( %this ) {
$Terrain::LerpBlend = ProjectSettings.value("Terrain/LerpBlend");
$Terrain::BlendDepth = ProjectSettings.value("Terrain/BlendDepth");
$Terrain::DetailTextureFormat = ProjectSettings.value("Terrain/DetailTextureFormat");
$Terrain::MacroTextureFormat = ProjectSettings.value("Terrain/MacroTextureFormat");
@ -134,6 +140,7 @@ function TerrainTextureSettingsDlg::applyAndSave( %this ) {
%this.apply();
ProjectSettings.setValue("Terrain/LerpBlend", $Terrain::LerpBlend);
ProjectSettings.setValue("Terrain/BlendDepth", $Terrain::BlendDepth);
ProjectSettings.setValue("Terrain/DetailTextureFormat", $Terrain::DetailTextureFormat);
ProjectSettings.setValue("Terrain/MacroTextureFormat", $Terrain::MacroTextureFormat);