| 106 | } // namespace |
| 107 | |
| 108 | bool ConvertedInput::convertTextureCoords(const UsdShadeShader& shader, Falcor::Transform& xform) |
| 109 | { |
| 110 | UsdShadeConnectableAPI source; |
| 111 | TfToken sourceName; |
| 112 | UsdShadeAttributeType sourceType; |
| 113 | UsdShadeInput stInput(getSourceInput(shader.GetInput(gStToken), source, sourceName, sourceType)); |
| 114 | if (!stInput) |
| 115 | { |
| 116 | return false; |
| 117 | } |
| 118 | |
| 119 | TfToken id = getAttribute(source.GetPrim().GetAttribute(UsdShadeTokens->infoId), TfToken()); |
| 120 | if (id == gTransform2dToken) |
| 121 | { |
| 122 | if (UsdShadeInput scaleInput = source.GetInput(gScaleToken); scaleInput) |
| 123 | { |
| 124 | float2 scaleVec; |
| 125 | if (getFloat2Value(scaleInput, scaleVec)) |
| 126 | { |
| 127 | xform.setScaling(float3(scaleVec.x, scaleVec.y, 1.f)); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | if (UsdShadeInput rotateInput = source.GetInput(gRotationToken); rotateInput) |
| 132 | { |
| 133 | float degrees; |
| 134 | if (rotateInput.Get<float>(°rees, UsdTimeCode::EarliestTime())) |
| 135 | { |
| 136 | xform.setRotationEulerDeg(float3(0.f, 0.f, degrees)); |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | if (UsdShadeInput translateInput = source.GetInput(gTranslationToken); translateInput) |
| 141 | { |
| 142 | float2 translateVec; |
| 143 | if (getFloat2Value(translateInput, translateVec)) |
| 144 | { |
| 145 | xform.setTranslation(float3(translateVec.x, translateVec.y, 0.f)); |
| 146 | } |
| 147 | } |
| 148 | xform.setCompositionOrder(Transform::CompositionOrder::ScaleRotateTranslate); |
| 149 | } |
| 150 | else if (id != gFloat2PrimvarReaderToken) |
| 151 | { |
| 152 | logWarning( |
| 153 | "UsdUVTexture node '{}' defines an st primvar reader '{}' of an unexpected type: '{}'.", |
| 154 | shader.GetPrim().GetPath().GetString(), |
| 155 | source.GetPrim().GetPath().GetString(), |
| 156 | id.GetString() |
| 157 | ); |
| 158 | } |
| 159 | return true; |
| 160 | } |
| 161 | |
| 162 | ConvertedInput ConvertedInput::convertTexture( |
| 163 | const UsdShadeInput& input, |
nothing calls this directly
no test coverage detected