GraphicResource struct
#include <Jazz2/Resources.h>
Specific graphic resource (from metadata).
One animation entry parsed from an object's metadata. It points at a shared GenericGraphicResource and describes the sub-range of its frames to play — frame offset, frame count, animation duration and loop mode — the AnimState it represents, and the palette offset used when the sprite is indexed. Stored in a Metadata and looked up by animation state at runtime.
Public static variables
-
static std::
uint16_t NotDeferred constexpr - Value of DeferredIndex of an entry that has no graphics to load (anymore), and the number of deferred animations a single metadata can describe.
Constructors, destructors, conversion operators
- GraphicResource() noexcept
- Creates a new instance.
Public functions
- auto operator<(const GraphicResource& p) const -> bool noexcept
- Compares two resources by animation state.
Public variables
- GenericGraphicResource* Base
- Underlying generic resource,
nullptruntil a deferred entry is resolved. - AnimState State
- Animation state.
- float AnimDuration
- Animation duration (in normalized frames), valid only once Base is loaded.
-
std::
int32_t FrameCount - Frame count, valid only once Base is loaded.
-
std::
int32_t FrameOffset - Frame offset.
- AnimationLoopMode LoopMode
- Animation loop mode.
-
std::
uint16_t PaletteOffset - Flat palette offset for an indexed sprite (from the metadata
PaletteOffset). -
std::
uint16_t DeferredIndex - Index into Metadata::
DeferredAnimations describing how to load Base, or NotDeferred.
Variable documentation
std:: uint16_t Jazz2:: Resources:: GraphicResource:: PaletteOffset
Flat palette offset for an indexed sprite (from the metadata PaletteOffset).
Selects which palette region the PrecompiledShader::
std:: uint16_t Jazz2:: Resources:: GraphicResource:: DeferredIndex
Index into Metadata::
Three states are encoded together with Base: a loaded entry has Base != nullptr, a deferred one has Base == nullptr and a valid index, and one whose graphics could not be loaded has Base == nullptr and NotDeferred — which is what keeps a missing asset from being retried on every single lookup.
Sits next to PaletteOffset, and is only 16 bits wide, so that both fit in the padding the struct has anyway (a level holds one of these per animation state of every object type it spawns).