28 # error This is a userspace-only header, not allowed by the current build.
31 #include <sifteo/asset/group.h>
32 #include <sifteo/math.h>
33 #include <sifteo/array.h>
34 #include <sifteo/abi.h>
53 _SYSAssetConfiguration sys;
69 sys.pGroup =
reinterpret_cast<uintptr_t
>(&
group);
88 return reinterpret_cast<AssetGroup*
>(sys.pGroup);
111 return roundup<unsigned>(
numTiles(), _SYS_ASSET_GROUP_SIZE_UNIT);
137 template <
unsigned tCapacity>
233 operator const _SYSAssetLoader& ()
const {
return sys; }
234 operator _SYSAssetLoader& () {
return sys; }
235 operator const _SYSAssetLoader* ()
const {
return &sys; }
236 operator _SYSAssetLoader* () {
return &sys; }
260 _SYS_asset_loadFinish(*
this);
280 void cancel(_SYSCubeIDVector cubes = -1) {
281 _SYS_asset_loadCancel(*
this, cubes);
316 template <
typename T >
317 void start(T& configuration, _SYSCubeIDVector cubes = -1)
322 _SYS_asset_loadStart(*
this, &configuration.begin()->sys, configuration.count(), cubes);
341 return cubes[cubeID].progress * max / cubes[cubeID].total;
355 unsigned progress = cubes[cubeID].progress;
356 unsigned total = cubes[cubeID].total;
357 return total ? (progress / float(total)) : 0.0f;
374 unsigned progress = 0, total = 0;
376 progress += cubes[i].progress;
377 total += cubes[i].total;
379 return progress * max / total;
392 unsigned progress = 0, total = 0;
394 progress += cubes[i].progress;
395 total += cubes[i].total;
397 return total ? (progress / float(total)) : 0.0f;
404 return sys.busyCubes;
419 return (sys.busyCubes & vec) == 0;
428 return isComplete(_SYSCubeIDVector(0x80000000 >> cubeID));
435 return sys.busyCubes == 0;
AssetSlots are numbered containers, in a cube's flash memory, which can hold AssetGroups.
Definition: group.h:181
void cancel(_SYSCubeIDVector cubes=-1)
End any in-progress asset loading operations without finishing them.
Definition: loader.h:280
A bundle of compressed tile data, for use by AssetImages.
Definition: group.h:54
unsigned cubeProgress(_SYSCubeID cubeID, unsigned max) const
Measures progress on a single cube, as an integer.
Definition: loader.h:337
ALWAYS_INLINE const _SYSAssetGroupHeader * sysHeader(bool requireConst=false) const
Get a pointer to the read-only system data for this asset group.
Definition: group.h:72
_SYSVolumeHandle volume() const
Return the Volume handle referenced by this node.
Definition: loader.h:94
#define ASSERT(_x)
Runtime debug assertion.
Definition: macros.h:205
void finish()
Ensure that the system is no longer using this AssetLoader object.
Definition: loader.h:259
unsigned compressedSize() const
Get the compressed size of this asset group, in bytes.
Definition: loader.h:117
An AssetConfiguration represents an arrangement of AssetGroups to load.
Definition: loader.h:138
void bzero(void *s, unsigned count)
Write 'n' zero bytes to memory.
Definition: memory.h:114
An AssetLoader subclass which automatically calls init() and finish() in the constructor and destruct...
Definition: loader.h:449
#define CUBE_ALLOCATION
Compile-time cube limit for the current application.
Definition: limits.h:54
void init()
Initialize this object.
Definition: loader.h:246
bool isComplete() const
Are all asset installations from this asset loading session complete?
Definition: loader.h:434
AssetSlot slot() const
Return the AssetSlot this node will be loaded into.
Definition: loader.h:80
unsigned compressedSize() const
Get the compressed size of this asset group, in bytes.
Definition: group.h:100
bool isComplete(_SYSCubeID cubeID) const
Is the asset install for "cubeID" finished?
Definition: loader.h:427
One node in an AssetConfiguration list.
Definition: loader.h:52
unsigned numTiles() const
Get the size of this asset group, in tiles.
Definition: group.h:84
A statically sized array.
Definition: array.h:51
unsigned numTiles() const
Get the size of this asset group, in tiles.
Definition: loader.h:101
AssetGroup * group() const
Return the AssetGroup referenced by this node.
Definition: loader.h:87
float averageProgress() const
Measures total progress on all cubes, as a floating point value.
Definition: loader.h:390
void start(T &configuration, _SYSCubeIDVector cubes=-1)
Start installing an AssetConfiguration.
Definition: loader.h:317
unsigned averageProgress(unsigned max) const
Measures total progress on all cubes, as an integer.
Definition: loader.h:372
unsigned tileAllocation() const
How many tiles will this group use up in its AssetSlot?
Definition: loader.h:110
#define STATIC_ASSERT(_x)
Definition: macros.h:342
_SYSCubeIDVector busyCubes() const
Which cubes are still busy loading?
Definition: loader.h:403
AssetConfigurationNode & append()
Synonym for push_back()
Definition: array.h:120
An AssetLoader coordinates asset loading operations on one or more cubes.
Definition: loader.h:228
void append(_SYSAssetSlot slot, AssetGroup &group, _SYSVolumeHandle volume=0)
Add an AssetGroup to this configuration.
Definition: loader.h:154
Vector2< T > vec(T x, T y)
Create a Vector2, from a set of (x,y) coordinates.
Definition: math.h:658
float cubeProgress(_SYSCubeID cubeID) const
Measures progress on a single cube, as a floating point value.
Definition: loader.h:352
bool isComplete(_SYSCubeIDVector vec) const
Is the asset install finished for all cubes in the specified vector?
Definition: loader.h:418