public void addRender(IRender a_render) { CRenderItem item = new CRenderItem(); item.m_reader = a_render; m_hashtable.Add(item.m_reader.GetHashCode(), item); }
public void _updatePostionColored() { m_device.VertexFormat = CustomVertex.PositionColored.Format; foreach (DictionaryEntry keyValuePair in m_hashtable) { CRenderItem item = (CRenderItem)keyValuePair.Value; IRender render = item.m_reader; if (render == null) { continue; } Vector3[] positionList = render.getPositions(); Int32[] postionIndex = render.getIndexs(); int countPosition = positionList.Length; int countIndex = postionIndex.Length; if (item.m_vectors == null || item.m_vectors.Length < countPosition) { item.m_vectors = new CustomVertex.PositionColored[countPosition]; } for (int j = 0; j < positionList.Length; ++j) { item.m_vectors[j].Position = positionList[j]; item.m_vectors[j].Color = render.getColor().ToArgb(); } try { m_device.DrawIndexedUserPrimitives(PrimitiveType.TriangleList, 0, countIndex, countIndex / 3, postionIndex, false, item.m_vectors); } catch (Exception e) { UnityUtility.CTrace.Singleton.error("DrawIndexedUserPrimitives:{0}", e.Message); } } }