Introduce interpolation mode to vectro and quaternion keys

pull/5680/head
Kim Kulling 2024-07-17 15:49:17 +02:00
parent 35e4f1bf64
commit da281b7f48
14 changed files with 310 additions and 213 deletions

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2024, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -37,11 +36,9 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@author: Richard Steffen, 2015
----------------------------------------------------------------------
*/
#ifndef ASSIMP_BUILD_NO_EXPORT
#ifndef ASSIMP_BUILD_NO_STEP_EXPORTER

View File

@ -1,15 +1,15 @@
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
----------------------------------------------------------------------
Copyright (c) 2006-2024, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
@ -36,7 +36,10 @@ Copyright (c) 2006-2024, assimp team
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
@author: Richard Steffen, 2014
----------------------------------------------------------------------
*/
/** @file USDLoader.cpp
@ -87,8 +90,7 @@ USDImporter::USDImporter() :
// ------------------------------------------------------------------------------------------------
bool USDImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const {
UNUSED(checkSig);
bool USDImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool) const {
// Based on token
static const uint32_t usdcTokens[] = { AI_MAKE_MAGIC("PXR-USDC") };
bool canRead = CheckMagicToken(pIOHandler, pFile, usdcTokens, AI_COUNT_OF(usdcTokens));

View File

@ -4,6 +4,7 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2024, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -35,6 +36,9 @@ Copyright (c) 2006-2024, assimp team
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@author: Richard Steffen, 2014
----------------------------------------------------------------------
*/

View File

@ -1,15 +1,14 @@
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
----------------------------------------------------------------------
Copyright (c) 2006-2024, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
@ -36,7 +35,8 @@ Copyright (c) 2006-2024, assimp team
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
----------------------------------------------------------------------
*/
/** @file USDLoader.cpp
@ -72,7 +72,7 @@ Copyright (c) 2006-2024, assimp team
#include "../../../contrib/tinyusdz/assimp_tinyusdz_logging.inc"
namespace {
const char *const TAG = "tinyusdz loader";
static constexpr char Tag[] = "tinyusdz loader";
}
namespace Assimp {
@ -81,9 +81,7 @@ using namespace std;
void USDImporterImplTinyusdz::InternReadFile(
const std::string &pFile,
aiScene *pScene,
IOSystem *pIOHandler) {
UNUSED(pIOHandler);
UNUSED(TAG); // Ignore unused variable when -Werror enabled
IOSystem *) {
// Grab filename for logging purposes
size_t pos = pFile.find_last_of('/');
string basePath = pFile.substr(0, pos);

View File

@ -35,6 +35,7 @@ Copyright (c) 2006-2024, assimp team
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/

View File

@ -1,3 +1,44 @@
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2024, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
#ifndef ASSIMP_BUILD_NO_USD_IMPORTER
#include "USDLoaderImplTinyusdzHelper.h"

View File

@ -1,3 +1,44 @@
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2024, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
#pragma once
#ifndef AI_USDLOADER_IMPL_TINYUSDZ_HELPER_H_INCLUDED
#define AI_USDLOADER_IMPL_TINYUSDZ_HELPER_H_INCLUDED

View File

@ -1,15 +1,14 @@
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
----------------------------------------------------------------------
Copyright (c) 2006-2024, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
@ -36,7 +35,8 @@ Copyright (c) 2006-2024, assimp team
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
----------------------------------------------------------------------
*/
/** @file USDLoader.cpp

View File

@ -35,6 +35,7 @@ Copyright (c) 2006-2024, assimp team
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
@ -45,15 +46,15 @@ Copyright (c) 2006-2024, assimp team
#ifndef AI_USDLOADER_UTIL_H_INCLUDED
#define AI_USDLOADER_UTIL_H_INCLUDED
#include <assimp/BaseImporter.h>
#include <assimp/types.h>
#include <vector>
#include <cstdint>
#include <string>
namespace Assimp {
bool isUsda(const std::string &pFile);
bool isUsdc(const std::string &pFile);
bool isUsdz(const std::string &pFile);
bool isUsd(const std::string &pFile);
} // namespace Assimp
#endif // AI_USDLOADER_UTIL_H_INCLUDED

View File

@ -71,10 +71,6 @@ SpatialSort::SpatialSort() :
mPlaneNormal.Normalize();
}
// ------------------------------------------------------------------------------------------------
// Destructor
SpatialSort::~SpatialSort() = default;
// ------------------------------------------------------------------------------------------------
void SpatialSort::Fill(const aiVector3D *pPositions, unsigned int pNumPositions,
unsigned int pElementOffset,

View File

@ -79,7 +79,7 @@ public:
unsigned int pElementOffset);
/** Destructor */
~SpatialSort();
~SpatialSort() = default;
// ------------------------------------------------------------------------------------
/** Sets the input data for the SpatialSort. This replaces existing data, if any.

View File

@ -59,6 +59,28 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
extern "C" {
#endif
// ---------------------------------------------------------------------------
/**
*/
enum aiAnimInterpolation {
/** */
aiAnimInterpolation_Step,
/** */
aiAnimInterpolation_Linear,
/** */
aiAnimInterpolation_Spherical_Linear,
/** */
aiAnimInterpolation_Cubic_Spline,
/** */
#ifndef SWIG
_aiAnimInterpolation_Force32Bit = INT_MAX
#endif
};
// ---------------------------------------------------------------------------
/** A time-value pair specifying a certain 3D vector for the given time. */
struct aiVectorKey {
@ -68,21 +90,18 @@ struct aiVectorKey {
/** The value of this key */
C_STRUCT aiVector3D mValue;
/** The interpolation setting of this key */
C_ENUM aiAnimInterpolation mInterpolation;
#ifdef __cplusplus
/// @brief The default constructor.
aiVectorKey() AI_NO_EXCEPT
: mTime(0.0),
mValue() {
// empty
}
: mTime(0.0), mValue(), mInterpolation(aiAnimInterpolation_Linear) {}
/// @brief Construction from a given time and key value.
aiVectorKey(double time, const aiVector3D &value) :
mTime(time), mValue(value) {
// empty
}
mTime(time), mValue(value), mInterpolation(aiAnimInterpolation_Linear){}
typedef aiVector3D elem_type;
@ -116,16 +135,16 @@ struct aiQuatKey {
/** The value of this key */
C_STRUCT aiQuaternion mValue;
/** The interpolation setting of this key */
C_ENUM aiAnimInterpolation mInterpolation;
#ifdef __cplusplus
aiQuatKey() AI_NO_EXCEPT
: mTime(0.0),
mValue() {
// empty
}
: mTime(0.0), mValue(), mInterpolation(aiAnimInterpolation_Linear) {}
/** Construction from a given time and key value */
aiQuatKey(double time, const aiQuaternion &value) :
mTime(time), mValue(value) {}
mTime(time), mValue(value), mInterpolation(aiAnimInterpolation_Linear) {}
typedef aiQuaternion elem_type;

View File

@ -1527,7 +1527,7 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray(
const char *pKey,
unsigned int type,
unsigned int index,
ai_real *pOut,
float *pOut,
unsigned int *pMax);
// ---------------------------------------------------------------------------
@ -1553,7 +1553,7 @@ inline aiReturn aiGetMaterialFloat(const C_STRUCT aiMaterial *pMat,
const char *pKey,
unsigned int type,
unsigned int index,
ai_real *pOut) {
float *pOut) {
return aiGetMaterialFloatArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0);
}

View File

@ -67,7 +67,7 @@ AI_FORCE_INLINE aiReturn aiMaterial::GetTexture( aiTextureType type,
C_STRUCT aiString* path,
aiTextureMapping* mapping /*= NULL*/,
unsigned int* uvindex /*= NULL*/,
ai_real* blend /*= NULL*/,
float* blend /*= NULL*/,
aiTextureOp* op /*= NULL*/,
aiTextureMapMode* mapmode /*= NULL*/) const {
return ::aiGetMaterialTexture(this,type,index,path,mapping,uvindex,blend,op,mapmode);
@ -136,9 +136,7 @@ AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
// Specialisation for a single bool.
// Casts floating point and integer to bool
template <>
AI_FORCE_INLINE
aiReturn
aiMaterial::Get(const char *pKey, unsigned int type,
AI_FORCE_INLINE aiReturn aiMaterial::Get(const char *pKey, unsigned int type,
unsigned int idx, bool &pOut) const {
const aiMaterialProperty *prop;
const aiReturn ret = ::aiGetMaterialProperty(this, pKey, type, idx,
@ -193,7 +191,7 @@ AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
}
// ---------------------------------------------------------------------------
AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
unsigned int idx,ai_real& pOut) const {
unsigned int idx, float& pOut) const {
return aiGetMaterialFloat(this,pKey,type,idx,&pOut);
}
// ---------------------------------------------------------------------------
@ -312,7 +310,6 @@ AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const int* pInput,
pKey,type,index,aiPTI_Integer);
}
// ---------------------------------------------------------------------------
// The template specializations below are for backwards compatibility.
// The recommended way to add material properties is using the non-template