Ejemplo n.º 1
0
    void ChangeMaterial()
    {
        // Change vlen
        // Get changed values for increase and decrease luminance change
        redlumIncrease = redVlen + (redVlen * lumChange);
        redlumDecrease = redVlen - (redVlen * lumChange);

        greenlumIncrease = greenVlen + (greenVlen * lumChange);
        greenlumDecrease = greenVlen - (greenVlen * lumChange);

        bluelumIncrease = blueVlen + (blueVlen * lumChange);
        bluelumDecrease = blueVlen - (blueVlen * lumChange);

        // Get RGB value of luminance changes
        int[] redlumUpRGB   = m_dklConversion.DKLtoRGB(redlumIncrease, redAzimuth, redElevation, 0);
        int[] redlumDownRGB = m_dklConversion.DKLtoRGB(redlumDecrease, redAzimuth, redElevation, 0);

        int[] greenlumUpRGB   = m_dklConversion.DKLtoRGB(greenlumIncrease, greenAzimuth, greenElevation, 0);
        int[] greenlumDownRGB = m_dklConversion.DKLtoRGB(greenlumDecrease, greenAzimuth, greenElevation, 0);

        int[] bluelumUpRGB   = m_dklConversion.DKLtoRGB(bluelumIncrease, blueAzimuth, blueElevation, 0);
        int[] bluelumDownRGB = m_dklConversion.DKLtoRGB(bluelumDecrease, blueAzimuth, blueElevation, 0);

        // Implement changes to the materials
        redLumUp.color   = new Color32(redlookup[redlumUpRGB[0]], greenlookup[redlumUpRGB[1]], bluelookup[redlumUpRGB[2]], 255);
        redLumDown.color = new Color32(redlookup[redlumDownRGB[0]], greenlookup[redlumDownRGB[1]], bluelookup[redlumDownRGB[2]], 255);

        greenLumUp.color   = new Color32(redlookup[greenlumUpRGB[0]], greenlookup[greenlumUpRGB[1]], bluelookup[greenlumUpRGB[2]], 255);
        greenLumDown.color = new Color32(redlookup[greenlumDownRGB[0]], greenlookup[greenlumDownRGB[1]], bluelookup[greenlumDownRGB[2]], 255);

        blueLumUp.color   = new Color32(redlookup[bluelumUpRGB[0]], greenlookup[bluelumUpRGB[1]], bluelookup[bluelumUpRGB[2]], 255);
        blueLumDown.color = new Color32(redlookup[bluelumDownRGB[0]], greenlookup[bluelumDownRGB[1]], bluelookup[bluelumDownRGB[2]], 255);
    }
    void ChangeMaterial()
    {
        // Change vlen
        // Get changed values for increase and decrease luminance change
        dist1LumIncrease = dist1Vlen + (dist1Vlen * lumChange);
        dist1LumDecrease = dist1Vlen - (dist1Vlen * lumChange);

        dist2LumIncrease = dist2Vlen + (dist2Vlen * lumChange);
        dist2LumDecrease = dist2Vlen - (dist2Vlen * lumChange);

        // Change elevation
        // Get changed values for increase and decrease saturation change
        dist1SatIncrease = dist1Elevation + (dist1Elevation * satChange);
        dist1SatDecrease = dist1Elevation - (dist1Elevation * satChange);

        dist2SatIncrease = dist2Elevation + (dist2Elevation * satChange);
        dist2SatDecrease = dist2Elevation - (dist2Elevation * satChange);

        // Get RGB value of luminance changes
        int[] dist1lumUpRGB   = m_dklConversion.DKLtoRGB(dist1LumIncrease, dist1Azimuth, dist1Elevation, 0);
        int[] dist1lumDownRGB = m_dklConversion.DKLtoRGB(dist1LumDecrease, dist1Azimuth, dist1Elevation, 0);

        int[] dist2lumUpRGB   = m_dklConversion.DKLtoRGB(dist2LumIncrease, dist2Azimuth, dist2Elevation, 0);
        int[] dist2lumDownRGB = m_dklConversion.DKLtoRGB(dist2LumDecrease, dist2Azimuth, dist2Elevation, 0);

        // Get RGB value of saturation changes
        int[] dist1satUpRGB   = m_dklConversion.DKLtoRGB(dist1Vlen, dist1Azimuth, dist1SatIncrease, 0);
        int[] dist1satDownRGB = m_dklConversion.DKLtoRGB(dist1Vlen, dist1Azimuth, dist1SatDecrease, 0);

        int[] dist2satUpRGB   = m_dklConversion.DKLtoRGB(dist2Vlen, dist2Azimuth, dist2SatIncrease, 0);
        int[] dist2satDownRGB = m_dklConversion.DKLtoRGB(dist2Vlen, dist2Azimuth, dist2SatDecrease, 0);

        // Implement changes to the materials
        dist1LumUp.color   = new Color32(redlookup[dist1lumUpRGB[0]], greenlookup[dist1lumUpRGB[1]], bluelookup[dist1lumUpRGB[2]], 255);
        dist1LumDown.color = new Color32(redlookup[dist1lumDownRGB[0]], greenlookup[dist1lumDownRGB[1]], bluelookup[dist1lumDownRGB[2]], 255);

        dist2LumUp.color   = new Color32(redlookup[dist2lumUpRGB[0]], greenlookup[dist2lumUpRGB[1]], bluelookup[dist2lumUpRGB[2]], 255);
        dist2LumDown.color = new Color32(redlookup[dist2lumDownRGB[0]], greenlookup[dist2lumDownRGB[1]], bluelookup[dist2lumDownRGB[2]], 255);

        dist1SatUp.color   = new Color32(redlookup[dist1satUpRGB[0]], greenlookup[dist1satUpRGB[1]], bluelookup[dist1satUpRGB[2]], 255);
        dist1SatDown.color = new Color32(redlookup[dist1satDownRGB[0]], greenlookup[dist1satDownRGB[1]], bluelookup[dist1satDownRGB[2]], 255);

        dist2SatUp.color   = new Color32(redlookup[dist2satUpRGB[0]], greenlookup[dist2satUpRGB[1]], bluelookup[dist2satUpRGB[2]], 255);
        dist2SatDown.color = new Color32(redlookup[dist2satDownRGB[0]], greenlookup[dist2satDownRGB[1]], bluelookup[dist2satDownRGB[2]], 255);
    }
Ejemplo n.º 3
0
    // This method changes the DKL hue value of a target color material by the input degree value and
    // implements the resulting RGB values to the target color material
    float StartingColors(Material blueMaterial, float deg, float startHue)
    {
        // INPUT: 1) target color material
        //        2) degree value to change hue
        //        3) baseline blue's DKL hue value

        // OUTPUT: target color's DKL hue value

        // Added starting DKL hue value with the degree change value
        float endHue = startHue + (deg / 1);

        // Convert DKL values to RGB values
        int[] rgb = m_dklConversion.DKLtoRGB(targetVectorLength, endHue, targetElevation, 0);

        // Implement color change to target color material
        blueMaterial.color = new Color32(redlookup[rgb[0]], greenlookup[rgb[1]], bluelookup[rgb[2]], 255);

        return(endHue);
    }
Ejemplo n.º 4
0
    // This method changes the DKL saturation value of a target color material and
    // implements the resulting RGB values to the target color material
    float ChangeSaturation(float vectorlength, float azimuth, float elevation, Material colorMaterial)
    {
        // INPUTS: 1) initial DKL saturation value of target color material,
        //         2) DKL hue value of target color material,
        //         3) DKL luminance value of target color material,
        //         4) target color material

        // OUTPUTS: end DKL saturation value of target color material

        // Upward scrollwheel input increases the DKL saturation value
        if (Input.GetAxis("Mouse ScrollWheel") > 0f)
        {
            // Increase DKL saturation by adding step size number
            elevation = elevation + satStepSize;

            // Convert DKL values to RGB values
            int[] rgb = m_dklConversion.DKLtoRGB(vectorlength, azimuth, elevation, 0);
            //Debug.Log("R = " + rgb[0] + ", G = " + rgb[1] + ", B = " + rgb[2]);

            // Give error text when value too high
            if (rgb[0] > 255 || rgb[1] > 255 || rgb[2] > 255 || elevation > 27)
            {
                errorText.SetActive(true);
                errorText.GetComponent <Text>().text = "Value too high";

                // Return to original saturation value
                elevation = elevation - satStepSize;
            }
            else
            {
                errorText.SetActive(false);

                // Implement color change to target color material
                colorMaterial.color = new Color32(redlookup[rgb[0]], greenlookup[rgb[1]], bluelookup[rgb[2]], 255);
            }
        }

        // Downward scollwheel input decreases the DKL saturation value
        if (Input.GetAxis("Mouse ScrollWheel") < 0f)
        {
            // Decrease DKL saturation by subtracting step size number
            elevation = elevation - satStepSize;

            // Convert DKL values to RGB values
            int[] rgb = m_dklConversion.DKLtoRGB(vectorlength, azimuth, elevation, 0);
            //Debug.Log("R = " + rgb[0] + ", G = " + rgb[1] + ", B = " + rgb[2]);

            // Give error text when value too low
            if (rgb[0] < 0 || rgb[1] < 0 || rgb[2] < 0 || elevation < 0)
            {
                errorText.SetActive(true);
                errorText.GetComponent <Text>().text = "Value too low";

                // Return to original saturation value
                elevation = elevation + satStepSize;
            }
            else
            {
                errorText.SetActive(false);

                // Implement color change to target color material
                colorMaterial.color = new Color32(redlookup[rgb[0]], greenlookup[rgb[1]], bluelookup[rgb[2]], 255);
            }
        }

        return(elevation);
    }