DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ RGBToHSV()

static vector RGBToHSV ( vector rgb)
static

См. определение в файле proto.c строка 362

363{
364 float r = rgb[0];
365 float g = rgb[1];
366 float b = rgb[2];
367
368 float maxVal = Math.Max(r, Math.Max(g, b));
369 float minVal = Math.Min(r, Math.Min(g, b));
370 float delta = maxVal - minVal;
371
372 float h = 0, s = 0, v = maxVal;
373
374 if (maxVal != 0)
375 s = delta / maxVal;
376
377 if (delta != 0)
378 {
379 switch (maxVal)
380 {
381 case r:
382 {
383 h = (g - b) / delta;
384 if (g < b)
385 h += 6;
386 }
387 break;
388 case g:
389 h = (b - r) / delta + 2;
390 break;
391 case b:
392 h = (r - g) / delta + 4;
393 break;
394 }
395 h = h / 6;
396 }
397
398 return Vector(h * 360, s, v); // H in degrees, S and V in 0-1
399}
Определения EnMath.c:7
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.

Перекрестные ссылки Math::Max(), Math::Min() и Vector().

Используется в PPERequester_SandstormEffect::OnStart().