|
@@ -2,8 +2,7 @@
|
|
Open Asset Import Library (assimp)
|
|
Open Asset Import Library (assimp)
|
|
----------------------------------------------------------------------
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
-Copyright (c) 2006-2019, assimp team
|
|
|
|
-
|
|
|
|
|
|
+Copyright (c) 2006-2020, assimp team
|
|
|
|
|
|
All rights reserved.
|
|
All rights reserved.
|
|
|
|
|
|
@@ -47,118 +46,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
#define INCLUDED_AI_3D_LOADER_H
|
|
#define INCLUDED_AI_3D_LOADER_H
|
|
|
|
|
|
#include <assimp/BaseImporter.h>
|
|
#include <assimp/BaseImporter.h>
|
|
-#include <stdint.h>
|
|
|
|
-
|
|
|
|
-namespace Assimp {
|
|
|
|
-namespace Unreal {
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- 0 = Normal one-sided
|
|
|
|
- 1 = Normal two-sided
|
|
|
|
- 2 = Translucent two-sided
|
|
|
|
- 3 = Masked two-sided
|
|
|
|
- 4 = Modulation blended two-sided
|
|
|
|
- 8 = Placeholder triangle for weapon positioning (invisible)
|
|
|
|
- */
|
|
|
|
-enum MeshFlags {
|
|
|
|
- MF_NORMAL_OS = 0,
|
|
|
|
- MF_NORMAL_TS = 1,
|
|
|
|
- MF_NORMAL_TRANS_TS = 2,
|
|
|
|
- MF_NORMAL_MASKED_TS = 3,
|
|
|
|
- MF_NORMAL_MOD_TS = 4,
|
|
|
|
- MF_WEAPON_PLACEHOLDER = 8
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
- // a single triangle
|
|
|
|
-struct Triangle {
|
|
|
|
- uint16_t mVertex[3]; // Vertex indices
|
|
|
|
- char mType; // James' Mesh Type
|
|
|
|
- char mColor; // Color for flat and Gourand Shaded
|
|
|
|
- unsigned char mTex[3][2]; // Texture UV coordinates
|
|
|
|
- unsigned char mTextureNum; // Source texture offset
|
|
|
|
- char mFlags; // Unreal Mesh Flags (unused)
|
|
|
|
-
|
|
|
|
- unsigned int matIndex;
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-// temporary representation for a material
|
|
|
|
-struct TempMat {
|
|
|
|
- TempMat()
|
|
|
|
- : type()
|
|
|
|
- , tex()
|
|
|
|
- , numFaces (0)
|
|
|
|
- {}
|
|
|
|
-
|
|
|
|
- explicit TempMat(const Triangle& in)
|
|
|
|
- : type ((Unreal::MeshFlags)in.mType)
|
|
|
|
- , tex (in.mTextureNum)
|
|
|
|
- , numFaces (0)
|
|
|
|
- {}
|
|
|
|
-
|
|
|
|
- // type of mesh
|
|
|
|
- Unreal::MeshFlags type;
|
|
|
|
-
|
|
|
|
- // index of texture
|
|
|
|
- unsigned int tex;
|
|
|
|
-
|
|
|
|
- // number of faces using us
|
|
|
|
- unsigned int numFaces;
|
|
|
|
-
|
|
|
|
- // for std::find
|
|
|
|
- bool operator == (const TempMat& o ) {
|
|
|
|
- return (tex == o.tex && type == o.type);
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-struct Vertex
|
|
|
|
-{
|
|
|
|
- int32_t X : 11;
|
|
|
|
- int32_t Y : 11;
|
|
|
|
- int32_t Z : 10;
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
- // UNREAL vertex compression
|
|
|
|
-inline void CompressVertex(const aiVector3D& v, uint32_t& out)
|
|
|
|
-{
|
|
|
|
- union {
|
|
|
|
- Vertex n;
|
|
|
|
- int32_t t;
|
|
|
|
- };
|
|
|
|
- n.X = (int32_t)v.x;
|
|
|
|
- n.Y = (int32_t)v.y;
|
|
|
|
- n.Z = (int32_t)v.z;
|
|
|
|
- ::memcpy( &out, &t, sizeof(int32_t));
|
|
|
|
- //out = t;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
- // UNREAL vertex decompression
|
|
|
|
-inline void DecompressVertex(aiVector3D& v, int32_t in)
|
|
|
|
-{
|
|
|
|
- union {
|
|
|
|
- Vertex n;
|
|
|
|
- int32_t i;
|
|
|
|
- };
|
|
|
|
- i = in;
|
|
|
|
-
|
|
|
|
- v.x = (float)n.X;
|
|
|
|
- v.y = (float)n.Y;
|
|
|
|
- v.z = (float)n.Z;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-} // end namespace Unreal
|
|
|
|
|
|
+
|
|
|
|
+namespace Assimp {
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
/** @brief Importer class to load UNREAL files (*.3d)
|
|
/** @brief Importer class to load UNREAL files (*.3d)
|
|
*/
|
|
*/
|
|
-class UnrealImporter : public BaseImporter
|
|
|
|
-{
|
|
|
|
|
|
+class UnrealImporter : public BaseImporter {
|
|
public:
|
|
public:
|
|
UnrealImporter();
|
|
UnrealImporter();
|
|
~UnrealImporter();
|
|
~UnrealImporter();
|
|
|
|
|
|
-
|
|
|
|
-public:
|
|
|
|
-
|
|
|
|
// -------------------------------------------------------------------
|
|
// -------------------------------------------------------------------
|
|
/** @brief Returns whether we can handle the format of the given file
|
|
/** @brief Returns whether we can handle the format of the given file
|
|
*
|
|
*
|
|
@@ -184,7 +82,6 @@ protected:
|
|
*/
|
|
*/
|
|
void SetupProperties(const Importer* pImp);
|
|
void SetupProperties(const Importer* pImp);
|
|
|
|
|
|
-
|
|
|
|
// -------------------------------------------------------------------
|
|
// -------------------------------------------------------------------
|
|
/** @brief Imports the given file into the given scene structure.
|
|
/** @brief Imports the given file into the given scene structure.
|
|
*
|
|
*
|
|
@@ -204,4 +101,5 @@ private:
|
|
}; // !class UnrealImporter
|
|
}; // !class UnrealImporter
|
|
|
|
|
|
} // end of namespace Assimp
|
|
} // end of namespace Assimp
|
|
|
|
+
|
|
#endif // AI_UNREALIMPORTER_H_INC
|
|
#endif // AI_UNREALIMPORTER_H_INC
|