* Rename CLA files so they no longer say "draft." * Change CONTRIBUTING.mv to correctly describe the new CLA process, remove language related to the old SPI CLAs. Also some touchups to README.md. * Update the project_intake.md to check of various things that we've completed. * Change all references to the old imageworks GitHub URLs to the new ASWF ones. (This touches comments at the start of basically every file.) Signed-off-by: Larry Gritz <lg@larrygritz.com>
65 lines
1.4 KiB
Plaintext
65 lines
1.4 KiB
Plaintext
// Copyright Contributors to the Open Shading Language project.
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
|
|
|
|
//
|
|
// Test arrays of structs
|
|
//
|
|
|
|
|
|
|
|
struct Astruct {
|
|
float f;
|
|
point p;
|
|
};
|
|
|
|
|
|
struct Bstruct {
|
|
Astruct a[5];
|
|
};
|
|
|
|
|
|
shader
|
|
test ()
|
|
{
|
|
printf ("test arrays of struct\n\n");
|
|
|
|
Astruct a[5];
|
|
a[2].f = 15;
|
|
a[2].p = 1;
|
|
|
|
float f;
|
|
f = a[2].f;
|
|
printf ("float f; f = a[2].f; ==> %g\n", f);
|
|
|
|
float g = a[2].f;
|
|
printf ("float g = a[2].f; ==> %g\n", g);
|
|
|
|
printf ("test struct containing array of struct:\n");
|
|
Bstruct b;
|
|
b.a[1].f = M_PI;
|
|
printf ("b.a[1].f == %g\n", b.a[1].f);
|
|
|
|
printf ("test struct assignment to and from one array element:\n");
|
|
Astruct c = a[2];
|
|
printf ("after c=a[2], c = { %g, %g }\n", c.f, c.p);
|
|
a[3] = c;
|
|
printf ("after a[3]=c, a[3] = { %g, %g }\n", a[3].f, a[3].p);
|
|
|
|
printf ("test array-of-struct assignmment:\n");
|
|
Astruct a2[5];
|
|
a2 = a;
|
|
float f2;
|
|
f2 = a[2].f;
|
|
printf ("a2 = a; float f2; f = a2[2].f; ==> %g (should be %g)\n", f2, f);
|
|
|
|
printf ("test array-of-struct array element assignmment:\n");
|
|
Astruct a3[5];
|
|
a3[0].f = 0.0;
|
|
a3[0].p = point(0.0);
|
|
a3[1].f = 1.0;
|
|
a3[1].p = point(1.0);
|
|
a3[0] = a3[1];
|
|
printf("a3[0] = a3[1]; ===> %g (should be %g) and [%g] (should be [%g])\n", a3[0].f, a3[1].f, a3[0].p, a3[1].p);
|
|
}
|