1 // 2 // Copyright 2016 Pixar 3 // 4 // Licensed under the Apache License, Version 2.0 (the "Apache License") 5 // with the following modification; you may not use this file except in 6 // compliance with the Apache License and the following modification to it: 7 // Section 6. Trademarks. is deleted and replaced with: 8 // 9 // 6. Trademarks. This License does not grant permission to use the trade 10 // names, trademarks, service marks, or product names of the Licensor 11 // and its affiliates, except as required to comply with Section 4(c) of 12 // the License and to reproduce the content of the NOTICE file. 13 // 14 // You may obtain a copy of the Apache License at 15 // 16 // http://www.apache.org/licenses/LICENSE-2.0 17 // 18 // Unless required by applicable law or agreed to in writing, software 19 // distributed under the Apache License with the above modification is 20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21 // KIND, either express or implied. See the Apache License for the specific 22 // language governing permissions and limitations under the Apache License. 23 // 24 #ifndef PXR_USD_USD_RENDER_SPEC_H 25 #define PXR_USD_USD_RENDER_SPEC_H 26 27 /// \file usdRender/spec.h 28 29 #include "pxr/pxr.h" 30 #include "pxr/usd/usdRender/api.h" 31 #include "pxr/usd/usdRender/settingsBase.h" 32 #include "pxr/usd/usd/prim.h" 33 #include "pxr/usd/usd/stage.h" 34 #include "pxr/usd/usdRender/tokens.h" 35 36 #include "pxr/base/gf/frustum.h" 37 38 39 #include "pxr/base/vt/value.h" 40 41 #include "pxr/base/gf/vec3d.h" 42 #include "pxr/base/gf/vec3f.h" 43 #include "pxr/base/gf/matrix4d.h" 44 45 #include "pxr/base/tf/token.h" 46 #include "pxr/base/tf/type.h" 47 48 PXR_NAMESPACE_OPEN_SCOPE 49 50 class UsdRenderSettings; 51 52 /// A self-contained specification of render settings. 53 /// \note This is preliminary API and is likely to change. 54 struct UsdRenderSpec { 55 /// Specification of a product. See UsdRenderProduct. 56 struct Product { 57 /// The type of product, ex: "raster". 58 TfToken type; 59 /// The name of the product, which uniquely identifies it. 60 TfToken name; 61 /// Path to the primary UsdGeomCamera camera to use for this product. 62 SdfPath cameraPath; 63 /// If set to true, disables motion blur. 64 bool instantaneousShutter; 65 /// The pixel resolution of the product. 66 GfVec2i resolution; 67 /// The pixel aspect ratio as adjusted by aspectRatioConformPolicy. 68 float pixelAspectRatio; 69 /// The policy that was applied to conform aspect ratio 70 /// mismatches between the aperture and image. 71 TfToken aspectRatioConformPolicy; 72 /// The camera aperture size as adjusted by aspectRatioConformPolicy. 73 GfVec2f apertureSize; 74 /// The data window, in NDC terms relative to the aperture. 75 /// (0,0) corresponds to bottom-left and (1,1) corresponds to 76 /// top-right. Note that the data window can partially cover 77 /// or extend beyond the unit range, for representing overscan 78 /// or cropped renders. 79 GfRange2f dataWindowNDC; 80 /// The render vars used by this product, as indices into the 81 /// top-level renderVars array. 82 std::vector<size_t> renderVarIndices; 83 /// Any extra settings values discovered in requested namespaces. 84 VtDictionary extraSettings; 85 }; 86 /// Specification of a render variable (aka AOV). See UsdRenderVar. 87 struct RenderVar { 88 /// The path of this render var, which uniquely identifies it. 89 SdfPath renderVarPath; 90 /// The value data type of the variable, as a USD type name. 91 TfToken dataType; 92 std::string sourceName; 93 TfToken sourceType; 94 /// Any extra settings values discovered in requested namespaces. 95 VtDictionary extraSettings; 96 }; 97 /// The full list of products requested by this render. 98 std::vector<Product> products; 99 /// The full list of render vars requested by products in this render. 100 std::vector<RenderVar> renderVars; 101 /// List of purposes to use to filter scene contents. 102 VtArray<TfToken> includedPurposes; 103 /// List of material binding purposes. 104 VtArray<TfToken> materialBindingPurposes; 105 /// Any extra settings values discovered in requested namespaces. 106 VtDictionary extraSettings; 107 }; 108 109 /// Computes the specification of the render settings. 110 /// For each product, applies the aspectRatioConformPolicy 111 /// and computes a final screenWindow and pixelAspectRatio. 112 /// 113 /// Any other attributes encountered are returned in extraSettings. 114 /// If a non-empty list of namespaces is provided, only attributes 115 /// within those namespaces are returned. 116 /// If an empty list of namespaces is provided, all custom 117 /// (non-schema) attributes are returned. 118 /// The same list of namespaces is used for finding extraSettings 119 /// in all UsdRender prim types. 120 USDRENDER_API 121 UsdRenderSpec 122 UsdRenderComputeSpec(UsdRenderSettings const& settings, 123 UsdTimeCode time, 124 std::vector<std::string> const& namespaces); 125 126 PXR_NAMESPACE_CLOSE_SCOPE 127 128 #endif 129