UberConstant - 图1

    1. // Color Space Changes by Adrian Cruceru
    2. // Redshift Rendering Technologies 2021
    3. // Modified by Saul Espinosa 09-24-2021 to output multiple constants
    4. // This file is licensed under Apache 2.0 license
    5. shader changeSpace [[ string label = "Uber Constant",
    6. string category = "Color", string help = "Transforms from an OCIO color space to another and outputs constants" ]]
    7. ( // Input Color
    8. color inColor = 0.5 [[ string label = "Input Color", string page = "Input Color"]],
    9. // Color Spaces
    10. string toSpace = ""
    11. [[ string label = "Output Space", string widget = "colorspace", string page = "Color OCIO Colorspace"]],
    12. // Float Color
    13. float inFloat = 0 [[ string label = "Input Float", string page = "Float", float min = 0, float max = 100]],
    14. // Vector Color
    15. vector inVector = 0 [[ string label = "Input Vector", string page = "Vector"]],
    16. // Matrix Input
    17. matrix inMatrix = 1 [[ string label = "Input Matrix", string page = "Matrix"]],
    18. // Output
    19. output color outColor = 0 [[ string label = "Out Color", string page = "Output" ]],
    20. output float outFloat = 0 [[ string label = "Out Float", string page = "Output" ]],
    21. output vector outVector = 0 [[ string label = "Out Vector", string page = "Output" ]],
    22. output matrix outMatrix = 0 [[ string label = "Out Matrix", string page = "Output" ]]
    23. )
    24. {
    25. outColor = transformc(toSpace, inColor);
    26. outFloat = inFloat;
    27. outVector = inVector;
    28. outMatrix = inMatrix;
    29. }