/// <summary> /// Returns a mapping tag that is used to detect when a mesh's colors need to be set. /// </summary> private MappingTag GetMappingTag() { var mt = new MappingTag(); // Since the false colors that are shown will change if // the mesh is transformed, we have to initialize the // transformation. mt.MeshTransform = Transform.Identity; // This is the analysis mode id passed to the // CRhinoVisualAnalysisMode constructor. Use the // m_am_id member and it this code will alwasy // work correctly. mt.Id = Id; // This is a 32 bit CRC or the information used to // set the false colors. // For this example, the m_z_range and m_hue_range // intervals control the colors, so we calculate // their crc. uint crc = 0; crc = RhinoMath.CRC32(crc, m_z_range.T0); crc = RhinoMath.CRC32(crc, m_z_range.T1); crc = RhinoMath.CRC32(crc, m_hue_range.T0); crc = RhinoMath.CRC32(crc, m_hue_range.T1); mt.MappingCRC = crc; return(mt); }
/// <summary> /// Returns a mapping tag that is used to detect when a mesh's colors need to /// be set. /// </summary> /// <returns></returns> Rhino.Render.MappingTag GetMappingTag(uint serialNumber) { Rhino.Render.MappingTag mt = new Rhino.Render.MappingTag(); mt.Id = this.Id; // Since the false colors that are shown will change if the mesh is // transformed, we have to initialize the transformation. mt.MeshTransform = Transform.Identity; // This is a 32 bit CRC or the information used to set the false colors. // For this example, the m_z_range and m_hue_range intervals control the // colors, so we calculate their crc. uint crc = RhinoMath.CRC32(serialNumber, m_z_range.T0); crc = RhinoMath.CRC32(crc, m_z_range.T1); crc = RhinoMath.CRC32(crc, m_hue_range.T0); crc = RhinoMath.CRC32(crc, m_hue_range.T1); mt.MappingCRC = crc; return(mt); }