mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
update assimp to 6.0.5
This commit is contained in:
parent
2d2eb57e2e
commit
f5cf21cfeb
941 changed files with 22718 additions and 12240 deletions
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -179,7 +179,8 @@ void AnimResolver::UpdateAnimRangeSetup() {
|
|||
case LWO::PrePostBehaviour_Oscillate: {
|
||||
const double start_time = delta - std::fmod(my_first - first, delta);
|
||||
std::vector<LWO::Key>::iterator n = std::find_if((*it).keys.begin(), (*it).keys.end(),
|
||||
[start_time](double t) { return start_time > t; }), m;
|
||||
[start_time](double t) { return start_time > t; });
|
||||
std::vector<LWO::Key>::iterator m;
|
||||
|
||||
size_t ofs = 0;
|
||||
if (n != (*it).keys.end()) {
|
||||
|
|
@ -211,13 +212,21 @@ void AnimResolver::UpdateAnimRangeSetup() {
|
|||
double cur_minus = delta;
|
||||
unsigned int tt = 1;
|
||||
for (const double tmp = delta * (num + 1); cur_minus <= tmp; cur_minus += delta, ++tt) {
|
||||
m = (delta == tmp ? (*it).keys.begin() : n - (old_size + 1));
|
||||
for (; m != n; --n) {
|
||||
(*n).time -= cur_minus;
|
||||
|
||||
// offset repeat? add delta offset to key value
|
||||
if (delta == tmp) {
|
||||
m = it->keys.begin();
|
||||
} else {
|
||||
ptrdiff_t dist = std::distance((*it).keys.begin(), n);
|
||||
if (dist <= static_cast<ptrdiff_t>(old_size)) {
|
||||
// clamp to begin to avoid seeking before begin
|
||||
m = (*it).keys.begin();
|
||||
} else {
|
||||
m = n - (old_size + 1);
|
||||
}
|
||||
}
|
||||
for (auto it2 = m; it2 != n; ++it2) {
|
||||
it2->time -= cur_minus;
|
||||
if ((*it).pre == LWO::PrePostBehaviour_OffsetRepeat) {
|
||||
(*n).value += tt * value_delta;
|
||||
it2->value += tt * value_delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ void LWOImporter::LoadLWOBFile() {
|
|||
else
|
||||
LoadLWOBPolygons(head.length);
|
||||
} break;
|
||||
|
||||
|
||||
case AI_LWO_SRFS: // list of tags
|
||||
{
|
||||
if (!mTags->empty())
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef ASSIMP_BUILD_NO_LWO_IMPORTER
|
||||
|
||||
// internal headers
|
||||
#include "AssetLib/LWO/LWOLoader.h"
|
||||
#include "LWOLoader.h"
|
||||
#include "PostProcessing/ConvertToLHProcess.h"
|
||||
#include "PostProcessing/ProcessHelper.h"
|
||||
#include "Geometry/GeometryUtils.h"
|
||||
|
|
@ -64,7 +64,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
using namespace Assimp;
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"LightWave/Modo Object Importer",
|
||||
"",
|
||||
"",
|
||||
|
|
@ -77,34 +77,10 @@ static const aiImporterDesc desc = {
|
|||
"lwo lxo"
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
LWOImporter::LWOImporter() :
|
||||
mIsLWO2(),
|
||||
mIsLXOB(),
|
||||
mIsLWO3(),
|
||||
mLayers(),
|
||||
mCurLayer(),
|
||||
mTags(),
|
||||
mMapping(),
|
||||
mSurfaces(),
|
||||
mFileBuffer(),
|
||||
fileSize(),
|
||||
mScene(nullptr),
|
||||
configSpeedFlag(),
|
||||
configLayerIndex(),
|
||||
hasNamedLayer() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
LWOImporter::~LWOImporter() = default;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
bool LWOImporter::CanRead(const std::string &file, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
||||
static const uint32_t tokens[] = {
|
||||
static constexpr uint32_t tokens[] = {
|
||||
AI_LWO_FOURCC_LWOB,
|
||||
AI_LWO_FOURCC_LWO2,
|
||||
AI_LWO_FOURCC_LXOB
|
||||
|
|
@ -155,6 +131,7 @@ void LWOImporter::InternReadFile(const std::string &pFile,
|
|||
}
|
||||
|
||||
mFileBuffer = &mBuffer[0] + 12;
|
||||
mFileBufferEnd = &mBuffer[0] + fileSize;
|
||||
fileSize -= 12;
|
||||
|
||||
// Initialize some members with their default values
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -57,6 +56,7 @@ struct aiNode;
|
|||
struct aiMaterial;
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
using namespace LWO;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -69,10 +69,17 @@ using namespace LWO;
|
|||
* they aren't specific to one format version
|
||||
*/
|
||||
// ---------------------------------------------------------------------------
|
||||
class LWOImporter : public BaseImporter {
|
||||
class LWOImporter final : public BaseImporter {
|
||||
public:
|
||||
LWOImporter();
|
||||
~LWOImporter() override;
|
||||
/**
|
||||
* @brief The class constructor.
|
||||
*/
|
||||
LWOImporter() = default;
|
||||
|
||||
/**
|
||||
* @brief The class destructor.
|
||||
*/
|
||||
~LWOImporter() override = default;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Returns whether the class can handle the format of the given file.
|
||||
|
|
@ -114,13 +121,13 @@ private:
|
|||
// -------------------------------------------------------------------
|
||||
/** Parsing functions used for all file format versions
|
||||
*/
|
||||
inline void GetS0(std::string &out, unsigned int max);
|
||||
inline float GetF4();
|
||||
inline float GetF8();
|
||||
inline uint64_t GetU8();
|
||||
inline uint32_t GetU4();
|
||||
inline uint16_t GetU2();
|
||||
inline uint8_t GetU1();
|
||||
void GetS0(std::string &out, unsigned int max);
|
||||
float GetF4();
|
||||
float GetF8();
|
||||
uint64_t GetU8();
|
||||
uint32_t GetU4();
|
||||
uint16_t GetU2();
|
||||
uint8_t GetU1();
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Loads a surface chunk from an LWOB file
|
||||
|
|
@ -354,57 +361,44 @@ private:
|
|||
LWO::Texture *SetupNewTextureLWOB(LWO::TextureList &list,
|
||||
unsigned int size);
|
||||
|
||||
protected:
|
||||
/** true if the file is a LWO2 file*/
|
||||
bool mIsLWO2;
|
||||
|
||||
/** true if the file is a LXOB file*/
|
||||
bool mIsLXOB;
|
||||
|
||||
bool mIsLWO3;
|
||||
|
||||
/** Temporary list of layers from the file */
|
||||
LayerList *mLayers;
|
||||
|
||||
/** Pointer to the current layer */
|
||||
LWO::Layer *mCurLayer;
|
||||
|
||||
/** Temporary tag list from the file */
|
||||
TagList *mTags;
|
||||
|
||||
/** Mapping table to convert from tag to surface indices.
|
||||
UINT_MAX indicates that a no corresponding surface is available */
|
||||
TagMappingTable *mMapping;
|
||||
|
||||
/** Temporary surface list from the file */
|
||||
SurfaceList *mSurfaces;
|
||||
|
||||
/** Temporary clip list from the file */
|
||||
ClipList mClips;
|
||||
|
||||
/** Temporary envelope list from the file */
|
||||
EnvelopeList mEnvelopes;
|
||||
|
||||
/** file buffer */
|
||||
uint8_t *mFileBuffer;
|
||||
|
||||
/** Size of the file, in bytes */
|
||||
unsigned int fileSize;
|
||||
|
||||
/** Output scene */
|
||||
aiScene *mScene;
|
||||
|
||||
/** Configuration option: speed flag set? */
|
||||
bool configSpeedFlag;
|
||||
|
||||
/** Configuration option: index of layer to be loaded */
|
||||
unsigned int configLayerIndex;
|
||||
|
||||
/** Configuration option: name of layer to be loaded */
|
||||
std::string configLayerName;
|
||||
|
||||
/** True if we have a named layer */
|
||||
bool hasNamedLayer;
|
||||
private:
|
||||
/// true if the file is a LWO2 file
|
||||
bool mIsLWO2{false};
|
||||
/// true if the file is a LXOB file
|
||||
bool mIsLXOB{false};
|
||||
/// true if the file is a LWO3 file
|
||||
bool mIsLWO3{false};
|
||||
/// Temporary list of layers from the file
|
||||
LayerList *mLayers{nullptr};
|
||||
/// Pointer to the current layer
|
||||
LWO::Layer *mCurLayer{nullptr};
|
||||
/// Temporary tag list from the file
|
||||
TagList *mTags{nullptr};
|
||||
/// Mapping table to convert from tag to surface indices.
|
||||
// UINT_MAX indicates that a no corresponding surface is available
|
||||
TagMappingTable *mMapping{nullptr};
|
||||
/// Temporary surface list from the file
|
||||
SurfaceList *mSurfaces{nullptr};
|
||||
/// Temporary clip list from the file
|
||||
ClipList mClips{};
|
||||
/// Temporary envelope list from the file
|
||||
EnvelopeList mEnvelopes{};
|
||||
/// Pointer to the file buffer
|
||||
uint8_t *mFileBuffer{nullptr};
|
||||
/// Size of the file, in bytes
|
||||
unsigned int fileSize{0u};
|
||||
/// End of the file buffer (for bounds checking)
|
||||
uint8_t *mFileBufferEnd{nullptr};
|
||||
/// Output scene
|
||||
aiScene *mScene{nullptr};
|
||||
/// Configuration option: speed flag set?
|
||||
bool configSpeedFlag{false};
|
||||
/// Configuration option: index of layer to be loaded
|
||||
unsigned int configLayerIndex{0};
|
||||
/// Configuration option: name of layer to be loaded */
|
||||
std::string configLayerName{};
|
||||
/// True if we have a named layer
|
||||
bool hasNamedLayer{false};
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
|
@ -416,6 +410,7 @@ inline float LWOImporter::GetF4() {
|
|||
return f;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
inline float LWOImporter::GetF8() {
|
||||
double f;
|
||||
::memcpy(&f, mFileBuffer, 8);
|
||||
|
|
@ -424,6 +419,7 @@ inline float LWOImporter::GetF8() {
|
|||
return (float)f;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
inline uint64_t LWOImporter::GetU8() {
|
||||
uint64_t f;
|
||||
::memcpy(&f, mFileBuffer, 8);
|
||||
|
|
@ -483,16 +479,23 @@ inline int LWOImporter::ReadVSizedIntLWO2(uint8_t *&inout) {
|
|||
inline void LWOImporter::GetS0(std::string &out, unsigned int max) {
|
||||
unsigned int iCursor = 0;
|
||||
const char *sz = (const char *)mFileBuffer;
|
||||
while (*mFileBuffer) {
|
||||
while (mFileBuffer < mFileBufferEnd && *mFileBuffer) {
|
||||
if (++iCursor > max) {
|
||||
ASSIMP_LOG_WARN("LWO: Invalid file, string is is too long");
|
||||
ASSIMP_LOG_WARN("LWO: Invalid file, string is too long");
|
||||
break;
|
||||
}
|
||||
++mFileBuffer;
|
||||
}
|
||||
size_t len = (size_t)((const char *)mFileBuffer - sz);
|
||||
out = std::string(sz, len);
|
||||
mFileBuffer += (len & 0x1 ? 1 : 2);
|
||||
|
||||
const size_t skip = (len & 0x1 ? 1u : 2u);
|
||||
const size_t remaining = static_cast<size_t>(mFileBufferEnd - mFileBuffer);
|
||||
if (remaining < skip) {
|
||||
mFileBuffer = mFileBufferEnd;
|
||||
} else {
|
||||
mFileBuffer += skip;
|
||||
}
|
||||
}
|
||||
|
||||
} // end of namespace Assimp
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -1150,4 +1148,4 @@ void LWOImporter::LoadLWO3Surface(unsigned int size) {
|
|||
}
|
||||
}
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_X_IMPORTER
|
||||
#endif // ASSIMP_BUILD_NO_LWO_IMPORTER
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue