You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
RenderDevice: Add support for multi-threaded image loading
For this initial commit, we are using it where it has the most impact,the animation system. Results may vary, but I got about a 2.5x speedupin opening GameStateLoad with several saves from flare-game with the newHD art assets.The usage is fairly simple: push images to load withRenderDevice::pushQueuedImage() and then callRenderDevice::loadQueuedImages() when ready to actually load them.In case this causes problems, I've added an option to the usersettings.txt to disable it.
Copy file name to clipboardExpand all lines: src/Animation.h
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -55,13 +55,21 @@ class Animation {
55
55
ACTIVE_SUBFRAME_ALL =2,
56
56
};
57
57
58
+
enum {
59
+
ANIMATION_COMPRESSED =0,
60
+
ANIMATION_UNCOMPRESSED
61
+
};
62
+
63
+
bool init;// image loading is deferred, so this flag is used to do some setup when calling getCurrentFrame() for the first time
64
+
58
65
bool reverse_playback;// only for type == BACK_FORTH
59
66
bool active_frame_triggered;
60
67
61
68
constuint8_t type;// see ANIMTYPE enum above
62
69
uint8_t active_sub_frame;
63
70
uint8_t blend_mode;
64
71
uint8_t alpha_mod;
72
+
uint8_t format;
65
73
66
74
unsignedshort total_frame_count;// the total number of frames for this animation (is different from frame_count for back/forth animations)
67
75
unsignedshort cur_frame;// counts up until reaching total_frame_count.
@@ -79,6 +87,8 @@ class Animation {
79
87
80
88
std::vector<std::pair<Image*, Rect> > gfx;// graphics for each frame taken from the spritesheet
81
89
std::vector<Point> render_offset;// "virtual point on the floor"
90
+
std::vector<std::string> keys;
91
+
std::vector<unsignedshort> dirs;
82
92
std::vector<short> active_frames;// frames that are marked as "active". Active frames are used to trigger various states (i.e power activation or hazard danger)
83
93
std::vector<unsignedshort> sub_frames;// a list of frames to play on each tick