MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / convertTexture

Method convertTexture

Source/Modules/USDUtils/ConvertedInput.cpp:162–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162ConvertedInput 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 {

Callers

nothing calls this directly

Calls 10

logInfoFunction · 0.85
getFloat4ValueFunction · 0.85
getSourceInputFunction · 0.85
getLayerHandleFunction · 0.85
getAttributeFunction · 0.70
logWarningFunction · 0.50
anyFunction · 0.50
updateMethod · 0.45
emptyMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected