Merge remote-tracking branch 'origin/gi' into large-worlds
# Conflicts: # Source/Engine/Core/Math/Vector3.h
This commit is contained in:
@@ -236,6 +236,39 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
}
|
||||
}
|
||||
|
||||
internal enum MaterialTemplateInputsMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Constant buffers.
|
||||
/// </summary>
|
||||
Constants = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Shader resources such as textures and buffers.
|
||||
/// </summary>
|
||||
ShaderResources = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Pre-processor definitions.
|
||||
/// </summary>
|
||||
Defines = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Included files.
|
||||
/// </summary>
|
||||
Includes = 7,
|
||||
|
||||
/// <summary>
|
||||
/// Default location after all shader resources and methods but before actual material code.
|
||||
/// </summary>
|
||||
Utilities = 8,
|
||||
|
||||
/// <summary>
|
||||
/// Shader functions location after all material shaders.
|
||||
/// </summary>
|
||||
Shaders = 9,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The nodes for that group.
|
||||
/// </summary>
|
||||
@@ -814,17 +847,20 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Title = "Custom Global Code",
|
||||
Description = "Custom global HLSL shader code expression (placed before material shader code). Can contain includes to shader utilities or declare functions to reuse later.",
|
||||
Flags = NodeFlags.MaterialGraph,
|
||||
Size = new Vector2(300, 220),
|
||||
Size = new Vector2(300, 240),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
"// Here you can add HLSL code\nfloat4 GetCustomColor()\n{\n\treturn float4(1, 0, 0, 1);\n}",
|
||||
true,
|
||||
(int)MaterialTemplateInputsMapping.Utilities,
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Bool(0, 0, 1),
|
||||
NodeElementArchetype.Factory.Text(20, 0, "Enabled"),
|
||||
NodeElementArchetype.Factory.TextBox(0, 20, 300, 200, 0),
|
||||
NodeElementArchetype.Factory.Text(0, 20, "Location"),
|
||||
NodeElementArchetype.Factory.Enum(50, 20, 120, 2, typeof(MaterialTemplateInputsMapping)),
|
||||
NodeElementArchetype.Factory.TextBox(0, 40, 300, 200, 0),
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -427,6 +427,20 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
NodeElementArchetype.Factory.Output(0, string.Empty, typeof(float), 4),
|
||||
}
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 49,
|
||||
Title = "Rotate Vector",
|
||||
Description = "Rotates given vector using the Quaternion",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
Size = new Vector2(200, 40),
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Input(0, "Quaternion", true, typeof(Quaternion), 0),
|
||||
NodeElementArchetype.Factory.Input(1, "Vector", true, typeof(Vector3), 1),
|
||||
NodeElementArchetype.Factory.Output(0, string.Empty, typeof(Vector3), 2),
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -888,7 +888,6 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
NodeElementArchetype.Factory.ComboBox(0, -10.0f, 160, 2, typeof(ParticleModelFacingMode)),
|
||||
},
|
||||
},
|
||||
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 214,
|
||||
@@ -912,6 +911,20 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
NodeElementArchetype.Factory.Input(-0.5f + 2.0f, "Velocity Scale", true, typeof(float), 2, 4),
|
||||
},
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 215,
|
||||
Create = CreateParticleModuleNode,
|
||||
Title = "Position (Global SDF)",
|
||||
Description = "Places the particles on Global SDF surface (uses current particle position to snap it to SDF)",
|
||||
Flags = DefaultModuleFlags,
|
||||
Size = new Vector2(200, 0 * Surface.Constants.LayoutOffsetY),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
true,
|
||||
(int)ModuleType.Initialize,
|
||||
},
|
||||
},
|
||||
GetParticleAttribute(ModuleType.Initialize, 250, "Set Position", "Sets the particle position", typeof(Vector3), Vector3.Zero),
|
||||
GetParticleAttribute(ModuleType.Initialize, 251, "Set Lifetime", "Sets the particle lifetime (in seconds)", typeof(float), 10.0f),
|
||||
GetParticleAttribute(ModuleType.Initialize, 252, "Set Age", "Sets the particle age (in seconds)", typeof(float), 0.0f),
|
||||
@@ -1344,7 +1357,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
true,
|
||||
(int)ModuleType.Update,
|
||||
false, // Invert
|
||||
0.0f, // Radius
|
||||
5.0f, // Radius
|
||||
0.0f, // Roughness
|
||||
0.1f, // Elasticity
|
||||
0.0f, // Friction
|
||||
@@ -1362,6 +1375,59 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
NodeElementArchetype.Factory.Input(-0.5f + 0, "Surface Thickness", true, typeof(float), 5, 8),
|
||||
},
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 335,
|
||||
Create = CreateParticleModuleNode,
|
||||
Title = "Conform to Global SDF",
|
||||
Description = "Applies the force vector to particles to conform around Global SDF",
|
||||
Flags = DefaultModuleFlags,
|
||||
Size = new Vector2(200, 4 * Surface.Constants.LayoutOffsetY),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
true,
|
||||
(int)ModuleType.Update,
|
||||
5.0f,
|
||||
2000.0f,
|
||||
1.0f,
|
||||
5000.0f,
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Input(-0.5f, "Attraction Speed", true, typeof(float), 0, 2),
|
||||
NodeElementArchetype.Factory.Input(-0.5f + 1.0f, "Attraction Force", true, typeof(float), 1, 3),
|
||||
NodeElementArchetype.Factory.Input(-0.5f + 2.0f, "Stick Distance", true, typeof(float), 2, 4),
|
||||
NodeElementArchetype.Factory.Input(-0.5f + 3.0f, "Stick Force", true, typeof(float), 3, 5),
|
||||
},
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 336,
|
||||
Create = CreateParticleModuleNode,
|
||||
Title = "Collision (Global SDF)",
|
||||
Description = "Collides particles with the scene Global SDF",
|
||||
Flags = DefaultModuleFlags,
|
||||
Size = new Vector2(200, 5 * Surface.Constants.LayoutOffsetY),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
true,
|
||||
(int)ModuleType.Update,
|
||||
false, // Invert
|
||||
5.0f, // Radius
|
||||
0.4f, // Roughness
|
||||
0.1f, // Elasticity
|
||||
0.0f, // Friction
|
||||
0.0f, // Lifetime Loss
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Input(-0.5f + 0, "Radius", true, typeof(float), 0, 3),
|
||||
NodeElementArchetype.Factory.Input(-0.5f + 1, "Roughness", true, typeof(float), 1, 4),
|
||||
NodeElementArchetype.Factory.Input(-0.5f + 2, "Elasticity", true, typeof(float), 2, 5),
|
||||
NodeElementArchetype.Factory.Input(-0.5f + 3, "Friction", true, typeof(float), 3, 6),
|
||||
NodeElementArchetype.Factory.Input(-0.5f + 4, "Lifetime Loss", true, typeof(float), 4, 7),
|
||||
},
|
||||
},
|
||||
GetParticleAttribute(ModuleType.Update, 350, "Set Position", "Sets the particle position", typeof(Vector3), Vector3.Zero),
|
||||
GetParticleAttribute(ModuleType.Update, 351, "Set Lifetime", "Sets the particle lifetime (in seconds)", typeof(float), 10.0f),
|
||||
GetParticleAttribute(ModuleType.Update, 352, "Set Age", "Sets the particle age (in seconds)", typeof(float), 0.0f),
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
});
|
||||
}
|
||||
cm.ItemClicked += item => AddModule((ushort)item.Tag);
|
||||
cm.SortChildren();
|
||||
cm.SortItems();
|
||||
cm.Show(this, button.BottomLeft);
|
||||
}
|
||||
|
||||
|
||||
@@ -358,6 +358,33 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
NodeElementArchetype.Factory.Input(1, "Location", true, null, 2),
|
||||
}
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 14,
|
||||
Title = "Sample Global SDF",
|
||||
Description = "Samples the Global SDF to get the distance to the closest surface (in world-space). Requires models SDF to be generated and checking `Enable Global SDF` in Graphics Settings.",
|
||||
Flags = NodeFlags.MaterialGraph | NodeFlags.ParticleEmitterGraph,
|
||||
Size = new Vector2(200, 20),
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Output(0, "Distance", typeof(float), 0),
|
||||
NodeElementArchetype.Factory.Input(0, "World Position", true, typeof(Vector3), 1),
|
||||
}
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 15,
|
||||
Title = "Sample Global SDF Gradient",
|
||||
Description = "Samples the Global SDF to get the gradient and distance to the closest surface (in world-space). Normalize gradient to get SDF surface normal vector. Requires models SDF to be generated and checking `Enable Global SDF` in Graphics Settings.",
|
||||
Flags = NodeFlags.MaterialGraph | NodeFlags.ParticleEmitterGraph,
|
||||
Size = new Vector2(260, 40),
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Output(0, "Gradient", typeof(Vector3), 0),
|
||||
NodeElementArchetype.Factory.Output(1, "Distance", typeof(float), 2),
|
||||
NodeElementArchetype.Factory.Input(0, "World Position", true, typeof(Vector3), 1),
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace FlaxEditor.Surface
|
||||
for (int i = 0; i < options.Count; i++)
|
||||
{
|
||||
var type = options[i];
|
||||
_options[i] = new OptionType(CustomEditorsUtil.GetPropertyNameUI(type.Name), type, Creator);
|
||||
_options[i] = new OptionType(Utilities.Utils.GetPropertyNameUI(type.Name), type, Creator);
|
||||
}
|
||||
|
||||
base.Initialize(layout);
|
||||
|
||||
@@ -457,7 +457,7 @@ namespace FlaxEditor.Surface
|
||||
if (field.Name.Equals("value__"))
|
||||
continue;
|
||||
|
||||
var name = CustomEditorsUtil.GetPropertyNameUI(field.Name);
|
||||
var name = Utilities.Utils.GetPropertyNameUI(field.Name);
|
||||
values.Add(name);
|
||||
}
|
||||
return ComboBox(x, y, width, valueIndex, values.ToArray());
|
||||
|
||||
@@ -466,7 +466,7 @@ namespace FlaxEditor.Surface
|
||||
cm.AddItem(item);
|
||||
}
|
||||
cm.ItemClicked += OnAddParameterItemClicked;
|
||||
cm.SortChildren();
|
||||
cm.SortItems();
|
||||
cm.Show(button.Parent, button.BottomLeft);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user