Skip to content

Commit

Permalink
Fix and cleanup my bad code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xlinka committed Nov 29, 2023
1 parent 5443623 commit bb922b4
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 224 deletions.
8 changes: 5 additions & 3 deletions ProjectObsidian.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<ResonitePath Condition="Exists('$(HOME)/.steam/steam/steamapps/common/Resonite/')">$(HOME)/.steam/steam/steamapps/common/Resonite/</ResonitePath>
<ResonitePath Condition="Exists('/mnt/LocalDisk2/SteamLibrary/steamapps/common/Resonite/')">/mnt/LocalDisk2/SteamLibrary/steamapps/common/Resonite/</ResonitePath>
</PropertyGroup>
<ItemGroup>
<Compile Remove="ProtoFlux\Bindings\Networking\**" />
<EmbeddedResource Remove="ProtoFlux\Bindings\Networking\**" />
<None Remove="ProtoFlux\Bindings\Networking\**" />
</ItemGroup>
<ItemGroup>
<Reference Include="Elements.Core">
<HintPath>$(ResonitePath)Resonite_Data/Managed/Elements.Core.dll</HintPath>
Expand All @@ -33,7 +38,4 @@
<HintPath>$(ResonitePath)Resonite_Data/Managed/ProtoFluxBindings.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="ProtoFlux\Bindings\Networking\ART-NET\" />
</ItemGroup>
</Project>

This file was deleted.

68 changes: 0 additions & 68 deletions ProtoFlux/Bindings/Math/Physics/ProjectileMotionBinding.cs

This file was deleted.

1 change: 1 addition & 0 deletions ProtoFlux/Bindings/Math/Physics/RefractNodeBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;
using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics;
using Elements.Core;

[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Math/Physics" })]
public class RefractionCalculation : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode<ExecutionContext, float>
Expand Down
34 changes: 0 additions & 34 deletions ProtoFlux/Math/Physics/PotentialEnergyCalculationNode

This file was deleted.

38 changes: 0 additions & 38 deletions ProtoFlux/Math/Physics/ProjectileMotionNode.cs

This file was deleted.

11 changes: 6 additions & 5 deletions ProtoFlux/Math/Physics/RefractCalculationNode.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Elements.Core;
using FrooxEngine;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;
Expand All @@ -16,15 +17,15 @@ protected override float Compute(ExecutionContext context)
{
float n1 = RefractiveIndex1.Evaluate(context);
float n2 = RefractiveIndex2.Evaluate(context);
float theta1Rad = AngleOfIncidence.Evaluate(context) * (float)Math.PI / 180.0f;
float theta1Rad = AngleOfIncidence.Evaluate(context) * (float)MathX.PI / 180.0f;
// Calculate using Snell's Law
float sinTheta2 = n1 * (float)Math.Sin(theta1Rad) / n2;
float sinTheta2 = n1 * (float)MathX.Sin(theta1Rad) / n2;

// Ensure value is within [-1, 1] due to numerical inaccuracies
sinTheta2 = Math.Min(Math.Max(sinTheta2, -1.0f), 1.0f);
sinTheta2 = MathX.Min(MathX.Max(sinTheta2, -1.0f), 1.0f);

float theta2Rad = (float)Math.Asin(sinTheta2);
return theta2Rad * 180.0f / (float)Math.PI;
float theta2Rad = (float)MathX.Asin(sinTheta2);
return theta2Rad * 180.0f / (float)MathX.PI;
}
}
}

0 comments on commit bb922b4

Please sign in to comment.