Elaztek Developer Hub
Blamite Game Engine - blam!  00423.10.27.24.0533.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: 7 //
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 
23 
24 #pragma pack(push, 1)
26 {
32  {
34  TAG_BLOCK(parameters,
35  {
36  });
37  int32_t imported_material_index;
38  });
39  //Render Geometry
40  /*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.*/
41  TAG_BLOCK(errors,
42  {
43  TAG_ENUM8(report_type,
44  {
45  comment,
46  warning,
47  error,
48  });
49 
51  data_reference text;
52  });
53  TAG_BLOCK(meshes,
54  {
57  int32_t material_index;
58  data_reference vertex_data;
59  data_reference triangles_data;
60  int8_t vertex_color_channels;
61  int8_t uv_channels;
62  //Axis-Aligned Bounding Box (AABB) Extents
63 
64  vector3 extents_min;
65  vector3 extents_max;
66  });
67  TAG_BLOCK(import_info,
68  {
69  int64_t source_filesize;
70  data_reference source_filename;
71  data_reference source_file_format;
72  });
73 };
74 #pragma pack(pop)
75 
77 {
78 public:
80  {
81  class_name_long = "render_model";
82  class_name_short = "mode";
83  version = 7;
84 
85  revisions = {
86  {1, "haloman30", "Initial implementation."},
87  {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"},
88  {3, "haloman30", "* Added flags bitfield and material index to meshes block"},
89  {4, "haloman30", "* Added a couple comments\n\n * Added AABB min/max vectors to meshes block"},
90  {5, "haloman30", "* Removed UVs block, as UV data is now stored with vertex data\n\n * Added vertex color/UV channels fields"},
91  {6, "haloman30", "* Added tangents/bitangents datarefs to meshes block"},
92  {7, "haloman30", "* Added support for default scale modifier"},
93 
94  };
95 
96  tag_size = 178;
97 
98  fields =
99  {
100  new DataReferenceField("name", "The name of the model"),
101  new Bitfield16Field("flags", "",
102  {
103  "use bounding sphere instead of combined aabb",
104  "automatically generate bounds at runtime",
105  "add padding to bounding box",
106  "infinite bounds",
107  }),
108  new RealField("bounding sphere radius", ""),
109  new Vector3Field("default scale modifier", ""),
110  new BlockField(68, "materials", "",
111  {
112  new TagReferenceField("material", "", { "mat"}),
113  new BlockField(0, "parameters", "",
114  {
115  }),
116  new Int32Field("imported material index", ""),
117  }),
118  new CommentField("Render Geometry",
119  "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."),
120  new BlockField(35, "errors", "",
121  {
122  new Enum8Field("report type", "",
123  {
124  "comment",
125  "warning",
126  "error",
127  }),
128  new Bitfield16Field("flags", "",
129  {
130  "rendered",
131  }),
132  new DataReferenceField("text", ""),
133  }),
134  new BlockField(128, "meshes", "",
135  {
136  new DataReferenceField("name", ""),
137  new Bitfield16Field("flags", "",
138  {
139  "uses 32-bit indices",
140  "has normals",
141  "has tangents",
142  }),
143  new Int32Field("material index", ""),
144  new DataReferenceField("vertex data", ""),
145  new DataReferenceField("triangles data", ""),
146  new Int8Field("vertex color channels", ""),
147  new Int8Field("uv channels", ""),
148  new CommentField("Axis-Aligned Bounding Box (AABB) Extents",
149  ""),
150  new Vector3Field("extents min", ""),
151  new Vector3Field("extents max", ""),
152  }),
153  new BlockField(72, "import info", "",
154  {
155  new Int64Field("source filesize", ""),
156  new DataReferenceField("source filename", ""),
157  new DataReferenceField("source file format", ""),
158  }),
159 
160  };
161  }
162 };
163 
164 namespace Blam::Content::Tags
165 {
166  BLAM render_model* GetRenderModelTag(std::string tag_path);
167 }
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:197
RealField
Class representing a real tag field.
Definition: real.h:16
render_model
Definition: render_model.h:25
vector3
BlamVector3 vector3
Typedef for a vector3 field, used in tag definitions.
Definition: tags.h:426
render_model::bounding_sphere_radius
real bounding_sphere_radius
Definition: render_model.h:29
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
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
Blam::API::v1::Tags::GetTagData
BLAM_EXT_API BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: api.cpp:197
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:200
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:199
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:197
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tags.h:198
tag_reference
Structure representing a tag reference.
Definition: tags.h:277
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:196
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:52
TAG_ENUM8
#define TAG_ENUM8(name,...)
Macro used to aid in the creation of enums within tag structures.
Definition: tags.h:56
real
float real
Typedef for a 'real', aka a float.
Definition: tags.h:424
render_model::name
data_reference name
The name of the model.
Definition: render_model.h:27
BLAM
#define BLAM
Definition: render_model.h:19
RenderModelTagClass::RenderModelTagClass
RenderModelTagClass()
Definition: render_model.h:79
Enum8Field
Definition: enum.h:34
render_model::TAG_BLOCK
TAG_BLOCK(materials, { tag_reference material;TAG_BLOCK(parameters, { });int32_t imported_material_index;})
Int32Field
Class representing an int32 tag field.
Definition: int.h:46
bitfield16
Typedef for a bitfield16 field, used in tag data definitions.
Definition: tags.h:359
data_reference
Structure representing a data reference.
Definition: tags.h:323
BlamTagClass::tag_size
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tags.h:201
render_model::flags
bitfield16 flags
Definition: render_model.h:28
BlamTagData::address
void * address
The address pointing to the start of the tag's data.
Definition: tags.h:130
tags.h
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:124
RenderModelTagClass
Definition: render_model.h:76
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:193
api.h
render_model::default_scale_modifier
vector3 default_scale_modifier
Definition: render_model.h:30
Blam::Content::Tags::GetRenderModelTag
BLAM render_model * GetRenderModelTag(std::string tag_path)
Definition: render_model.cpp:16