Exemplo n.º 1
0
    public void addMixture(desiredMixtureType aimingFor, bool ignoreQuants, colorSpace csUsed, mixingMethod mixAlgo)
    {
        GameObject newMixtureDataGO = Instantiate(mixtureDataPrefab, mixtureListPanel.transform);

        mixtureDataList.Add(newMixtureDataGO, new mixtureData(newMixtureDataGO, aimingFor, ignoreQuants, csUsed, mixAlgo));
        mixtureDataList[newMixtureDataGO].updateMixture(Camera.main.GetComponent <demo_colors>().getAllColors(), Camera.main.GetComponent <demo_colors>().getAllQuants());
    }
Exemplo n.º 2
0
    public void setCSUsed(colorSpace newCSUsed, int i)
    {
        csUsed = newCSUsed;
        updateMixture(Camera.main.GetComponent <demo_colors>().getAllColors(), Camera.main.GetComponent <demo_colors>().getAllQuants());

        theGO.GetComponent <mixtureRefs>().justSet = true;
        theGO.GetComponent <mixtureRefs>().colorspaceGO.GetComponent <Dropdown>().value = i;
        theGO.GetComponent <mixtureRefs>().justSet = false;
    }
Exemplo n.º 3
0
    public mixtureData(GameObject GO, desiredMixtureType AF, bool IQ, colorSpace CSU, mixingMethod MM)
    {
        theGO = GO;

        setAimingFor(AF);
        setIgnoreQuants(IQ);
        setCSUsed(CSU);
        setMixAlgo(MM);
    }
Exemplo n.º 4
0
        public static float distBetweenColors(Color color1, Color color2, colorSpace colorSpaceUsed)
        {
            switch (colorSpaceUsed)
            {
            case colorSpace.RGB:
                return(distBetweenColors_inRGB_colorSpace(color1, color2));

            case colorSpace.RYB:
                return(distBetweenColors_inRYB_colorSpace(color1, color2));

            default:
                return(distBetweenColors_inCMYK_colorSpace(color1, color2));
            }
        }
        static Color mixColors(Color[] colors, float[] colorQuantities, colorSpace csToUse, mixingMethod mm, bool ignoreQuants)
        {
            switch (csToUse)
            {
            case colorSpace.RGB:
                return(mixColors_inRGB_colorSpace(colors, colorQuantities, mm, ignoreQuants));

            case colorSpace.RYB:
                return(mixColors_inRYB_colorSpace(colors, colorQuantities, mm, ignoreQuants));

            default:
                return(mixColors_inCMYK_colorSpace(colors, colorQuantities, mm, ignoreQuants));
            }
        }
Exemplo n.º 6
0
        public static Color complimentary(Color origColor, colorSpace csToUse)
        {
            switch (csToUse)
            {
            case colorSpace.RGB:
                return(complimentary_inRGB_colorSpace(origColor));

            case colorSpace.RYB:
                return(complimentary_inRYB_colorSpace(origColor));

            default:
                return(complimentary_inCMYK_colorSpace(origColor));
            }
        }
        public static Color colorLerp(Color start, Color end, float lerpValue, colorSpace csToUse) //value between 0 and 1
        {
            switch (csToUse)
            {
            case colorSpace.RGB:     //NOTE: this works exaclty the same as Color.Lerp()
                return(colorLerp_inRGB_colorSpace(start, end, lerpValue));

            case colorSpace.RYB:
                return(colorLerp_inRYB_colorSpace(start, end, lerpValue));

            default:
                return(colorLerp_inCMYK_colorSpace(start, end, lerpValue));
            }
        }
Exemplo n.º 8
0
    public void setCSUsed(colorSpace newCSUsed)
    {
        int newIndex = 0;

        switch (newCSUsed)
        {
        case colorSpace.RGB:
            newIndex = 0;
            break;

        case colorSpace.RYB:
            newIndex = 1;
            break;

        case colorSpace.CMYK:
            newIndex = 2;
            break;
        }

        setCSUsed(newCSUsed, newIndex);
    }
        public static float calcGuideDistance(Color startColor, Color currColor, Color endColor, colorSpace CS, guideDistance GD)
        {
            switch (CS)
            {
            case colorSpace.RGB:

                if (GD == guideDistance.distBetween_StartAndCurr)
                {
                    return(colorDistances.distBetweenColors(startColor, currColor, colorSpace.RGB));
                }
                else if (GD == guideDistance.distBetween_StartAndEnd)
                {
                    return(colorDistances.distBetweenColors(startColor, endColor, colorSpace.RGB));
                }
                else if (GD == guideDistance.distBetween_CurrAndEnd)
                {
                    return(colorDistances.distBetweenColors(currColor, endColor, colorSpace.RGB));
                }
                else
                {
                    return(441.672956f);    // maxDistanceInRGBColorSpace
                }

            case colorSpace.RYB:

                if (GD == guideDistance.distBetween_StartAndCurr)
                {
                    return(colorDistances.distBetweenColors(startColor, currColor, colorSpace.RYB));
                }
                else if (GD == guideDistance.distBetween_StartAndEnd)
                {
                    return(colorDistances.distBetweenColors(startColor, endColor, colorSpace.RYB));
                }
                else if (GD == guideDistance.distBetween_CurrAndEnd)
                {
                    return(colorDistances.distBetweenColors(currColor, endColor, colorSpace.RYB));
                }
                else
                {
                    return(441.672956f);    //maxDistanceInRYBColorSpace
                }

            default:

                if (GD == guideDistance.distBetween_StartAndCurr)
                {
                    return(colorDistances.distBetweenColors(startColor, currColor, colorSpace.CMYK));
                }
                else if (GD == guideDistance.distBetween_StartAndEnd)
                {
                    return(colorDistances.distBetweenColors(startColor, endColor, colorSpace.CMYK));
                }
                else if (GD == guideDistance.distBetween_CurrAndEnd)
                {
                    return(colorDistances.distBetweenColors(currColor, endColor, colorSpace.CMYK));
                }
                else
                {
                    return(255);    //maxDistanceInCMYKColorSpace (because we have no accurate representation for 4D distance)
                }
            }
        }
        public static float calcLerpValue(Color startColor, Color currColor, Color endColor, float lerpVelocity_DperF, colorSpace CS)
        {
            //---calc distance left to travel
            float distToFinish = 0;

            switch (CS)
            {
            case colorSpace.RGB:
                distToFinish = colorDistances.distBetweenColors(currColor, endColor, colorSpace.RGB);
                break;

            case colorSpace.RYB:
                distToFinish = colorDistances.distBetweenColors(currColor, endColor, colorSpace.RYB);
                break;

            default:
                distToFinish = colorDistances.distBetweenColors(currColor, endColor, colorSpace.CMYK);
                break;
            }

            //--- calc lerp value based on this
            return(Mathf.Clamp((lerpVelocity_DperF / distToFinish), 0, 1));
        }
 public static float calcLerpValue(Color startColor, Color currColor, Color endColor, float guideDistance, float guideTime, unitOfTime UOT_GD, updateLocation UL, colorSpace CS)
 {
     return(calcLerpValue(startColor, currColor, endColor, calcLerpVelocity(guideDistance, guideTime, UOT_GD, UL), CS));
 }
 public static Color mixColors(this Color c, Color[] colors, colorSpace csToUse, mixingMethod mm)
 {
     return(colorMixing.mixColors(colors, csToUse, mm));
 }
    //Description: find the distance Between 2 Colors in 1D, 2D, 3D, and 4D Space

    //NOTE: Vector 4 distance works out to be really strange because we don't really have an accurate version of distance in 4 Dimensional Space

    public static float distBetweenColors(this Color color1, Color color2, colorSpace colorSpaceUsed)
    {
        return(colorDistances.distBetweenColors(color1, color2, colorSpaceUsed));
    }
    //Allows you to interpolate between 2 colors

    public static Color colorLerp(this Color startColor, Color endColor, float lerpValue, colorSpace csToUse)
    {
        return(colorLerping.colorLerp(startColor, endColor, lerpValue, csToUse));
    }
 public static Color mixColors(this Color[] colors, float[] colorQuantities, colorSpace csToUse, mixingMethod mm)
 {
     return(colorMixing.mixColors(colors, colorQuantities, csToUse, mm));
 }
 public static float calcLerpValue(this Color startColor, Color currColor, Color endColor, float lerpVelocity_DperF, colorSpace CS)
 {
     return(colorLerpHelper.calcLerpValue(startColor, currColor, endColor, lerpVelocity_DperF, CS));
 }
 public static float calcLerpValue(this Color startColor, Color currColor, Color endColor, float guideDistance, float guideTime, unitOfTime UOT_GD, updateLocation UL, colorSpace CS)
 {
     return(colorLerpHelper.calcLerpValue(startColor, currColor, endColor, guideDistance, guideTime, UOT_GD, UL, CS));
 }
 public static float calcGuideDistance(this Color startColor, Color currColor, Color endColor, colorSpace CS, guideDistance GD)
 {
     return(colorLerpHelper.calcGuideDistance(startColor, currColor, endColor, CS, GD));
 }
 //Ignore Quants == true
 public static Color mixColors(Color[] colors, colorSpace csToUse, mixingMethod mm)
 {
     float[] colorQuantities = new float[0]; //create it to meet requirements
     return(mixColors(colors, colorQuantities, csToUse, mm, true));
 }
 //Ignore Quants == false
 public static Color mixColors(Color[] colors, float[] colorQuantities, colorSpace csToUse, mixingMethod mm)
 {
     return(mixColors(colors, colorQuantities, csToUse, mm, false));
 }
    //get the complement / inverse of a color

    public static Color complimentary(this Color color, colorSpace csToUse)
    {
        return(colorCompliments.complimentary(color, csToUse));
    }