-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
…e (pun not intended)
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using UnityEngine; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace SimDataStructure | ||
{ | ||
// Data for each cell (only inside cells) | ||
[Serializable] | ||
public abstract class AbstractCellData | ||
{ | ||
public CellDataType type; | ||
|
||
public AbstractCellData() | ||
{ | ||
} | ||
|
||
public CellDataType DataType() | ||
{ | ||
return type; | ||
} | ||
|
||
public string DataTypeName() | ||
{ | ||
return type.ToString(); | ||
} | ||
} | ||
|
||
// [CreateAssetMenu(menuName = "Data Structure/Cell Data")] | ||
public class CellData<T> : AbstractCellData | ||
{ | ||
public T data; | ||
|
||
public CellData(T data) : base() | ||
{ | ||
this.data = data; | ||
|
||
if (typeof(T) == typeof(float)) | ||
{ | ||
type = CellDataType.Float; | ||
} | ||
else if (typeof(T) == typeof(int)) | ||
{ | ||
type = CellDataType.Int; | ||
} | ||
else if (typeof(T) == typeof(bool)) | ||
{ | ||
type = CellDataType.Bool; | ||
} | ||
else if (typeof(T) == typeof(Vector2)) | ||
{ | ||
type = CellDataType.Vector2; | ||
} | ||
else | ||
{ | ||
type = CellDataType.Object; | ||
} | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return data.ToString(); | ||
} | ||
} | ||
|
||
public enum CellDataType | ||
{ | ||
Float, | ||
Int, | ||
Bool, | ||
Vector2, | ||
Object | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using UnityEngine; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace SimDataStructure | ||
{ | ||
// Data for whole grid (one instance per grid) | ||
// This class will contain a reference to a compute shader that will be a grid shader that computes some data for each cell | ||
// This class will contain a method to update the shader | ||
// This class will contain a method to access the data of the shader | ||
// This class will contain a method to supply input data to the shader | ||
[Serializable] | ||
public abstract class AbstractGridData | ||
{ | ||
public ComputeShader computeShader; | ||
|
||
public GenericDictionary<string, ComputeBuffer> computeBuffers = new GenericDictionary<string, ComputeBuffer>(); | ||
public GenericDictionary<string, RenderTexture> renderTextures = new GenericDictionary<string, RenderTexture>(); | ||
|
||
// This class will contain a reference to a compute shader that will be a grid shader that computes some data for each cell | ||
// This class will contain a method to update the shader | ||
// This class will contain a method to access the data of the shader | ||
// This class will contain a method to supply input data to the shader | ||
public AbstractGridData() | ||
{ | ||
} | ||
|
||
public override void Init() | ||
{ | ||
this.InitComputeShader(); | ||
this.CreateComputeBuffers(); | ||
this.CreateRenderTextures(); | ||
} | ||
|
||
public override void Update() | ||
{ | ||
this.UpdateShader(); | ||
|
||
} | ||
|
||
public abstract void InitComputeShader(); | ||
|
||
public abstract void CreateRenderTextures(); | ||
|
||
public abstract void CreateComputeBuffers(); | ||
|
||
public abstract void UpdateShader(float deltaTime); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "DataStructure.Data" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.