add missing include.

pull/2656/head
Kim Kulling 2019-09-17 21:58:46 +02:00
parent 8b95479bb0
commit 2edcf82f5a
7 changed files with 27 additions and 49 deletions

View File

@ -695,7 +695,7 @@ namespace Assimp {
std::fill_n(chain, static_cast<unsigned int>(TransformationComp_MAXIMUM), aiMatrix4x4());
// generate transformation matrices for all the different transformation components
const float zero_epsilon = 1e-6f;
const float zero_epsilon = Math::getEpsilon<float>();
const aiVector3D all_ones(1.0f, 1.0f, 1.0f);
const aiVector3D& PreRotation = PropertyGet<aiVector3D>(props, "PreRotation", ok);
@ -2968,7 +2968,7 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTa
TransformationCompDefaultValue(comp)
);
const float epsilon = 1e-6f;
const float epsilon = Math::getEpsilon<float>();
return (dyn_val - static_val).SquareLength() < epsilon;
}

View File

@ -500,7 +500,7 @@ bool Curve::InRange(IfcFloat u) const {
if (IsClosed()) {
return true;
}
const IfcFloat epsilon = 1e-5;
const IfcFloat epsilon = Math::getEpsilon<float>();
return u - range.first > -epsilon && range.second - u > -epsilon;
}
#endif

View File

@ -593,7 +593,7 @@ typedef std::vector<std::pair<
bool BoundingBoxesAdjacent(const BoundingBox& bb, const BoundingBox& ibb)
{
// TODO: I'm pretty sure there is a much more compact way to check this
const IfcFloat epsilon = 1e-5f;
const IfcFloat epsilon = Math::getEpsilon<float>();
return (std::fabs(bb.second.x - ibb.first.x) < epsilon && bb.first.y <= ibb.second.y && bb.second.y >= ibb.first.y) ||
(std::fabs(bb.first.x - ibb.second.x) < epsilon && ibb.first.y <= bb.second.y && ibb.second.y >= bb.first.y) ||
(std::fabs(bb.second.y - ibb.first.y) < epsilon && bb.first.x <= ibb.second.x && bb.second.x >= ibb.first.x) ||
@ -681,7 +681,7 @@ bool IntersectingLineSegments(const IfcVector2& n0, const IfcVector2& n1,
// ------------------------------------------------------------------------------------------------
void FindAdjacentContours(ContourVector::iterator current, const ContourVector& contours)
{
const IfcFloat sqlen_epsilon = static_cast<IfcFloat>(1e-8);
const IfcFloat sqlen_epsilon = static_cast<IfcFloat>(Math::getEpsilon<float>());
const BoundingBox& bb = (*current).bb;
// What is to be done here is to populate the skip lists for the contour
@ -758,7 +758,7 @@ void FindAdjacentContours(ContourVector::iterator current, const ContourVector&
// ------------------------------------------------------------------------------------------------
AI_FORCE_INLINE bool LikelyBorder(const IfcVector2& vdelta)
{
const IfcFloat dot_point_epsilon = static_cast<IfcFloat>(1e-5);
const IfcFloat dot_point_epsilon = static_cast<IfcFloat>(Math::getEpsilon<float>());
return std::fabs(vdelta.x * vdelta.y) < dot_point_epsilon;
}

View File

@ -53,6 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "MD5Loader.h"
#include <assimp/StringComparison.h>
#include <assimp/fast_atof.h>
#include <assimp/MathFunctions.h>
#include <assimp/SkeletonMeshBuilder.h>
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
@ -64,7 +65,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp;
// Minimum weight value. Weights inside [-n ... n] are ignored
#define AI_MD5_WEIGHT_EPSILON 1e-5f
#define AI_MD5_WEIGHT_EPSILON Math::getEpsilon<float>()
static const aiImporterDesc desc = {

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2019, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -94,23 +92,24 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
MDLImporter::MDLImporter()
: configFrameID(),
mBuffer(),
iGSFileVersion(),
pIOHandler(),
pScene(),
iFileSize()
{}
: configFrameID()
, mBuffer()
, iGSFileVersion()
, pIOHandler()
, pScene()
, iFileSize() {
// empty
}
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
MDLImporter::~MDLImporter()
{}
MDLImporter::~MDLImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
bool MDLImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
{
bool MDLImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const {
const std::string extension = GetExtension(pFile);
// if check for extension is not enough, check for the magic tokens
@ -404,23 +403,15 @@ void MDLImporter::InternReadFile_Quake1() {
// now get a pointer to the first frame in the file
BE_NCONST MDL::Frame* pcFrames = (BE_NCONST MDL::Frame*)szCurrent;
BE_NCONST MDL::SimpleFrame* pcFirstFrame;
MDL::SimpleFrame* pcFirstFrame;
if (0 == pcFrames->type) {
// get address of single frame
pcFirstFrame = &pcFrames->frame;
pcFirstFrame =( MDL::SimpleFrame*) &pcFrames->frame;
} else {
// get the first frame in the group
#if 1
// FIXME: the cast is wrong and cause a warning on clang 5.0
// disable this code for now, fix it later
ai_assert(false && "Bad pointer cast");
pcFirstFrame = nullptr; // Workaround: msvc++ C4703 error
#else
BE_NCONST MDL::GroupFrame* pcFrames2 = (BE_NCONST MDL::GroupFrame*)pcFrames;
pcFirstFrame = (BE_NCONST MDL::SimpleFrame*)(&pcFrames2->time + pcFrames->type);
#endif
BE_NCONST MDL::GroupFrame* pcFrames2 = (BE_NCONST MDL::GroupFrame*) pcFrames;
pcFirstFrame = &(pcFrames2->frames[0]);
}
BE_NCONST MDL::Vertex* pcVertices = (BE_NCONST MDL::Vertex*) ((pcFirstFrame->name) + sizeof(pcFirstFrame->name));
VALIDATE_FILE_SIZE((const unsigned char*)(pcVertices + pcHeader->num_verts));

View File

@ -89,16 +89,12 @@ public:
MDLImporter();
~MDLImporter();
public:
// -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file.
* See BaseImporter::CanRead() for details. */
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
bool checkSig) const;
// -------------------------------------------------------------------
/** Called prior to ReadFile().
* The function is a request to the importer to update its configuration
@ -107,8 +103,6 @@ public:
void SetupProperties(const Importer* pImp);
protected:
// -------------------------------------------------------------------
/** Return importer meta information.
* See #BaseImporter::GetInfo for the details
@ -122,8 +116,6 @@ protected:
void InternReadFile( const std::string& pFile, aiScene* pScene,
IOSystem* pIOHandler);
protected:
// -------------------------------------------------------------------
/** Import a quake 1 MDL file (IDPO)
*/
@ -154,7 +146,6 @@ protected:
void SizeCheck(const void* szPos);
void SizeCheck(const void* szPos, const char* szFile, unsigned int iLine);
// -------------------------------------------------------------------
/** Validate the header data structure of a game studio MDL7 file
* \param pcHeader Input header to be validated
@ -167,7 +158,6 @@ protected:
*/
void ValidateHeader_Quake1(const MDL::Header* pcHeader);
// -------------------------------------------------------------------
/** Try to load a palette from the current directory (colormap.lmp)
* If it is not found the default palette of Quake1 is returned
@ -179,9 +169,8 @@ protected:
*/
void FreePalette(const unsigned char* pszColorMap);
// -------------------------------------------------------------------
/** Load a paletized texture from the file and convert it to 32bpp
/** Load a palletized texture from the file and convert it to 32bpp
*/
void CreateTextureARGB8_3DGS_MDL3(const unsigned char* szData);
@ -195,7 +184,6 @@ protected:
unsigned int iType,
unsigned int* piSkip);
// -------------------------------------------------------------------
/** Used to load textures from MDL5
* \param szData Input data
@ -206,7 +194,6 @@ protected:
unsigned int iType,
unsigned int* piSkip);
// -------------------------------------------------------------------
/** Checks whether a texture can be replaced with a single color
* This is useful for all file formats before MDL7 (all those
@ -218,14 +205,12 @@ protected:
*/
aiColor4D ReplaceTextureWithColor(const aiTexture* pcTexture);
// -------------------------------------------------------------------
/** Converts the absolute texture coordinates in MDL5 files to
* relative in a range between 0 and 1
*/
void CalculateUVCoordinates_MDL5();
// -------------------------------------------------------------------
/** Read an UV coordinate from the file. If the file format is not
* MDL5, the function calculates relative texture coordinates
@ -245,7 +230,6 @@ protected:
*/
void SetupMaterialProperties_3DGS_MDL5_Quake1( );
// -------------------------------------------------------------------
/** Parse a skin lump in a MDL7/HMP7 file with all of its features
* variant 1: Current cursor position is the beginning of the skin header

View File

@ -49,6 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_MATERIAL_INL_INC
#define AI_MATERIAL_INL_INC
#include <assimp/MathFunctions.h>
// ---------------------------------------------------------------------------
inline aiPropertyTypeInfo ai_real_to_property_type_info(float)
{