7 #include <unordered_map>
24 using std::unordered_map;
50 const vector<uint8_t>*
data;
89 ((
static_cast<int32_t
>(
readByte()) & 0xFF) << 24) +
90 ((
static_cast<int32_t
>(
readByte()) & 0xFF) << 16) +
91 ((
static_cast<int32_t
>(
readByte()) & 0xFF) << 8) +
92 ((
static_cast<int32_t
>(
readByte()) & 0xFF) << 0);
103 ((
static_cast<int32_t
>(
readByte()) & 0xFF) << 24) +
104 ((
static_cast<int32_t
>(
readByte()) & 0xFF) << 16) +
105 ((
static_cast<int32_t
>(
readByte()) & 0xFF) << 8) +
106 ((
static_cast<int32_t
>(
readByte()) & 0xFF) << 0);
107 float* floatValue = (
float*)&value;
122 for (
auto i = 0; i < l; i++) {
136 if (length !=
data.size()) {
139 for (
auto i = 0; i <
data.size(); i++) {
151 if (length !=
data.size()) {
154 for (
auto i = 0; i <
data.size(); i++) {
166 if (length !=
data.size()) {
169 for (
auto i = 0; i <
data.size(); i++) {
181 if (length !=
data.size()) {
184 for (
auto i = 0; i <
data.size(); i++) {
196 if (length !=
data.size()) {
199 for (
auto i = 0; i <
data.size(); i++) {
212 for (
auto i = 0; i < f.size(); i++) {
242 static Model*
read(
const string& pathName,
const string& fileName,
bool useBC7TextureCompression =
true);
253 static Model*
read(
const vector<uint8_t>& data,
const string& pathName =
string(),
const string& fileName =
string(),
bool useBC7TextureCompression =
true);
262 static const string getTexturePath(
const string& modelPathName,
const string& texturePathName,
const string& textureFileName);
271 auto embeddedTextureIt = embeddedTextures.find(fileName);
272 if (embeddedTextureIt == embeddedTextures.end())
return nullptr;
273 auto embeddedTexture = embeddedTextureIt->second;
275 return embeddedTexture;
static void readSubNodes(TMReaderInputStream *is, Model *model, Node *parentNode, unordered_map< string, Node * > &subNodes)
Read sub nodes.
static Joint readSkinningJoint(TMReaderInputStream *is)
Read skinning joint.
static Material * readMaterial(const string &pathName, TMReaderInputStream *is, Model *model, const unordered_map< string, Texture * > &embeddedTextures, bool useBC7TextureCompression, const array< uint8_t, 3 > &version)
Read material.
static const string getTexturePath(const string &modelPathName, const string &texturePathName, const string &textureFileName)
Get texture path.
static const vector< Vector3 > readVertices(TMReaderInputStream *is)
Read vertices from input stream.
static const vector< Vector2 > readTextureCoordinates(TMReaderInputStream *is)
Read texture coordinates from input stream.
static Animation * readAnimation(TMReaderInputStream *is, Node *g)
Read animation from input stream into node.
static void readFacesEntities(TMReaderInputStream *is, Node *g)
Read faces entities from input stream.
static void readAnimationSetup(TMReaderInputStream *is, Model *model, const array< uint8_t, 3 > &version)
Read animation setup.
static void readSkinning(TMReaderInputStream *is, Node *g)
Read skinning from input stream.
static bool readIndices(TMReaderInputStream *is, array< int32_t, 3 > *indices)
Read indices from input stream.
static void readEmbeddedTextures(TMReaderInputStream *is, unordered_map< string, Texture * > &embeddedTextures, const array< uint8_t, 3 > &version)
Read material.
static JointWeight readSkinningJointWeight(TMReaderInputStream *is)
Read skinning joint weight.
static Texture * getEmbeddedTexture(const unordered_map< string, Texture * > &embeddedTextures, const string &fileName)
Read material.
static Model * read(const string &pathName, const string &fileName, bool useBC7TextureCompression=true)
TDME model format reader.
static Node * readNode(TMReaderInputStream *is, Model *model, Node *parentNode)
Write node to output stream.
Representation of a 3D model.
Vector2 class representing vector2 mathematical structure and operations with x, y components.
Vector3 class representing vector3 mathematical structure and operations with x, y,...
virtual void acquireReference()
Acquires a reference, incrementing the counter.