Beispiel #1
0
 public void API_SetColor(float r, float g, float b)
 {
     logger.Log("Called API_SetColor with arguments " + r + ", " + g + ", " + b);
     color = new Float3(r, g, b);
     return;
 }
Beispiel #2
0
 public SortedDictionary<KeyWrapper, object> API_HSVtoRGB(float H, float S, float V)
 {
     Float3 white = new Float3 (1f, 1f, 1f);
     if (S == 0)
     {
         white.x = V;
         white.y = V;
         white.z = V;
     }
     else
     {
         if (V == 0)
         {
             white.x = 0;
             white.y = 0;
             white.z = 0;
         }
         else
         {
             white.x = 0;
             white.y = 0;
             white.z = 0;
             float num = H * 6;
             int num2 = (int)System.Math.Floor(num);
             float num3 = num - (float)num2;
             float num4 = V * (1 - S);
             float num5 = V * (1 - S * num3);
             float num6 = V * (1 - S * (1 - num3));
             int num7 = num2;
             switch (num7 + 1)
             {
             case 0:
                 white.x = V;
                 white.y = num4;
                 white.z = num5;
                 break;
             case 1:
                 white.x = V;
                 white.y = num6;
                 white.z = num4;
                 break;
             case 2:
                 white.x = num5;
                 white.y = V;
                 white.z = num4;
                 break;
             case 3:
                 white.x = num4;
                 white.y = V;
                 white.z = num6;
                 break;
             case 4:
                 white.x = num4;
                 white.y = num5;
                 white.z = V;
                 break;
             case 5:
                 white.x = num6;
                 white.y = num4;
                 white.z = V;
                 break;
             case 6:
                 white.x = V;
                 white.y = num4;
                 white.z = num5;
                 break;
             case 7:
                 white.x = V;
                 white.y = num6;
                 white.z = num4;
                 break;
             }
             white.x = Clamp01 (white.x);
             white.y = Clamp01 (white.y);
             white.z = Clamp01 (white.z);
         }
     }
     return new SortedDictionary<KeyWrapper,object> {
         {new KeyWrapper(0), white.x},
         {new KeyWrapper(1), white.y},
         {new KeyWrapper(2), white.z} };
 }