Sector Constellations

Generating links between zones within the sector using elimination algorithm with connectedness testing
Improved sample elimination API - now accepts simple density function!
Ported MIConvexHull library to single precision, Unity.Mathematics math
Removed old galaxy generator (new code is much better!)
This commit is contained in:
Reinier Vens 2021-03-11 01:36:08 +00:00
commit 0f33e541c0
99 changed files with 668 additions and 6762 deletions

2
.gitignore vendored
View file

@ -54,6 +54,7 @@ Economy.Shared.Unity.csproj
MessagePack.csproj
Substance.EditorHelper.csproj
Substance.Platform.csproj
UniRx.csproj
# Unity3D generated meta files
*.pidb.meta
@ -78,3 +79,4 @@ Economy.Shared/obj/
# JetBrains Rider .idea folder
.idea/
Assembly-CSharp-Editor-firstpass.csproj

View file

@ -86,7 +86,7 @@ Material:
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Scale: 9.618273
- _Scale: 20.890537
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1

View file

@ -1,38 +0,0 @@
using System;
using UnityEngine;
using System.Collections;
using MIConvexHull;
public class Vertex2 : IVertex
{
public double[] Position => new[] {(double) StoredPosition.x, StoredPosition.y};
public Vector2 StoredPosition;
public float x { get { return StoredPosition.x; } }
public float y { get { return StoredPosition.y; } }
public Vertex2(float x, float y)
{
StoredPosition = new Vector2(x, y);
}
public Vertex2(Vector2 pos)
{
StoredPosition = pos;
}
public Vector2 ToVector2() {
return StoredPosition;
}
public Vector3 ToVector3() {
return StoredPosition;
}
public double Distance(Vertex2 v)
{
return Math.Sqrt((v.x - x) * (v.x - x) + (v.y - y) * (v.y - y));
}
}

View file

@ -1,22 +0,0 @@
using UnityEngine;
using System.Collections;
using MIConvexHull;
public class Vertex3 : IVertex
{
public double[] Position { get; set; }
public double x { get { return Position[0]; } }
public double y { get { return Position[1]; } }
public double z { get { return Position[2]; } }
public Vertex3(double x, double y, double z)
{
Position = new double[] { x, y, z };
}
public Vector3 ToVector3() {
return new Vector3((float) Position[0], (float) Position[1], (float) Position[2]);
}
}

View file

@ -13409,11 +13409,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 39f95af24dd29a645895a57a75460b0c, type: 3}
m_Name:
m_EditorClassIdentifier:
Settings: {fileID: 11400000, guid: cd2344e2001a37544aab0960c164d4ff, type: 2}
StarterShipTemplate: Longinus
Sensitivity:
x: -0.001
y: 0.001
Credits: 100000000
TargetSpottedBlinkFrequency: 20
TargetSpottedBlinkOffset: -0.25
DeathPPTransitionTime: 0
DeathPP: {fileID: 0}
NameFile: {fileID: 4900000, guid: 8ba25d5d0ecee31408c7ce7460b4e015, type: 3}
NameGeneratorMinLength: 5
NameGeneratorMaxLength: 10
NameGeneratorOrder: 4
DeathPPTransitionTime: 3
DeathPP: {fileID: 803284856}
HeatstrokePP: {fileID: 1404901906}
SevereHeatstrokePP: {fileID: 837424435}
HostileTargetIndicator: {fileID: 1787772783}
@ -13427,7 +13436,6 @@ MonoBehaviour:
- {fileID: 1771741750}
- {fileID: 1631662979}
EventLog: {fileID: 1396909588}
Settings: {fileID: 11400000, guid: cd2344e2001a37544aab0960c164d4ff, type: 2}
SectorRenderer: {fileID: 1009503731}
DockCamera: {fileID: 393266593}
FollowCamera: {fileID: 887677622}
@ -13440,10 +13448,6 @@ MonoBehaviour:
ShipPanel: {fileID: 7628189704109037582}
TargetShipPanel: {fileID: 410701133}
ConfirmationDialog: {fileID: 620555924}
Sensitivity:
x: -0.001
y: 0.001
Credits: 100000000
--- !u!4 &1009503730
Transform:
m_ObjectHideFlags: 0
@ -23664,7 +23668,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!64 &2075269401
MeshCollider:
m_ObjectHideFlags: 0

View file

@ -553,7 +553,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 441433737}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.01}
m_LocalPosition: {x: 0, y: 0, z: 0.02}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_Children: []
m_Father: {fileID: 1124877095}
@ -646,10 +646,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 820952284}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: -0.5, y: -0.5, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1124877095}
- {fileID: 1388747985}
m_Father: {fileID: 1183010124}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -823,6 +824,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
SectorRenderer: {fileID: 1940409866}
Settings:
NoisePosition: 0
CloudExponent: 10
CloudAmplitude: 0.01
NoiseAmplitude: 1.25
@ -830,7 +832,11 @@ MonoBehaviour:
NoiseGain: 0.55
NoiseLacunarity: 2.5
NoiseFrequency: 2
Zoom: 2
ZonePrototype: {fileID: 1124877096}
LinkPrototype: {fileID: 1955533723}
ZoneCount: 32
LinkDensity: 0
NameFile: {fileID: 4900000, guid: 8ba25d5d0ecee31408c7ce7460b4e015, type: 3}
NameFileMinWordLength: 4
NameGeneratorMinLength: 5
@ -894,6 +900,37 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1388747984
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1388747985}
m_Layer: 0
m_Name: Links
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1388747985
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1388747984}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.01}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1955533727}
m_Father: {fileID: 820952285}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1404197274
GameObject:
m_ObjectHideFlags: 0
@ -1272,6 +1309,115 @@ Transform:
m_Father: {fileID: 1183010124}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1955533722
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1955533727}
- component: {fileID: 1955533726}
- component: {fileID: 1955533725}
- component: {fileID: 1955533724}
- component: {fileID: 1955533723}
m_Layer: 0
m_Name: Link
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1955533723
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1955533722}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1281fe44325f9b548aa42dc331b17266, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!64 &1955533724
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1955533722}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1955533725
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1955533722}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a8d716e09aea7ce48a1220980f19b494, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1955533726
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1955533722}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1955533727
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1955533722}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.10253583, y: 0.014964979, z: 0.014964979}
m_Children: []
m_Father: {fileID: 1388747985}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1988754119
GameObject:
m_ObjectHideFlags: 0

View file

@ -1,391 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System;
using System.Collections.Generic;
using System.Linq;
using MIConvexHull;
using Newtonsoft.Json;
using RethinkDb.Driver;
using RethinkDb.Driver.Net;
using UnityEditor;
using UnityEngine;
using static UnityEditor.EditorGUILayout;
using Random = UnityEngine.Random;
using static Unity.Mathematics.math;
[CustomEditor(typeof(Galaxy))]
public class GalaxyEditor : Editor
{
private static readonly RethinkDB R = RethinkDB.R;
private int _width;
private bool _showResourceMaps;
private GalaxyMapLayerData _currentLayer;
private string _currentLayerName = "Star Density";
private bool _showStarEditor;
private int _hilbertOrder = 6;
private ulong _hilbertIndex;
private int _starCount = 1;
private float _minStarDistance = .01f;
private float _maxLinkLength = .1f;
private float _linkFilter = .5f;
private IEnumerable<Vector2> _stars = new Vector2[0];
private bool _drawStars;
private bool _drawResource;
private bool _drawLinks;
private VoronoiMesh< Vertex2, Cell2, VoronoiEdge<Vertex2, Cell2>> _voronoiMesh;
private List<VoronoiLink> _starLinks = new List<VoronoiLink>();
private Texture2D _white;
private Texture2D _starTex;
private Texture2D _linkTex;
private Material _galaxyMat;
private Material _transparent;
private Connection _connection;
private void OnEnable()
{
_white = Color.white.ToTexture();
_galaxyMat = new Material(Shader.Find("Unlit/GalaxyMap"));
_transparent = new Material(Shader.Find("Unlit/Transparent"));
_width = Screen.width;
_starTex = new Texture2D(_width,_width, TextureFormat.ARGB32, false);
_linkTex = new Texture2D(_width,_width, TextureFormat.ARGB32, false);
// var galaxy = target as Galaxy;
// _stars = galaxy.MapData.Stars.Select(s => s.Position);
}
public override void OnInspectorGUI()
{
var galaxy = target as Galaxy;
if (_currentLayer == null)
_currentLayer = galaxy.MapData.StarDensity;
if (Screen.width != _width)
{
_width = Screen.width;
_starTex = new Texture2D(_width,_width, TextureFormat.ARGB32, false);
_linkTex = new Texture2D(_width,_width, TextureFormat.ARGB32, false);
RenderStars();
RenderLinks();
}
GUILayout.Label("Preview", EditorStyles.boldLabel);
_galaxyMat.SetFloat("Arms", galaxy.MapData.ShapeSettings.Arms);
_galaxyMat.SetFloat("Twist", galaxy.MapData.ShapeSettings.Twist);
_galaxyMat.SetFloat("TwistPower", galaxy.MapData.ShapeSettings.TwistExponent);
_galaxyMat.SetFloat("SpokeOffset", _currentLayer.SpokeOffset);
_galaxyMat.SetFloat("SpokeScale", _currentLayer.SpokeScale);
_galaxyMat.SetFloat("CoreBoost", _currentLayer.CoreBoost);
_galaxyMat.SetFloat("CoreBoostOffset", _currentLayer.CoreBoostOffset);
_galaxyMat.SetFloat("CoreBoostPower", _currentLayer.CoreBoostPower);
_galaxyMat.SetFloat("EdgeReduction", _currentLayer.EdgeReduction);
_galaxyMat.SetFloat("NoisePosition", _currentLayer.NoisePosition);
_galaxyMat.SetFloat("NoiseAmplitude", _currentLayer.NoiseAmplitude);
_galaxyMat.SetFloat("NoiseOffset", _currentLayer.NoiseOffset);
_galaxyMat.SetFloat("NoiseGain", _currentLayer.NoiseGain);
_galaxyMat.SetFloat("NoiseLacunarity", _currentLayer.NoiseLacunarity);
_galaxyMat.SetFloat("NoiseFrequency", _currentLayer.NoiseFrequency);
var rect = GetControlRect(false, _width);
EditorGUI.DrawPreviewTexture(rect, _white, _galaxyMat);
if(_drawLinks)
EditorGUI.DrawPreviewTexture(rect, _linkTex, _transparent);
if(_drawStars)
EditorGUI.DrawPreviewTexture(rect, _starTex, _transparent);
_drawStars = ToggleLeft($"Display {_stars.Count()} Stars", _drawStars);
_drawResource = ToggleLeft("Display Resources", _drawResource);
_drawLinks = ToggleLeft($"Display {_starLinks.Count} Links", _drawLinks);
GUILayout.Space(10);
// Show default inspector property editor
DrawDefaultInspector ();
BeginVertical("Box");
EditorGUI.indentLevel++;
GUILayout.Label(_currentLayerName);
Inspect(_currentLayer);
EditorGUI.indentLevel--;
EndVertical();
BeginVertical("Box");
EditorGUI.indentLevel++;
_showResourceMaps = Foldout(_showResourceMaps, "Resource Density Maps");
if (_showResourceMaps)
{
EditorGUI.indentLevel++;
foreach (var resourceDensity in galaxy.MapData.ResourceDensities)
{
BeginHorizontal();
resourceDensity.Name = DelayedTextField(resourceDensity.Name);
if (GUILayout.Button("Inspect"))
{
_currentLayer = resourceDensity;
}
if (GUILayout.Button("Copy"))
{
galaxy.MapData.ResourceDensities.Add(resourceDensity.Copy());
}
EndHorizontal();
}
EditorGUI.indentLevel--;
if (GUILayout.Button("Add New Resource"))
{
galaxy.MapData.ResourceDensities.Add(new GalaxyMapLayerData(){Name = "New Resource"});
}
}
else if(_currentLayer != galaxy.MapData.StarDensity)
{
_currentLayerName = "Star Density";
_currentLayer = galaxy.MapData.StarDensity;
}
EditorGUI.indentLevel--;
EndVertical();
BeginVertical("Box");
EditorGUI.indentLevel++;
_showStarEditor = Foldout(_showStarEditor, "Star Tools");
if (_showStarEditor)
{
_hilbertOrder = IntField("Hilbert Order", _hilbertOrder);
_starCount = IntField("Star Count", _starCount);
//_hilbertIndex = (ulong) EditorGUILayout.IntField("Hilbert Index", (int) _hilbertIndex);
if (GUILayout.Button("Evaluate Hilbert Curve"))
{
var points = EvaluateHilbert(_hilbertOrder,false);
Debug.Log($"Hilbert curve has {points.Count()} points, resolution {Mathf.RoundToInt(points.Max(p=>p.x))+1}");
}
_minStarDistance = FloatField("Minimum Star Distance", _minStarDistance);
if (GUILayout.Button("Generate Stars"))
{
var points = EvaluateHilbert(_hilbertOrder).ToArray();
var stars = new List<Vector2>();
int bail = 0;
while (stars.Count < _starCount && bail < 10)
{
var accum = 0f;
foreach (var hp in points.Select(p=>p+Random.insideUnitCircle * ((points[0]-points[1]).magnitude/2)))
{
var den = galaxy.MapData.StarDensity.Evaluate(hp, galaxy.MapData.ShapeSettings);
if(!float.IsNaN(den))
accum += saturate(den) * Random.value;
// else
// Debug.Log($"Density at ({hp.x},{hp.y}) is NaN");
if (accum > 1 && (!stars.Any() || stars.Min(s=>(s-hp).magnitude) > _minStarDistance) )
{
stars.Add(hp);
accum = 0;
}
//Debug.Log($"Accumulator: {accum}");
}
bail++;
}
Debug.Log($"Generated {stars.Count} stars.");
_stars = stars;
RenderStars();
}
if (_stars.Any())
{
_maxLinkLength = FloatField("Max Link Length", _maxLinkLength);
if (GUILayout.Button("Generate Star Links"))
{
_voronoiMesh = VoronoiMesh<Vertex2, Cell2, VoronoiEdge<Vertex2, Cell2>>.Create(_stars.Select(s=>new Vertex2(s.x,s.y)).ToList());
_starLinks.Clear();
// Each cell in this collection represents one of the triangle faces of the Delaunay Triangulation
foreach (var cell in _voronoiMesh.Vertices)
{
var links = new[] {new VoronoiLink(cell.Vertices[0], cell.Vertices[1]),
new VoronoiLink(cell.Vertices[0], cell.Vertices[2]),
new VoronoiLink(cell.Vertices[2], cell.Vertices[1])};
_starLinks.AddRange(links.Where(l=>!_starLinks.ContainsLine(l) && l.Length < _maxLinkLength));
RenderLinks();
}
}
if (_starLinks.Any())
{
_linkFilter = FloatField("Link Filter Percentage", _linkFilter);
if (GUILayout.Button("Filter Star Links"))
{
var bail = 0;
var count = _starLinks.Count * Mathf.Clamp01(_linkFilter);
var deadLinks = new List<VoronoiLink>();
for (int i = 0; i < count && bail < count*10; bail++)
{
var link = _starLinks.ElementAt(Random.Range(0, _starLinks.Count));
if (deadLinks.Contains(link)) continue;
var mapMinusLink = _starLinks.Where(l => !l.Equals(link)).ToArray();
if (!mapMinusLink.ConnectedRegion(link.point1).Contains(link.point2))
deadLinks.Add(link);
else
{
_starLinks.Remove(link);
i++;
}
//if (_starLinks.Count(sl => sl.ContainsPoint(link.point1)) > 1 && _starLinks.Count(sl => sl.ContainsPoint(link.point2)) > 1)
}
RenderLinks();
}
if (GUILayout.Button("Save Star Data"))
{
galaxy.MapData.Stars = _stars.Select(s => new StarData {Position = s}).ToList();
foreach (var star in galaxy.MapData.Stars)
{
star.Links.Clear();
star.Links.AddRange(_starLinks.Where(sl => (sl.point1.ToVector2() - star.Position).sqrMagnitude < float.Epsilon)
.Select(sl => galaxy.MapData.Stars.IndexOf(galaxy.MapData.Stars.First(s => (sl.point2.ToVector2() - s.Position).sqrMagnitude < float.Epsilon))));
star.Links.AddRange(_starLinks.Where(sl => (sl.point2.ToVector2() - star.Position).sqrMagnitude < float.Epsilon)
.Select(sl => galaxy.MapData.Stars.IndexOf(galaxy.MapData.Stars.First(s => (sl.point1.ToVector2() - s.Position).sqrMagnitude < float.Epsilon))));
}
}
if (GUILayout.Button("Connect to RethinkDB"))
_connection = R.Connection().Hostname(EditorPrefs.GetString("RethinkDB.URL")).Port(RethinkDBConstants.DefaultPort).Timeout(60).Connect();
EditorGUI.BeginDisabledGroup(_connection == null);
if (GUILayout.Button("Drop Galaxy Table"))
R.Db("Aetheria").TableDrop("Galaxy").Run(_connection);
if (GUILayout.Button("Create Galaxy Table"))
R.Db("Aetheria").TableCreate("Galaxy").Run(_connection);
EditorGUI.BeginDisabledGroup(!galaxy.MapData.Stars.Any());
if (GUILayout.Button("Upload Star Data"))
{
Converter.Serializer.Converters.Add(new MathJsonConverter());
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Converters = new List<JsonConverter>
{
new MathJsonConverter(),
Converter.DateTimeConverter,
Converter.BinaryConverter,
Converter.GroupingConverter,
Converter.PocoExprConverter
}
};
var starIDs = new Dictionary<StarData, Guid>();
foreach (var star in galaxy.MapData.Stars)
starIDs[star] = Guid.NewGuid();
foreach (var star in galaxy.MapData.Stars)
{
R.Db("Aetheria").Table("Galaxy").Insert(new ZoneData
{
ID = starIDs[star],
Name = starIDs[star].ToString().Substring(0, 8),
Wormholes = star.Links.Select(i => starIDs[galaxy.MapData.Stars[i]]).ToList(),
Position = star.Position
}).Run(_connection);
}
//galaxy.MapData.GlobalData.MapLayers["StarDensity"] = galaxy.MapData.StarDensity.ID = Guid.NewGuid();
galaxy.MapData.StarDensity.Name = "StarDensity";
R.Db("Aetheria").Table("Galaxy").Insert(galaxy.MapData.StarDensity).Run(_connection);
foreach (var data in galaxy.MapData.ResourceDensities)
{
// galaxy.MapData.GlobalData.MapLayers[data.Name] = data.ID = Guid.NewGuid();
R.Db("Aetheria").Table("Galaxy").Insert(data).Run(_connection);
}
R.Db("Aetheria").Table("Galaxy").Insert(galaxy.MapData.ShapeSettings).Run(_connection);
}
EditorGUI.EndDisabledGroup();
EditorGUI.EndDisabledGroup();
}
}
}
EditorGUI.indentLevel--;
EndVertical();
EditorUtility.SetDirty(target);
}
private IEnumerable<Vector2> EvaluateHilbert(int order, bool normalized = true)
{
throw new NotImplementedException("GOTTA GET A NEW CURVE EVALUATOR");
// var points = new List<Vector2>();
// uint x = 0, y = 1;
// ulong i = 1;
// uint max = 0;
// while (x != 0 || y != 0)
// {
// SpaceFillingCurve.ReverseHilbert(order, i, out x, out y);
// points.Add(new Vector2(x, y));
// if (x > max)
// max = x;
// i++;
// }
// return normalized ? points.Select(p => p / (max + 1)) : points;
}
void Inspect(GalaxyMapLayerData layer)
{
layer.EdgeReduction = FloatField("Edge Reduction", layer.EdgeReduction);
layer.CoreBoost = FloatField("Core Boost", layer.CoreBoost);
layer.CoreBoostOffset = FloatField("Core Boost Offset", layer.CoreBoostOffset);
layer.CoreBoostPower = FloatField("Core Boost Power", layer.CoreBoostPower);
layer.NoisePosition = FloatField("Noise Position", layer.NoisePosition);
layer.NoiseOffset = FloatField("Noise Offset", layer.NoiseOffset);
layer.NoiseAmplitude = FloatField("Noise Amplitude", layer.NoiseAmplitude);
layer.NoiseGain = FloatField("Noise Gain", layer.NoiseGain);
layer.NoiseLacunarity = FloatField("Noise Lacunarity", layer.NoiseLacunarity);
layer.NoiseOctaves = IntField("Noise Octaves", layer.NoiseOctaves);
layer.NoiseFrequency = FloatField("Noise Frequency", layer.NoiseFrequency);
layer.SpokeOffset = FloatField("Spoke Offset", layer.SpokeOffset);
layer.SpokeScale = FloatField("Spoke Scale", layer.SpokeScale);
}
int UvToIndex(Vector2 v) => (int) (v.y * _width) * _width + (int) (v.x * _width);
void RenderLinks()
{
Color[] pixels = new Color[_width*_width];
for (var i = 0; i < pixels.Length; i++)
{
pixels[i] = Color.clear;
}
foreach (var l in _starLinks)
{
var pixelCount = Mathf.Max((int) (Mathf.Abs(l.point1.x - l.point2.x) * _width), (int) (Mathf.Abs(l.point1.y - l.point2.y) * _width));
//Debug.Log($"Marching across {pixelCount} pixels!");
for(int i=0;i<pixelCount;i++)
pixels[UvToIndex(Vector2.Lerp(l.point1.ToVector2(),l.point2.ToVector2(),(float)i/pixelCount))] = XKCDColors.OrangeRed;
}
_linkTex.SetPixels(pixels);
_linkTex.Apply();
}
void RenderStars()
{
Color[] pixels = new Color[_width*_width];
for (var i = 0; i < pixels.Length; i++)
{
pixels[i] = Color.clear;
}
foreach (var s in _stars)
{
pixels[UvToIndex(s)] = Color.white;
pixels[UvToIndex(s + Vector2.up / _width)] = new Color(.5f, .5f, .5f, 1);
pixels[UvToIndex(s - Vector2.up / _width)] = new Color(.5f, .5f, .5f, 1);
pixels[UvToIndex(s + Vector2.right / _width)] = new Color(.5f, .5f, .5f, 1);
pixels[UvToIndex(s - Vector2.right / _width)] = new Color(.5f, .5f, .5f, 1);
pixels[UvToIndex(s + Vector2.up / _width + Vector2.right / _width)] = new Color(0, 0, 0, 1);
pixels[UvToIndex(s + Vector2.up / _width - Vector2.right / _width)] = new Color(0, 0, 0, 1);
pixels[UvToIndex(s - Vector2.up / _width - Vector2.right / _width)] = new Color(0, 0, 0, 1);
pixels[UvToIndex(s - Vector2.up / _width + Vector2.right / _width)] = new Color(0, 0, 0, 1);
}
_starTex.SetPixels(pixels);
_starTex.Apply();
}
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 3122b5a17f0ed2f4a90bb61f6766340a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,167 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
//using MessagePack;
using UnityEngine;
using NaughtyAttributes;
using JM.LinqFaster;
using QuickGraph;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using static Unity.Mathematics.noise;
[Serializable]
[CreateAssetMenu(menuName = "Aetheria/Galaxy")]
public class Galaxy : ScriptableObject
{
public GalaxyMapData MapData;
}
[Serializable]
public class GalaxyMapData
{
public GalaxyShapeSettings ShapeSettings = new GalaxyShapeSettings();
[HideInInspector]
public GalaxyMapLayerData StarDensity;
[HideInInspector]
public List<GalaxyMapLayerData> ResourceDensities = new List<GalaxyMapLayerData>();
[HideInInspector]
public List<StarData> Stars = new List<StarData>();
}
public static class StarListExtensions
{
class DijkstraStar
{
public float Cost;
public DijkstraStar Parent;
public StarData Star;
}
public static List<StarData> FindPath(this List<StarData> stars, StarData source, StarData target, bool bestFirst = false)
{
SortedList<float,DijkstraStar> members = new SortedList<float,DijkstraStar>{{0,new DijkstraStar{Star = source}}};
List<DijkstraStar> searched = new List<DijkstraStar>();
while (true)
{
var s = members.FirstOrDefault(m => !searched.Contains(m.Value)).Value; // Lowest cost unsearched node
if (s == null) return null; // No vertices left unsearched
if (s.Star == target) // We found the path
{
Stack<DijkstraStar> path = new Stack<DijkstraStar>(); // Since we start at the end, use a LIFO collection
path.Push(s);
while(path.Peek().Parent!=null) // Keep pushing until we reach the start, which has no parent
path.Push(path.Peek().Parent);
return path.Select(dv => dv.Star).ToList();
}
// foreach (var dijkstraStar in s.Star.Links.Select(i => stars[i]) // All adjacent stars
// .Where(n => members.All(m => m.Value.Star != n)) // That are not members
// .Select(n => new DijkstraStar {Parent = s, Star = n, Cost = s.Cost + (s.Star.Position - n.Position).magnitude}))
// For each adjacent star (filter already visited stars unless heuristic is in use)
foreach (var dijkstraStar in s.Star.Links.WhereSelectF(i => !bestFirst || members.All(m => m.Value.Star != stars[i]),
// Cost is parent cost plus distance
i => new DijkstraStar {Parent = s, Star = stars[i], Cost = s.Cost + (s.Star.Position - stars[i].Position).magnitude}))
// Add new member to list, sorted by cost plus optional heuristic
members.Add(bestFirst ? dijkstraStar.Cost + (dijkstraStar.Star.Position - target.Position).magnitude : dijkstraStar.Cost, dijkstraStar);
searched.Add(s);
}
}
}
[Serializable]
public class StarData
{
public Vector2 Position;
public List<int> Links = new List<int>();
}
public class VoronoiLink
{
public Vertex2 point1;
public Vertex2 point2;
public float Length { get { return (point1.ToVector2() - point2.ToVector2()).magnitude; } }
public VoronoiLink(Vertex2 p1, Vertex2 p2)
{
point1 = p1;
point2 = p2;
}
public bool ContainsPoint(Vertex2 p)
{
return point1 == p || point2 == p;
}
}
public static class VoronoiLinkExtensions
{
class DijkstraVertex
{
public double Cost;
public double Heuristic;
public DijkstraVertex Parent;
public Vertex2 Vertex;
}
public static bool ContainsLine(this IEnumerable<VoronoiLink> data, VoronoiLink l)
{
return
data.Any(
line =>
(line.point1 == l.point1 && line.point2 == l.point2) ||
(line.point1 == l.point2 && line.point2 == l.point1));
}
public static IEnumerable<Vertex2> FindPath(this IEnumerable<VoronoiLink> data, Vertex2 source, Vertex2 target, bool bestFirst = true)
{
List<DijkstraVertex> members = new List<DijkstraVertex>{new DijkstraVertex{Vertex = source}};
List<Vertex2> searched = new List<Vertex2>();
while (true)
{
var v = members.Where(m=>!searched.Contains(m.Vertex)).OrderBy(m=>bestFirst?m.Heuristic:m.Cost).FirstOrDefault();
if (v == null) return null; // No vertices left unsearched
if (v.Vertex == target)
{
Stack<DijkstraVertex> path = new Stack<DijkstraVertex>();
path.Push(v);
while(path.Peek().Parent!=null)
path.Push(path.Peek().Parent);
return path.Select(dv => dv.Vertex).ToList();
}
members.AddRange(data.Where(l => l.point1 == v.Vertex).Select(l => l.point2).Concat(data.Where(l => l.point2 == v.Vertex).Select(l => l.point1))
.Where(n => members.All(m => m.Vertex != n)).Select(n =>
{
var c = new DijkstraVertex {Parent = v, Vertex = n, Cost = v.Cost + v.Vertex.Distance(n)};
if (bestFirst)
c.Heuristic = c.Cost + c.Vertex.Distance(target);
return c;
}));
searched.Add(v.Vertex);
}
}
public static IEnumerable<Vertex2> ConnectedRegion(this IEnumerable<VoronoiLink> data, Vertex2 v)
{
List<Vertex2> members = new List<Vertex2>();
members.Add(v);
while (true)
{
int lastCount = members.Count;
// For each member, add all vertices that are connected to it via a line but are not already a member
foreach (Vertex2 m in members.ToArray())
members.AddRange(data.Where(l => l.point1 == m).Select(l => l.point2)
.Concat(data.Where(l => l.point2 == m).Select(l => l.point1))
.Where(n => !members.Contains(n)));
// If we have stopped finding neighbors, stop traversing
if (members.Count == lastCount)
return members;
}
}
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a17905e2bcacd37408f3f6e93b9885e9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,23 +1,24 @@
 using UnityEngine;
using System.Collections;
using System.Collections;
using System.Linq;
using MIConvexHull;
using Unity.Mathematics;
using static Unity.Mathematics.math;
/// <summary>
/// A vertex is a simple class that stores the postion of a point, node or vertex.
/// </summary>
public class Cell2 : TriangulationCell<Vertex2, Cell2>
{
Vector2? circumCenter, centroid;
float2? circumCenter, centroid;
public Vector2 Circumcenter {
public float2 Circumcenter {
get {
circumCenter = circumCenter ?? GetCircumcenter();
return circumCenter.Value;
}
}
public Vector2 Centroid {
public float2 Centroid {
get {
centroid = centroid ?? GetCentroid();
return centroid.Value;
@ -29,9 +30,9 @@ public class Cell2 : TriangulationCell<Vertex2, Cell2>
}
double LengthSquared (double[] v)
double LengthSquared (float[] v)
{
double norm = 0;
float norm = 0;
for (int i = 0; i < v.Length; i++) {
var t = v [i];
norm += t * t;
@ -39,24 +40,24 @@ public class Cell2 : TriangulationCell<Vertex2, Cell2>
return norm;
}
double Determinant(double[,] m)
float Determinant(float[,] m)
{
double fCofactor00 = m[1,1] * m[2,2] - m[1,2] * m[2,1];
double fCofactor10 = m[1,2] * m[2,0] - m[1,0] * m[2,2];
double fCofactor20 = m[1,0] * m[2,1] - m[1,1] * m[2,0];
float fCofactor00 = m[1,1] * m[2,2] - m[1,2] * m[2,1];
float fCofactor10 = m[1,2] * m[2,0] - m[1,0] * m[2,2];
float fCofactor20 = m[1,0] * m[2,1] - m[1,1] * m[2,0];
double fDet = m[0,0] * fCofactor00 + m[0,1] * fCofactor10 + m[0,2] * fCofactor20;
float fDet = m[0,0] * fCofactor00 + m[0,1] * fCofactor10 + m[0,2] * fCofactor20;
return fDet;
}
Vector2 GetCircumcenter ()
float2 GetCircumcenter ()
{
// From MathWorld: http://mathworld.wolfram.com/Circumcircle.html
var points = Vertices;
double[,] m = new double[3, 3];
float[,] m = new float[3, 3];
// x, y, 1
for (int i = 0; i < 3; i++) {
@ -68,7 +69,7 @@ public class Cell2 : TriangulationCell<Vertex2, Cell2>
// size, y, 1
for (int i = 0; i < 3; i++) {
m[i, 0] = points[i].StoredPosition.sqrMagnitude;
m[i, 0] = lengthsq(points[i].StoredPosition);
}
var dx = -Determinant(m);
@ -84,15 +85,15 @@ public class Cell2 : TriangulationCell<Vertex2, Cell2>
//}
//var c = -Det(m);
var s = -1.0 / (2.0 * a);
var s = -1.0f / (2.0f * a);
//var r = System.Math.Abs(s) * System.Math.Sqrt(dx * dx + dy * dy - 4 * a * c);
return new Vector2((float)(s * dx), (float)(s * dy));
return new float2(s * dx, s * dy);
}
Vector2 GetCentroid ()
float2 GetCentroid ()
{
return new Vector2((float)Vertices.Select(v => v.Position[0]).Average(), (float)Vertices.Select(v => v.Position[1]).Average());
return new float2(Vertices.Select(v => v.Position[0]).Average(), Vertices.Select(v => v.Position[1]).Average());
}
}

View file

@ -0,0 +1,114 @@
using System.Collections;
using System.Linq;
using MIConvexHull;
using Unity.Mathematics;
using static Unity.Mathematics.math;
/// <summary>
/// A vertex is a simple class that stores the postion of a point, node or vertex.
/// </summary>
public class Cell2<T> : TriangulationCell<Vertex2<T>, Cell2<T>>
{
float2? circumCenter, centroid;
public float2 Circumcenter {
get {
circumCenter = circumCenter ?? GetCircumcenter();
return circumCenter.Value;
}
}
public float2 Centroid {
get {
centroid = centroid ?? GetCentroid();
return centroid.Value;
}
}
public Cell2 ()
{
}
double LengthSquared (float[] v)
{
float norm = 0;
for (int i = 0; i < v.Length; i++) {
var t = v [i];
norm += t * t;
}
return norm;
}
float Determinant(float[,] m)
{
float fCofactor00 = m[1,1] * m[2,2] - m[1,2] * m[2,1];
float fCofactor10 = m[1,2] * m[2,0] - m[1,0] * m[2,2];
float fCofactor20 = m[1,0] * m[2,1] - m[1,1] * m[2,0];
float fDet = m[0,0] * fCofactor00 + m[0,1] * fCofactor10 + m[0,2] * fCofactor20;
return fDet;
}
float2 GetCircumcenter ()
{
// From MathWorld: http://mathworld.wolfram.com/Circumcircle.html
var points = Vertices;
float[,] m = new float[3, 3];
// x, y, 1
for (int i = 0; i < 3; i++) {
m[i, 0] = points[i].x;
m[i, 1] = points[i].y;
m[i, 2] = 1;
}
var a = Determinant(m);
// size, y, 1
for (int i = 0; i < 3; i++) {
m[i, 0] = lengthsq(points[i].StoredPosition);
}
var dx = -Determinant(m);
// size, x, 1
for (int i = 0; i < 3; i++) {
m[i, 1] = points[i].x;
}
var dy = Determinant(m);
// size, x, y
//for (int i = 0; i < 3; i++) {
// m[i, 2] = points[i].y;
//}
//var c = -Det(m);
var s = -1.0f / (2.0f * a);
//var r = System.Math.Abs(s) * System.Math.Sqrt(dx * dx + dy * dy - 4 * a * c);
return new float2(s * dx, s * dy);
}
float2 GetCentroid ()
{
return new float2(Vertices.Select(v => v.Position[0]).Average(), Vertices.Select(v => v.Position[1]).Average());
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ea854ab9e5204f92828e92ffb1244964
timeCreated: 1615420193

View file

@ -33,11 +33,11 @@ namespace MIConvexHull
/// <summary>
/// The default plane distance tolerance
/// </summary>
internal const double DefaultPlaneDistanceTolerance = 1e-10;
internal const float DefaultPlaneDistanceTolerance = 1e-10f;
/// <summary>
/// The starting delta dot product in simplex
/// </summary>
internal const double StartingDeltaDotProductInSimplex = 0.5;
internal const float StartingDeltaDotProductInSimplex = 0.5f;
/// <summary>
/// The connector table size
/// </summary>

View file

@ -47,7 +47,7 @@ namespace MIConvexHull
/// ConvexHull&lt;TVertex, TFace&gt;.
/// </returns>
public static ConvexHull<TVertex, TFace> Create<TVertex, TFace>(IList<TVertex> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
where TVertex : IVertex
where TFace : ConvexFace<TVertex, TFace>, new()
{
@ -65,7 +65,7 @@ namespace MIConvexHull
/// ConvexHull&lt;TVertex, DefaultConvexFace&lt;TVertex&gt;&gt;.
/// </returns>
public static ConvexHull<TVertex, DefaultConvexFace<TVertex>> Create<TVertex>(IList<TVertex> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
where TVertex : IVertex
{
return ConvexHull<TVertex, DefaultConvexFace<TVertex>>.Create(data, PlaneDistanceTolerance);
@ -80,8 +80,8 @@ namespace MIConvexHull
/// <returns>
/// ConvexHull&lt;DefaultVertex, DefaultConvexFace&lt;DefaultVertex&gt;&gt;.
/// </returns>
public static ConvexHull<DefaultVertex, DefaultConvexFace<DefaultVertex>> Create(IList<double[]> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
public static ConvexHull<DefaultVertex, DefaultConvexFace<DefaultVertex>> Create(IList<float[]> data,
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
{
var points = data.Select(p => new DefaultVertex { Position = p }).ToList();
return ConvexHull<DefaultVertex, DefaultConvexFace<DefaultVertex>>.Create(points, PlaneDistanceTolerance);
@ -126,7 +126,7 @@ namespace MIConvexHull
/// </returns>
/// <exception cref="System.ArgumentNullException">The supplied data is null.</exception>
/// <exception cref="ArgumentNullException">data</exception>
public static ConvexHull<TVertex, TFace> Create(IList<TVertex> data, double PlaneDistanceTolerance)
public static ConvexHull<TVertex, TFace> Create(IList<TVertex> data, float PlaneDistanceTolerance)
{
if (data == null) throw new ArgumentNullException("The supplied data is null.");
return ConvexHullAlgorithm.GetConvexHull<TVertex, TFace>(data, PlaneDistanceTolerance);

View file

@ -55,7 +55,7 @@ namespace MIConvexHull
/// The normal vector of the face. Null if used in triangulation.
/// </summary>
/// <value>The normal.</value>
public double[] Normal { get; set; }
public float[] Normal { get; set; }
}
/// <summary>

View file

@ -57,7 +57,7 @@ namespace MIConvexHull
/// MIConvexHull.ConvexHull&lt;TVertex, TFace&gt;.
/// </returns>
internal static ConvexHull<TVertex, TFace> GetConvexHull<TVertex, TFace>(IList<TVertex> data,
double PlaneDistanceTolerance)
float PlaneDistanceTolerance)
where TFace : ConvexFace<TVertex, TFace>, new()
where TVertex : IVertex
{
@ -86,7 +86,7 @@ namespace MIConvexHull
/// Dimension of the input must be 2 or greater.</exception>
/// <exception cref="ArgumentException">There are too few vertices (m) for the n-dimensional space. (m must be greater " +
/// "than the n, but m is " + NumberOfVertices + " and n is " + Dimension</exception>
private ConvexHullAlgorithm(IVertex[] vertices, bool lift, double PlaneDistanceTolerance)
private ConvexHullAlgorithm(IVertex[] vertices, bool lift, float PlaneDistanceTolerance)
{
IsLifted = lift;
Vertices = vertices;
@ -107,7 +107,7 @@ namespace MIConvexHull
AffectedFaceFlags = new bool[(NumOfDimensions + 1) * 10];
ObjectManager = new ObjectManager(this);
Center = new double[NumOfDimensions];
Center = new float[NumOfDimensions];
TraverseStack = new IndexBuffer();
UpdateBuffer = new int[NumOfDimensions];
UpdateIndices = new int[NumOfDimensions];
@ -121,10 +121,10 @@ namespace MIConvexHull
for (var i = 0; i < Constants.ConnectorTableSize; i++) ConnectorTable[i] = new ConnectorList();
VertexVisited = new bool[NumberOfVertices];
Positions = new double[NumberOfVertices * NumOfDimensions];
Positions = new float[NumberOfVertices * NumOfDimensions];
boundingBoxPoints = new List<int>[NumOfDimensions];
minima = new double[NumOfDimensions];
maxima = new double[NumOfDimensions];
minima = new float[NumOfDimensions];
maxima = new float[NumOfDimensions];
mathHelper = new MathHelper(NumOfDimensions, Positions);
}
/// <summary>
@ -194,7 +194,7 @@ namespace MIConvexHull
{
foreach (var v in Vertices)
{
var parabolaTerm = 0.0; // the lifted term is a sum of squares.
var parabolaTerm = 0.0f; // the lifted term is a sum of squares.
var origNumDim = NumOfDimensions - 1;
for (var i = 0; i < origNumDim; i++)
{
@ -226,7 +226,7 @@ namespace MIConvexHull
{
var minIndices = new List<int>();
var maxIndices = new List<int>();
double min = double.PositiveInfinity, max = double.NegativeInfinity;
float min = float.PositiveInfinity, max = float.NegativeInfinity;
for (var j = 0; j < NumberOfVertices; j++)
{
var v = GetCoordinate(j, i);
@ -304,7 +304,7 @@ namespace MIConvexHull
for (int i = origNumDim; i < positionsLength; i += NumOfDimensions)
Positions[i] *= parabolaScale;
}
var shiftAmount = new double[NumOfDimensions];
var shiftAmount = new float[NumOfDimensions];
for (int i = 0; i < NumOfDimensions; i++)
// now the entire model is shifted to all positive numbers...plus some more.
// why?
@ -316,7 +316,7 @@ namespace MIConvexHull
// half of the maxima. 'Half' is much preferred to 'thousands of times'
// Think of the first term as the range (max - min), then the second term avoids cases
// where there are both positive and negative numbers.
if (maxima[i] == minima[i]) shiftAmount[i] = 0.0;
if (maxima[i] == minima[i]) shiftAmount[i] = 0.0f;
else shiftAmount[i] = (maxima[i] - minima[i]) - minima[i];
for (int i = 0; i < positionsLength; i++)
Positions[i] += shiftAmount[i % NumOfDimensions];
@ -394,7 +394,7 @@ namespace MIConvexHull
VertexVisited[vertex1] = VertexVisited[vertex2] = true;
CurrentVertex = vertex1; UpdateCenter();
CurrentVertex = vertex2; UpdateCenter();
var edgeVectors = new double[NumOfDimensions][];
var edgeVectors = new float[NumOfDimensions][];
edgeVectors[0] = mathHelper.VectorBetweenVertices(vertex2, vertex1);
// now the remaining vertices are just combined in one big list
var extremes = boundingBoxPoints.SelectMany(x => x).ToList();
@ -403,7 +403,7 @@ namespace MIConvexHull
while (index < NumOfDimensions && extremes.Any())
{
var bestVertex = -1;
var bestEdgeVector = new double[] { };
var bestEdgeVector = new float[] { };
var maxVolume = Constants.DefaultPlaneDistanceTolerance;
for (var i = extremes.Count - 1; i >= 0; i--)
{
@ -438,7 +438,7 @@ namespace MIConvexHull
while (index < NumOfDimensions && allVertices.Any())
{
var bestVertex = -1;
var bestEdgeVector = new double[] { };
var bestEdgeVector = new float[] { };
var maxVolume = 0.0;
for (var i = allVertices.Count - 1; i >= 0; i--)
{
@ -470,7 +470,7 @@ namespace MIConvexHull
while (index < NumOfDimensions && allVertices.Any())
{
var bestVertex = -1;
var bestEdgeVector = new double[] { };
var bestEdgeVector = new float[] { };
var maxVolume = 0.0;
for (var i = allVertices.Count - 1; i >= 0; i--)
{
@ -549,7 +549,7 @@ namespace MIConvexHull
private void FindBeyondVertices(ConvexFaceInternal face)
{
var beyondVertices = face.VerticesBeyond;
MaxDistance = double.NegativeInfinity;
MaxDistance = float.NegativeInfinity;
FurthestVertex = 0;
for (var i = 0; i < NumberOfVertices; i++)
{
@ -575,7 +575,7 @@ namespace MIConvexHull
/// <summary>
/// Explained in ConvexHullComputationConfig.
/// </summary>
private readonly double PlaneDistanceTolerance;
private readonly float PlaneDistanceTolerance;
/*
* Representation of the input vertices.
@ -594,7 +594,7 @@ namespace MIConvexHull
/// <summary>
/// The positions
/// </summary>
private double[] Positions;
private float[] Positions;
/// <summary>
/// The vertex marks
/// </summary>
@ -650,7 +650,7 @@ namespace MIConvexHull
/// <summary>
/// The centroid of the currently computed hull.
/// </summary>
private readonly double[] Center;
private readonly float[] Center;
/*
* Helper arrays to store faces for adjacency update.
@ -714,8 +714,8 @@ namespace MIConvexHull
private readonly MathHelper mathHelper;
private readonly List<int>[] boundingBoxPoints;
private int indexOfDimensionWithLeastExtremes;
private readonly double[] minima;
private readonly double[] maxima;
private readonly float[] minima;
private readonly float[] maxima;
#endregion
}
}

View file

@ -429,7 +429,7 @@ namespace MIConvexHull
{
for (var i = 0; i < NumOfDimensions; i++) Center[i] *= ConvexHullSize;
ConvexHullSize += 1;
var f = 1.0 / ConvexHullSize;
var f = 1.0f / ConvexHullSize;
var co = CurrentVertex * NumOfDimensions;
for (var i = 0; i < NumOfDimensions; i++) Center[i] = f * (Center[i] + Positions[co + i]);
}
@ -441,7 +441,7 @@ namespace MIConvexHull
{
for (var i = 0; i < NumOfDimensions; i++) Center[i] *= ConvexHullSize;
ConvexHullSize -= 1;
var f = ConvexHullSize > 0 ? 1.0 / ConvexHullSize : 0.0;
var f = ConvexHullSize > 0 ? 1.0f / ConvexHullSize : 0.0f;
var co = CurrentVertex * NumOfDimensions;
for (var i = 0; i < NumOfDimensions; i++) Center[i] = f * (Center[i] - Positions[co + i]);
}
@ -478,7 +478,7 @@ namespace MIConvexHull
/// <param name="vIndex">The vertex index.</param>
/// <param name="dimension">The index of the dimension.</param>
/// <returns>System.Double.</returns>
private double GetCoordinate(int vIndex, int dimension)
private float GetCoordinate(int vIndex, int dimension)
{
return Positions[vIndex * NumOfDimensions + dimension];
}

View file

@ -190,12 +190,12 @@ namespace MIConvexHull
/// <summary>
/// Gets or sets the normal vector.
/// </summary>
public double[] Normal;
public float[] Normal;
/// <summary>
/// Face plane constant element.
/// </summary>
public double Offset;
public float Offset;
//public int UnprocessedIndex;
@ -230,7 +230,7 @@ namespace MIConvexHull
Index = index;
AdjacentFaces = new int[dimension];
VerticesBeyond = beyondList;
Normal = new double[dimension];
Normal = new float[dimension];
Vertices = new int[dimension];
}
}

View file

@ -26,6 +26,9 @@
using System;
using System.Collections.Generic;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using Random = Unity.Mathematics.Random;
namespace MIConvexHull
{
@ -47,46 +50,48 @@ namespace MIConvexHull
/// <summary>
/// The n d matrix
/// </summary>
private readonly double[] nDMatrix;
private readonly float[] nDMatrix;
/// <summary>
/// The n d normal helper vector
/// </summary>
private readonly double[] nDNormalHelperVector;
private readonly float[] nDNormalHelperVector;
/// <summary>
/// The nt x
/// </summary>
private readonly double[] ntX;
private readonly float[] ntX;
/// <summary>
/// The nt y
/// </summary>
private readonly double[] ntY;
private readonly float[] ntY;
/// <summary>
/// The nt z
/// </summary>
private readonly double[] ntZ;
private readonly float[] ntZ;
/// <summary>
/// The position data
/// </summary>
private readonly double[] PositionData;
private readonly float[] PositionData;
private static Random _random = new Random((uint) (DateTime.Now.Ticks % uint.MaxValue));
/// <summary>
/// Initializes a new instance of the <see cref="MathHelper"/> class.
/// </summary>
/// <param name="dimension">The dimension.</param>
/// <param name="positions">The positions.</param>
internal MathHelper(int dimension, double[] positions)
internal MathHelper(int dimension, float[] positions)
{
PositionData = positions;
Dimension = dimension;
ntX = new double[Dimension];
ntY = new double[Dimension];
ntZ = new double[Dimension];
ntX = new float[Dimension];
ntY = new float[Dimension];
ntZ = new float[Dimension];
nDNormalHelperVector = new double[Dimension];
nDMatrix = new double[Dimension * Dimension];
nDNormalHelperVector = new float[Dimension];
nDMatrix = new float[Dimension * Dimension];
matrixPivots = new int[Dimension];
}
@ -96,19 +101,19 @@ namespace MIConvexHull
/// <param name="face">The face.</param>
/// <param name="center">The center.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
internal bool CalculateFacePlane(ConvexFaceInternal face, double[] center)
internal bool CalculateFacePlane(ConvexFaceInternal face, float[] center)
{
var vertices = face.Vertices;
var normal = face.Normal;
FindNormalVector(vertices, normal);
if (double.IsNaN(normal[0]))
if (float.IsNaN(normal[0]))
{
return false;
}
var offset = 0.0;
var centerDistance = 0.0;
var offset = 0.0f;
var centerDistance = 0.0f;
var fi = vertices[0] * Dimension;
for (var i = 0; i < Dimension; i++)
{
@ -152,9 +157,9 @@ namespace MIConvexHull
/// <param name="toIndex">To index.</param>
/// <param name="fromIndex">From index.</param>
/// <returns>System.Double[].</returns>
internal double[] VectorBetweenVertices(int toIndex, int fromIndex)
internal float[] VectorBetweenVertices(int toIndex, int fromIndex)
{
var target = new double[Dimension];
var target = new float[Dimension];
VectorBetweenVertices(toIndex, fromIndex, target);
return target;
}
@ -165,7 +170,7 @@ namespace MIConvexHull
/// <param name="toIndex">To index.</param>
/// <param name="target">The target.</param>
/// <returns></returns>
private void VectorBetweenVertices(int toIndex, int fromIndex, double[] target)
private void VectorBetweenVertices(int toIndex, int fromIndex, float[] target)
{
int u = toIndex * Dimension, v = fromIndex * Dimension;
for (var i = 0; i < Dimension; i++)
@ -174,11 +179,10 @@ namespace MIConvexHull
}
}
internal void RandomOffsetToLift(int index, double maxHeight)
internal void RandomOffsetToLift(int index, float maxHeight)
{
var random = new Random();
var liftIndex = (index * Dimension) + Dimension - 1;
PositionData[liftIndex] += 0.0001 * maxHeight * (random.NextDouble() - 0.5);
PositionData[liftIndex] += 0.0001f * maxHeight * (_random.NextFloat() - 0.5f);
}
#region Find the normal vector of the face
/// <summary>
@ -187,7 +191,7 @@ namespace MIConvexHull
/// </summary>
/// <param name="vertices">The vertices.</param>
/// <param name="normalData">The normal data.</param>
private void FindNormalVector(int[] vertices, double[] normalData)
private void FindNormalVector(int[] vertices, float[] normalData)
{
switch (Dimension)
{
@ -210,16 +214,16 @@ namespace MIConvexHull
/// </summary>
/// <param name="vertices">The vertices.</param>
/// <param name="normal">The normal.</param>
private void FindNormalVector2D(int[] vertices, double[] normal)
private void FindNormalVector2D(int[] vertices, float[] normal)
{
VectorBetweenVertices(vertices[1], vertices[0], ntX);
var nx = -ntX[1];
var ny = ntX[0];
var norm = Math.Sqrt(nx * nx + ny * ny);
var norm = sqrt(nx * nx + ny * ny);
var f = 1.0 / norm;
var f = 1.0f / norm;
normal[0] = f * nx;
normal[1] = f * ny;
}
@ -228,7 +232,7 @@ namespace MIConvexHull
/// </summary>
/// <param name="vertices">The vertices.</param>
/// <param name="normal">The normal.</param>
private void FindNormalVector3D(int[] vertices, double[] normal)
private void FindNormalVector3D(int[] vertices, float[] normal)
{
VectorBetweenVertices(vertices[1], vertices[0], ntX);
VectorBetweenVertices(vertices[2], vertices[1], ntY);
@ -237,9 +241,9 @@ namespace MIConvexHull
var ny = ntX[2] * ntY[0] - ntX[0] * ntY[2];
var nz = ntX[0] * ntY[1] - ntX[1] * ntY[0];
var norm = Math.Sqrt(nx * nx + ny * ny + nz * nz);
var norm = sqrt(nx * nx + ny * ny + nz * nz);
var f = 1.0 / norm;
var f = 1.0f / norm;
normal[0] = f * nx;
normal[1] = f * ny;
normal[2] = f * nz;
@ -249,7 +253,7 @@ namespace MIConvexHull
/// </summary>
/// <param name="vertices">The vertices.</param>
/// <param name="normal">The normal.</param>
private void FindNormalVector4D(int[] vertices, double[] normal)
private void FindNormalVector4D(int[] vertices, float[] normal)
{
VectorBetweenVertices(vertices[1], vertices[0], ntX);
VectorBetweenVertices(vertices[2], vertices[1], ntY);
@ -273,9 +277,9 @@ namespace MIConvexHull
+ x[1] * (y[2] * z[0] - y[0] * z[2])
+ x[0] * (y[1] * z[2] - y[2] * z[1]);
var norm = Math.Sqrt(nx * nx + ny * ny + nz * nz + nw * nw);
var norm = sqrt(nx * nx + ny * ny + nz * nz + nw * nw);
var f = 1.0 / norm;
var f = 1.0f / norm;
normal[0] = f * nx;
normal[1] = f * ny;
normal[2] = f * nz;
@ -287,7 +291,7 @@ namespace MIConvexHull
/// </summary>
/// <param name="vertices">The vertices.</param>
/// <param name="normal">The normal.</param>
private void FindNormalVectorND(int[] vertices, double[] normal)
private void FindNormalVectorND(int[] vertices, float[] normal)
{
/* We need to solve the matrix A n = B where
* - A contains coordinates of vertices as columns
@ -297,7 +301,7 @@ namespace MIConvexHull
*/
var iPiv = matrixPivots;
var data = nDMatrix;
var norm = 0.0;
var norm = 0.0f;
// Solve determinants by replacing x-th column by all 1.
for (var x = 0; x < Dimension; x++)
@ -309,11 +313,11 @@ namespace MIConvexHull
{
// maybe I got the i/j mixed up here regarding the representation Math.net uses...
// ...but it does not matter since Det(A) = Det(Transpose(A)).
data[Dimension * i + j] = j == x ? 1.0 : PositionData[offset + j];
data[Dimension * i + j] = j == x ? 1.0f : PositionData[offset + j];
}
}
LUFactor(data, Dimension, iPiv, nDNormalHelperVector);
var coord = 1.0;
var coord = 1.0f;
for (var i = 0; i < Dimension; i++)
{
if (iPiv[i] != i) coord *= -data[Dimension * i + i]; // the determinant sign changes on row swap.
@ -324,7 +328,7 @@ namespace MIConvexHull
}
// Normalize the result
var f = 1.0 / Math.Sqrt(norm);
var f = 1.0f / sqrt(norm);
for (var i = 0; i < normal.Length; i++) normal[i] *= f;
}
#endregion
@ -339,15 +343,15 @@ namespace MIConvexHull
/// <param name="lastIndex">The last index.</param>
/// <param name="bigNumber">The big number.</param>
/// <returns>System.Double.</returns>
internal double GetSimplexVolume(double[][] edgeVectors, int lastIndex, double bigNumber)
internal float GetSimplexVolume(float[][] edgeVectors, int lastIndex, float bigNumber)
{
var A = new double[Dimension * Dimension];
var A = new float[Dimension * Dimension];
var index = 0;
for (int i = 0; i < Dimension; i++)
for (int j = 0; j < Dimension; j++)
if (i <= lastIndex)
A[index++] = edgeVectors[i][j];
else A[index] = (Math.Pow(-1, index) * index++) / bigNumber;
else A[index] = (pow(-1, index) * index++) / bigNumber;
// this last term is used for all the vertices in the comparison for the yet determined vertices
// the idea is to come up with sets of numbers that are orthogonal so that an non-zero value will result
// and to choose smallish numbers since the choice of vectors will affect what the end volume is.
@ -355,7 +359,7 @@ namespace MIConvexHull
// (the upper left) had too many zeros. So, one would need to find the right subset. Indeed choosing a subset
// biases the first dimensions of the others. Perhaps a larger volume would be created from a different vertex
// if another subset of dimensions were used.
return Math.Abs(DeterminantDestructive(A));
return abs(DeterminantDestructive(A));
}
/// <summary>
@ -363,12 +367,12 @@ namespace MIConvexHull
/// </summary>
/// <param name="A">a.</param>
/// <returns>System.Double.</returns>
private double DeterminantDestructive(double[] A)
private float DeterminantDestructive(float[] A)
{
switch (Dimension)
{
case 0:
return 0.0;
return 0.0f;
case 1:
return A[0];
case 2:
@ -379,9 +383,9 @@ namespace MIConvexHull
default:
{
var iPiv = new int[Dimension];
var helper = new double[Dimension];
var helper = new float[Dimension];
LUFactor(A, Dimension, iPiv, helper);
var det = 1.0;
var det = 1.0f;
for (var i = 0; i < iPiv.Length; i++)
{
det *= A[Dimension * i + i];
@ -403,7 +407,7 @@ namespace MIConvexHull
/// <param name="order">The order.</param>
/// <param name="ipiv">The ipiv.</param>
/// <param name="vecLUcolj">The vec l ucolj.</param>
private static void LUFactor(double[] data, int order, int[] ipiv, double[] vecLUcolj)
private static void LUFactor(float[] data, int order, int[] ipiv, float[] vecLUcolj)
{
// Initialize the pivot matrix to the identity permutation.
for (var i = 0; i < order; i++)
@ -428,7 +432,7 @@ namespace MIConvexHull
{
// Most of the time is spent in the following dot product.
var kmax = Math.Min(i, j);
var s = 0.0;
var s = 0.0f;
for (var k = 0; k < kmax; k++)
{
s += data[k * order + i] * vecLUcolj[k];
@ -441,7 +445,7 @@ namespace MIConvexHull
var p = j;
for (var i = j + 1; i < order; i++)
{
if (Math.Abs(vecLUcolj[i]) > Math.Abs(vecLUcolj[p]))
if (abs(vecLUcolj[i]) > abs(vecLUcolj[p]))
{
p = i;
}
@ -463,7 +467,7 @@ namespace MIConvexHull
}
// Compute multipliers.
if (j < order & data[indexjj] != 0.0)
if (j < order & data[indexjj] != 0.0f)
{
for (var i = j + 1; i < order; i++)
{

View file

@ -1,5 +1,4 @@
using UnityEngine;
using System.Collections;
using System.Collections;
using MIConvexHull;
public class Face3 : ConvexFace<Vertex3, Face3>

View file

@ -35,7 +35,7 @@ namespace MIConvexHull
/// Position of the vertex.
/// </summary>
/// <value>The position.</value>
double[] Position { get; }
float[] Position { get; }
}
/// <summary>
@ -48,6 +48,6 @@ namespace MIConvexHull
/// Position of the vertex.
/// </summary>
/// <value>The position.</value>
public double[] Position { get; set; }
public float[] Position { get; set; }
}
}

View file

@ -60,7 +60,7 @@ namespace MIConvexHull
/// <returns>ITriangulation&lt;TVertex, DefaultTriangulationCell&lt;TVertex&gt;&gt;.</returns>
public static ITriangulation<TVertex, DefaultTriangulationCell<TVertex>> CreateDelaunay<TVertex>(
IList<TVertex> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
where TVertex : IVertex
{
return DelaunayTriangulation<TVertex, DefaultTriangulationCell<TVertex>>.Create(data, PlaneDistanceTolerance);
@ -74,8 +74,8 @@ namespace MIConvexHull
/// will be missed. If too low, the algorithm may break. Only adjust if you notice problems.</param>
/// <returns>ITriangulation&lt;DefaultVertex, DefaultTriangulationCell&lt;DefaultVertex&gt;&gt;.</returns>
public static ITriangulation<DefaultVertex, DefaultTriangulationCell<DefaultVertex>> CreateDelaunay(
IList<double[]> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
IList<float[]> data,
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
{
var points = data.Select(p => new DefaultVertex { Position = p }).ToList();
return DelaunayTriangulation<DefaultVertex, DefaultTriangulationCell<DefaultVertex>>.Create(points, PlaneDistanceTolerance);
@ -91,7 +91,7 @@ namespace MIConvexHull
/// will be missed. If too low, the algorithm may break. Only adjust if you notice problems.</param>
/// <returns>ITriangulation&lt;TVertex, TFace&gt;.</returns>
public static ITriangulation<TVertex, TFace> CreateDelaunay<TVertex, TFace>(IList<TVertex> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
where TVertex : IVertex
where TFace : TriangulationCell<TVertex, TFace>, new()
{
@ -110,7 +110,7 @@ namespace MIConvexHull
/// will be missed. If too low, the algorithm may break. Only adjust if you notice problems.</param>
/// <returns>VoronoiMesh&lt;TVertex, TCell, TEdge&gt;.</returns>
public static VoronoiMesh<TVertex, TCell, TEdge> CreateVoronoi<TVertex, TCell, TEdge>(IList<TVertex> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
where TCell : TriangulationCell<TVertex, TCell>, new()
where TVertex : IVertex
where TEdge : VoronoiEdge<TVertex, TCell>, new()
@ -130,7 +130,7 @@ namespace MIConvexHull
VoronoiMesh
<TVertex, DefaultTriangulationCell<TVertex>, VoronoiEdge<TVertex, DefaultTriangulationCell<TVertex>>>
CreateVoronoi<TVertex>(IList<TVertex> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
where TVertex : IVertex
{
return
@ -150,8 +150,8 @@ namespace MIConvexHull
VoronoiMesh
<DefaultVertex, DefaultTriangulationCell<DefaultVertex>,
VoronoiEdge<DefaultVertex, DefaultTriangulationCell<DefaultVertex>>>
CreateVoronoi(IList<double[]> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
CreateVoronoi(IList<float[]> data,
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
{
var points = data.Select(p => new DefaultVertex { Position = p.ToArray() }).ToList();
return
@ -171,7 +171,7 @@ namespace MIConvexHull
/// <returns>VoronoiMesh&lt;TVertex, TCell, VoronoiEdge&lt;TVertex, TCell&gt;&gt;.</returns>
public static VoronoiMesh<TVertex, TCell, VoronoiEdge<TVertex, TCell>> CreateVoronoi<TVertex, TCell>(
IList<TVertex> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
where TVertex : IVertex
where TCell : TriangulationCell<TVertex, TCell>, new()
{

View file

@ -47,7 +47,7 @@ namespace MIConvexHull
/// <param name="PlaneDistanceTolerance">The plane distance tolerance.</param>
/// <returns>TCell[].</returns>
internal static TCell[] GetDelaunayTriangulation<TVertex, TCell>(IList<TVertex> data,
double PlaneDistanceTolerance )
float PlaneDistanceTolerance )
where TCell : TriangulationCell<TVertex, TCell>, new()
where TVertex : IVertex
{

View file

@ -62,7 +62,7 @@ namespace MIConvexHull
/// <exception cref="System.ArgumentNullException">data</exception>
/// <exception cref="ArgumentNullException">data</exception>
public static DelaunayTriangulation<TVertex, TCell> Create(IList<TVertex> data,
double PlaneDistanceTolerance)// = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance)// = Constants.DefaultPlaneDistanceTolerance)
{
if (data == null) throw new ArgumentNullException("data");
if (data.Count == 0) return new DelaunayTriangulation<TVertex, TCell> { Cells = new TCell[0] };

View file

@ -44,7 +44,7 @@ namespace MIConvexHull
/// <param name="data">The data.</param>
/// <returns>VoronoiMesh&lt;TVertex, TCell, TEdge&gt;.</returns>
public static VoronoiMesh<TVertex, TCell, TEdge> Create<TVertex, TCell, TEdge>(IList<TVertex> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
where TCell : TriangulationCell<TVertex, TCell>, new()
where TVertex : IVertex
where TEdge : VoronoiEdge<TVertex, TCell>, new()
@ -62,7 +62,7 @@ namespace MIConvexHull
VoronoiMesh
<TVertex, DefaultTriangulationCell<TVertex>, VoronoiEdge<TVertex, DefaultTriangulationCell<TVertex>>>
Create<TVertex>(IList<TVertex> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
where TVertex : IVertex
{
return
@ -80,8 +80,8 @@ namespace MIConvexHull
VoronoiMesh
<DefaultVertex, DefaultTriangulationCell<DefaultVertex>,
VoronoiEdge<DefaultVertex, DefaultTriangulationCell<DefaultVertex>>>
Create(IList<double[]> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
Create(IList<float[]> data,
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
{
var points = data.Select(p => new DefaultVertex { Position = p.ToArray() }).ToList();
return
@ -99,7 +99,7 @@ namespace MIConvexHull
/// <returns>VoronoiMesh&lt;TVertex, TCell, VoronoiEdge&lt;TVertex, TCell&gt;&gt;.</returns>
public static VoronoiMesh<TVertex, TCell, VoronoiEdge<TVertex, TCell>> Create<TVertex, TCell>(
IList<TVertex> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
where TVertex : IVertex
where TCell : TriangulationCell<TVertex, TCell>, new()
{
@ -148,7 +148,7 @@ namespace MIConvexHull
/// <exception cref="System.ArgumentNullException">data</exception>
/// <exception cref="ArgumentNullException">data</exception>
public static VoronoiMesh<TVertex, TCell, TEdge> Create(IList<TVertex> data,
double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
float PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
{
if (data == null) throw new ArgumentNullException("data");

View file

@ -0,0 +1,34 @@
using System;
using System.Collections;
using MIConvexHull;
using Unity.Mathematics;
using static Unity.Mathematics.math;
public class Vertex2 : IVertex
{
public float[] Position => new[] {StoredPosition.x, StoredPosition.y};
public float2 StoredPosition;
public float x { get { return StoredPosition.x; } }
public float y { get { return StoredPosition.y; } }
public Vertex2(float x, float y)
{
StoredPosition = float2(x, y);
}
public Vertex2(float2 pos)
{
StoredPosition = pos;
}
public float2 ToFloat2() {
return StoredPosition;
}
public float Distance(Vertex2 v)
{
return length(StoredPosition-v.StoredPosition);
}
}

View file

@ -0,0 +1,16 @@
using Unity.Mathematics;
public class Vertex2<T> : Vertex2
{
public T StoredObject { get; }
public Vertex2(float x, float y, T obj) : base(x, y)
{
StoredObject = obj;
}
public Vertex2(float2 pos, T obj) : base(pos)
{
StoredObject = obj;
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e42612a273ec490380eaa67bed216a6d
timeCreated: 1615418804

View file

@ -0,0 +1,30 @@
using System.Collections;
using MIConvexHull;
using Unity.Mathematics;
using static Unity.Mathematics.math;
public class Vertex3 : IVertex
{
public float[] Position => new[] {StoredPosition.x, StoredPosition.y};
public float3 StoredPosition;
public Vertex3(float x, float y, float z)
{
StoredPosition = float3(x, y, z);
}
public Vertex3(float3 pos)
{
StoredPosition = pos;
}
public float3 ToFloat3() {
return StoredPosition;
}
public float Distance(Vertex3 v)
{
return length(StoredPosition-v.StoredPosition);
}
}

View file

@ -6,6 +6,7 @@ using DataStructures.ViliWonka.KDTree;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using float2 = Unity.Mathematics.float2;
using Random = Unity.Mathematics.Random;
public static class WeightedSampleElimination
{
@ -70,6 +71,43 @@ public static class WeightedSampleElimination
}, d_max);
}
public static void Eliminate(
float2[] inputPoints,
float2[] outputPoints,
Func<float2, float> density = null,
float d_max = 0)
{
if ( d_max < .001f ) d_max = 2 * GetMaxPoissonDiskRadius( outputPoints.Length );
Eliminate( inputPoints, outputPoints, (p0, p1, d2, dmax) =>
{
float d = sqrt(d2);
return pow( 1 - (d / dmax), 5 + 6 * saturate((density ?? (v => .5f))((p0 + p1) / 2)) );
}, d_max);
}
public static float2[] GeneratePoints(int count, Func<float2, float> density = null, Func<float2, float> envelope = null, uint seed = 1337)
{
if (density == null) density = v => .5f;
if (envelope == null) envelope = v => 1;
var random = new Random(seed);
var inputSamples = new float2[count * 8];
var sample = 0;
var accumulator = 0f;
while (sample < inputSamples.Length)
{
var v = random.NextFloat2();
accumulator += pow(saturate(density(v)), 2f) * envelope(v);
if (accumulator > .5f)
{
accumulator = 0;
inputSamples[sample++] = v;
}
}
var outputSamples = new float2[count];
Eliminate(inputSamples, outputSamples, density);
return outputSamples;
}
// Returns the maximum possible Poisson disk radius in the given dimensions for the given sampleCount
// to spread over the given domainSize. If the domainSize argument is zero or negative, it is computed
// as the area or N-dimensional volume of the box defined by the minimum and maximum bounds.
@ -100,15 +138,6 @@ public static class WeightedSampleElimination
for (int i = 0; i < inputPoints.Length; i++)
{
var p = inputPoints[i];
// for (int qi = 0; qi < inputPoints.Length; qi++)
// {
// var d2 = lengthsq(inputPoints[i] - inputPoints[qi]);
// if (i != qi && d2 < dmax2)
// {
// var p2 = inputPoints[qi];
// weights[i] += weightFunction(p, p2, d2, d_max);
// }
// }
foreach (var (qi, d2) in query.Radius(kdtree, inputPoints[i], d_max))
{
var p2 = inputPoints[qi];
@ -129,16 +158,6 @@ public static class WeightedSampleElimination
var i = heap.PopObj();
var p = inputPoints[i];
// For each sample around it, remove its weight contribution and update the heap
// for (int qi = 0; qi < inputPoints.Length; qi++)
// {
// var d2 = lengthsq(inputPoints[i] - inputPoints[qi]);
// if (i != qi && d2 < dmax2)
// {
// var p2 = inputPoints[qi];
// weights[qi] -= weightFunction(p, p2, d2, d_max);
// heap.SetValue(qi, weights[qi]);
// }
// }
foreach (var (qi, d2) in query.Radius(kdtree, p, d_max))
{
var p2 = inputPoints[qi];

View file

@ -1,9 +1,64 @@
using System.Collections.Generic;
using System.Linq;
using Unity.Mathematics;
using JM.LinqFaster;
using static Unity.Mathematics.math;
public class Sector
{
public List<SectorZone> Zones = new List<SectorZone>();
class DijkstraVertex
{
public float Cost;
public DijkstraVertex Parent;
public SectorZone Zone;
}
public List<SectorZone> ConnectedRegion(SectorZone v, SectorZone ignoreZone = null)
{
List<SectorZone> members = new List<SectorZone>();
members.Add(v);
while (true)
{
int lastCount = members.Count;
// For each member, add all vertices that are connected to it but are not already a member
// Also, if there is a zone being ignored, do not traverse across it
foreach (SectorZone m in members.ToArray())
members.AddRange(m.AdjacentZones
.Where(z => !members.Contains(z) && !(m == v && ignoreZone == z)));
// If we have stopped finding neighbors, stop traversing
if (members.Count == lastCount)
return members;
}
}
public List<SectorZone> FindPath(SectorZone source, SectorZone target, bool bestFirst = false)
{
SortedList<float,DijkstraVertex> members = new SortedList<float,DijkstraVertex>{{0, new DijkstraVertex{Zone = source}}};
List<DijkstraVertex> searched = new List<DijkstraVertex>();
while (true)
{
var s = members.FirstOrDefault(m => !searched.Contains(m.Value)).Value; // Lowest cost unsearched node
if (s == null) return null; // No vertices left unsearched
if (s.Zone == target) // We found the path
{
Stack<DijkstraVertex> path = new Stack<DijkstraVertex>(); // Since we start at the end, use a LIFO collection
path.Push(s);
while(path.Peek().Parent!=null) // Keep pushing until we reach the start, which has no parent
path.Push(path.Peek().Parent);
return path.Select(dv => dv.Zone).ToList();
}
// For each adjacent star (filter already visited stars unless heuristic is in use)
foreach (var dijkstraStar in s.Zone.AdjacentZones
.WhereSelectF(zone => !bestFirst || members.All(m => m.Value.Zone != zone),
// Cost is parent cost plus distance squared
zone => new DijkstraVertex {Parent = s, Zone = zone, Cost = s.Cost + lengthsq(s.Zone.Position - zone.Position)}))
// Add new member to list, sorted by cost plus optional heuristic
members.Add(bestFirst ? dijkstraStar.Cost + lengthsq(dijkstraStar.Zone.Position - target.Position) : dijkstraStar.Cost, dijkstraStar);
searched.Add(s);
}
}
}
public class SectorZone

View file

@ -1,37 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DataStructures.ViliWonka.Heap;
using MIConvexHull;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using Random = Unity.Mathematics.Random;
public static class SectorGenerator
{
public static Sector GenerateSector(ref Random random, SectorGenerationSettings settings, MarkovNameGenerator nameGenerator)
public static Sector GenerateSector(SectorGenerationSettings settings, MarkovNameGenerator nameGenerator, int zoneCount, float linkDensity)
{
var inputSamples = new float2[2048];
var sample = 0;
var accumulator = 0f;
while (sample < inputSamples.Length)
{
var v = random.NextFloat2();
accumulator += pow(settings.CloudDensity(v), 3f) * (.25f-lengthsq(v - float2(.5f))) * 4;
if (accumulator > .5f)
{
accumulator = 0;
inputSamples[sample++] = v;
}
}
// for (int i = 0; i < inputSamples.Length; i++)
// {
// inputSamples[i] = random.NextFloat2();
// }
var outputSamples = new float2[64];
//Array.Copy(inputSamples,outputSamples,32);
Func<float2, float2, float, float, float> weightFunc = (p1, p2, d2, dmax) =>
pow(1-sqrt(d2)/dmax, 1+settings.CloudDensity((p1 + p2) / 2)*8);
WeightedSampleElimination.Eliminate(inputSamples, outputSamples, 0f, 4, 0.0f);
var outputSamples = WeightedSampleElimination.GeneratePoints(zoneCount,
settings.CloudDensity,
v => (.2f - lengthsq(v - float2(.5f))) * 4);
var sector = new Sector();
foreach (var v in outputSamples) sector.Zones.Add(new SectorZone {Position = v, Name = nameGenerator.NextName});
// Create a delaunay triangulation to connect adjacent sectors
var triangulation = DelaunayTriangulation<Vertex2<SectorZone>, Cell2<SectorZone>>
.Create(sector.Zones.Select(z => new Vertex2<SectorZone>(z.Position, z)).ToList(), 1e-5f);
var links = new List<(SectorZone, SectorZone)>();
foreach(var cell in triangulation.Cells)
{
links.Add((cell.Vertices[0].StoredObject, cell.Vertices[1].StoredObject));
links.Add((cell.Vertices[1].StoredObject, cell.Vertices[2].StoredObject));
links.Add((cell.Vertices[0].StoredObject, cell.Vertices[2].StoredObject));
}
foreach (var link in links)
{
link.Item1.AdjacentZones.Add(link.Item2);
link.Item2.AdjacentZones.Add(link.Item1);
}
float LinkWeight((SectorZone, SectorZone) link)
{
return 1 / saturate(settings.CloudDensity((link.Item1.Position + link.Item2.Position) / 2)) *
lengthsq(link.Item1.Position - link.Item2.Position) *
(link.Item1.AdjacentZones.Count - 1) * (link.Item2.AdjacentZones.Count - 1);
}
var heap = new MaxHeap<(SectorZone, SectorZone)>(links.Count);
foreach(var link in links) heap.PushObj(link, LinkWeight(link));
while (heap.Count > linkDensity * links.Count)
{
var link = heap.PopObj();
if(sector.ConnectedRegion(link.Item1, link.Item2).Contains(link.Item2))
{
link.Item1.AdjacentZones.Remove(link.Item2);
link.Item2.AdjacentZones.Remove(link.Item1);
foreach (var secondary in link.Item1.AdjacentZones)
{
heap.SetValue((link.Item1, secondary), LinkWeight((link.Item1, secondary)));
heap.SetValue((secondary, link.Item1), LinkWeight((secondary, link.Item1)));
}
foreach (var secondary in link.Item2.AdjacentZones)
{
heap.SetValue((link.Item2, secondary), LinkWeight((link.Item2, secondary)));
heap.SetValue((secondary, link.Item2), LinkWeight((secondary, link.Item2)));
}
}
}
return sector;
}

View file

@ -54,6 +54,7 @@ public class SectorGenerationSettings
public float NoiseGain;
public float NoiseLacunarity;
public float NoiseFrequency;
public float Zoom = 1;
public float fBm(float2 p, int octaves)
{
@ -72,7 +73,7 @@ public class SectorGenerationSettings
public float CloudDensity(float2 uv)
{
float noise = fBm(uv + NoisePosition, 8);
float noise = fBm(uv / Zoom + NoisePosition, 10);
return pow(noise, CloudExponent) * CloudAmplitude;
}
}

View file

@ -111,7 +111,7 @@ public class Zone
foreach(var agent in Agents)
agent.Update(deltaTime);
foreach (var entity in Entities) entity.Update(deltaTime);
foreach (var entity in Entities.ToArray()) entity.Update(deltaTime);
}
public float2 WormholePosition(ZoneDefinition target)

View file

@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Unity.Mathematics;
using static Unity.Mathematics.math;
@ -12,6 +13,9 @@ public class SectorMap : MonoBehaviour
public MeshRenderer SectorRenderer;
public SectorGenerationSettings Settings;
public Prototype ZonePrototype;
public Prototype LinkPrototype;
public int ZoneCount = 64;
public float LinkDensity = .5f;
[Header("Name Generation")]
public TextAsset NameFile;
@ -35,11 +39,30 @@ public class SectorMap : MonoBehaviour
for (int i = 0; i < 4096; i++) random.NextFloat();
var nameGenerator = new MarkovNameGenerator(ref random, names, NameGeneratorOrder, NameGeneratorMinLength, NameGeneratorMaxLength);
Settings.NoisePosition = Random.value * 100;
var sector = SectorGenerator.GenerateSector(ref random, Settings, nameGenerator);
var sector = SectorGenerator.GenerateSector(Settings, nameGenerator, ZoneCount, LinkDensity);
var visitedZones = new HashSet<SectorZone>();
Debug.Log($"Found {sector.Zones.Count(z=>!z.AdjacentZones.Any())} orphaned zones!");
foreach (var zone in sector.Zones)
{
var zoneInstance = ZonePrototype.Instantiate<Transform>();
zoneInstance.position = new Vector3(zone.Position.x - .5f, zone.Position.y - .5f);
zoneInstance.localPosition = new Vector3(zone.Position.x, zone.Position.y);
foreach (var link in zone.AdjacentZones)
{
if (!visitedZones.Contains(link))
{
var linkInstance = LinkPrototype.Instantiate<Transform>();
var pos = (zone.Position + link.Position) / 2;
linkInstance.localPosition = new Vector3(pos.x, pos.y);
var localScale = linkInstance.localScale;
localScale = new Vector3(length(zone.Position - link.Position), localScale.y, localScale.z);
linkInstance.localScale = localScale;
var dir = normalize(zone.Position - link.Position);
linkInstance.rotation = Quaternion.Euler(0,0,atan2(dir.y,dir.x) * Mathf.Rad2Deg);
}
}
visitedZones.Add(zone);
}
}
@ -49,6 +72,7 @@ public class SectorMap : MonoBehaviour
SectorRenderer.material.SetFloat("CloudAmplitude", Settings.CloudAmplitude);
SectorRenderer.material.SetFloat("CloudExponent", Settings.CloudExponent);
SectorRenderer.material.SetFloat("NoisePosition", Settings.NoisePosition);
SectorRenderer.material.SetFloat("Zoom", Settings.Zoom);
SectorRenderer.material.SetFloat("NoiseAmplitude", Settings.NoiseAmplitude);
SectorRenderer.material.SetFloat("NoiseOffset", Settings.NoiseOffset);
SectorRenderer.material.SetFloat("NoiseGain", Settings.NoiseGain);

View file

@ -8,6 +8,7 @@ Shader "Unlit/GalaxyMap"
{
_MainTex ("Texture", 2D) = "white" {}
[HDR]_CloudColor ("Cloud Color", Color) = (1,1,1,1)
Zoom("Zoom", Float) = 1
CloudAmplitude("Cloud Amplitude", Float) = 1
CloudExponent ("Cloud Exponent", Float) = 2
_GlowColor ("GlowColor", Color) = (1,1,1,1)
@ -54,6 +55,7 @@ Shader "Unlit/GalaxyMap"
fixed4 _CloudColor;
fixed4 _GlowColor;
float Zoom;
float CloudExponent;
float CloudAmplitude;
float NoisePosition;
@ -92,7 +94,7 @@ Shader "Unlit/GalaxyMap"
fixed4 frag (v2f i) : SV_Target
{
float noise = fBm(i.uv + NoisePosition.xx, 8);
float noise = fBm(i.uv / Zoom + NoisePosition.xx, 10);
float gal = pow(noise, CloudExponent) * CloudAmplitude;
float stars = tex2D(_MainTex, i.uv2) * pow(noise, StarExponent) * StarBoost;
return fixed4(max(gal*_CloudColor.rgb - _GlowColor.rgb, 0) + stars.xxx, 1);

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -1,9 +0,0 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\rwvens\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\rwvens\\.nuget\\packages",
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
]
}
}

View file

@ -1,9 +0,0 @@
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "3.1.0"
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,22 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Economy.Server")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Economy.Server")]
[assembly: System.Reflection.AssemblyTitleAttribute("Economy.Server")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View file

@ -1 +0,0 @@
12c88651412949f40a1a35da8dd0e4390916233c

View file

@ -1,42 +0,0 @@
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.exe
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.deps.json
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.runtimeconfig.json
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.runtimeconfig.dev.json
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Server.pdb
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\MessagePack.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\MessagePack.Annotations.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Bcl.AsyncInterfaces.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Configuration.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Configuration.Abstractions.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Configuration.Binder.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.DependencyInjection.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.DependencyInjection.Abstractions.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Logging.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Logging.Abstractions.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Logging.Configuration.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Logging.Console.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Options.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Options.ConfigurationExtensions.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Microsoft.Extensions.Primitives.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Shared.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Economy.Shared.pdb
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.csprojAssemblyReference.cache
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.AssemblyInfoInputs.cache
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.AssemblyInfo.cs
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.csproj.CopyComplete
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\obj\Debug\netcoreapp3.1\Economy.Server.pdb
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Isopoh.Cryptography.Argon2.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Isopoh.Cryptography.Blake2b.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Isopoh.Cryptography.SecureArray.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Newtonsoft.Json.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Remotion.Linq.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Serilog.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Serilog.Extensions.Logging.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\Serilog.Sinks.File.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\System.ComponentModel.Annotations.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\System.Reactive.Linq.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\System.Runtime.CompilerServices.Unsafe.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\System.Reactive.dll
C:\Users\rwvens\Documents\GitHub\Aetheria-Economy\Economy.Server\bin\Debug\netcoreapp3.1\System.Reactive.xml

Binary file not shown.

View file

@ -1,5 +0,0 @@
{
"version": 1,
"dgSpecHash": "WoNuPi+aWywGG7ROuRNeMRLKOYBN++BGhstQ8hnnnQmTJDqYI7U3GGk/0AHVSbKn6oFDHAntQbyHzgJk4mXiZA==",
"success": true
}

View file

@ -1,172 +0,0 @@
{
"format": 1,
"restore": {
"C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj": {}
},
"projects": {
"C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj",
"projectName": "Economy.Server",
"projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj",
"packagesPath": "C:\\Users\\rwvens\\.nuget\\packages\\",
"outputPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
],
"configFilePaths": [
"C:\\Users\\rwvens\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netcoreapp3.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp3.1": {
"projectReferences": {
"C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj": {
"projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp3.1": {
"dependencies": {
"Isopoh.Cryptography.Argon2": {
"target": "Package",
"version": "[1.1.3, )"
},
"MessagePack": {
"target": "Package",
"version": "[2.1.90, )"
},
"Microsoft.Extensions.Logging.Console": {
"target": "Package",
"version": "[5.0.0-preview.1.20120.4, )"
},
"Serilog.Extensions.Logging": {
"target": "Package",
"version": "[3.0.2-dev-10272, )"
},
"Serilog.Sinks.File": {
"target": "Package",
"version": "[5.0.0-dev-00864, )"
},
"System.Reactive.Linq": {
"target": "Package",
"version": "[4.3.2, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
}
}
},
"C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj",
"projectName": "Economy.Shared",
"projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj",
"packagesPath": "C:\\Users\\rwvens\\.nuget\\packages\\",
"outputPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
],
"configFilePaths": [
"C:\\Users\\rwvens\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netstandard2.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.0": {
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netstandard2.0": {
"dependencies": {
"MessagePack": {
"target": "Package",
"version": "[2.1.90, )"
},
"MessagePack.MSBuild.Tasks": {
"suppressParent": "All",
"target": "Package",
"version": "[2.0.323, )"
},
"Microsoft.Extensions.Logging": {
"target": "Package",
"version": "[5.0.0-preview.1.20120.4, )"
},
"NETStandard.Library": {
"suppressParent": "All",
"target": "Package",
"version": "[2.0.3, )",
"autoReferenced": true
},
"Newtonsoft.Json": {
"target": "Package",
"version": "[10.0.3, )"
},
"Remotion.Linq": {
"target": "Package",
"version": "[2.2.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
}
}
}
}
}

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\rwvens\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.3.0</NuGetToolVersion>
</PropertyGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgNewtonsoft_Json Condition=" '$(PkgNewtonsoft_Json)' == '' ">C:\Users\rwvens\.nuget\packages\newtonsoft.json\10.0.3</PkgNewtonsoft_Json>
</PropertyGroup>
</Project>

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)system.reactive\4.3.2\buildTransitive\netcoreapp3.0\System.Reactive.targets" Condition="Exists('$(NuGetPackageRoot)system.reactive\4.3.2\buildTransitive\netcoreapp3.0\System.Reactive.targets')" />
</ImportGroup>
</Project>

File diff suppressed because it is too large Load diff

View file

@ -1,80 +0,0 @@
{
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj",
"projectName": "Economy.Server",
"projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\Economy.Server.csproj",
"outputPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Server\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
],
"originalTargetFrameworks": [
"netcoreapp3.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp3.1": {
"projectReferences": {
"C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj": {
"projectPath": "C:\\Users\\rwvens\\Documents\\GitHub\\Aetheria-Economy\\Economy.Shared\\Economy.Shared.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp3.1": {
"dependencies": {
"Isopoh.Cryptography.Argon2": {
"target": "Package",
"version": "[1.1.3, )"
},
"MessagePack": {
"target": "Package",
"version": "[2.1.90, )"
},
"Microsoft.Extensions.Logging.Console": {
"target": "Package",
"version": "[5.0.0-preview.1.20120.4, )"
},
"Serilog.Extensions.Logging": {
"target": "Package",
"version": "[3.0.2-dev-10272, )"
},
"Serilog.Sinks.File": {
"target": "Package",
"version": "[5.0.0-dev-00864, )"
},
"System.Reactive.Linq": {
"target": "Package",
"version": "[4.3.2, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
}
}
}