12
12
13
13
#include < utils/BinarySerialisation.h>
14
14
15
- #include " PackFile.h"
16
-
17
15
// TODO - Remove this hard-coded value and support various texture channel sizes
18
16
#define TEXTURE2D_TEXTURE_CHANNELS 4
19
17
20
18
namespace Siege
21
19
{
22
20
23
- struct Texture2DData : BinarySerialisation::BinarySerialisable
21
+ struct Texture2DData
24
22
{
25
23
int32_t texWidth = 0 ;
26
24
int32_t texHeight = 0 ;
@@ -29,19 +27,23 @@ struct Texture2DData : BinarySerialisation::BinarySerialisable
29
27
30
28
uint64_t GetImageSize () const
31
29
{
32
- return texWidth * texHeight * TEXTURE2D_TEXTURE_CHANNELS;
33
- }
34
-
35
- void serialise (BinarySerialisation::Buffer& buffer,
36
- BinarySerialisation::SerialisationMode mode) override
37
- {
38
- BinarySerialisation::serialise (buffer, texWidth, mode);
39
- BinarySerialisation::serialise (buffer, texHeight, mode);
40
- BinarySerialisation::serialise (buffer, texChannels, mode);
41
- BinarySerialisation::serialise (buffer, pixels, mode);
30
+ return texWidth * texHeight * texChannels;
42
31
}
43
32
};
44
33
34
+ namespace BinarySerialisation
35
+ {
36
+
37
+ inline void serialise (Buffer& buffer, Texture2DData& value, SerialisationMode mode)
38
+ {
39
+ serialise (buffer, value.texWidth , mode);
40
+ serialise (buffer, value.texHeight , mode);
41
+ serialise (buffer, value.texChannels , mode);
42
+ serialise (buffer, value.pixels , mode);
43
+ }
44
+
45
+ } // namespace BinarySerialisation
46
+
45
47
} // namespace Siege
46
48
47
49
#endif // SIEGE_ENGINE_TEXTURE2DDATA_H
0 commit comments