public void FinalizePrimitiveBatch() { Vector3[] vertList = new Vector3[m_wireLinePointList.Count * 2]; Color[] colorList = new Color[m_wireLinePointList.Count * 2]; int[] indexList = new int[m_wireLinePointList.Count * 2]; for (int i = 0; i < m_wireLinePointList.Count; i++) { vertList[(i*2) + 0] = m_wireLinePointList[i].PosA; vertList[(i*2) + 1] = m_wireLinePointList[i].PosB; colorList[(i * 2) + 0] = m_wireLinePointList[i].Color; colorList[(i * 2) + 1] = m_wireLinePointList[i].Color; indexList[(i * 2) + 0] = (i * 2) + 0; indexList[(i * 2) + 1] = (i * 2) + 1; } m_wireLineMesh.SubMeshes[0].Vertices = vertList; m_wireLineMesh.SubMeshes[0].Color0 = colorList; m_wireLineMesh.SubMeshes[0].Indexes = indexList; // Add it to the instance list so that it gets drawn line a normal instance, it jsut happens to have a sort of unique mesh. m_instanceList.Add(new DrawInstance { Mesh = m_wireLineMesh, Position = Vector3.Zero, Scale = Vector3.One, Color = new Color(1f, 1f, 1f, 1f), DepthTest = true }); }
public void DrawWireCube(Vector3 position, Vector3 scale, Color color, bool depthTest = true) { m_instanceList.Add(new DrawInstance { Mesh = m_wireCubeMesh, Position = position, Scale = scale, Color = color, DepthTest = depthTest }); }
public void DrawLine(Vector3 posA, Vector3 posB, Color color) { m_wireLinePointList.Add(new LineInstance { PosA = posA, PosB = posB, Color = color }); }