protected override void CreateVertices() { ILColormap colormap = m_panel.Colormap; if (m_vertices == null) { m_vertices = ILMemoryPool.Pool.New <VERTEXTYPEDEF>(m_Vertcount); } float val = 0.0f; float minZ = m_sourceArray.MinValue; float maxZ = m_sourceArray.MaxValue; float a = colormap.Length / (maxZ - minZ); byte ca = (byte)(m_opacity * 255); VERTEXTYPEDEF curVertex; int i = 0; // first row is special (no color, just for grid) for (int c = 0; c < m_cols - 1; c++) { curVertex = new VERTEXTYPEDEF(); curVertex.Vx = c - 0.5f; curVertex.Vy = -0.5f; curVertex.CA = ca; val = m_sourceArray.GetValue(0, c); colormap.Map((val - minZ) * a, out curVertex.CR, out curVertex.CG, out curVertex.CB); m_vertices[i++] = curVertex; } // right corner curVertex = new VERTEXTYPEDEF(); curVertex.Vx = m_cols - 1.5f; curVertex.Vy = -0.5f; curVertex.CA = ca; colormap.Map((val - minZ) * a, out curVertex.CR, out curVertex.CG, out curVertex.CB); m_vertices[i++] = curVertex; for (int r = 0; r < m_rows - 1; r++) { // first col part is special (no color) curVertex = new VERTEXTYPEDEF(); curVertex.Vx = -0.5f; curVertex.Vy = r + 0.5f; curVertex.CA = ca; colormap.Map((m_sourceArray.GetValue(r, 0) - minZ) * a, out curVertex.CR, out curVertex.CG, out curVertex.CB); m_vertices[i++] = curVertex; for (int c = 0; c < m_cols - 1; c++) { curVertex = new VERTEXTYPEDEF(); val = m_sourceArray.GetValue(r, c); // set color values colormap.Map((val - minZ) * a, out curVertex.CR, out curVertex.CG, out curVertex.CB); curVertex.CA = ca; curVertex.Vx = c + 0.5f; curVertex.Vy = r + 0.5f; m_vertices[i++] = curVertex; } } m_vertexReady = true; }
protected override void CreateVertices() { ILColormap colormap = m_panel.Colormap; if (m_vertices == null) { m_vertices = ILMemoryPool.Pool.New<VERTEXTYPEDEF>(m_Vertcount); } float val = 0.0f; float minZ = m_sourceArray.MinValue; float maxZ = m_sourceArray.MaxValue; float a = colormap.Length / (maxZ - minZ); byte ca = (byte)(m_opacity * 255); VERTEXTYPEDEF curVertex; int i = 0; // first row is special (no color, just for grid) for (int c = 0; c < m_cols-1; c++) { curVertex = new VERTEXTYPEDEF(); curVertex.Vx = c-0.5f; curVertex.Vy = -0.5f; curVertex.CA = ca; val = m_sourceArray.GetValue(0,c); colormap.Map((val - minZ) * a, out curVertex.CR, out curVertex.CG,out curVertex.CB); m_vertices[i++] = curVertex; } // right corner curVertex = new VERTEXTYPEDEF(); curVertex.Vx = m_cols-1.5f; curVertex.Vy = -0.5f; curVertex.CA = ca; colormap.Map((val - minZ) * a, out curVertex.CR, out curVertex.CG,out curVertex.CB); m_vertices[i++] = curVertex; for (int r = 0; r < m_rows-1; r++) { // first col part is special (no color) curVertex = new VERTEXTYPEDEF(); curVertex.Vx = -0.5f; curVertex.Vy = r+0.5f; curVertex.CA = ca; colormap.Map((m_sourceArray.GetValue(r,0) - minZ) * a, out curVertex.CR, out curVertex.CG,out curVertex.CB); m_vertices[i++] = curVertex; for (int c = 0; c < m_cols-1; c++) { curVertex = new VERTEXTYPEDEF(); val = m_sourceArray.GetValue(r,c); // set color values colormap.Map((val- minZ) * a, out curVertex.CR, out curVertex.CG,out curVertex.CB); curVertex.CA = ca; curVertex.Vx = c+0.5f; curVertex.Vy = r+0.5f; m_vertices[i++] = curVertex; } } m_vertexReady = true; }