| 160 | } |
| 161 | |
| 162 | ConvertedInput ConvertedInput::convertTexture( |
| 163 | const UsdShadeInput& input, |
| 164 | const TfToken& outputName, |
| 165 | const TextureEncoding& texEncoding, |
| 166 | ConvertedTexTransform& texTransform |
| 167 | ) |
| 168 | { |
| 169 | ConvertedInput ret; |
| 170 | |
| 171 | ret.shadeInput = input; |
| 172 | |
| 173 | // Note that the wrapS, wrapT, scale, and bias inputs are unsupported, and are ignored. |
| 174 | |
| 175 | UsdPrim prim(input.GetPrim()); |
| 176 | if (!prim.IsA<UsdShadeShader>()) |
| 177 | { |
| 178 | logWarning("Expected UsdUVTexture node '{}' is not a UsdShadeShader.", prim.GetPath().GetString()); |
| 179 | return ret; |
| 180 | } |
| 181 | |
| 182 | UsdShadeShader shader(prim); |
| 183 | |
| 184 | TfToken id = getAttribute(prim.GetAttribute(UsdShadeTokens->infoId), TfToken()); |
| 185 | if (id != gUVTextureToken) |
| 186 | { |
| 187 | logWarning("Expected UsdUVTexture node '{}' is not a UsdUVTexture.", prim.GetPath().GetString()); |
| 188 | return ret; |
| 189 | } |
| 190 | |
| 191 | if (shader.GetInput(gWrapSToken) || shader.GetInput(gWrapTToken)) |
| 192 | { |
| 193 | // Issue a low-priorty message, under the assumption that wrap modes most often don't matter. |
| 194 | logInfo("UsdUvTexture node '{}' specifies a wrap mode, which is not supported.", prim.GetPath().GetString()); |
| 195 | } |
| 196 | |
| 197 | if (UsdShadeInput biasInput = shader.GetInput(gBiasToken); biasInput) |
| 198 | { |
| 199 | float4 value; |
| 200 | if (!getFloat4Value(biasInput, value)) |
| 201 | { |
| 202 | logWarning( |
| 203 | "UsdUvTexture node '{}' specifies value scale of an unsupported type: '{}'.", |
| 204 | prim.GetPath().GetString(), |
| 205 | biasInput.GetTypeName().GetAsToken().GetString() |
| 206 | ); |
| 207 | } |
| 208 | else if (texEncoding == TextureEncoding::Normal) |
| 209 | { |
| 210 | if (any(value.xy() != float2(-1.f, -1.f))) |
| 211 | { |
| 212 | logWarning( |
| 213 | "UsdUvTexture normalMap node '{}' specifies a bias other than (-1, -1), which is not supported.", |
| 214 | prim.GetPath().GetString() |
| 215 | ); |
| 216 | } |
| 217 | } |
| 218 | else if (any(value != float4(0.f, 0.f, 0.f, 0.f))) |
| 219 | { |
nothing calls this directly
no test coverage detected