Beispiel #1
0
        /// <summary>
        /// Get the corresponding string associated with a `ComponentIndex` enum
        /// according to it's `ComponentIndexType`
        /// </summary>
        /// <param name="component"></param>
        /// <param name="type"></param>
        /// <returns>The string representation of component</returns>
        internal static string GetString(this ComponentIndex component, ComponentIndexType type = ComponentIndexType.Vector)
        {
            //out of range case
            if (!Enum.IsDefined(typeof(ComponentIndex), component))
            {
                return(((int)component).ToString());
            }

            int ind = ((int)component);

            if (type == ComponentIndexType.Vector)
            {
                return(ind == 0 ? "X" : (ind == 1 ? "Y" : (ind == 2 ? "Z" : "W")));
            }
            else if (type == ComponentIndexType.Color)
            {
                return(ind == 0 ? "R" : (ind == 1 ? "G" : (ind == 2 ? "B" : "A")));
            }
            else
            {
                return(ind.ToString());
            }
        }
Beispiel #2
0
 /// <summary>
 /// Construct component index with a specific type/index combination
 /// </summary>
 /// <param name="type"></param>
 /// <param name="index"></param>
 public ComponentIndex(ComponentIndexType type, int index)
 {
     m_type  = (uint)type;
     m_index = index;
 }
 internal ComponentIndex(ComponentIndexType type, int index)
 {
   m_type = (uint)type;
   m_index = index;
 }