Elaztek Developer Hub
Blamite Game Engine - blam!  00406.12.10.23.1457.blamite
The core library for the Blamite Game Engine.
bitmap.h
Go to the documentation of this file.
1 // bitmap [bitm] - Tag Definition //
3 // -------- //
4 // Author: haloman30 //
5 // Revision: 5 //
6 // -------- //
7 // Part of the Blamite Game Engine //
8 // Copyright (c) Elaztek Studios 2013 - 2023 //
10 
11 
12 #pragma once
13 
14 #include <string>
15 #include <blam/api/v1/types/tags.h>
17 
18 #ifndef BLAM
19 #define BLAM
20 #endif
21 
23 {
24  point,
25  linear,
27  none,
28 };
29 
30 
31 #pragma pack(push, 1)
32 struct bitmap
33 {
34  //filtering modes
35  /*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.
36 
37 
38 
39  * Point - Minimal filtering mode that preserves sharp edges. Ideal for pixel art or other similar cases.
40 
41  * Linear - Balanced filtering mode that will attempt to blend pixels together to avoid a pixelated appearance, with a minimal performance impact. Ideal for most situations.
42 
43  * Anisotropic - Best filtering mode. Performs the poorest but gives the best possible image quality.
44 
45  * None - No filtering is applied. Will often be identical to Point filtering.*/
50  //BITMAP DATA
51 
72  {
73  BF_RGBA8_UNORM,
74  BF_UNUSED,
75  });
76 
80  TAG_BLOCK(import_info,
81  {
82  //IMPORT INFO
83  /*The fields listed below refer to data from the originally imported file, and are not used by the engine directly.*/
84  int64_t source_filesize;
85  ascii source_filename;
86  ascii source_file_format;
87  ascii source_pixel_format;
88  ascii parsed_pixel_format;
89  });
90 };
91 #pragma pack(pop)
92 
94 {
95 public:
97  {
98  class_name_long = "bitmap";
99  class_name_short = "bitm";
100  version = 5;
101 
102  revisions = {
103  {1, "haloman30", "Initial implementation."},
104  {2, "haloman30", "Add test datarefs and tagrefs"},
105  {3, "haloman30", "Remove all test fields, actual initial implementation"},
106  {4, "haloman30", "Add multiple filtering enums for min, mag, mip, and allow bitmap filter mode to override material filter mode"},
107  {5, "haloman30", "Add support for RGBA8_UNORM pixel formats, move format_temp to import info block as parsed_pixel_format"},
108 
109  };
110 
111  tag_size = 91;
112 
113  fields =
114  {
115  new CommentField("filtering modes",
116  "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.\n"
117  "\n"
118  "\n"
119  "\n"
120  "* Point - Minimal filtering mode that preserves sharp edges. Ideal for pixel art or other similar cases.\n"
121  "\n"
122  "* Linear - Balanced filtering mode that will attempt to blend pixels together to avoid a pixelated appearance, with a minimal performance impact. Ideal for most situations.\n"
123  "\n"
124  "* Anisotropic - Best filtering mode. Performs the poorest but gives the best possible image quality.\n"
125  "\n"
126  "* None - No filtering is applied. Will often be identical to Point filtering."),
127  new Enum32Field("filtering mode (min)", "The texture filtering mode for minification. See comment above for details.",
128  {
129  "point",
130  "linear",
131  "anisotropic",
132  "none",
133  }),
134  new Enum32Field("filtering mode (mag)", "The texture filtering mode for magnification. See comment above for details.",
135  {
136  "point",
137  "linear",
138  "anisotropic",
139  "none",
140  }),
141  new Enum32Field("filtering mode (mip)", "The texture filtering mode for mip-mapping. See comment above for details.",
142  {
143  "point",
144  "linear",
145  "anisotropic",
146  "none",
147  }),
148  new Bitfield8Field("flags", "",
149  {
150  "force mip filtering mode",
151  "force min filtering mode",
152  "force mag filtering mode",
153  }),
154  new CommentField("BITMAP DATA",
155  "***************************************************************************************************************************\n"
156  "\n"
157  "\n"
158  "\n"
159  "The fields below contain the raw bitmap data. It is updated when you reimport the bitmap.\n"
160  "\n"
161  "\n"
162  "\n"
163  "Any changes you make below will be lost in the next import, and may even cause 'bad things' to happen - such as invalid textures or crashes.\n"
164  "\n"
165  "\n"
166  "\n"
167  "If you wish to make any changes to a bitmap, you should simply re-import the image from its source. If the source image filehas been lost, consult the documentation for methods to export a bitmap tag back into a source image file.\n"
168  "\n"
169  "\n"
170  "\n"
171  "***************************************************************************************************************************"),
172  new Enum32Field("format", "The pixel format of the bitmap data.",
173  {
174  "RGBA8_UNORM",
175  "UNUSED",
176  }),
177  new DataReferenceField("pixel data", "The raw pixel data for the bitmap."),
178  new Vector2Field("size", "The resolution of the bitmap."),
179  new Int16Field("bytes per line", "The amount of bytes needed for a single line/row of pixels for this bitmap."),
180  new BlockField(520, "import info", "",
181  {
182  new CommentField("IMPORT INFO",
183  "The fields listed below refer to data from the originally imported file, and are not used by the engine directly."),
184  new Int64Field("source filesize", "The file size of the original image, in bytes."),
185  new AsciiField("source filename", "The file name (or file path) of the original image."),
186  new AsciiField("source file format", "The format of the original image."),
187  new AsciiField("source pixel format", "The original pixel format of the source image."),
188  new AsciiField("parsed pixel format", "The pixel format of the interpreted image data during import."),
189  }),
190 
191  };
192  }
193 };
194 
196 {
197  BLAM bitmap* GetBitmapTag(std::string tag_path);
198 }
Int16Field
Class representing an int16 tag field.
Definition: int.h:59
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:195
bitmap.h
AsciiField
Class representing an ascii tag field.
Definition: ascii.h:18
ascii
char ascii[128]
Typedef for an ascii field, used in tag data definitions.
Definition: tags.h:410
Vector2Field
Class representing a vector2 tag field.
Definition: vector.h:34
DataReferenceField
Class representing a data reference, or dataref for short.
Definition: dataref.h:19
BitmapTagClass::BitmapTagClass
BitmapTagClass()
Definition: bitmap.h:96
bitmap_filtering_mode::point
@ point
bitmap::bytes_per_line
int16_t bytes_per_line
The amount of bytes needed for a single line/row of pixels for this bitmap.
Definition: bitmap.h:79
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:46
Blam::API::v1::Tags::GetTagData
BLAM_EXT_API BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: api.cpp:34
BlamTagClass::fields
std::vector< BlamTagClassField * > fields
A series of tag fields that store the layout of the tag.
Definition: tags.h:195
bitfield8
Typedef for a bitfield8 field, used in tag data definitions.
Definition: tags.h:332
bitmap_filtering_mode::anisotropic
@ anisotropic
bitmap::filtering_mode_mag
bitmap_filtering_mode filtering_mode_mag
Definition: bitmap.h:47
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: tags.h:194
bitmap::size
vector2 size
The resolution of the bitmap.
Definition: bitmap.h:78
plugins.h
format
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying reordering converting format
Definition: ARPHICPL.TXT:16
BlamTagClass::class_name_short
std::string class_name_short
The short, 4-character name of the tag class.
Definition: tags.h:192
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tags.h:193
bitmap::filtering_mode_mip
bitmap_filtering_mode filtering_mode_mip
Definition: bitmap.h:48
BlamTagClass::class_name_long
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tags.h:191
int64_t
long long int64_t
Definition: stdint.h:14
Int64Field
Class representing an int64 tag field.
Definition: int.h:33
uint32_t
unsigned int uint32_t
Definition: stdint.h:17
Blam::Content::Tags::GetBitmapTag
BLAM bitmap * GetBitmapTag(std::string tag_path)
Definition: bitmap.cpp:16
bitmap_filtering_mode::none
@ none
bitmap_filtering_mode::linear
@ linear
bitmap::pixel_data
data_reference pixel_data
The raw pixel data for the bitmap.
Definition: bitmap.h:77
BLAM
#define BLAM
Definition: bitmap.h:19
bitmap::flags
bitfield8 flags
Definition: bitmap.h:49
data_reference
Structure representing a data reference.
Definition: tags.h:318
BlamTagClass::tag_size
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tags.h:196
bitmap_filtering_mode
bitmap_filtering_mode
Definition: bitmap.h:22
vector2
BlamVector2 vector2
Typedef for a vector2 field, used in tag definitions.
Definition: tags.h:413
bitmap
Definition: bitmap.h:32
BlamTagData::address
void * address
The address pointing to the start of the tag's data.
Definition: tags.h:128
tags.h
int16_t
short int16_t
Definition: stdint.h:12
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:125
bitmap::filtering_mode_min
bitmap_filtering_mode filtering_mode_min
Definition: bitmap.h:46
CommentField
Class representing a comment field.
Definition: comment.h:29
BlockField
Class representing a tag block field, also sometimes referred to as a struct or reflexive in the modd...
Definition: block.h:19
BlamTagClass
Class representing a tag class.
Definition: tags.h:188
bitmap::TAG_ENUM
TAG_ENUM(format, { BF_RGBA8_UNORM, BF_UNUSED, })
The fields below contain the raw bitmap data.
BitmapTagClass
Definition: bitmap.h:93
Bitfield8Field
Class representing a bitfield8 tag field.
Definition: bitfield.h:33
api.h