Elaztek Developer Hub
Blamite Game Engine - blam!  00368.02.12.23.1347.blamite
The core library for the Blamite Game Engine.
bitmap.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #ifndef BLAM
7 #define BLAM
8 #endif
9 
11 {
16 };
17 
18 #pragma pack(push, 1)
19 
27 struct bitmap
28 {
32 
34 
35  TAG_ENUM(format,
36  {
37  BF_RGBA8_UNORM,
38  BF_UNUSED
39  });
40 
44 
45  TAG_BLOCK(import_info,
46  {
47  int64_t source_filesize;
48  ascii source_filename;
49  ascii source_file_format;
50  ascii source_pixel_format;
51  ascii parsed_pixel_format;
52  });
53 };
54 #pragma pack(pop)
55 
57 {
58 public:
60  {
61  class_name_long = "bitmap";
62  class_name_short = "bitm";
63  version = 5;
64 
65  revisions = {
66  {1, "haloman30", "Initial implementation."},
67  {2, "haloman30", "Add test datarefs and tagrefs"},
68  {3, "haloman30", "Remove all test fields, actual initial implementation"},
69  {4, "haloman30", "Add multiple filtering enums for min, mag, mip, and allow bitmap filter mode to override material filter mode"},
70  {5, "haloman30", "Add support for RGBA8_UNORM pixel formats, move format_temp to import info block as parsed_pixel_format"}
71  };
72 
73  tag_size = sizeof(bitmap);
74 
75  fields =
76  {
77  new CommentField("filtering modes",
78  "The texture filtering mode adjusts how the bitmap is displayed in-game. Below is a list of all filtering modes and their ideal use cases."
79  "\r\n\r\n"
80  "* Point - Minimal filtering mode that preserves sharp edges. Ideal for pixel art or other similar cases."
81  "\r\n"
82  "* Linear - Balanced filtering mode that will attempt to blend pixels together to avoid a pixelated appearance, with a "
83  "minimal performance impact. Ideal for most situations."
84  "\r\n"
85  "* Anisotropic - Best filtering mode. Performs the poorest but gives the best possible image quality."
86  "\r\n"
87  "* None - No filtering is applied. Will often be identical to Point filtering."),
88  new Enum32Field("filtering mode (min)", "The texture filtering mode for minification. See comment above for details.",
89  {
90  "point",
91  "linear",
92  "anisotropic",
93  "none"
94  }),
95  new Enum32Field("filtering mode (mag)", "The texture filtering mode for magnification. See comment above for details.",
96  {
97  "point",
98  "linear",
99  "anisotropic",
100  "none"
101  }),
102  new Enum32Field("filtering mode (mip)", "The texture filtering mode for mip-mapping. See comment above for details.",
103  {
104  "point",
105  "linear",
106  "anisotropic",
107  "none"
108  }),
109  new Bitfield8Field("flags", "",
110  {
111  "force mip filtering mode",
112  "force min filtering mode",
113  "force mag filtering mode"
114  }),
115 
116  new CommentField("BITMAP DATA",
117  "***************************************************************************************************************************"
118  "\r\n\r\n"
119  "The fields below contain the raw bitmap data. It is updated when you reimport the bitmap."
120  "\r\n\r\n"
121  "Any changes you make below will be lost in the next import, and may even cause 'bad things' to happen - such as invalid "
122  "textures or crashes."
123  "\r\n\r\n"
124  "If you wish to make any changes to a bitmap, you should simply re-import the image from its source. If the source image file"
125  "has been lost, consult the documentation for methods to export a bitmap tag back into a source image file."
126  "\r\n\r\n"
127  "***************************************************************************************************************************"),
128 
129  new Enum32Field("format", "The pixel format of the bitmap data.",
130  {
131  "RGBA8_UNORM",
132  "UNUSED"
133  }),
134  new DataReferenceField("pixel data", "The raw pixel data for the bitmap."),
135  new Vector2Field("size", "The resolution of the bitmap.", "[w,h]"),
136  new Int16Field("bytes per line", "The amount of bytes needed for a single line/row of pixels for this bitmap."),
137  new BlockField(sizeof(bitmap::import_info_entry), "import info", "",
138  {
139  new CommentField("IMPORT INFO", "The fields listed below refer to data from the originally imported file, and "
140  "are not used by the engine directly."),
141  new Int64Field("source filesize", "The file size of the original image, in bytes."),
142  new AsciiField("source filename", "The file name (or file path) of the original image."),
143  new AsciiField("source file format", "The format of the original image."),
144  new AsciiField("source pixel format", "The original pixel format of the source image."),
145  new AsciiField("parsed pixel format", "The pixel format of the interpreted image data during import."),
146  })
147  };
148  }
149 };
150 
152 {
153  BLAM bitmap* GetBitmapTag(std::string tag_path);
154 }
Int16Field
Class representing an int16 tag field.
Definition: int.h:53
ascii
char ascii[128]
Typedef for an ascii field, used in tag data definitions.
Definition: tags.h:313
vector2
BlamVector2 vector2
Typedef for a vector2 field, used in tag definitions.
Definition: tags.h:316
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:151
bitm_filter_none
@ bitm_filter_none
Definition: bitmap.h:15
AsciiField
Class representing an ascii tag field.
Definition: ascii.h:12
Vector2Field
Class representing a vector2 tag field.
Definition: vector.h:28
DataReferenceField
Class representing a data reference, or dataref for short.
Definition: dataref.h:14
BitmapTagClass::BitmapTagClass
BitmapTagClass()
Definition: bitmap.h:59
bitmap::TAG_ENUM
TAG_ENUM(format, { BF_RGBA8_UNORM, BF_UNUSED })
int16_t
signed short int16_t
Definition: stdint.h:122
bitmap::bytes_per_line
int16_t bytes_per_line
Definition: bitmap.h:43
bitmap::TAG_BLOCK
TAG_BLOCK(import_info, { int64_t source_filesize;ascii source_filename;ascii source_file_format;ascii source_pixel_format;ascii parsed_pixel_format;})
Enum32Field
Definition: enum.h:40
bitfield8
Typedef for a bitfield8 field, used in tag data definitions.
Definition: tags.h:235
bitm_filter_point
@ bitm_filter_point
Definition: bitmap.h:12
BlamTagClass::revisions
std::vector< BlamTagClassRevision > revisions
List of all tag class revisions. Does not get written to tags, but is included in plugin files.
Definition: tagclass.h:49
bitmap::size
vector2 size
Definition: bitmap.h:42
bitm_filter_linear
@ bitm_filter_linear
Definition: bitmap.h:13
BlamTagClass::class_name_short
std::string class_name_short
The short, 4-character name of the tag class.
Definition: tagclass.h:47
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tagclass.h:48
BlamTagClass::class_name_long
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tagclass.h:46
Int64Field
Class representing an int64 tag field.
Definition: int.h:27
bitmap::filter_mode_mip
bitmap_filtering_mode filter_mode_mip
Definition: bitmap.h:31
Blam::Content::Tags::GetBitmapTag
BLAM bitmap * GetBitmapTag(std::string tag_path)
Definition: bitmap.cpp:5
int64_t
signed __int64 int64_t
Definition: stdint.h:135
bitm_filter_anisotropic
@ bitm_filter_anisotropic
Definition: bitmap.h:14
bitmap::filter_mode_min
bitmap_filtering_mode filter_mode_min
Definition: bitmap.h:29
fields.h
bitmap::pixel_data
data_reference pixel_data
Definition: bitmap.h:41
BLAM
#define BLAM
Definition: bitmap.h:7
bitmap::flags
bitfield8 flags
Definition: bitmap.h:33
bitmap_filtering_mode
bitmap_filtering_mode
Definition: bitmap.h:10
data_reference
Structure representing a data reference.
Definition: tags.h:208
bitmap::filter_mode_mag
bitmap_filtering_mode filter_mode_mag
Definition: bitmap.h:30
BlamTagClass::tag_size
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tagclass.h:53
bitmap
Structure representing a Bitmap tag.
Definition: bitmap.h:27
tagclass.h
CommentField
Class representing a comment field.
Definition: comment.h:23
BlockField
Class representing a tag block field, also sometimes referred to as a struct or reflexive in the modd...
Definition: block.h:13
BlamTagClass
Class representing a tag class.
Definition: tagclass.h:43
BlamTagClass::fields
std::vector< BlamPluginField * > fields
A series of tag fields that store the layout of the tag.
Definition: tagclass.h:51
BitmapTagClass
Definition: bitmap.h:56
Bitfield8Field
Class representing a bitfield8 tag field.
Definition: bitfield.h:27