]> git.lizzy.rs Git - minetest.git/blob - src/tileanimation.h
Remove legacy unused define DIGGING_PARTICLES_AMOUNT
[minetest.git] / src / tileanimation.h
1 /*
2 Minetest
3 Copyright (C) 2016 sfan5 <sfan5@live.de>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef TILEANIMATION_HEADER
21 #define TILEANIMATION_HEADER
22
23 #include <iostream>
24 #include "irrlichttypes_bloated.h"
25
26 enum TileAnimationType
27 {
28         TAT_NONE = 0,
29         TAT_VERTICAL_FRAMES = 1,
30         TAT_SHEET_2D = 2,
31 };
32
33 struct TileAnimationParams
34 {
35         enum TileAnimationType type;
36         union
37         {
38                 // struct {
39                 // } none;
40                 struct
41                 {
42                         int aspect_w; // width for aspect ratio
43                         int aspect_h; // height for aspect ratio
44                         float length; // seconds
45                 } vertical_frames;
46                 struct
47                 {
48                         int frames_w;       // number of frames left-to-right
49                         int frames_h;       // number of frames top-to-bottom
50                         float frame_length; // seconds
51                 } sheet_2d;
52         };
53
54         void serialize(std::ostream &os, u16 protocol_version) const;
55         void deSerialize(std::istream &is, u16 protocol_version);
56         void determineParams(v2u32 texture_size, int *frame_count, int *frame_length_ms,
57                         v2u32 *frame_size) const;
58         void getTextureModifer(std::ostream &os, v2u32 texture_size, int frame) const;
59         v2f getTextureCoords(v2u32 texture_size, int frame) const;
60 };
61
62 #endif