last hope
This commit is contained in:
@@ -81,36 +81,36 @@ float perceptualColorDistance(vec3 color1, vec3 color2) {
|
||||
return dot(delta, delta);
|
||||
}
|
||||
|
||||
//int findMostPerceptuallyAccurateColor(vec3 color) {
|
||||
// int bestMatchIndex = 0;
|
||||
// float minDistance = perceptualColorDistance(color, ConsoleColorVec3[0]);
|
||||
//
|
||||
// for (int i = 1; i < 16; i++) {
|
||||
// float currentDistance = perceptualColorDistance(color, ConsoleColorVec3[i]);
|
||||
// if (currentDistance < minDistance) {
|
||||
// minDistance = currentDistance;
|
||||
// bestMatchIndex = i;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return bestMatchIndex;
|
||||
//}
|
||||
|
||||
int findMostPerceptuallyAccurateColor(vec3 color) {
|
||||
int closestIndex = 0;
|
||||
float minDistance = distance(color, ConsoleColorVec3[0]);
|
||||
int bestMatchIndex = 0;
|
||||
float minDistance = perceptualColorDistance(color, ConsoleColorVec3[0]);
|
||||
|
||||
for (int i = 1; i < 16; i++) {
|
||||
float dist = distance(color, ConsoleColorVec3[i]);
|
||||
if (dist < minDistance) {
|
||||
minDistance = dist;
|
||||
closestIndex = i;
|
||||
float currentDistance = perceptualColorDistance(color, ConsoleColorVec3[i]);
|
||||
if (currentDistance < minDistance) {
|
||||
minDistance = currentDistance;
|
||||
bestMatchIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
return closestIndex;
|
||||
return bestMatchIndex;
|
||||
}
|
||||
|
||||
//int findMostPerceptuallyAccurateColor(vec3 color) {
|
||||
// int closestIndex = 0;
|
||||
// float minDistance = distance(color, ConsoleColorVec3[0]);
|
||||
//
|
||||
// for (int i = 1; i < 16; i++) {
|
||||
// float dist = distance(color, ConsoleColorVec3[i]);
|
||||
// if (dist < minDistance) {
|
||||
// minDistance = dist;
|
||||
// closestIndex = i;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return closestIndex;
|
||||
//}
|
||||
|
||||
// Enhanced luminosity calculation considering human perception
|
||||
float calculatePerceptualLuminance(vec3 color) {
|
||||
// BT.709 luminance coefficients with slight adjustment
|
||||
|
||||
Reference in New Issue
Block a user