1// Copyright Contributors to the Open Shading Language project.
2// SPDX-License-Identifier: BSD-3-Clause
3// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
4
5
6
7shader
8test ()
9{
10    int resolution[2] = { -1, -1 };
11    string projection = "";
12    float hither = -1, yon = -1;
13    float clip[2] = { -1, -1 };
14    float pixelaspect = -1;
15    float fov = -1;
16    float shutter_open = -1, shutter_close = -1;
17    float shutter[2] = { -1, -1 };
18    float screen_window[4] = { -1, -1, -1, -1 };
19
20    printf ("Camera parameters\n");
21    getattribute ("camera:resolution", resolution);
22    getattribute ("camera:projection", projection);
23    getattribute ("camera:fov", fov);
24    getattribute ("camera:pixelaspect", pixelaspect);
25    getattribute ("camera:clip_near", hither);
26    getattribute ("camera:clip_far", yon);
27    getattribute ("camera:clip", clip);
28    getattribute ("camera:shutter_open", shutter_open);
29    getattribute ("camera:shutter_close", shutter_close);
30    getattribute ("camera:shutter", shutter);
31    getattribute ("camera:screen_window", screen_window);
32
33    printf ("Resolution: %d x %d\n", resolution[0], resolution[1]);
34    printf ("Projection: %s\n", projection);
35    printf ("fov: %g\n", fov);
36    printf ("Pixel aspect: %g\n", pixelaspect);
37    printf ("Clipping:   hither = %g, yon = %g (also %g %g)\n",
38            hither, yon, clip[0], clip[1]);
39    printf ("Shutter:    open = %g, close = %g (also %g %g)\n",
40            shutter_open, shutter_close, shutter[0], shutter[1]);
41    printf ("Screen window: %g", screen_window);
42}
43