Skip to content

Commit

Permalink
Merge pull request #735 from sirpalee/pr/animated_textures_for_draw_mode
Browse files Browse the repository at this point in the history
[USD] Allowing animated textures for drawModeAdapter

(Internal change: 1940814)
  • Loading branch information
pixar-oss committed Feb 20, 2019
2 parents e380a5c + a6917af commit 22d5e69
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
1 change: 1 addition & 0 deletions pxr/usdImaging/lib/usdImaging/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ PXR_NAMESPACE_OPEN_SCOPE
(usdVaryingWidths) \
(usdVaryingNormals) \
(usdVaryingXform) \
(usdVaryingTexture) \
(bxdf) \
(displacement) \
(uvPrimvar) \
Expand Down
33 changes: 31 additions & 2 deletions pxr/usdImaging/lib/usdImagingGL/drawModeAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,40 @@ UsdImagingGLDrawModeAdapter::TrackVariability(UsdPrim const& prim,
UsdImagingInstancerContext const*
instancerContext) const
{
if (_IsMaterialPath(cachePath) || _IsTexturePath(cachePath)) {
// Shader/texture aspects aren't time-varying.
const std::array<TfToken, 6> textureAttrs = {
UsdGeomTokens->modelCardTextureXPos,
UsdGeomTokens->modelCardTextureYPos,
UsdGeomTokens->modelCardTextureZPos,
UsdGeomTokens->modelCardTextureXNeg,
UsdGeomTokens->modelCardTextureYNeg,
UsdGeomTokens->modelCardTextureZNeg,
};

auto checkForTextureVariability =
[&textureAttrs, &prim, &timeVaryingBits, this]
(HdDirtyBits dirtyBits) {
for (const TfToken& attr: textureAttrs) {
if (_IsVarying(prim, attr, dirtyBits,
UsdImagingTokens->usdVaryingTexture,
timeVaryingBits, true)) {
break;
}
}
};

if (_IsTexturePath(cachePath)) {
checkForTextureVariability(HdTexture::DirtyTexture);
return;
}

if (_IsMaterialPath(cachePath)) {
checkForTextureVariability(
HdMaterial::DirtySurfaceShader | HdMaterial::DirtyParams);
return;
}

checkForTextureVariability(HdChangeTracker::DirtyParams);

// WARNING: This method is executed from multiple threads, the value cache
// has been carefully pre-populated to avoid mutating the underlying
// container during update.
Expand Down

0 comments on commit 22d5e69

Please sign in to comment.