public void Get(int index, out Color color, out int edgeModel, out Base27Directions.Direction normal0, out Base27Directions.Direction normal1) { fixed (uint* i = m_data) fixed (byte* d = m_data2) fixed (int* edges = m_edgeModels) { color = new Color(i[index]); normal0 = (Base27Directions.Direction)color.A; normal1 = (Base27Directions.Direction)d[index]; edgeModel = edges[index]; } }
public void Get(int index, out Color color, out MyStringHash edgeModel, out Base27Directions.Direction normal0, out Base27Directions.Direction normal1) { fixed (uint* i = m_data) fixed (byte* d = m_data2) fixed (int* edges = m_edgeModels) { color = new Color(i[index]); normal0 = (Base27Directions.Direction)color.A; normal1 = (Base27Directions.Direction)d[index]; edgeModel = MyStringHash.TryGet(edges[index]); Debug.Assert(edges[index] == 0 || edgeModel != MyStringHash.NullOrEmpty); } }
public bool Set(int index, Color value, MyStringHash edgeModel, Base27Directions.Direction normal0, Base27Directions.Direction normal1) { fixed (uint* i = m_data) fixed (byte* d = m_data2) fixed (int* edges = m_edgeModels) { value.A = (byte)normal0; bool result = i[index] == 0; i[index] = value.PackedValue; d[index] = (byte)normal1; edges[index] = (int)edgeModel; return result; } }
public bool GetNormalInfo(int index, out Color color, out MyStringHash edgeModel, out Base27Directions.Direction normal0, out Base27Directions.Direction normal1) { m_data.Get(index, out color, out edgeModel, out normal0, out normal1); color.A = 0; return normal0 != 0; }
public bool AddInstance(Vector3 blockPos, Color color, MyStringHash edgeModel, Base27Directions.Direction normal0, Base27Directions.Direction normal1) { return m_data.Set(GetIndex(ref blockPos), color, edgeModel, normal0, normal1); }