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

shader
test_transform_u_matrix_affine_u_normal (
    output color Cout = 0)
{
    float val = raytype("camera");
    float val2 = val/2;
    float val3 = val/4;

    normal v1 = normal(val, val2, val3);
    normal v2 = normal(val3, val, val2);
    
    matrix M = matrix(
        0.1 + val*0.1, val*0.125, val*0.150, 0,
        val*0.2, 0.1 + val*0.225, val*0.250, 0,
        val*0.3, val*0.325, 0.1 + val*0.350, 0,
        val*0.4, val*0.425, val*0.450, 1);
    normal tv = transform(M, v1);
    normal tv2 = tv*transform(M*2, v1);

    if (int(P[0]*64)%2==0) {
        tv2 = transform(M, v2);
    }
    
    Cout = tv2;
}
