Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Xlinka committed Jun 26, 2024
1 parent bb283a0 commit c2fd29d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion ProjectObsidian/Components/Mesh/Planet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<float3> vertices, List<int> triangles)
Expand Down
9 changes: 3 additions & 6 deletions ProjectObsidian/ProtoFlux/Math/Random/RandomBool2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random;
[NodeCategory("Obsidian/Math/Random")]
[ContinuouslyChanging]

public class RandomBool2 : ObjectFunctionNode<FrooxEngineContext, bool2>
public class RandomBool2 : ValueFunctionNode<FrooxEngineContext, bool2>
{
public ValueInput<float2> 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));

}
}
38 changes: 22 additions & 16 deletions ProjectObsidian/ProtoFlux/Math/Random/RandomCharacter.cs
Original file line number Diff line number Diff line change
@@ -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<FrooxEngineContext, char>
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Random
{
public ValueInput<int> Start;
public ValueInput<int> End;
public ObjectInput<string> String;

protected override char Compute(FrooxEngineContext context)
[NodeCategory("Obsidian/Math/Random")]
[NodeName("Random Character")]
[ContinuouslyChanging]
public class RandomCharacter : ValueFunctionNode<FrooxEngineContext, char>
{
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<int> Start;
public ValueInput<int> 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);
}
}
}

0 comments on commit c2fd29d

Please sign in to comment.