add GridController for management of GridShader.shader, add RecordStates calls for path building

This commit is contained in:
Xevion
2020-11-09 13:39:35 -06:00
parent 2d5938415e
commit 3591d16832
11 changed files with 275 additions and 270 deletions

View File

@@ -22,11 +22,11 @@ namespace Algorithms {
public Stack<Node> FindPath(Vector2 Start, Vector2 End) { public Stack<Node> FindPath(Vector2 Start, Vector2 End) {
this._start = Start; this._start = Start;
this._end = End; this._end = End;
RecordState();
var start = new Node(Start, true); var start = new Node(Start, true);
var end = new Node(End, true); var end = new Node(End, true);
RecordState();
_path = new Stack<Node>(); _path = new Stack<Node>();
_openList = new List<Node>(); _openList = new List<Node>();
@@ -70,6 +70,7 @@ namespace Algorithms {
if (temp == null) return null; if (temp == null) return null;
do { do {
_path.Push(temp); _path.Push(temp);
RecordState();
temp = temp.Parent; temp = temp.Parent;
} while (temp != start && temp != null); } while (temp != start && temp != null);

View File

@@ -0,0 +1,102 @@
using System;
using System.Linq;
using UnityEngine;
public enum PropertyName {
GridSize,
ValueLength,
Values
}
/// <summary>
/// A simple Grid Rendering Controller using MeshRenderer.
/// </summary>
public class GridController : MonoBehaviour {
public Material gridMaterial;
public int size = 32;
private int[] _values;
private ComputeBuffer _buffer;
// Get all property IDs
private static readonly int ValueLength = Shader.PropertyToID("_valueLength");
private static readonly int Values = Shader.PropertyToID("_values");
private static readonly int GridSize = Shader.PropertyToID("_GridSize");
private void Start() {
_values = new int[size * size];
_buffer = new ComputeBuffer((int) Mathf.Pow(2048, 2), 4);
// Update all Shader properties
foreach (PropertyName property in Enum.GetValues(typeof(PropertyName)))
UpdateShader(property);
}
/// <summary>
/// Updates Shader material properties.
/// </summary>
/// <param name="property">PropertyName item representing Shader property to be updated</param>
/// <exception cref="ArgumentOutOfRangeException"></exception>
public void UpdateShader(PropertyName property) {
switch (property) {
case PropertyName.GridSize:
gridMaterial.SetFloat(GridSize, size);
break;
case PropertyName.Values:
_buffer.SetData(_values);
gridMaterial.SetBuffer(Values, _buffer);
break;
case PropertyName.ValueLength:
gridMaterial.SetFloat(ValueLength, _values.Length);
break;
default:
throw new ArgumentOutOfRangeException(nameof(property), property, null);
}
}
private void OnApplicationQuit() {
// Release ComputeBuffer memory
_buffer.Release();
}
/// <summary>
/// Loads a GridState
/// </summary>
/// <param name="gridState"></param>
public void LoadGridState(GridState gridState) {
// Loop over matrix and set values via cast Enum to int
foreach(int x in Enumerable.Range(0, gridState.Grid.Count - 1))
foreach(int y in Enumerable.Range(0, gridState.Grid[0].Count - 1))
this.SetValue(x, y, (int) gridState.Grid[x][y]);
}
/// <summary>
/// Sets a value in the 1D array at a particular 2D coordinate
/// </summary>
/// <param name="x">the X coordinate</param>
/// <param name="y">the Y coordinate</param>
/// <param name="value">the integer value</param>
public void SetValue(int x, int y, int value) {
_values[size * y + x] = value;
}
/// <summary>
/// Returns the value at a 2D coordinate within the 1D array
/// </summary>
/// <param name="x">the X coordinate</param>
/// <param name="y">the Y coordinate</param>
/// <returns>a integer value</returns>
public int GetValue(int x, int y) {
return _values[size * y + x];
}
/// <summary>
/// Converts a 2D coordinate into a 1D array index
/// </summary>
/// <param name="x">the X coordinate</param>
/// <param name="y">the Y coordinate</param>
/// <returns>the integer array index</returns>
public int GetIndex(int x, int y) {
return size * y + x;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ae862ef271614573a2ecacb6d9fa2078
timeCreated: 1604939699

View File

@@ -4,37 +4,41 @@ using System.Numerics;
using Algorithms; using Algorithms;
public class GridState { public class GridState {
private List<List<GridNodeType>> _grid; public List<List<GridNodeType>> Grid;
public GridState(NodeGrid grid, IEnumerable<Node> seen, IEnumerable<Node> expanded, Vector2 start, Vector2 end, IReadOnlyCollection<Node> path) { public GridState(NodeGrid grid, IEnumerable<Node> seen, IEnumerable<Node> expanded, Vector2 start, Vector2 end, IReadOnlyCollection<Node> path) {
this._grid = new List<List<GridNodeType>>(grid.Width); this.Grid = new List<List<GridNodeType>>(grid.Width);
// Add walls and empty tiles // Add walls and empty tiles
foreach (var x in Enumerable.Range(0, grid.Width - 1)) { foreach (var x in Enumerable.Range(0, grid.Width - 1)) {
this._grid.Add(new List<GridNodeType>(grid.Height)); this.Grid.Add(new List<GridNodeType>(grid.Height));
foreach (var y in Enumerable.Range(0, grid.Height - 1)) { foreach (var y in Enumerable.Range(0, grid.Height - 1)) {
Node node = grid.GetNode(x, y); Node node = grid.GetNode(x, y);
this._grid[x].Add(!node.Walkable ? GridNodeType.Wall : GridNodeType.Empty); this.Grid[x].Add(!node.Walkable ? GridNodeType.Wall : GridNodeType.Empty);
} }
} }
// Add 'seen' tiles // Add 'seen' tiles
foreach (Node seenNode in seen) { foreach (Node seenNode in seen) {
this._grid[(int) seenNode.Position.X][(int) seenNode.Position.Y] = GridNodeType.Seen; this.Grid[(int) seenNode.Position.X][(int) seenNode.Position.Y] = GridNodeType.Seen;
} }
// Add 'expanded' tiles // Add 'expanded' tiles
foreach (Node expandedNode in expanded) { foreach (Node expandedNode in expanded) {
this._grid[(int) expandedNode.Position.X][(int) expandedNode.Position.Y] = GridNodeType.Expanded; this.Grid[(int) expandedNode.Position.X][(int) expandedNode.Position.Y] = GridNodeType.Expanded;
} }
// Set start and end tiles // Set start and end tiles
this._grid[(int) start.X][(int) start.Y] = GridNodeType.Start; this.Grid[(int) start.X][(int) start.Y] = GridNodeType.Start;
this._grid[(int) end.X][(int) end.Y] = GridNodeType.End; this.Grid[(int) end.X][(int) end.Y] = GridNodeType.End;
// Add 'path' tiles // Add 'path' tiles
if (path != null) if (path != null)
foreach (Node pathNode in path) foreach (Node pathNode in path)
this._grid[(int) pathNode.Position.X][(int) pathNode.Position.Y] = GridNodeType.Path; this.Grid[(int) pathNode.Position.X][(int) pathNode.Position.Y] = GridNodeType.Path;
}
public IEnumerable<GridNodeType> GetNodes() {
return this.Grid.SelectMany(nodeList => nodeList).ToList();
} }
} }

View File

@@ -0,0 +1,77 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GridShader Material
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 780d53bea4df7b0418e9c8ed8afd6410
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -32,257 +32,14 @@ Shader "PDT Shaders/TestGrid" {
float4 _InactiveColor; float4 _InactiveColor;
float4 _ActiveColor; float4 _ActiveColor;
static const float4 _gradient[250] = { static const float4 _gridColors[7] = {
float4(0.443, 0.0, 0.0, 1.0), float4(255 / 255.0, 255 / 255.0, 255 / 255.0, 1.0), // Empty
float4(0.486, 0.0, 0.0, 1.0), float4(0 / 255.0, 0 / 255.0, 0 / 255.0, 1.0), // Wall
float4(0.506, 0.0, 0.0, 1.0), float4(0 / 255.0, 255 / 255.0, 0 / 255.0, 1.0), // Start
float4(0.522, 0.0, 0.0, 1.0), float4(255 / 255.0, 0 / 255.0, 0 / 255.0, 1.0), // End
float4(0.537, 0.0, 0.0, 1.0), float4(252 / 255.0, 236 / 255.0, 3 / 255.0, 1.0), // Seen
float4(0.553, 0.0, 0.0, 1.0), float4(252 / 255.0, 127 / 255.0, 3 / 255.0, 1.0), // Expanded
float4(0.573, 0.0, 0.0, 1.0), float4(166 / 255.0, 2 / 255.0, 51 / 255.0, 1.0) // Path
float4(0.588, 0.0, 0.0, 1.0),
float4(0.604, 0.0, 0.0, 1.0),
float4(0.62, 0.0, 0.0, 1.0),
float4(0.639, 0.0, 0.0, 1.0),
float4(0.659, 0.0, 0.0, 1.0),
float4(0.675, 0.0, 0.0, 1.0),
float4(0.69, 0.0, 0.0, 1.0),
float4(0.706, 0.0, 0.0, 1.0),
float4(0.725, 0.0, 0.0, 1.0),
float4(0.741, 0.0, 0.0, 1.0),
float4(0.757, 0.0, 0.0, 1.0),
float4(0.792, 0.0, 0.0, 1.0),
float4(0.808, 0.0, 0.0, 1.0),
float4(0.808, 0.0, 0.0, 1.0),
float4(0.824, 0.0, 0.0, 1.0),
float4(0.843, 0.0, 0.0, 1.0),
float4(0.875, 0.012, 0.0, 1.0),
float4(0.89, 0.027, 0.0, 1.0),
float4(0.91, 0.039, 0.0, 1.0),
float4(0.91, 0.039, 0.0, 1.0),
float4(0.925, 0.055, 0.0, 1.0),
float4(0.945, 0.078, 0.0, 1.0),
float4(0.945, 0.094, 0.0, 1.0),
float4(0.945, 0.11, 0.0, 1.0),
float4(0.945, 0.125, 0.0, 1.0),
float4(0.945, 0.133, 0.0, 1.0),
float4(0.945, 0.149, 0.0, 1.0),
float4(0.945, 0.165, 0.0, 1.0),
float4(0.945, 0.176, 0.0, 1.0),
float4(0.945, 0.192, 0.0, 1.0),
float4(0.945, 0.204, 0.0, 1.0),
float4(0.945, 0.216, 0.0, 1.0),
float4(0.945, 0.231, 0.0, 1.0),
float4(0.945, 0.247, 0.0, 1.0),
float4(0.945, 0.263, 0.0, 1.0),
float4(0.945, 0.271, 0.0, 1.0),
float4(0.945, 0.286, 0.0, 1.0),
float4(0.945, 0.302, 0.0, 1.0),
float4(0.945, 0.314, 0.0, 1.0),
float4(0.945, 0.329, 0.0, 1.0),
float4(0.945, 0.341, 0.0, 1.0),
float4(0.945, 0.353, 0.0, 1.0),
float4(0.945, 0.369, 0.0, 1.0),
float4(0.945, 0.384, 0.0, 1.0),
float4(0.945, 0.4, 0.0, 1.0),
float4(0.945, 0.408, 0.0, 1.0),
float4(0.945, 0.424, 0.0, 1.0),
float4(0.945, 0.439, 0.0, 1.0),
float4(0.945, 0.451, 0.0, 1.0),
float4(0.945, 0.467, 0.0, 1.0),
float4(0.945, 0.478, 0.0, 1.0),
float4(0.945, 0.494, 0.0, 1.0),
float4(0.945, 0.506, 0.0, 1.0),
float4(0.945, 0.522, 0.0, 1.0),
float4(0.945, 0.537, 0.0, 1.0),
float4(0.945, 0.545, 0.0, 1.0),
float4(0.945, 0.576, 0.0, 1.0),
float4(0.945, 0.576, 0.0, 1.0),
float4(0.945, 0.588, 0.0, 1.0),
float4(0.945, 0.604, 0.0, 1.0),
float4(0.945, 0.616, 0.0, 1.0),
float4(0.945, 0.643, 0.0, 1.0),
float4(0.945, 0.659, 0.0, 1.0),
float4(0.945, 0.675, 0.0, 1.0),
float4(0.945, 0.675, 0.0, 1.0),
float4(0.945, 0.682, 0.0, 1.0),
float4(0.945, 0.714, 0.0, 1.0),
float4(0.945, 0.725, 0.0, 1.0),
float4(0.945, 0.741, 0.0, 1.0),
float4(0.945, 0.753, 0.0, 1.0),
float4(0.945, 0.769, 0.0, 1.0),
float4(0.945, 0.78, 0.0, 1.0),
float4(0.945, 0.796, 0.0, 1.0),
float4(0.945, 0.808, 0.0, 1.0),
float4(0.945, 0.82, 0.0, 1.0),
float4(0.945, 0.835, 0.0, 1.0),
float4(0.945, 0.851, 0.0, 1.0),
float4(0.945, 0.867, 0.0, 1.0),
float4(0.941, 0.875, 0.0, 1.0),
float4(0.929, 0.89, 0.0, 1.0),
float4(0.918, 0.906, 0.0, 1.0),
float4(0.902, 0.918, 0.004, 1.0),
float4(0.89, 0.933, 0.02, 1.0),
float4(0.878, 0.945, 0.031, 1.0),
float4(0.871, 0.945, 0.043, 1.0),
float4(0.855, 0.945, 0.055, 1.0),
float4(0.843, 0.945, 0.067, 1.0),
float4(0.831, 0.945, 0.078, 1.0),
float4(0.82, 0.945, 0.09, 1.0),
float4(0.808, 0.945, 0.102, 1.0),
float4(0.796, 0.945, 0.114, 1.0),
float4(0.784, 0.945, 0.129, 1.0),
float4(0.773, 0.945, 0.137, 1.0),
float4(0.761, 0.945, 0.149, 1.0),
float4(0.745, 0.945, 0.161, 1.0),
float4(0.737, 0.945, 0.176, 1.0),
float4(0.725, 0.945, 0.188, 1.0),
float4(0.714, 0.945, 0.2, 1.0),
float4(0.702, 0.945, 0.208, 1.0),
float4(0.686, 0.945, 0.22, 1.0),
float4(0.675, 0.945, 0.235, 1.0),
float4(0.655, 0.945, 0.259, 1.0),
float4(0.655, 0.945, 0.259, 1.0),
float4(0.639, 0.945, 0.267, 1.0),
float4(0.627, 0.945, 0.282, 1.0),
float4(0.616, 0.945, 0.294, 1.0),
float4(0.592, 0.945, 0.318, 1.0),
float4(0.58, 0.945, 0.333, 1.0),
float4(0.569, 0.945, 0.341, 1.0),
float4(0.569, 0.945, 0.341, 1.0),
float4(0.557, 0.945, 0.353, 1.0),
float4(0.533, 0.945, 0.376, 1.0),
float4(0.522, 0.945, 0.392, 1.0),
float4(0.51, 0.945, 0.404, 1.0),
float4(0.498, 0.945, 0.412, 1.0),
float4(0.498, 0.945, 0.412, 1.0),
float4(0.471, 0.945, 0.439, 1.0),
float4(0.463, 0.945, 0.451, 1.0),
float4(0.451, 0.945, 0.463, 1.0),
float4(0.439, 0.945, 0.471, 1.0),
float4(0.424, 0.945, 0.482, 1.0),
float4(0.412, 0.945, 0.498, 1.0),
float4(0.404, 0.945, 0.51, 1.0),
float4(0.392, 0.945, 0.522, 1.0),
float4(0.376, 0.945, 0.533, 1.0),
float4(0.365, 0.945, 0.545, 1.0),
float4(0.353, 0.945, 0.557, 1.0),
float4(0.341, 0.945, 0.569, 1.0),
float4(0.333, 0.945, 0.58, 1.0),
float4(0.318, 0.945, 0.592, 1.0),
float4(0.306, 0.945, 0.604, 1.0),
float4(0.294, 0.945, 0.616, 1.0),
float4(0.282, 0.945, 0.627, 1.0),
float4(0.267, 0.945, 0.639, 1.0),
float4(0.259, 0.945, 0.655, 1.0),
float4(0.247, 0.945, 0.667, 1.0),
float4(0.235, 0.945, 0.675, 1.0),
float4(0.22, 0.945, 0.686, 1.0),
float4(0.208, 0.945, 0.702, 1.0),
float4(0.2, 0.945, 0.714, 1.0),
float4(0.188, 0.945, 0.725, 1.0),
float4(0.176, 0.945, 0.737, 1.0),
float4(0.161, 0.945, 0.745, 1.0),
float4(0.149, 0.945, 0.761, 1.0),
float4(0.137, 0.945, 0.773, 1.0),
float4(0.129, 0.945, 0.784, 1.0),
float4(0.102, 0.945, 0.808, 1.0),
float4(0.102, 0.945, 0.808, 1.0),
float4(0.09, 0.945, 0.82, 1.0),
float4(0.078, 0.945, 0.831, 1.0),
float4(0.067, 0.937, 0.843, 1.0),
float4(0.043, 0.906, 0.871, 1.0),
float4(0.031, 0.89, 0.878, 1.0),
float4(0.031, 0.89, 0.878, 1.0),
float4(0.02, 0.875, 0.89, 1.0),
float4(0.004, 0.859, 0.902, 1.0),
float4(0.0, 0.831, 0.929, 1.0),
float4(0.0, 0.816, 0.941, 1.0),
float4(0.0, 0.804, 0.945, 1.0),
float4(0.0, 0.788, 0.945, 1.0),
float4(0.0, 0.788, 0.945, 1.0),
float4(0.0, 0.757, 0.945, 1.0),
float4(0.0, 0.741, 0.945, 1.0),
float4(0.0, 0.729, 0.945, 1.0),
float4(0.0, 0.714, 0.945, 1.0),
float4(0.0, 0.698, 0.945, 1.0),
float4(0.0, 0.682, 0.945, 1.0),
float4(0.0, 0.671, 0.945, 1.0),
float4(0.0, 0.655, 0.945, 1.0),
float4(0.0, 0.639, 0.945, 1.0),
float4(0.0, 0.62, 0.945, 1.0),
float4(0.0, 0.608, 0.945, 1.0),
float4(0.0, 0.596, 0.945, 1.0),
float4(0.0, 0.58, 0.945, 1.0),
float4(0.0, 0.565, 0.945, 1.0),
float4(0.0, 0.549, 0.945, 1.0),
float4(0.0, 0.537, 0.945, 1.0),
float4(0.0, 0.522, 0.945, 1.0),
float4(0.0, 0.502, 0.945, 1.0),
float4(0.0, 0.49, 0.945, 1.0),
float4(0.0, 0.475, 0.945, 1.0),
float4(0.0, 0.463, 0.945, 1.0),
float4(0.0, 0.447, 0.945, 1.0),
float4(0.0, 0.427, 0.945, 1.0),
float4(0.0, 0.416, 0.945, 1.0),
float4(0.0, 0.404, 0.945, 1.0),
float4(0.0, 0.388, 0.945, 1.0),
float4(0.0, 0.369, 0.945, 1.0),
float4(0.0, 0.357, 0.945, 1.0),
float4(0.0, 0.341, 0.945, 1.0),
float4(0.0, 0.329, 0.945, 1.0),
float4(0.0, 0.298, 0.945, 1.0),
float4(0.0, 0.298, 0.945, 1.0),
float4(0.0, 0.282, 0.945, 1.0),
float4(0.0, 0.267, 0.945, 1.0),
float4(0.0, 0.251, 0.945, 1.0),
float4(0.0, 0.224, 0.945, 1.0),
float4(0.0, 0.208, 0.945, 1.0),
float4(0.0, 0.208, 0.945, 1.0),
float4(0.0, 0.192, 0.945, 1.0),
float4(0.0, 0.18, 0.945, 1.0),
float4(0.0, 0.149, 0.945, 1.0),
float4(0.0, 0.133, 0.945, 1.0),
float4(0.0, 0.122, 0.945, 1.0),
float4(0.0, 0.106, 0.945, 1.0),
float4(0.0, 0.106, 0.945, 1.0),
float4(0.0, 0.071, 0.945, 1.0),
float4(0.0, 0.063, 0.945, 1.0),
float4(0.0, 0.047, 0.945, 1.0),
float4(0.0, 0.031, 0.945, 1.0),
float4(0.0, 0.012, 0.945, 1.0),
float4(0.0, 0.0, 0.945, 1.0),
float4(0.0, 0.0, 0.945, 1.0),
float4(0.0, 0.0, 0.945, 1.0),
float4(0.0, 0.0, 0.945, 1.0),
float4(0.0, 0.0, 0.945, 1.0),
float4(0.0, 0.0, 0.925, 1.0),
float4(0.0, 0.0, 0.91, 1.0),
float4(0.0, 0.0, 0.89, 1.0),
float4(0.0, 0.0, 0.875, 1.0),
float4(0.0, 0.0, 0.859, 1.0),
float4(0.0, 0.0, 0.839, 1.0),
float4(0.0, 0.0, 0.824, 1.0),
float4(0.0, 0.0, 0.808, 1.0),
float4(0.0, 0.0, 0.792, 1.0),
float4(0.0, 0.0, 0.773, 1.0),
float4(0.0, 0.0, 0.757, 1.0),
float4(0.0, 0.0, 0.741, 1.0),
float4(0.0, 0.0, 0.725, 1.0),
float4(0.0, 0.0, 0.706, 1.0),
float4(0.0, 0.0, 0.69, 1.0),
float4(0.0, 0.0, 0.675, 1.0),
float4(0.0, 0.0, 0.659, 1.0),
float4(0.0, 0.0, 0.639, 1.0),
float4(0.0, 0.0, 0.62, 1.0),
float4(0.0, 0.0, 0.604, 1.0),
float4(0.0, 0.0, 0.588, 1.0),
float4(0.0, 0.0, 0.573, 1.0),
float4(0.0, 0.0, 0.553, 1.0),
float4(0.0, 0.0, 0.537, 1.0),
float4(0.0, 0.0, 0.522, 1.0),
float4(0.0, 0.0, 0.486, 1.0),
float4(0.0, 0.0, 0.471, 1.0)
}; };
float _GridSize; float _GridSize;
@@ -326,8 +83,8 @@ Shader "PDT Shaders/TestGrid" {
} else { } else {
float pos = id.y * _GridSize + id.x; float pos = id.y * _GridSize + id.x;
if(pos < _valueLength) { if(pos < _valueLength) {
float index = clamp(floor(_values[pos] * 250), 0, 99); float index = _values[pos];
color = _gradient[index]; color = _gridColors[index];
// color = lerp(_InactiveColor, _ActiveColor, _values[pos]); // color = lerp(_InactiveColor, _ActiveColor, _values[pos]);
brightness = color.w; brightness = color.w;
} }

View File

@@ -3,6 +3,7 @@
--- !u!11 &1 --- !u!11 &1
AudioManager: AudioManager:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2
m_Volume: 1 m_Volume: 1
Rolloff Scale: 1 Rolloff Scale: 1
Doppler Factor: 1 Doppler Factor: 1
@@ -15,3 +16,4 @@ AudioManager:
m_AmbisonicDecoderPlugin: m_AmbisonicDecoderPlugin:
m_DisableAudio: 0 m_DisableAudio: 0
m_VirtualizeEffects: 1 m_VirtualizeEffects: 1
m_RequestedDSPBufferSize: 1024

View File

@@ -3,7 +3,7 @@
--- !u!55 &1 --- !u!55 &1
PhysicsManager: PhysicsManager:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 7 serializedVersion: 13
m_Gravity: {x: 0, y: -9.81, z: 0} m_Gravity: {x: 0, y: -9.81, z: 0}
m_DefaultMaterial: {fileID: 0} m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2 m_BounceThreshold: 2
@@ -22,9 +22,14 @@ PhysicsManager:
m_AutoSyncTransforms: 0 m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1 m_ReuseCollisionCallbacks: 1
m_ClothInterCollisionSettingsToggle: 0 m_ClothInterCollisionSettingsToggle: 0
m_ClothGravity: {x: 0, y: -9.81, z: 0}
m_ContactPairsMode: 0 m_ContactPairsMode: 0
m_BroadphaseType: 0 m_BroadphaseType: 0
m_WorldBounds: m_WorldBounds:
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 250, y: 250, z: 250} m_Extent: {x: 250, y: 250, z: 250}
m_WorldSubdivisions: 8 m_WorldSubdivisions: 8
m_FrictionType: 0
m_EnableEnhancedDeterminism: 0
m_EnableUnifiedHeightmaps: 1
m_DefaultMaxAngularSpeed: 7

View File

@@ -18,7 +18,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0 shadowmaskMode: 0
blendWeights: 1 skinWeights: 1
textureQuality: 1 textureQuality: 1
anisotropicTextures: 0 anisotropicTextures: 0
antiAliasing: 0 antiAliasing: 0
@@ -29,9 +29,16 @@ QualitySettings:
vSyncCount: 0 vSyncCount: 0
lodBias: 0.3 lodBias: 0.3
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 4 particleRaycastBudget: 4
asyncUploadTimeSlice: 2 asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: [] excludedTargetPlatforms: []
- serializedVersion: 2 - serializedVersion: 2
@@ -46,7 +53,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0 shadowmaskMode: 0
blendWeights: 2 skinWeights: 2
textureQuality: 0 textureQuality: 0
anisotropicTextures: 0 anisotropicTextures: 0
antiAliasing: 0 antiAliasing: 0
@@ -57,9 +64,16 @@ QualitySettings:
vSyncCount: 0 vSyncCount: 0
lodBias: 0.4 lodBias: 0.4
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 16 particleRaycastBudget: 16
asyncUploadTimeSlice: 2 asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: [] excludedTargetPlatforms: []
- serializedVersion: 2 - serializedVersion: 2
@@ -74,7 +88,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0 shadowmaskMode: 0
blendWeights: 2 skinWeights: 2
textureQuality: 0 textureQuality: 0
anisotropicTextures: 0 anisotropicTextures: 0
antiAliasing: 0 antiAliasing: 0
@@ -85,9 +99,16 @@ QualitySettings:
vSyncCount: 1 vSyncCount: 1
lodBias: 0.7 lodBias: 0.7
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 64 particleRaycastBudget: 64
asyncUploadTimeSlice: 2 asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: [] excludedTargetPlatforms: []
- serializedVersion: 2 - serializedVersion: 2
@@ -102,7 +123,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1 shadowmaskMode: 1
blendWeights: 2 skinWeights: 2
textureQuality: 0 textureQuality: 0
anisotropicTextures: 0 anisotropicTextures: 0
antiAliasing: 0 antiAliasing: 0
@@ -113,9 +134,16 @@ QualitySettings:
vSyncCount: 1 vSyncCount: 1
lodBias: 1 lodBias: 1
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 256 particleRaycastBudget: 256
asyncUploadTimeSlice: 2 asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: [] excludedTargetPlatforms: []
- serializedVersion: 2 - serializedVersion: 2
@@ -130,7 +158,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1 shadowmaskMode: 1
blendWeights: 4 skinWeights: 4
textureQuality: 0 textureQuality: 0
anisotropicTextures: 0 anisotropicTextures: 0
antiAliasing: 0 antiAliasing: 0
@@ -141,9 +169,16 @@ QualitySettings:
vSyncCount: 1 vSyncCount: 1
lodBias: 1.5 lodBias: 1.5
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 1024 particleRaycastBudget: 1024
asyncUploadTimeSlice: 2 asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: [] excludedTargetPlatforms: []
- serializedVersion: 2 - serializedVersion: 2
@@ -158,7 +193,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1 shadowmaskMode: 1
blendWeights: 4 skinWeights: 4
textureQuality: 0 textureQuality: 0
anisotropicTextures: 0 anisotropicTextures: 0
antiAliasing: 0 antiAliasing: 0
@@ -169,9 +204,16 @@ QualitySettings:
vSyncCount: 1 vSyncCount: 1
lodBias: 2 lodBias: 2
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 4096 particleRaycastBudget: 4096
asyncUploadTimeSlice: 2 asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: [] excludedTargetPlatforms: []
m_PerPlatformDefaultQuality: m_PerPlatformDefaultQuality:

View File

@@ -4,4 +4,8 @@
VFXManager: VFXManager:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_IndirectShader: {fileID: 0} m_IndirectShader: {fileID: 0}
m_CopyBufferShader: {fileID: 0}
m_SortShader: {fileID: 0}
m_RenderPipeSettingsPath: m_RenderPipeSettingsPath:
m_FixedTimeStep: 0.016666668
m_MaxDeltaTime: 0.05