diff --git a/ProjectObsidian/Components/Mesh/Planet.cs b/ProjectObsidian/Components/Mesh/Planet.cs index ad6b8b6..b9e0562 100644 --- a/ProjectObsidian/Components/Mesh/Planet.cs +++ b/ProjectObsidian/Components/Mesh/Planet.cs @@ -51,7 +51,7 @@ private void GeneratePlanet(MeshX mesh, int subdivisions, float radius, float no mesh.AddTriangle(triangles[i], triangles[i + 1], triangles[i + 2]); } - mesh.RecalculateNormals(AllTriangles); + // mesh.RecalculateNormals(AllTriangles); } private void CreateIcosahedron(List vertices, List triangles) diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomBool2.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool2.cs index 5ce02eb..16dd775 100644 --- a/ProjectObsidian/ProtoFlux/Math/Random/RandomBool2.cs +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomBool2.cs @@ -10,17 +10,14 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; [NodeCategory("Obsidian/Math/Random")] [ContinuouslyChanging] -public class RandomBool2 : ObjectFunctionNode +public class RandomBool2 : ValueFunctionNode { public ValueInput Chance; protected override bool2 Compute(FrooxEngineContext context) { var chance = Chance.Evaluate(context); - var result = new bool2( - RandomX.Chance(chance.x), - RandomX.Chance(chance.y) - ); - return result; + return new bool2(RandomX.Chance(chance.x), RandomX.Chance(chance.y)); + } } diff --git a/ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs b/ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs index c64b917..d76fab8 100644 --- a/ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs +++ b/ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs @@ -1,25 +1,31 @@ -using Elements.Core; +using System; +using Elements.Core; using FrooxEngine.ProtoFlux; using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; using ProtoFlux.Runtimes.Execution.Nodes.Actions; -namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random; - -[NodeCategory("Obsidian/Math/Random")] -[NodeName("Random Character")] -[ContinuouslyChanging] -public class RandomCharacter : ValueFunctionNode +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random { - public ValueInput Start; - public ValueInput End; - public ObjectInput String; - - protected override char Compute(FrooxEngineContext context) + [NodeCategory("Obsidian/Math/Random")] + [NodeName("Random Character")] + [ContinuouslyChanging] + public class RandomCharacter : ValueFunctionNode { - var str = String.Evaluate(context); - var start = MathX.Clamp(Start.Evaluate(context), 0, str.Length); - var end = MathX.Clamp(End.Evaluate(context,str.Length), start, str.Length); - return str[RandomX.Range(start, end)]; + public ValueInput Start; + public ValueInput End; + + protected override char Compute(FrooxEngineContext context) + { + int start = MathX.Clamp(Start.Evaluate(context), 0, 25); + int end = MathX.Clamp(End.Evaluate(context), start, 25); + if (start == end) + { + return (char)('A' + start); + } + + int randomIndex = RandomX.Range(start, end + 1); + return (char)('A' + randomIndex); + } } }