Elaztek Developer Hub
Blamite Game Engine - blam!  00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
render_model.h
Go to the documentation of this file.
1 // render_model [mode] - Tag Definition //
3 // -------- //
4 // Author: haloman30 //
5 // Revision: 8 //
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 
22 #define tag_mode "mode"
23 
24 
25 
26 #pragma pack(push, 1)
28 {
31  {
34  bool pad_bounding_box : 1;
35  bool infinite_bounds : 1;
36  bool unused4 : 1;
37  bool unused5 : 1;
38  bool unused6 : 1;
39  bool unused7 : 1;
40  bool unused8 : 1;
41  bool unused9 : 1;
42  bool unused10 : 1;
43  bool unused11 : 1;
44  bool unused12 : 1;
45  bool unused13 : 1;
46  bool unused14 : 1;
47  bool unused15 : 1;
48  };
49 
54  {
56  TAG_BLOCK(parameters,
57  {
58  });
59  int32_t imported_material_index;
60  });
61  TAG_BLOCK(errors,
62  {
63  TAG_ENUM8(report_type,
64  {
65  comment,
66  warning,
67  error,
68  });
69 
70  struct bitfield16_flags
71  {
72  bool rendered : 1;
73  bool unused1 : 1;
74  bool unused2 : 1;
75  bool unused3 : 1;
76  bool unused4 : 1;
77  bool unused5 : 1;
78  bool unused6 : 1;
79  bool unused7 : 1;
80  bool unused8 : 1;
81  bool unused9 : 1;
82  bool unused10 : 1;
83  bool unused11 : 1;
84  bool unused12 : 1;
85  bool unused13 : 1;
86  bool unused14 : 1;
87  bool unused15 : 1;
88  };
89 
90  bitfield16_flags flags;
91  data_reference text;
92  });
93  TAG_BLOCK(meshes,
94  {
96  struct bitfield16_flags
97  {
98  bool uses_32_bit_indices : 1;
99  bool has_normals : 1;
100  bool has_tangents : 1;
101  bool unused3 : 1;
102  bool unused4 : 1;
103  bool unused5 : 1;
104  bool unused6 : 1;
105  bool unused7 : 1;
106  bool unused8 : 1;
107  bool unused9 : 1;
108  bool unused10 : 1;
109  bool unused11 : 1;
110  bool unused12 : 1;
111  bool unused13 : 1;
112  bool unused14 : 1;
113  bool unused15 : 1;
114  };
115 
116  bitfield16_flags flags;
117  int32_t material_index;
118  data_reference vertex_data;
119  data_reference triangles_data;
120  int8_t vertex_color_channels;
121  int8_t uv_channels;
122  vector3 extents_min;
123  vector3 extents_max;
124  });
125  TAG_BLOCK(import_info,
126  {
127  int64_t source_filesize;
128  data_reference source_filename;
129  data_reference source_file_format;
130  });
131 };
132 #pragma pack(pop)
133 
135 {
136 public:
138  {
139  class_name_long = "render_model";
140  class_name_short = "mode";
141  version = 8;
142 
143  revisions = {
144  {1, "haloman30", "Initial implementation."},
145  {2, "haloman30", "Vertex data, triangle data, and texture coordinates are now stored as datarefs instead of tag blocks - in order to reduce filesize of decompiled tags"},
146  {3, "haloman30", "* Added flags bitfield and material index to meshes block"},
147  {4, "haloman30", "* Added a couple comments\n\n * Added AABB min/max vectors to meshes block"},
148  {5, "haloman30", "* Removed UVs block, as UV data is now stored with vertex data\n\n * Added vertex color/UV channels fields"},
149  {6, "haloman30", "* Added tangents/bitangents datarefs to meshes block"},
150  {7, "haloman30", "* Added support for default scale modifier"},
151  {8, "haloman30", "* Add support for shader [rmsh] tags"},
152 
153  };
154 
155  tag_size = 178;
156 
157  fields =
158  {
159  new DataReferenceField("name", "The name of the model"),
160  new Bitfield16Field("flags", "",
161  {
162  "use bounding sphere instead of combined aabb",
163  "automatically generate bounds at runtime",
164  "add padding to bounding box",
165  "infinite bounds",
166  }),
167  new RealField("bounding sphere radius", ""),
168  new Vector3Field("default scale modifier", ""),
169  new BlockField(68, "materials", "",
170  {
171  new TagReferenceField("material", "", { "mat""rmsh""rmsp"}),
172  new BlockField(0, "parameters", "",
173  {
174  }),
175  new Int32Field("imported material index", ""),
176  }),
177  new CommentField("Render Geometry",
178  "All fields below should not be modified directly. This data is automatically updated when importing (or re-importing) a 3D model. As such, any changes made will be lost if the model is re-imported."),
179  new BlockField(35, "errors", "",
180  {
181  new Enum8Field("report type", "",
182  {
183  "comment",
184  "warning",
185  "error",
186  }),
187  new Bitfield16Field("flags", "",
188  {
189  "rendered",
190  }),
191  new DataReferenceField("text", ""),
192  }),
193  new BlockField(128, "meshes", "",
194  {
195  new DataReferenceField("name", ""),
196  new Bitfield16Field("flags", "",
197  {
198  "uses 32-bit indices",
199  "has normals",
200  "has tangents",
201  }),
202  new Int32Field("material index", ""),
203  new DataReferenceField("vertex data", ""),
204  new DataReferenceField("triangles data", ""),
205  new Int8Field("vertex color channels", ""),
206  new Int8Field("uv channels", ""),
207  new CommentField("Axis-Aligned Bounding Box (AABB) Extents",
208  ""),
209  new Vector3Field("extents min", ""),
210  new Vector3Field("extents max", ""),
211  }),
212  new BlockField(72, "import info", "",
213  {
214  new Int64Field("source filesize", ""),
215  new DataReferenceField("source filename", ""),
216  new DataReferenceField("source file format", ""),
217  }),
218 
219  };
220  }
221 };
222 
223 namespace Blam::Content::Tags
224 {
225  BLAM render_model* GetRenderModelTag(std::string tag_path);
226 }
render_model::bitfield16_flags::unused9
bool unused9
Definition: render_model.h:41
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:181
RealField
Class representing a real tag field.
Definition: real.h:16
render_model::bitfield16_flags::unused14
bool unused14
Definition: render_model.h:46
render_model
Definition: render_model.h:27
vector3
BlamVector3 vector3
Typedef for a vector3 field, used in tag definitions.
Definition: tags.h:445
render_model::bounding_sphere_radius
real bounding_sphere_radius
Definition: render_model.h:51
DataReferenceField
Class representing a data reference, or dataref for short.
Definition: dataref.h:19
Vector3Field
Class representing a vector3 tag field.
Definition: vector.h:47
render_model.h
render_model::bitfield16_flags::unused15
bool unused15
Definition: render_model.h:47
Bitfield16Field
Class representing a bitfield16 tag field.
Definition: bitfield.h:44
TagReferenceField
Class representing a tag reference, or tagref for short.
Definition: tagref.h:20
render_model::flags
bitfield16_flags flags
Bitfield data for flags. See #bitfield16_flags for details.
Definition: render_model.h:50
Blam::API::v1::Tags::GetTagData
BLAM_EXT_API BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: api.cpp:208
int8_t
signed char int8_t
Definition: stdint.h:11
BlamTagClass::fields
std::vector< BlamTagClassField * > fields
A series of tag fields that store the layout of the tag.
Definition: tags.h:209
render_model::bitfield16_flags::unused11
bool unused11
Definition: render_model.h:43
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:208
render_model::bitfield16_flags::auto_generate_bounds
bool auto_generate_bounds
Definition: render_model.h:33
render_model::bitfield16_flags::use_bounding_sphere
bool use_bounding_sphere
Definition: render_model.h:32
int32_t
int int32_t
Definition: stdint.h:13
plugins.h
Int8Field
Class representing an int8 tag field.
Definition: int.h:72
BlamTagClass::class_name_short
std::string class_name_short
The short, 4-character name of the tag class.
Definition: tags.h:206
render_model::bitfield16_flags::unused8
bool unused8
Definition: render_model.h:40
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tags.h:207
render_model::bitfield16_flags::unused5
bool unused5
Definition: render_model.h:37
render_model::bitfield16_flags::pad_bounding_box
bool pad_bounding_box
Definition: render_model.h:34
tag_reference
Structure representing a tag reference.
Definition: tags.h:289
materials
b output the Images to a print format other than for collateral materials(such as sales literature and illustrations) which support your primary electronic use of the Images. Subject to the foregoing limitations
BlamTagClass::class_name_long
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tags.h:205
int64_t
long long int64_t
Definition: stdint.h:14
Int64Field
Class representing an int64 tag field.
Definition: int.h:33
material
Definition: material.h:54
TAG_ENUM8
#define TAG_ENUM8(name,...)
Macro used to aid in the creation of enums within tag structures.
Definition: tags.h:57
real
float real
Typedef for a 'real', aka a float.
Definition: tags.h:443
render_model::name
data_reference name
The name of the model.
Definition: render_model.h:29
BLAM
#define BLAM
Definition: render_model.h:19
RenderModelTagClass::RenderModelTagClass
RenderModelTagClass()
Definition: render_model.h:137
Enum8Field
Definition: enum.h:33
render_model::TAG_BLOCK
TAG_BLOCK(materials, { tag_reference material;TAG_BLOCK(parameters, { });int32_t imported_material_index;})
render_model::bitfield16_flags::unused7
bool unused7
Definition: render_model.h:39
Int32Field
Class representing an int32 tag field.
Definition: int.h:46
render_model::bitfield16_flags::unused13
bool unused13
Definition: render_model.h:45
data_reference
Structure representing a data reference.
Definition: tags.h:342
render_model::bitfield16_flags::unused4
bool unused4
Definition: render_model.h:36
BlamTagClass::tag_size
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tags.h:210
BlamTagData::address
void * address
The address pointing to the start of the tag's data.
Definition: tags.h:132
tags.h
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:125
render_model::bitfield16_flags
Definition: render_model.h:30
render_model::bitfield16_flags::unused12
bool unused12
Definition: render_model.h:44
render_model::bitfield16_flags::unused10
bool unused10
Definition: render_model.h:42
RenderModelTagClass
Definition: render_model.h:134
render_model::bitfield16_flags::infinite_bounds
bool infinite_bounds
Definition: render_model.h:35
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:202
tag_mode
#define tag_mode
Definition: render_model.h:22
render_model::bitfield16_flags::unused6
bool unused6
Definition: render_model.h:38
api.h
render_model::default_scale_modifier
vector3 default_scale_modifier
Definition: render_model.h:52
BlamTagData::tag_class
std::string tag_class
The tag's short class name.
Definition: tags.h:146
Blam::Content::Tags::GetRenderModelTag
BLAM render_model * GetRenderModelTag(std::string tag_path)
Definition: render_model.cpp:16