Skip to content

Commit

Permalink
GLTF::Material::TextureShaderAttribs: added GetUVSelector, GetWrapUMo…
Browse files Browse the repository at this point in the history
…de, and GetWrapVMode methods
  • Loading branch information
TheMostDiligent committed Sep 28, 2024
1 parent bfa1c21 commit 983d62c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions AssetLoader/interface/GLTFLoader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ struct Material
PackedProps &= ~UVSelectorShiftedMask;
PackedProps |= (static_cast<Uint32>(Selector) & UVSelectorMask) << UVSelectorShift;
}
int GetUVSelector() const
{
return static_cast<int>((PackedProps >> UVSelectorShift) & UVSelectorMask) - 1;
}

static_assert(TEXTURE_ADDRESS_WRAP == 1, "TEXTURE_ADDRESS_WRAP must be 1");
static_assert(TEXTURE_ADDRESS_MIRROR == 2, "TEXTURE_ADDRESS_MIRROR must be 2");
Expand All @@ -286,6 +290,14 @@ struct Material
PackedProps &= ~WrapVShiftedMask;
PackedProps |= (((std::max)(static_cast<Uint32>(AddressMode), 1u) - 1u) & WrapVMask) << WrapVShift;
}
TEXTURE_ADDRESS_MODE GetWrapUMode() const
{
return static_cast<TEXTURE_ADDRESS_MODE>(((PackedProps >> WrapUShift) & WrapUMask) + 1u);
}
TEXTURE_ADDRESS_MODE GetWrapVMode() const
{
return static_cast<TEXTURE_ADDRESS_MODE>(((PackedProps >> WrapVShift) & WrapVMask) + 1u);
}
};
static_assert(sizeof(TextureShaderAttribs) % 16 == 0, "TextureShaderAttribs struct must be 16-byte aligned");

Expand Down

0 comments on commit 983d62c

Please sign in to comment.