// Copyright Contributors to the Open Shading Language project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage

shader
test_varying_index_float (output color Cout = color(0,0,0))
{
    // Test array referencing with varying index
    float rarray[3] = { 0.1, 0.2, 0.3 };
    float garray[3] = { 0.2, 0.4, 0.6 };
    float barray[3] = { 0.3, 0.5, 0.8 };
    
    int varyingIndex = int(clamp(P[0]*3, 0, 2));
    float indirectR = rarray[varyingIndex];
    float indirectG = garray[varyingIndex];
    float indirectB = barray[varyingIndex];
    
    Cout = color(indirectR,indirectG,indirectB);
}
