Add **Depth Offset to materials**

This commit is contained in:
Wojtek Figat
2023-01-29 22:09:51 +01:00
parent a214c14a4d
commit a219a3d2eb
13 changed files with 73 additions and 13 deletions

View File

@@ -40,6 +40,7 @@ namespace FlaxEditor.Surface.Archetypes
TessellationMultiplier = 12,
WorldDisplacement = 13,
SubsurfaceColor = 14,
DepthOffset = 15,
};
/// <inheritdoc />
@@ -85,6 +86,7 @@ namespace FlaxEditor.Surface.Archetypes
GetBox(MaterialNodeBoxes.TessellationMultiplier).Enabled = false;
GetBox(MaterialNodeBoxes.WorldDisplacement).Enabled = false;
GetBox(MaterialNodeBoxes.SubsurfaceColor).Enabled = false;
GetBox(MaterialNodeBoxes.DepthOffset).Enabled = false;
return;
}
@@ -116,6 +118,7 @@ namespace FlaxEditor.Surface.Archetypes
GetBox(MaterialNodeBoxes.TessellationMultiplier).Enabled = withTess;
GetBox(MaterialNodeBoxes.WorldDisplacement).Enabled = withTess;
GetBox(MaterialNodeBoxes.SubsurfaceColor).Enabled = info.ShadingModel == MaterialShadingModel.Subsurface || info.ShadingModel == MaterialShadingModel.Foliage;
GetBox(MaterialNodeBoxes.DepthOffset).Enabled = true;
break;
}
case MaterialDomain.PostProcess:
@@ -134,6 +137,7 @@ namespace FlaxEditor.Surface.Archetypes
GetBox(MaterialNodeBoxes.TessellationMultiplier).Enabled = false;
GetBox(MaterialNodeBoxes.WorldDisplacement).Enabled = false;
GetBox(MaterialNodeBoxes.SubsurfaceColor).Enabled = false;
GetBox(MaterialNodeBoxes.DepthOffset).Enabled = false;
break;
}
case MaterialDomain.Decal:
@@ -154,6 +158,7 @@ namespace FlaxEditor.Surface.Archetypes
GetBox(MaterialNodeBoxes.TessellationMultiplier).Enabled = false;
GetBox(MaterialNodeBoxes.WorldDisplacement).Enabled = false;
GetBox(MaterialNodeBoxes.SubsurfaceColor).Enabled = false;
GetBox(MaterialNodeBoxes.DepthOffset).Enabled = false;
break;
}
case MaterialDomain.GUI:
@@ -172,6 +177,7 @@ namespace FlaxEditor.Surface.Archetypes
GetBox(MaterialNodeBoxes.TessellationMultiplier).Enabled = false;
GetBox(MaterialNodeBoxes.WorldDisplacement).Enabled = false;
GetBox(MaterialNodeBoxes.SubsurfaceColor).Enabled = false;
GetBox(MaterialNodeBoxes.DepthOffset).Enabled = false;
break;
}
case MaterialDomain.VolumeParticle:
@@ -190,6 +196,7 @@ namespace FlaxEditor.Surface.Archetypes
GetBox(MaterialNodeBoxes.TessellationMultiplier).Enabled = false;
GetBox(MaterialNodeBoxes.WorldDisplacement).Enabled = false;
GetBox(MaterialNodeBoxes.SubsurfaceColor).Enabled = false;
GetBox(MaterialNodeBoxes.DepthOffset).Enabled = false;
break;
}
default: throw new ArgumentOutOfRangeException();
@@ -281,7 +288,7 @@ namespace FlaxEditor.Surface.Archetypes
Title = "Material",
Description = "Main material node",
Flags = NodeFlags.MaterialGraph | NodeFlags.NoRemove | NodeFlags.NoSpawnViaGUI | NodeFlags.NoSpawnViaPaste | NodeFlags.NoCloseButton,
Size = new Float2(150, 300),
Size = new Float2(150, 320),
Elements = new[]
{
NodeElementArchetype.Factory.Input(0, "", true, typeof(void), 0),
@@ -299,6 +306,7 @@ namespace FlaxEditor.Surface.Archetypes
NodeElementArchetype.Factory.Input(12, "Tessellation Multiplier", true, typeof(float), 12),
NodeElementArchetype.Factory.Input(13, "World Displacement", true, typeof(Float3), 13),
NodeElementArchetype.Factory.Input(14, "Subsurface Color", true, typeof(Float3), 14),
NodeElementArchetype.Factory.Input(15, "Depth Offset", true, typeof(float), 15),
}
},
new NodeArchetype