propagating precision requirments into operations

pull/947/head
Chris Russ 2016-07-15 15:38:29 +10:00
parent 5adb0e899c
commit fa1d6d8c55
36 changed files with 437 additions and 411 deletions

View File

@ -197,7 +197,7 @@ void CopyTexture(aiMaterial& mat, D3DS::Texture& texture, aiTextureType type)
// Setup the texture blend factor
if (is_not_qnan(texture.mTextureBlend))
mat.AddProperty<float>( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0));
mat.AddProperty<ai_real>( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0));
// Setup the texture mapping mode
mat.AddProperty<int>((int*)&texture.mMapMode,1,AI_MATKEY_MAPPINGMODE_U(type,0));
@ -207,14 +207,14 @@ void CopyTexture(aiMaterial& mat, D3DS::Texture& texture, aiTextureType type)
// FIXME: this is not really correct ...
if (texture.mMapMode == aiTextureMapMode_Mirror)
{
texture.mScaleU *= 2.f;
texture.mScaleV *= 2.f;
texture.mOffsetU /= 2.f;
texture.mOffsetV /= 2.f;
texture.mScaleU *= 2.0;
texture.mScaleV *= 2.0;
texture.mOffsetU /= 2.0;
texture.mOffsetV /= 2.0;
}
// Setup texture UV transformations
mat.AddProperty<float>(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0));
mat.AddProperty<ai_real>(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0));
}
// ------------------------------------------------------------------------------------------------
@ -265,10 +265,10 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material& oldMat,
}
// Opacity
mat.AddProperty<float>( &oldMat.mTransparency,1,AI_MATKEY_OPACITY);
mat.AddProperty<ai_real>( &oldMat.mTransparency,1,AI_MATKEY_OPACITY);
// Bump height scaling
mat.AddProperty<float>( &oldMat.mBumpHeight,1,AI_MATKEY_BUMPSCALING);
mat.AddProperty<ai_real>( &oldMat.mBumpHeight,1,AI_MATKEY_BUMPSCALING);
// Two sided rendering?
if (oldMat.mTwoSided)

View File

@ -327,11 +327,11 @@ struct Texture
{
//! Default constructor
Texture()
: mOffsetU (0.0f)
, mOffsetV (0.0f)
, mScaleU (1.0f)
, mScaleV (1.0f)
, mRotation (0.0f)
: mOffsetU (0.0)
, mOffsetV (0.0)
, mScaleU (1.0)
, mScaleV (1.0)
, mRotation (0.0)
, mMapMode (aiTextureMapMode_Wrap)
, bPrivate()
, iUVSrc (0)
@ -340,17 +340,17 @@ struct Texture
}
//! Specifies the blend factor for the texture
float mTextureBlend;
ai_real mTextureBlend;
//! Specifies the filename of the texture
std::string mMapName;
//! Specifies texture coordinate offsets/scaling/rotations
float mOffsetU;
float mOffsetV;
float mScaleU;
float mScaleV;
float mRotation;
ai_real mOffsetU;
ai_real mOffsetV;
ai_real mScaleU;
ai_real mScaleV;
ai_real mRotation;
//! Specifies the mapping mode to be used for the texture
aiTextureMapMode mMapMode;
@ -369,12 +369,12 @@ struct Material
//! Default constructor. Builds a default name for the material
Material()
:
mDiffuse (0.6f,0.6f,0.6f), // FIX ... we won't want object to be black
mSpecularExponent (0.0f),
mShininessStrength (1.0f),
mDiffuse (0.6,0.6,0.6), // FIX ... we won't want object to be black
mSpecularExponent (0.0),
mShininessStrength (1.0),
mShading(Discreet3DS::Gouraud),
mTransparency (1.0f),
mBumpHeight (1.0f),
mTransparency (1.0),
mBumpHeight (1.0),
mTwoSided (false)
{
static int iCnt = 0;
@ -389,9 +389,9 @@ struct Material
//! Diffuse color of the material
aiColor3D mDiffuse;
//! Specular exponent
float mSpecularExponent;
ai_real mSpecularExponent;
//! Shininess strength, in percent
float mShininessStrength;
ai_real mShininessStrength;
//! Specular color of the material
aiColor3D mSpecular;
//! Ambient color of the material
@ -399,7 +399,7 @@ struct Material
//! Shading type to be used
Discreet3DS::shadetype3ds mShading;
//! Opacity of the material
float mTransparency;
ai_real mTransparency;
//! Diffuse texture channel
Texture sTexDiffuse;
//! Opacity texture channel
@ -415,7 +415,7 @@ struct Material
//! Shininess texture channel
Texture sTexShininess;
//! Scaling factor for the bump values
float mBumpHeight;
ai_real mBumpHeight;
//! Emissive color
aiColor3D mEmissive;
//! Ambient texture channel
@ -459,7 +459,7 @@ struct Mesh : public MeshWithSmoothingGroups<D3DS::Face>
struct aiFloatKey
{
double mTime; ///< The time of this key
float mValue; ///< The value of this key
ai_real mValue; ///< The value of this key
#ifdef __cplusplus

View File

@ -458,20 +458,20 @@ void Discreet3DSImporter::ParseChunk(const char* name, unsigned int num)
camera->mLookAt.x = stream->GetF4() - camera->mPosition.x;
camera->mLookAt.y = stream->GetF4() - camera->mPosition.y;
camera->mLookAt.z = stream->GetF4() - camera->mPosition.z;
float len = camera->mLookAt.Length();
if (len < 1e-5f) {
ai_real len = camera->mLookAt.Length();
if (len < 1e-5) {
// There are some files with lookat == position. Don't know why or whether it's ok or not.
DefaultLogger::get()->error("3DS: Unable to read proper camera look-at vector");
camera->mLookAt = aiVector3D(0.f,1.f,0.f);
camera->mLookAt = aiVector3D(0.0,1.0,0.0);
}
else camera->mLookAt /= len;
// And finally - the camera rotation angle, in counter clockwise direction
const float angle = AI_DEG_TO_RAD( stream->GetF4() );
const ai_real angle = AI_DEG_TO_RAD( stream->GetF4() );
aiQuaternion quat(camera->mLookAt,angle);
camera->mUp = quat.GetMatrix() * aiVector3D(0.f,1.f,0.f);
camera->mUp = quat.GetMatrix() * aiVector3D(0.0,1.0,0.0);
// Read the lense angle
camera->mHorizontalFOV = AI_DEG_TO_RAD ( stream->GetF4() );
@ -1167,13 +1167,13 @@ void Discreet3DSImporter::ParseMaterialChunk()
case Discreet3DS::CHUNK_MAT_TRANSPARENCY:
{
// This is the material's transparency
float* pcf = &mScene->mMaterials.back().mTransparency;
ai_real* pcf = &mScene->mMaterials.back().mTransparency;
*pcf = ParsePercentageChunk();
// NOTE: transparency, not opacity
if (is_qnan(*pcf))
*pcf = 1.0f;
else *pcf = 1.0f - *pcf * (float)0xFFFF / 100.0f;
*pcf = 1.0;
else *pcf = 1.0 - *pcf * (ai_real)0xFFFF / 100.0;
}
break;
@ -1189,30 +1189,30 @@ void Discreet3DSImporter::ParseMaterialChunk()
case Discreet3DS::CHUNK_MAT_SHININESS:
{ // This is the shininess of the material
float* pcf = &mScene->mMaterials.back().mSpecularExponent;
ai_real* pcf = &mScene->mMaterials.back().mSpecularExponent;
*pcf = ParsePercentageChunk();
if (is_qnan(*pcf))
*pcf = 0.0f;
else *pcf *= (float)0xFFFF;
*pcf = 0.0;
else *pcf *= (ai_real)0xFFFF;
}
break;
case Discreet3DS::CHUNK_MAT_SHININESS_PERCENT:
{ // This is the shininess strength of the material
float* pcf = &mScene->mMaterials.back().mShininessStrength;
ai_real* pcf = &mScene->mMaterials.back().mShininessStrength;
*pcf = ParsePercentageChunk();
if (is_qnan(*pcf))
*pcf = 0.0f;
else *pcf *= (float)0xffff / 100.0f;
*pcf = 0.0;
else *pcf *= (ai_real)0xffff / 100.0;
}
break;
case Discreet3DS::CHUNK_MAT_SELF_ILPCT:
{ // This is the self illumination strength of the material
float f = ParsePercentageChunk();
ai_real f = ParsePercentageChunk();
if (is_qnan(f))
f = 0.0f;
else f *= (float)0xFFFF / 100.0f;
f = 0.0;
else f *= (ai_real)0xFFFF / 100.0;
mScene->mMaterials.back().mEmissive = aiColor3D(f,f,f);
}
break;
@ -1277,7 +1277,7 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut)
case Discreet3DS::CHUNK_PERCENTW:
// Manually parse the blend factor
pcOut->mTextureBlend = (float)((uint16_t)stream->GetI2()) / 100.0f;
pcOut->mTextureBlend = (ai_real)((uint16_t)stream->GetI2()) / 100.0;
break;
case Discreet3DS::CHUNK_MAT_MAP_USCALE:
@ -1336,7 +1336,7 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut)
// ------------------------------------------------------------------------------------------------
// Read a percentage chunk
float Discreet3DSImporter::ParsePercentageChunk()
ai_real Discreet3DSImporter::ParsePercentageChunk()
{
Discreet3DS::Chunk chunk;
ReadChunk(&chunk);
@ -1344,7 +1344,7 @@ float Discreet3DSImporter::ParsePercentageChunk()
if (Discreet3DS::CHUNK_PERCENTF == chunk.Flag)
return stream->GetF4();
else if (Discreet3DS::CHUNK_PERCENTW == chunk.Flag)
return (float)((uint16_t)stream->GetI2()) / (float)0xFFFF;
return (ai_real)((uint16_t)stream->GetI2()) / (ai_real)0xFFFF;
return get_qnan();
}
@ -1356,7 +1356,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out,
ai_assert(out != NULL);
// error return value
const float qnan = get_qnan();
const ai_real qnan = get_qnan();
static const aiColor3D clrError = aiColor3D(qnan,qnan,qnan);
Discreet3DS::Chunk chunk;
@ -1372,7 +1372,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out,
bGamma = true;
case Discreet3DS::CHUNK_RGBF:
if (sizeof(float) * 3 > diff) {
if (sizeof(ai_real) * 3 > diff) {
*out = clrError;
return;
}
@ -1388,9 +1388,9 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out,
*out = clrError;
return;
}
out->r = (float)(uint8_t)stream->GetI1() / 255.0f;
out->g = (float)(uint8_t)stream->GetI1() / 255.0f;
out->b = (float)(uint8_t)stream->GetI1() / 255.0f;
out->r = (ai_real)(uint8_t)stream->GetI1() / 255.0;
out->g = (ai_real)(uint8_t)stream->GetI1() / 255.0;
out->b = (ai_real)(uint8_t)stream->GetI1() / 255.0;
break;
// Percentage chunks are accepted, too.
@ -1404,7 +1404,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out,
case Discreet3DS::CHUNK_PERCENTW:
if (acceptPercent && 1 <= diff) {
out->g = out->b = out->r = (float)(uint8_t)stream->GetI1() / 255.0f;
out->g = out->b = out->r = (ai_real)(uint8_t)stream->GetI1() / 255.0;
break;
}
*out = clrError;

View File

@ -119,7 +119,7 @@ protected:
* chunk behind afterwards. If no percentage chunk is found
* QNAN is returned.
*/
float ParsePercentageChunk();
ai_real ParsePercentageChunk();
// -------------------------------------------------------------------
/** Parse a color chunk. mCurrent will point to the next
@ -265,7 +265,7 @@ protected:
aiColor3D mClrAmbient;
/** Master scaling factor of the scene */
float mMasterScale;
ai_real mMasterScale;
/** Path to the background image of the scene */
std::string mBackgroundImage;

View File

@ -819,10 +819,10 @@ void CopyASETexture(aiMaterial& mat, ASE::Texture& texture, aiTextureType type)
// Setup the texture blend factor
if (is_not_qnan(texture.mTextureBlend))
mat.AddProperty<float>( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0));
mat.AddProperty<ai_real>( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0));
// Setup texture UV transformations
mat.AddProperty<float>(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0));
mat.AddProperty<ai_real>(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0));
}
// ------------------------------------------------------------------------------------------------
@ -865,7 +865,7 @@ void ASEImporter::ConvertMaterial(ASE::Material& mat)
}
// opacity
mat.pcInstance->AddProperty<float>( &mat.mTransparency,1,AI_MATKEY_OPACITY);
mat.pcInstance->AddProperty<ai_real>( &mat.mTransparency,1,AI_MATKEY_OPACITY);
// Two sided rendering?
if (mat.mTwoSided)

View File

@ -431,7 +431,7 @@ void Parser::ParseLV1SoftSkinBlock()
ParseString(bone,"*MESH_SOFTSKINVERTS.Bone");
// Find the bone in the mesh's list
std::pair<int,float> me;
std::pair<int,ai_real> me;
me.first = -1;
for (unsigned int n = 0; n < curMesh->mBones.size();++n)
@ -618,12 +618,12 @@ void Parser::ParseLV2MaterialBlock(ASE::Material& mat)
if (TokenMatch(filePtr,"MATERIAL_TRANSPARENCY",21))
{
ParseLV4MeshFloat(mat.mTransparency);
mat.mTransparency = 1.0f - mat.mTransparency;continue;
mat.mTransparency = 1.0 - mat.mTransparency;continue;
}
// material self illumination
if (TokenMatch(filePtr,"MATERIAL_SELFILLUM",18))
{
float f = 0.0f;
ai_real f = 0.0;
ParseLV4MeshFloat(f);
mat.mEmissive.r = f;
@ -1251,7 +1251,7 @@ void Parser::ParseLV3RotAnimationBlock(ASE::Animation& anim)
{
anim.akeyRotations.push_back(aiQuatKey());
aiQuatKey& key = anim.akeyRotations.back();
aiVector3D v;float f;
aiVector3D v;ai_real f;
ParseLV4MeshFloatTriple(&v.x,iIndex);
ParseLV4MeshFloat(f);
key.mTime = (double)iIndex;
@ -1604,7 +1604,7 @@ void Parser::ParseLV4MeshBonesVertices(unsigned int iNumVertices,ASE::Mesh& mesh
}
// --- ignored
float afVert[3];
ai_real afVert[3];
ParseLV4MeshFloatTriple(afVert);
std::pair<int,float> pairOut;
@ -2102,7 +2102,7 @@ void Parser::ParseLV4MeshLongTriple(unsigned int* apOut, unsigned int& rIndexOut
ParseLV4MeshLongTriple(apOut);
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut)
void Parser::ParseLV4MeshFloatTriple(ai_real* apOut, unsigned int& rIndexOut)
{
ai_assert(NULL != apOut);
@ -2113,7 +2113,7 @@ void Parser::ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut)
ParseLV4MeshFloatTriple(apOut);
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshFloatTriple(float* apOut)
void Parser::ParseLV4MeshFloatTriple(ai_real* apOut)
{
ai_assert(NULL != apOut);
@ -2121,19 +2121,19 @@ void Parser::ParseLV4MeshFloatTriple(float* apOut)
ParseLV4MeshFloat(apOut[i]);
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshFloat(float& fOut)
void Parser::ParseLV4MeshFloat(ai_real& fOut)
{
// skip spaces and tabs
if(!SkipSpaces(&filePtr))
{
// LOG
LogWarning("Unable to parse float: unexpected EOL [#1]");
fOut = 0.0f;
fOut = 0.0;
++iLineNumber;
return;
}
// parse the first float
filePtr = fast_atoreal_move<float>(filePtr,fOut);
filePtr = fast_atoreal_move<ai_real>(filePtr,fOut);
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshLong(unsigned int& iOut)

View File

@ -222,7 +222,7 @@ struct BaseNode
mName = szTemp;
// Set mTargetPosition to qnan
const float qnan = get_qnan();
const ai_real qnan = get_qnan();
mTargetPosition.x = qnan;
}
@ -317,9 +317,9 @@ struct Light : public BaseNode
LightType mLightType;
aiColor3D mColor;
float mIntensity;
float mAngle; // in degrees
float mFalloff;
ai_real mIntensity;
ai_real mAngle; // in degrees
ai_real mFalloff;
};
// ---------------------------------------------------------------------------
@ -342,7 +342,7 @@ struct Camera : public BaseNode
{
}
float mFOV, mNear, mFar;
ai_real mFOV, mNear, mFar;
CameraType mCameraType;
};
@ -544,13 +544,13 @@ private:
//! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
//! \param apOut Output buffer (3 floats)
//! \param rIndexOut Output index
void ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut);
void ParseLV4MeshFloatTriple(ai_real* apOut, unsigned int& rIndexOut);
// -------------------------------------------------------------------
//! Parse a *MESH_VERT block in a file
//! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
//! \param apOut Output buffer (3 floats)
void ParseLV4MeshFloatTriple(float* apOut);
void ParseLV4MeshFloatTriple(ai_real* apOut);
// -------------------------------------------------------------------
//! Parse a *MESH_TFACE block in a file
@ -568,7 +568,7 @@ private:
// -------------------------------------------------------------------
//! Parse a single float element
//! \param fOut Output float
void ParseLV4MeshFloat(float& fOut);
void ParseLV4MeshFloat(ai_real& fOut);
// -------------------------------------------------------------------
//! Parse a single int element

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderBMesh.h"
#include "BlenderTessellator.h"
#include <stddef.h>
#include <stddef.h>
static const unsigned int BLEND_TESS_MAGIC = 0x83ed9ac3;
@ -470,19 +470,19 @@ PlaneP2T BlenderTessellatorP2T::FindLLSQPlane( const std::vector< PointP2T >& po
{
PlaneP2T result;
aiVector3D sum( 0.0f );
aiVector3D sum( 0.0 );
for ( size_t i = 0; i < points.size( ); ++i )
{
sum += points[ i ].point3D;
}
result.centre = sum * ( 1.0f / points.size( ) );
result.centre = sum * (ai_real)( 1.0 / points.size( ) );
float sumXX = 0.0f;
float sumXY = 0.0f;
float sumXZ = 0.0f;
float sumYY = 0.0f;
float sumYZ = 0.0f;
float sumZZ = 0.0f;
ai_real sumXX = 0.0;
ai_real sumXY = 0.0;
ai_real sumXZ = 0.0;
ai_real sumYY = 0.0;
ai_real sumYZ = 0.0;
ai_real sumZZ = 0.0;
for ( size_t i = 0; i < points.size( ); ++i )
{
aiVector3D offset = points[ i ].point3D - result.centre;
@ -496,7 +496,7 @@ PlaneP2T BlenderTessellatorP2T::FindLLSQPlane( const std::vector< PointP2T >& po
aiMatrix3x3 mtx( sumXX, sumXY, sumXZ, sumXY, sumYY, sumYZ, sumXZ, sumYZ, sumZZ );
const float det = mtx.Determinant( );
const ai_real det = mtx.Determinant( );
if ( det == 0.0f )
{
result.normal = aiVector3D( 0.0f );

View File

@ -49,10 +49,10 @@ using namespace Assimp;
namespace {
const static aiVector3D base_axis_y(0.f,1.f,0.f);
const static aiVector3D base_axis_x(1.f,0.f,0.f);
const static aiVector3D base_axis_z(0.f,0.f,1.f);
const static float angle_epsilon = 0.95f;
const static aiVector3D base_axis_y(0.0,1.0,0.0);
const static aiVector3D base_axis_x(1.0,0.0,0.0);
const static aiVector3D base_axis_z(0.0,0.0,1.0);
const static ai_real angle_epsilon = 0.95;
}
// ------------------------------------------------------------------------------------------------
@ -81,9 +81,9 @@ bool ComputeUVMappingProcess::IsActive( unsigned int pFlags) const
inline bool PlaneIntersect(const aiRay& ray, const aiVector3D& planePos,
const aiVector3D& planeNormal, aiVector3D& pos)
{
const float b = planeNormal * (planePos - ray.pos);
float h = ray.dir * planeNormal;
if ((h < 10e-5f && h > -10e-5f) || (h = b/h) < 0)
const ai_real b = planeNormal * (planePos - ray.pos);
ai_real h = ray.dir * planeNormal;
if ((h < 10e-5 && h > -10e-5) || (h = b/h) < 0)
return false;
pos = ray.pos + (ray.dir * h);
@ -109,11 +109,11 @@ void RemoveUVSeams (aiMesh* mesh, aiVector3D* out)
// much easier, but I don't know how and am currently too tired to
// to think about a better solution.
const static float LOWER_LIMIT = 0.1f;
const static float UPPER_LIMIT = 0.9f;
const static ai_real LOWER_LIMIT = 0.1;
const static ai_real UPPER_LIMIT = 0.9;
const static float LOWER_EPSILON = 10e-3f;
const static float UPPER_EPSILON = 1.f-10e-3f;
const static ai_real LOWER_EPSILON = 10e-3;
const static ai_real UPPER_EPSILON = 1.0-10e-3;
for (unsigned int fidx = 0; fidx < mesh->mNumFaces;++fidx)
{
@ -156,12 +156,12 @@ void RemoveUVSeams (aiMesh* mesh, aiVector3D* out)
// If the u value is over the upper limit and no other u
// value of that face is 0, round it to 0
if (out[face.mIndices[n]].x > UPPER_LIMIT && !zero)
out[face.mIndices[n]].x = 0.f;
out[face.mIndices[n]].x = 0.0;
// If the u value is below the lower limit and no other u
// value of that face is 1, round it to 1
else if (out[face.mIndices[n]].x < LOWER_LIMIT && !one)
out[face.mIndices[n]].x = 1.f;
out[face.mIndices[n]].x = 1.0;
// The face contains both 0 and 1 as UV coords. This can occur
// for faces which have an edge that lies directly on the seam.
@ -171,9 +171,9 @@ void RemoveUVSeams (aiMesh* mesh, aiVector3D* out)
else if (one && zero)
{
if (round_to_zero && out[face.mIndices[n]].x >= UPPER_EPSILON)
out[face.mIndices[n]].x = 0.f;
out[face.mIndices[n]].x = 0.0;
else if (!round_to_zero && out[face.mIndices[n]].x <= LOWER_EPSILON)
out[face.mIndices[n]].x = 1.f;
out[face.mIndices[n]].x = 1.0;
}
}
}
@ -207,7 +207,7 @@ void ComputeUVMappingProcess::ComputeSphereMapping(aiMesh* mesh,const aiVector3D
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D diff = (mesh->mVertices[pnt]-center).Normalize();
out[pnt] = aiVector3D((atan2 (diff.z, diff.y) + AI_MATH_PI_F ) / AI_MATH_TWO_PI_F,
(std::asin (diff.x) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.f);
(std::asin (diff.x) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.0);
}
}
else if (axis * base_axis_y >= angle_epsilon) {
@ -215,7 +215,7 @@ void ComputeUVMappingProcess::ComputeSphereMapping(aiMesh* mesh,const aiVector3D
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D diff = (mesh->mVertices[pnt]-center).Normalize();
out[pnt] = aiVector3D((atan2 (diff.x, diff.z) + AI_MATH_PI_F ) / AI_MATH_TWO_PI_F,
(std::asin (diff.y) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.f);
(std::asin (diff.y) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.0);
}
}
else if (axis * base_axis_z >= angle_epsilon) {
@ -223,7 +223,7 @@ void ComputeUVMappingProcess::ComputeSphereMapping(aiMesh* mesh,const aiVector3D
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D diff = (mesh->mVertices[pnt]-center).Normalize();
out[pnt] = aiVector3D((atan2 (diff.y, diff.x) + AI_MATH_PI_F ) / AI_MATH_TWO_PI_F,
(std::asin (diff.z) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.f);
(std::asin (diff.z) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.0);
}
}
// slower code path in case the mapping axis is not one of the coordinate system axes
@ -235,7 +235,7 @@ void ComputeUVMappingProcess::ComputeSphereMapping(aiMesh* mesh,const aiVector3D
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D diff = ((mTrafo*mesh->mVertices[pnt])-center).Normalize();
out[pnt] = aiVector3D((atan2 (diff.y, diff.x) + AI_MATH_PI_F ) / AI_MATH_TWO_PI_F,
(asin (diff.z) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.f);
(asin (diff.z) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.0);
}
}
@ -257,7 +257,7 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
// thus changing the mapping axis)
if (axis * base_axis_x >= angle_epsilon) {
FindMeshCenter(mesh, center, min, max);
const float diff = max.x - min.x;
const ai_real diff = max.x - min.x;
// If the main axis is 'z', the z coordinate of a point 'p' is mapped
// directly to the texture V axis. The other axis is derived from
@ -268,12 +268,12 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
aiVector3D& uv = out[pnt];
uv.y = (pos.x - min.x) / diff;
uv.x = (atan2 ( pos.z - center.z, pos.y - center.y) +(float)AI_MATH_PI ) / (float)AI_MATH_TWO_PI;
uv.x = (atan2 ( pos.z - center.z, pos.y - center.y) +(ai_real)AI_MATH_PI ) / (ai_real)AI_MATH_TWO_PI;
}
}
else if (axis * base_axis_y >= angle_epsilon) {
FindMeshCenter(mesh, center, min, max);
const float diff = max.y - min.y;
const ai_real diff = max.y - min.y;
// just the same ...
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
@ -281,12 +281,12 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
aiVector3D& uv = out[pnt];
uv.y = (pos.y - min.y) / diff;
uv.x = (atan2 ( pos.x - center.x, pos.z - center.z) +(float)AI_MATH_PI ) / (float)AI_MATH_TWO_PI;
uv.x = (atan2 ( pos.x - center.x, pos.z - center.z) +(ai_real)AI_MATH_PI ) / (ai_real)AI_MATH_TWO_PI;
}
}
else if (axis * base_axis_z >= angle_epsilon) {
FindMeshCenter(mesh, center, min, max);
const float diff = max.z - min.z;
const ai_real diff = max.z - min.z;
// just the same ...
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
@ -294,7 +294,7 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
aiVector3D& uv = out[pnt];
uv.y = (pos.z - min.z) / diff;
uv.x = (atan2 ( pos.y - center.y, pos.x - center.x) +(float)AI_MATH_PI ) / (float)AI_MATH_TWO_PI;
uv.x = (atan2 ( pos.y - center.y, pos.x - center.x) +(ai_real)AI_MATH_PI ) / (ai_real)AI_MATH_TWO_PI;
}
}
// slower code path in case the mapping axis is not one of the coordinate system axes
@ -302,7 +302,7 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
aiMatrix4x4 mTrafo;
aiMatrix4x4::FromToMatrix(axis,base_axis_y,mTrafo);
FindMeshCenterTransformed(mesh, center, min, max,mTrafo);
const float diff = max.y - min.y;
const ai_real diff = max.y - min.y;
// again the same, except we're applying a transformation now
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt){
@ -310,7 +310,7 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
aiVector3D& uv = out[pnt];
uv.y = (pos.y - min.y) / diff;
uv.x = (atan2 ( pos.x - center.x, pos.z - center.z) +(float)AI_MATH_PI ) / (float)AI_MATH_TWO_PI;
uv.x = (atan2 ( pos.x - center.x, pos.z - center.z) +(ai_real)AI_MATH_PI ) / (ai_real)AI_MATH_TWO_PI;
}
}
@ -323,7 +323,7 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
// ------------------------------------------------------------------------------------------------
void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D& axis, aiVector3D* out)
{
float diffu,diffv;
ai_real diffu,diffv;
aiVector3D center, min, max;
// If the axis is one of x,y,z run a faster code path. It's worth the extra effort ...
@ -337,7 +337,7 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D&
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D& pos = mesh->mVertices[pnt];
out[pnt].Set((pos.z - min.z) / diffu,(pos.y - min.y) / diffv,0.f);
out[pnt].Set((pos.z - min.z) / diffu,(pos.y - min.y) / diffv,0.0);
}
}
else if (axis * base_axis_y >= angle_epsilon) {
@ -347,7 +347,7 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D&
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D& pos = mesh->mVertices[pnt];
out[pnt].Set((pos.x - min.x) / diffu,(pos.z - min.z) / diffv,0.f);
out[pnt].Set((pos.x - min.x) / diffu,(pos.z - min.z) / diffv,0.0);
}
}
else if (axis * base_axis_z >= angle_epsilon) {
@ -357,7 +357,7 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D&
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D& pos = mesh->mVertices[pnt];
out[pnt].Set((pos.y - min.y) / diffu,(pos.x - min.x) / diffv,0.f);
out[pnt].Set((pos.y - min.y) / diffu,(pos.x - min.x) / diffv,0.0);
}
}
// slower code path in case the mapping axis is not one of the coordinate system axes
@ -372,7 +372,7 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D&
// again the same, except we're applying a transformation now
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D pos = mTrafo * mesh->mVertices[pnt];
out[pnt].Set((pos.x - min.x) / diffu,(pos.z - min.z) / diffv,0.f);
out[pnt].Set((pos.x - min.x) / diffu,(pos.z - min.z) / diffv,0.0);
}
}

View File

@ -3037,7 +3037,7 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
next_pos.resize( inputs.size(), 0 );
for( KeyTimeList::value_type time : keys ) {
float result[ 3 ] = { def_value.x, def_value.y, def_value.z };
ai_real result[ 3 ] = { def_value.x, def_value.y, def_value.z };
for ( size_t i = 0; i < count; ++i ) {
const KeyFrameList& kfl = inputs[ i ];
@ -3060,7 +3060,7 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
// do the actual interpolation in double-precision arithmetics
// because it is a bit sensitive to rounding errors.
const double factor = timeB == timeA ? 0. : static_cast<double>( ( time - timeA ) / ( timeB - timeA ) );
const float interpValue = static_cast<float>( valueA + ( valueB - valueA ) * factor );
const ai_real interpValue = static_cast<ai_real>( valueA + ( valueB - valueA ) * factor );
result[ std::get<2>(kfl) ] = interpValue;
}

View File

@ -58,7 +58,7 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
FindInvalidDataProcess::FindInvalidDataProcess()
: configEpsilon(0.0f)
: configEpsilon(0.0)
{
// nothing to do here
}
@ -221,16 +221,16 @@ inline bool ProcessArray(T*& in, unsigned int num,const char* name,
// ------------------------------------------------------------------------------------------------
template <typename T>
AI_FORCE_INLINE bool EpsilonCompare(const T& n, const T& s, float epsilon);
AI_FORCE_INLINE bool EpsilonCompare(const T& n, const T& s, ai_real epsilon);
// ------------------------------------------------------------------------------------------------
AI_FORCE_INLINE bool EpsilonCompare(float n, float s, float epsilon) {
AI_FORCE_INLINE bool EpsilonCompare(ai_real n, ai_real s, ai_real epsilon) {
return std::fabs(n-s)>epsilon;
}
// ------------------------------------------------------------------------------------------------
template <>
bool EpsilonCompare<aiVectorKey>(const aiVectorKey& n, const aiVectorKey& s, float epsilon) {
bool EpsilonCompare<aiVectorKey>(const aiVectorKey& n, const aiVectorKey& s, ai_real epsilon) {
return
EpsilonCompare(n.mValue.x,s.mValue.x,epsilon) &&
EpsilonCompare(n.mValue.y,s.mValue.y,epsilon) &&
@ -239,7 +239,7 @@ bool EpsilonCompare<aiVectorKey>(const aiVectorKey& n, const aiVectorKey& s, flo
// ------------------------------------------------------------------------------------------------
template <>
bool EpsilonCompare<aiQuatKey>(const aiQuatKey& n, const aiQuatKey& s, float epsilon) {
bool EpsilonCompare<aiQuatKey>(const aiQuatKey& n, const aiQuatKey& s, ai_real epsilon) {
return
EpsilonCompare(n.mValue.x,s.mValue.x,epsilon) &&
EpsilonCompare(n.mValue.y,s.mValue.y,epsilon) &&
@ -249,7 +249,7 @@ bool EpsilonCompare<aiQuatKey>(const aiQuatKey& n, const aiQuatKey& s, float eps
// ------------------------------------------------------------------------------------------------
template <typename T>
inline bool AllIdentical(T* in, unsigned int num, float epsilon)
inline bool AllIdentical(T* in, unsigned int num, ai_real epsilon)
{
if (num <= 1) {
return true;

View File

@ -97,7 +97,7 @@ public:
void ProcessAnimationChannel (aiNodeAnim* anim);
private:
float configEpsilon;
ai_real configEpsilon;
};
} // end of namespace Assimp

View File

@ -207,54 +207,54 @@ void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMateri
// by six single planes with different textures, so we'll
// need to build six meshes.
const float l = 10.f; // the size used by Irrlicht
const ai_real l = 10.0; // the size used by Irrlicht
// FRONT SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex(-l,-l,-l, 0, 0, 1, 1.f,1.f),
SkyboxVertex( l,-l,-l, 0, 0, 1, 0.f,1.f),
SkyboxVertex( l, l,-l, 0, 0, 1, 0.f,0.f),
SkyboxVertex(-l, l,-l, 0, 0, 1, 1.f,0.f)) );
SkyboxVertex(-l,-l,-l, 0, 0, 1, 1.0,1.0),
SkyboxVertex( l,-l,-l, 0, 0, 1, 0.0,1.0),
SkyboxVertex( l, l,-l, 0, 0, 1, 0.0,0.0),
SkyboxVertex(-l, l,-l, 0, 0, 1, 1.0,0.0)) );
meshes.back()->mMaterialIndex = materials.size()-6u;
// LEFT SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex( l,-l,-l, -1, 0, 0, 1.f,1.f),
SkyboxVertex( l,-l, l, -1, 0, 0, 0.f,1.f),
SkyboxVertex( l, l, l, -1, 0, 0, 0.f,0.f),
SkyboxVertex( l, l,-l, -1, 0, 0, 1.f,0.f)) );
SkyboxVertex( l,-l,-l, -1, 0, 0, 1.0,1.0),
SkyboxVertex( l,-l, l, -1, 0, 0, 0.0,1.0),
SkyboxVertex( l, l, l, -1, 0, 0, 0.0,0.0),
SkyboxVertex( l, l,-l, -1, 0, 0, 1.0,0.0)) );
meshes.back()->mMaterialIndex = materials.size()-5u;
// BACK SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex( l,-l, l, 0, 0, -1, 1.f,1.f),
SkyboxVertex(-l,-l, l, 0, 0, -1, 0.f,1.f),
SkyboxVertex(-l, l, l, 0, 0, -1, 0.f,0.f),
SkyboxVertex( l, l, l, 0, 0, -1, 1.f,0.f)) );
SkyboxVertex( l,-l, l, 0, 0, -1, 1.0,1.0),
SkyboxVertex(-l,-l, l, 0, 0, -1, 0.0,1.0),
SkyboxVertex(-l, l, l, 0, 0, -1, 0.0,0.0),
SkyboxVertex( l, l, l, 0, 0, -1, 1.0,0.0)) );
meshes.back()->mMaterialIndex = materials.size()-4u;
// RIGHT SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex(-l,-l, l, 1, 0, 0, 1.f,1.f),
SkyboxVertex(-l,-l,-l, 1, 0, 0, 0.f,1.f),
SkyboxVertex(-l, l,-l, 1, 0, 0, 0.f,0.f),
SkyboxVertex(-l, l, l, 1, 0, 0, 1.f,0.f)) );
SkyboxVertex(-l,-l, l, 1, 0, 0, 1.0,1.0),
SkyboxVertex(-l,-l,-l, 1, 0, 0, 0.0,1.0),
SkyboxVertex(-l, l,-l, 1, 0, 0, 0.0,0.0),
SkyboxVertex(-l, l, l, 1, 0, 0, 1.0,0.0)) );
meshes.back()->mMaterialIndex = materials.size()-3u;
// TOP SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex( l, l,-l, 0, -1, 0, 1.f,1.f),
SkyboxVertex( l, l, l, 0, -1, 0, 0.f,1.f),
SkyboxVertex(-l, l, l, 0, -1, 0, 0.f,0.f),
SkyboxVertex(-l, l,-l, 0, -1, 0, 1.f,0.f)) );
SkyboxVertex( l, l,-l, 0, -1, 0, 1.0,1.0),
SkyboxVertex( l, l, l, 0, -1, 0, 0.0,1.0),
SkyboxVertex(-l, l, l, 0, -1, 0, 0.0,0.0),
SkyboxVertex(-l, l,-l, 0, -1, 0, 1.0,0.0)) );
meshes.back()->mMaterialIndex = materials.size()-2u;
// BOTTOM SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex( l,-l, l, 0, 1, 0, 0.f,0.f),
SkyboxVertex( l,-l,-l, 0, 1, 0, 1.f,0.f),
SkyboxVertex(-l,-l,-l, 0, 1, 0, 1.f,1.f),
SkyboxVertex(-l,-l, l, 0, 1, 0, 0.f,1.f)) );
SkyboxVertex( l,-l, l, 0, 1, 0, 0.0,0.0),
SkyboxVertex( l,-l,-l, 0, 1, 0, 1.0,0.0),
SkyboxVertex(-l,-l,-l, 0, 1, 0, 1.0,1.0),
SkyboxVertex(-l,-l, l, 0, 1, 0, 0.0,1.0)) );
meshes.back()->mMaterialIndex = materials.size()-1u;
}
@ -479,7 +479,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
aiVectorKey& key = anim->mPositionKeys[i];
key.mTime = i * tdelta;
const float t = (float) ( in.speed * key.mTime );
const ai_real t = (ai_real) ( in.speed * key.mTime );
key.mValue = in.circleCenter + in.circleRadius * ((vecU * std::cos(t)) + (vecV * std::sin(t)));
}
@ -498,7 +498,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
anim->mPositionKeys = new aiVectorKey[anim->mNumPositionKeys];
aiVector3D diff = in.direction - in.circleCenter;
const float lengthOfWay = diff.Length();
const ai_real lengthOfWay = diff.Length();
diff.Normalize();
const double timeFactor = lengthOfWay / in.timeForWay;
@ -507,7 +507,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
for (unsigned int i = 0; i < anim->mNumPositionKeys;++i) {
aiVectorKey& key = anim->mPositionKeys[i];
key.mTime = i * tdelta;
key.mValue = in.circleCenter + diff * float(timeFactor * key.mTime);
key.mValue = in.circleCenter + diff * ai_real(timeFactor * key.mTime);
}
}
break;
@ -542,8 +542,8 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
{
aiVectorKey& key = anim->mPositionKeys[i];
const float dt = (i * in.speed * 0.001f );
const float u = dt - std::floor(dt);
const ai_real dt = (i * in.speed * 0.001 );
const ai_real u = dt - std::floor(dt);
const int idx = (int)std::floor(dt) % size;
// get the 4 current points to evaluate the spline
@ -553,13 +553,13 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
const aiVector3D& p3 = in.splineKeys[ ClampSpline( idx + 2, size ) ].mValue;
// compute polynomials
const float u2 = u*u;
const float u3 = u2*2;
const ai_real u2 = u*u;
const ai_real u3 = u2*2;
const float h1 = 2.0f * u3 - 3.0f * u2 + 1.0f;
const float h2 = -2.0f * u3 + 3.0f * u3;
const float h3 = u3 - 2.0f * u3;
const float h4 = u3 - u2;
const ai_real h1 = 2.0 * u3 - 3.0 * u2 + 1.0;
const ai_real h2 = -2.0 * u3 + 3.0 * u3;
const ai_real h3 = u3 - 2.0 * u3;
const ai_real h4 = u3 - u2;
// compute the spline tangents
const aiVector3D t1 = ( p2 - p0 ) * in.tightness;

View File

@ -116,9 +116,9 @@ private:
explicit Animator(AT t = UNKNOWN)
: type (t)
, speed (0.001f)
, direction (0.f,1.f,0.f)
, circleRadius (1.f)
, speed (0.001)
, direction (0.0,1.0,0.0)
, circleRadius (1.0)
, tightness (0.5f)
, loop (true)
, timeForWay (100)
@ -127,15 +127,15 @@ private:
// common parameters
float speed;
ai_real speed;
aiVector3D direction;
// FLY_CIRCLE
aiVector3D circleCenter;
float circleRadius;
ai_real circleRadius;
// FOLLOW_SPLINE
float tightness;
ai_real tightness;
std::vector<aiVectorKey> splineKeys;
// ROTATION (angles given in direction)
@ -166,11 +166,11 @@ private:
explicit Node(ET t)
: type (t)
, scaling (1.f,1.f,1.f) // assume uniform scaling by default
, scaling (1.0,1.0,1.0) // assume uniform scaling by default
, parent()
, framesPerSecond (0.f)
, framesPerSecond (0.0)
, id()
, sphereRadius (1.f)
, sphereRadius (1.0)
, spherePolyCountX (100)
, spherePolyCountY (100)
{
@ -202,7 +202,7 @@ private:
// Animated meshes: frames per second
// 0.f if not specified
float framesPerSecond;
ai_real framesPerSecond;
// Meshes: path to the mesh to be loaded
std::string meshPath;
@ -213,7 +213,7 @@ private:
std::vector< std::pair<aiMaterial*, unsigned int> > materials;
// Spheres: radius of the sphere to be generates
float sphereRadius;
ai_real sphereRadius;
// Spheres: Number of polygons in the x,y direction
unsigned int spherePolyCountX,spherePolyCountY;
@ -230,13 +230,13 @@ private:
{}
//! Construction from single vertex components
SkyboxVertex(float px, float py, float pz,
float nx, float ny, float nz,
float uvx, float uvy)
SkyboxVertex(ai_real px, ai_real py, ai_real pz,
ai_real nx, ai_real ny, ai_real nz,
ai_real uvx, ai_real uvy)
: position (px,py,pz)
, normal (nx,ny,nz)
, uv (uvx,uvy,0.f)
, uv (uvx,uvy,0.0)
{}
aiVector3D position, normal, uv;

View File

@ -141,13 +141,13 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
aiVector3D v;
switch (texture.majorAxis) {
case Texture::AXIS_X:
v = aiVector3D(1.f,0.f,0.f);
v = aiVector3D(1.0,0.0,0.0);
break;
case Texture::AXIS_Y:
v = aiVector3D(0.f,1.f,0.f);
v = aiVector3D(0.0,1.0,0.0);
break;
default: // case Texture::AXIS_Z:
v = aiVector3D(0.f,0.f,1.f);
v = aiVector3D(0.0,0.0,1.0);
break;
}
@ -159,7 +159,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
trafo.mScaling.x = texture.wrapAmountW;
trafo.mScaling.y = texture.wrapAmountH;
static_assert(sizeof(aiUVTransform)/sizeof(float) == 5, "sizeof(aiUVTransform)/sizeof(float) == 5");
static_assert(sizeof(aiUVTransform)/sizeof(ai_real) == 5, "sizeof(aiUVTransform)/sizeof(ai_real) == 5");
pcMat->AddProperty(&trafo,1,AI_MATKEY_UVTRANSFORM(type,cur));
}
DefaultLogger::get()->debug("LWO2: Setting up non-UV mapping");
@ -286,17 +286,17 @@ void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat)
{
float fGloss;
if (mIsLWO2) {
fGloss = std::pow( surf.mGlossiness*10.0f+2.0f, 2.0f);
fGloss = std::pow( surf.mGlossiness*10.0+2.0, 2.0);
}
else
{
if (16.0f >= surf.mGlossiness)
fGloss = 6.0f;
else if (64.0f >= surf.mGlossiness)
fGloss = 20.0f;
else if (256.0f >= surf.mGlossiness)
fGloss = 50.0f;
else fGloss = 80.0f;
if (16.0 >= surf.mGlossiness)
fGloss = 6.0;
else if (64.0 >= surf.mGlossiness)
fGloss = 20.0;
else if (256.0 >= surf.mGlossiness)
fGloss = 50.0;
else fGloss = 80.0;
}
pcMat->AddProperty(&surf.mSpecularValue,1,AI_MATKEY_SHININESS_STRENGTH);
@ -306,17 +306,17 @@ void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat)
else m = aiShadingMode_Gouraud;
// specular color
aiColor3D clr = lerp( aiColor3D(1.f,1.f,1.f), surf.mColor, surf.mColorHighlights );
aiColor3D clr = lerp( aiColor3D(1.0,1.0,1.0), surf.mColor, surf.mColorHighlights );
pcMat->AddProperty(&clr,1,AI_MATKEY_COLOR_SPECULAR);
pcMat->AddProperty(&surf.mSpecularValue,1,AI_MATKEY_SHININESS_STRENGTH);
// emissive color
// luminosity is not really the same but it affects the surface in a similar way. Some scaling looks good.
clr.g = clr.b = clr.r = surf.mLuminosity*0.8f;
clr.g = clr.b = clr.r = surf.mLuminosity*0.8;
pcMat->AddProperty<aiColor3D>(&clr,1,AI_MATKEY_COLOR_EMISSIVE);
// opacity ... either additive or default-blended, please
if (0.f != surf.mAdditiveTransparency) {
if (0.0 != surf.mAdditiveTransparency) {
const int add = aiBlendMode_Additive;
pcMat->AddProperty(&surf.mAdditiveTransparency,1,AI_MATKEY_OPACITY);
@ -361,13 +361,13 @@ void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat)
DefaultLogger::get()->warn("LWO2: Unknown surface shader: " + shader.functionName);
}
}
if (surf.mMaximumSmoothAngle <= 0.0f)
if (surf.mMaximumSmoothAngle <= 0.0)
m = aiShadingMode_Flat;
pcMat->AddProperty((int*)&m,1,AI_MATKEY_SHADING_MODEL);
// (the diffuse value is just a scaling factor)
// If a diffuse texture is set, we set this value to 1.0
clr = (b && false ? aiColor3D(1.f,1.f,1.f) : surf.mColor);
clr = (b && false ? aiColor3D(1.0,1.0,1.0) : surf.mColor);
clr.r *= surf.mDiffuseValue;
clr.g *= surf.mDiffuseValue;
clr.b *= surf.mDiffuseValue;
@ -497,7 +497,7 @@ void LWOImporter::FindVCChannels(const LWO::Surface& surf, LWO::SortedRep& sorte
for (unsigned int n = 0; n < face.mNumIndices; ++n) {
unsigned int idx = face.mIndices[n];
if (vc.abAssigned[idx] && ((aiColor4D*)&vc.rawData[0])[idx] != aiColor4D(0.f,0.f,0.f,1.f)) {
if (vc.abAssigned[idx] && ((aiColor4D*)&vc.rawData[0])[idx] != aiColor4D(0.0,0.0,0.0,1.0)) {
if (next >= AI_MAX_NUMBER_OF_COLOR_SETS) {
DefaultLogger::get()->error("LWO: Maximum number of vertex color channels for "

View File

@ -136,7 +136,7 @@ struct Frame
aiVector3D origin;
//! radius of bounding sphere
float radius;
ai_real radius;
//! name of frame
char name[ AI_MD3_MAXFRAME ];
@ -154,7 +154,7 @@ struct Tag
//! Local tag origin and orientation
aiVector3D origin;
float orientation[3][3];
ai_real orientation[3][3];
} PACK_STRUCT;
@ -231,7 +231,7 @@ struct Triangle
struct TexCoord
{
//! UV coordinates
float U,V;
ai_real U,V;
} PACK_STRUCT;
@ -257,12 +257,12 @@ struct Vertex
*
* @note This has been taken from q3 source (misc_model.c)
*/
inline void LatLngNormalToVec3(uint16_t p_iNormal, float* p_afOut)
inline void LatLngNormalToVec3(uint16_t p_iNormal, ai_real* p_afOut)
{
float lat = (float)(( p_iNormal >> 8u ) & 0xff);
float lng = (float)(( p_iNormal & 0xff ));
lat *= 3.141926f/128.0f;
lng *= 3.141926f/128.0f;
ai_real lat = (ai_real)(( p_iNormal >> 8u ) & 0xff);
ai_real lng = (ai_real)(( p_iNormal & 0xff ));
lat *= 3.141926/128.0;
lng *= 3.141926/128.0;
p_afOut[0] = std::cos(lat) * std::sin(lng);
p_afOut[1] = std::sin(lat) * std::sin(lng);
@ -313,4 +313,3 @@ inline void Vec3NormalToLatLng( const aiVector3D& p_vIn, uint16_t& p_iOut )
}
#endif // !! AI_MD3FILEHELPER_H_INC

View File

@ -1018,7 +1018,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
// Convert the normal vector to uncompressed float3 format
aiVector3D& nor = pcMesh->mNormals[iCurrent];
LatLngNormalToVec3(pcVertices[pcTriangles->INDEXES[c]].NORMAL,(float*)&nor);
LatLngNormalToVec3(pcVertices[pcTriangles->INDEXES[c]].NORMAL,(ai_real*)&nor);
// Read texture coordinates
pcMesh->mTextureCoords[0][iCurrent].x = pcUVs[ pcTriangles->INDEXES[c]].U;

View File

@ -475,7 +475,7 @@ void MD5Importer::LoadMD5MeshFile ()
*pv = aiVector3D();
// there are models which have weights which don't sum to 1 ...
float fSum = 0.0f;
ai_real fSum = 0.0;
for (unsigned int jub = (*iter).mFirstWeight, w = jub; w < jub + (*iter).mNumWeights;++w)
fSum += meshSrc.mWeights[w].mWeight;
if (!fSum) {
@ -493,7 +493,7 @@ void MD5Importer::LoadMD5MeshFile ()
continue;
}
const float fNewWeight = desc.mWeight / fSum;
const ai_real fNewWeight = desc.mWeight / fSum;
// transform the local position into worldspace
MD5::BoneDesc& boneSrc = meshParser.mJoints[desc.mBone];
@ -501,7 +501,7 @@ void MD5Importer::LoadMD5MeshFile ()
// use the original weight to compute the vertex position
// (some MD5s seem to depend on the invalid weight values ...)
*pv += ((boneSrc.mPositionXYZ+v)* desc.mWeight);
*pv += ((boneSrc.mPositionXYZ+v)* (ai_real)desc.mWeight);
aiBone* bone = mesh->mBones[boneSrc.mMap];
*bone->mWeights++ = aiVertexWeight((unsigned int)(pv-mesh->mVertices),fNewWeight);

View File

@ -408,7 +408,7 @@ void MDCImporter::InternReadFile(
// copy texture coordinates
pcUVCur->x = pcUVs[quak].u;
pcUVCur->y = 1.0f-pcUVs[quak].v; // DX to OGL
pcUVCur->y = 1.0-pcUVs[quak].v; // DX to OGL
}
pcVertCur->x += pcFrame->localOrigin[0] ;
pcVertCur->y += pcFrame->localOrigin[1] ;

View File

@ -657,7 +657,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
if (is_not_qnan(clrTexture.r)) {
clrTemp.r *= clrTexture.a;
}
pcMatOut->AddProperty<float>(&clrTemp.r,1,AI_MATKEY_OPACITY);
pcMatOut->AddProperty<ai_real>(&clrTemp.r,1,AI_MATKEY_OPACITY);
// read phong power
int iShadingMode = (int)aiShadingMode_Gouraud;

View File

@ -965,7 +965,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
// compute the center point of the cone/cylinder -
// it is its local transformation origin
currentMesh.dir = center2-center1;
currentMesh.center = center1+currentMesh.dir/2.f;
currentMesh.center = center1+currentMesh.dir/(ai_real)2.0;
float f;
if (( f = currentMesh.dir.Length()) < 10e-3f )
@ -1159,7 +1159,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
++ppcChildren;
} else {
*pMeshes++ = m;
}
}
// copy vertex positions
mesh->mVertices = new aiVector3D[mesh->mNumVertices];

View File

@ -692,7 +692,7 @@ void PretransformVertices::Execute( aiScene* pScene)
aiVector3D d = max-min;
const ai_real div = std::max(d.x,std::max(d.y,d.z))*0.5;
d = min+d*0.5f;
d = min + d * (ai_real)0.5;
for (unsigned int a = 0; a < pScene->mNumMeshes; ++a) {
aiMesh* m = pScene->mMeshes[a];
for (unsigned int i = 0; i < m->mNumVertices;++i) {

View File

@ -77,8 +77,8 @@ void ConvertListToStrings(const std::string& in, std::list<std::string>& out)
void FindAABBTransformed (const aiMesh* mesh, aiVector3D& min, aiVector3D& max,
const aiMatrix4x4& m)
{
min = aiVector3D (10e10f, 10e10f, 10e10f);
max = aiVector3D (-10e10f,-10e10f,-10e10f);
min = aiVector3D (10e10, 10e10, 10e10);
max = aiVector3D (-10e10,-10e10,-10e10);
for (unsigned int i = 0;i < mesh->mNumVertices;++i)
{
const aiVector3D v = m * mesh->mVertices[i];
@ -91,7 +91,7 @@ void FindAABBTransformed (const aiMesh* mesh, aiVector3D& min, aiVector3D& max,
void FindMeshCenter (aiMesh* mesh, aiVector3D& out, aiVector3D& min, aiVector3D& max)
{
ArrayBounds(mesh->mVertices,mesh->mNumVertices, min,max);
out = min + (max-min)*0.5f;
out = min + (max-min)*(ai_real)0.5;
}
// -------------------------------------------------------------------------------
@ -114,7 +114,7 @@ void FindSceneCenter (aiScene* scene, aiVector3D& out, aiVector3D& min, aiVector
if (max[1] < tmax[1]) max[1] = tmax[1];
if (max[2] < tmax[2]) max[2] = tmax[2];
}
out = min + (max-min)*0.5f;
out = min + (max-min)*(ai_real)0.5;
}
@ -123,7 +123,7 @@ void FindMeshCenterTransformed (aiMesh* mesh, aiVector3D& out, aiVector3D& min,
aiVector3D& max, const aiMatrix4x4& m)
{
FindAABBTransformed(mesh,min,max,m);
out = min + (max-min)*0.5f;
out = min + (max-min)*(ai_real)0.5;
}
// -------------------------------------------------------------------------------

View File

@ -163,13 +163,13 @@ static aiColor3D ReadColor(StreamReaderLE* stream)
static void UnknownChunk(StreamReaderLE* stream, const SIBChunk& chunk)
{
char temp[5] = {
char temp[5] = {
static_cast<char>(( chunk.Tag>>24 ) & 0xff),
static_cast<char>(( chunk.Tag>>16 ) & 0xff),
static_cast<char>(( chunk.Tag>>8 ) & 0xff),
static_cast<char>(chunk.Tag & 0xff), '\0'
};
DefaultLogger::get()->warn((Formatter::format(), "SIB: Skipping unknown '",temp,"' chunk."));
}
@ -373,7 +373,7 @@ static void ConnectFaces(SIBMesh* mesh)
uint32_t *idx = &mesh->idx[mesh->faceStart[faceIdx]];
uint32_t numPoints = *idx++;
uint32_t prev = idx[(numPoints-1)*N+POS];
for (uint32_t i=0;i<numPoints;i++,idx+=N)
{
uint32_t next = idx[POS];
@ -398,7 +398,7 @@ static void ConnectFaces(SIBMesh* mesh)
static aiVector3D CalculateVertexNormal(SIBMesh* mesh, uint32_t faceIdx, uint32_t pos,
const std::vector<aiVector3D>& faceNormals)
{
// Creased edges complicate this. We need to find the start/end range of the
// Creased edges complicate this. We need to find the start/end range of the
// ring of faces that touch this position.
// We do this in two passes. The first pass is to find the end of the range,
// the second is to work backwards to the start and calculate the final normal.
@ -449,7 +449,7 @@ static aiVector3D CalculateVertexNormal(SIBMesh* mesh, uint32_t faceIdx, uint32_
prevFaceIdx = faceIdx;
faceIdx = nextFaceIdx;
}
}
}
// Normalize it.
@ -610,7 +610,7 @@ static void ReadShape(SIB* sib, StreamReaderLE* stream)
obj.name = name;
obj.axis = smesh.axis;
obj.meshIdx = sib->meshes.size();
// Now that we know the size of everything,
// we can build the final one-material-per-mesh data.
for (size_t n=0;n<meshes.size();n++)
@ -697,8 +697,8 @@ static void ReadLightInfo(aiLight* light, StreamReaderLE* stream)
light->mColorDiffuse = ReadColor(stream);
light->mColorAmbient = ReadColor(stream);
light->mColorSpecular = ReadColor(stream);
float spotExponent = stream->GetF4();
float spotCutoff = stream->GetF4();
ai_real spotExponent = stream->GetF4();
ai_real spotCutoff = stream->GetF4();
light->mAttenuationConstant = stream->GetF4();
light->mAttenuationLinear = stream->GetF4();
light->mAttenuationQuadratic = stream->GetF4();
@ -709,9 +709,9 @@ static void ReadLightInfo(aiLight* light, StreamReaderLE* stream)
// 99% and 1% percentiles.
// OpenGL: I = cos(angle)^E
// Solving: angle = acos(I^(1/E))
float E = 1.0f / std::max(spotExponent, 0.00001f);
float inner = acosf(powf(0.99f, E));
float outer = acosf(powf(0.01f, E));
ai_real E = 1.0 / std::max(spotExponent, (ai_real)0.00001);
ai_real inner = acos(pow((ai_real)0.99, E));
ai_real outer = acos(pow((ai_real)0.01, E));
// Apply the cutoff.
outer = std::min(outer, AI_DEG_TO_RAD(spotCutoff));

View File

@ -96,31 +96,31 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode)
// find a suitable coordinate system
const aiMatrix4x4& childTransform = pNode->mChildren[a]->mTransformation;
aiVector3D childpos( childTransform.a4, childTransform.b4, childTransform.c4);
float distanceToChild = childpos.Length();
if( distanceToChild < 0.0001f)
ai_real distanceToChild = childpos.Length();
if( distanceToChild < 0.0001)
continue;
aiVector3D up = aiVector3D( childpos).Normalize();
aiVector3D orth( 1.0f, 0.0f, 0.0f);
if( std::fabs( orth * up) > 0.99f)
orth.Set( 0.0f, 1.0f, 0.0f);
aiVector3D orth( 1.0, 0.0, 0.0);
if( std::fabs( orth * up) > 0.99)
orth.Set( 0.0, 1.0, 0.0);
aiVector3D front = (up ^ orth).Normalize();
aiVector3D side = (front ^ up).Normalize();
unsigned int localVertexStart = mVertices.size();
mVertices.push_back( -front * distanceToChild * 0.1f);
mVertices.push_back( -front * distanceToChild * (ai_real)0.1);
mVertices.push_back( childpos);
mVertices.push_back( -side * distanceToChild * 0.1f);
mVertices.push_back( -side * distanceToChild * 0.1f);
mVertices.push_back( -side * distanceToChild * (ai_real)0.1);
mVertices.push_back( -side * distanceToChild * (ai_real)0.1);
mVertices.push_back( childpos);
mVertices.push_back( front * distanceToChild * 0.1f);
mVertices.push_back( front * distanceToChild * 0.1f);
mVertices.push_back( front * distanceToChild * (ai_real)0.1);
mVertices.push_back( front * distanceToChild * (ai_real)0.1);
mVertices.push_back( childpos);
mVertices.push_back( side * distanceToChild * 0.1f);
mVertices.push_back( side * distanceToChild * 0.1f);
mVertices.push_back( side * distanceToChild * (ai_real)0.1);
mVertices.push_back( side * distanceToChild * (ai_real)0.1);
mVertices.push_back( childpos);
mVertices.push_back( -front * distanceToChild * 0.1f);
mVertices.push_back( -front * distanceToChild * (ai_real)0.1);
mFaces.push_back( Face( localVertexStart + 0, localVertexStart + 1, localVertexStart + 2));
mFaces.push_back( Face( localVertexStart + 3, localVertexStart + 4, localVertexStart + 5));
@ -132,33 +132,33 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode)
{
// if the node has no children, it's an end node. Put a little knob there instead
aiVector3D ownpos( pNode->mTransformation.a4, pNode->mTransformation.b4, pNode->mTransformation.c4);
float sizeEstimate = ownpos.Length() * 0.18f;
ai_real sizeEstimate = ownpos.Length() * 0.18;
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0f, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, sizeEstimate, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, 0.0f, -sizeEstimate));
mVertices.push_back( aiVector3D( 0.0f, sizeEstimate, 0.0f));
mVertices.push_back( aiVector3D( sizeEstimate, 0.0f, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, 0.0f, -sizeEstimate));
mVertices.push_back( aiVector3D( sizeEstimate, 0.0f, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, -sizeEstimate, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, 0.0f, -sizeEstimate));
mVertices.push_back( aiVector3D( 0.0f, -sizeEstimate, 0.0f));
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0f, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, 0.0f, -sizeEstimate));
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0, 0.0));
mVertices.push_back( aiVector3D( 0.0, sizeEstimate, 0.0));
mVertices.push_back( aiVector3D( 0.0, 0.0, -sizeEstimate));
mVertices.push_back( aiVector3D( 0.0, sizeEstimate, 0.0));
mVertices.push_back( aiVector3D( sizeEstimate, 0.0, 0.0));
mVertices.push_back( aiVector3D( 0.0, 0.0, -sizeEstimate));
mVertices.push_back( aiVector3D( sizeEstimate, 0.0, 0.0));
mVertices.push_back( aiVector3D( 0.0, -sizeEstimate, 0.0));
mVertices.push_back( aiVector3D( 0.0, 0.0, -sizeEstimate));
mVertices.push_back( aiVector3D( 0.0, -sizeEstimate, 0.0));
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0, 0.0));
mVertices.push_back( aiVector3D( 0.0, 0.0, -sizeEstimate));
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0f, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, 0.0f, sizeEstimate));
mVertices.push_back( aiVector3D( 0.0f, sizeEstimate, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, sizeEstimate, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, 0.0f, sizeEstimate));
mVertices.push_back( aiVector3D( sizeEstimate, 0.0f, 0.0f));
mVertices.push_back( aiVector3D( sizeEstimate, 0.0f, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, 0.0f, sizeEstimate));
mVertices.push_back( aiVector3D( 0.0f, -sizeEstimate, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, -sizeEstimate, 0.0f));
mVertices.push_back( aiVector3D( 0.0f, 0.0f, sizeEstimate));
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0f, 0.0f));
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0, 0.0));
mVertices.push_back( aiVector3D( 0.0, 0.0, sizeEstimate));
mVertices.push_back( aiVector3D( 0.0, sizeEstimate, 0.0));
mVertices.push_back( aiVector3D( 0.0, sizeEstimate, 0.0));
mVertices.push_back( aiVector3D( 0.0, 0.0, sizeEstimate));
mVertices.push_back( aiVector3D( sizeEstimate, 0.0, 0.0));
mVertices.push_back( aiVector3D( sizeEstimate, 0.0, 0.0));
mVertices.push_back( aiVector3D( 0.0, 0.0, sizeEstimate));
mVertices.push_back( aiVector3D( 0.0, -sizeEstimate, 0.0));
mVertices.push_back( aiVector3D( 0.0, -sizeEstimate, 0.0));
mVertices.push_back( aiVector3D( 0.0, 0.0, sizeEstimate));
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0, 0.0));
mFaces.push_back( Face( vertexStartIndex + 0, vertexStartIndex + 1, vertexStartIndex + 2));
mFaces.push_back( Face( vertexStartIndex + 3, vertexStartIndex + 4, vertexStartIndex + 5));
@ -187,7 +187,7 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode)
bone->mNumWeights = numVertices;
bone->mWeights = new aiVertexWeight[numVertices];
for( unsigned int a = 0; a < numVertices; a++)
bone->mWeights[a] = aiVertexWeight( vertexStartIndex + a, 1.0f);
bone->mWeights[a] = aiVertexWeight( vertexStartIndex + a, 1.0);
// HACK: (thom) transform all vertices to the bone's local space. Should be done before adding
// them to the array, but I'm tired now and I'm annoyed.
@ -232,8 +232,8 @@ aiMesh* SkeletonMeshBuilder::CreateMesh()
aiVector3D nor = ((mVertices[inface.mIndices[2]] - mVertices[inface.mIndices[0]]) ^
(mVertices[inface.mIndices[1]] - mVertices[inface.mIndices[0]]));
if (nor.Length() < 1e-5f) /* ensure that FindInvalidData won't remove us ...*/
nor = aiVector3D(1.f,0.f,0.f);
if (nor.Length() < 1e-5) /* ensure that FindInvalidData won't remove us ...*/
nor = aiVector3D(1.0,0.0,0.0);
for (unsigned int n = 0; n < 3; ++n)
mesh->mNormals[inface.mIndices[n]] = nor;

View File

@ -182,7 +182,7 @@ namespace {
// and then use them to work with ULPs (Units in the Last Place, for high-precision
// computations) or to compare them (integer comparisons are faster than floating-point
// comparisons on many platforms).
typedef signed int BinFloat;
typedef ai_int BinFloat;
// --------------------------------------------------------------------------------------------
// Converts the bit pattern of a floating-point number to its signed integer representation.
@ -308,7 +308,7 @@ void SpatialSort::FindIdenticalPositions( const aiVector3D& pPosition,
}
// ------------------------------------------------------------------------------------------------
unsigned int SpatialSort::GenerateMappingTable(std::vector<unsigned int>& fill,float pRadius) const
unsigned int SpatialSort::GenerateMappingTable(std::vector<unsigned int>& fill, ai_real pRadius) const
{
fill.resize(mPositions.size(),UINT_MAX);
ai_real dist, maxDist;

View File

@ -95,7 +95,7 @@ namespace Assimp {
void Subdivide(std::vector<aiVector3D>& positions)
{
// assume this to be constant - (fixme: must be 1.0? I think so)
const float fl1 = positions[0].Length();
const ai_real fl1 = positions[0].Length();
unsigned int origSize = (unsigned int)positions.size();
for (unsigned int i = 0 ; i < origSize ; i+=3)
@ -194,21 +194,21 @@ unsigned int StandardShapes::MakeIcosahedron(std::vector<aiVector3D>& positions)
{
positions.reserve(positions.size()+60);
const float t = (1.f + 2.236067977f)/2.f;
const float s = std::sqrt(1.f + t*t);
const ai_real t = (1.0 + 2.236067977)/2.0;
const ai_real s = std::sqrt(1.0 + t*t);
const aiVector3D v0 = aiVector3D(t,1.f, 0.f)/s;
const aiVector3D v1 = aiVector3D(-t,1.f, 0.f)/s;
const aiVector3D v2 = aiVector3D(t,-1.f, 0.f)/s;
const aiVector3D v3 = aiVector3D(-t,-1.f, 0.f)/s;
const aiVector3D v4 = aiVector3D(1.f, 0.f, t)/s;
const aiVector3D v5 = aiVector3D(1.f, 0.f,-t)/s;
const aiVector3D v6 = aiVector3D(-1.f, 0.f,t)/s;
const aiVector3D v7 = aiVector3D(-1.f, 0.f,-t)/s;
const aiVector3D v8 = aiVector3D(0.f, t, 1.f)/s;
const aiVector3D v9 = aiVector3D(0.f,-t, 1.f)/s;
const aiVector3D v10 = aiVector3D(0.f, t,-1.f)/s;
const aiVector3D v11 = aiVector3D(0.f,-t,-1.f)/s;
const aiVector3D v0 = aiVector3D(t,1.0, 0.0)/s;
const aiVector3D v1 = aiVector3D(-t,1.0, 0.0)/s;
const aiVector3D v2 = aiVector3D(t,-1.0, 0.0)/s;
const aiVector3D v3 = aiVector3D(-t,-1.0, 0.0)/s;
const aiVector3D v4 = aiVector3D(1.0, 0.0, t)/s;
const aiVector3D v5 = aiVector3D(1.0, 0.0,-t)/s;
const aiVector3D v6 = aiVector3D(-1.0, 0.0,t)/s;
const aiVector3D v7 = aiVector3D(-1.0, 0.0,-t)/s;
const aiVector3D v8 = aiVector3D(0.0, t, 1.0)/s;
const aiVector3D v9 = aiVector3D(0.0,-t, 1.0)/s;
const aiVector3D v10 = aiVector3D(0.0, t,-1.0)/s;
const aiVector3D v11 = aiVector3D(0.0,-t,-1.0)/s;
ADD_TRIANGLE(v0,v8,v4);
ADD_TRIANGLE(v0,v5,v10);
@ -244,9 +244,9 @@ unsigned int StandardShapes::MakeDodecahedron(std::vector<aiVector3D>& positions
{
positions.reserve(positions.size()+108);
const float a = 1.f / 1.7320508f;
const float b = std::sqrt((3.f-2.23606797f)/6.f);
const float c = std::sqrt((3.f+2.23606797f)/6.f);
const ai_real a = 1.0 / 1.7320508;
const ai_real b = std::sqrt((3.0-2.23606797f)/6.0);
const ai_real c = std::sqrt((3.0+2.23606797f)/6.0);
const aiVector3D v0 = aiVector3D(a,a,a);
const aiVector3D v1 = aiVector3D(a,a,-a);
@ -256,18 +256,18 @@ unsigned int StandardShapes::MakeDodecahedron(std::vector<aiVector3D>& positions
const aiVector3D v5 = aiVector3D(-a,a,-a);
const aiVector3D v6 = aiVector3D(-a,-a,a);
const aiVector3D v7 = aiVector3D(-a,-a,-a);
const aiVector3D v8 = aiVector3D(b,c,0.f);
const aiVector3D v9 = aiVector3D(-b,c,0.f);
const aiVector3D v10 = aiVector3D(b,-c,0.f);
const aiVector3D v11 = aiVector3D(-b,-c,0.f);
const aiVector3D v12 = aiVector3D(c, 0.f, b);
const aiVector3D v13 = aiVector3D(c, 0.f, -b);
const aiVector3D v14 = aiVector3D(-c, 0.f, b);
const aiVector3D v15 = aiVector3D(-c, 0.f, -b);
const aiVector3D v16 = aiVector3D(0.f, b, c);
const aiVector3D v17 = aiVector3D(0.f, -b, c);
const aiVector3D v18 = aiVector3D(0.f, b, -c);
const aiVector3D v19 = aiVector3D(0.f, -b, -c);
const aiVector3D v8 = aiVector3D(b,c,0.0);
const aiVector3D v9 = aiVector3D(-b,c,0.0);
const aiVector3D v10 = aiVector3D(b,-c,0.0);
const aiVector3D v11 = aiVector3D(-b,-c,0.0);
const aiVector3D v12 = aiVector3D(c, 0.0, b);
const aiVector3D v13 = aiVector3D(c, 0.0, -b);
const aiVector3D v14 = aiVector3D(-c, 0.0, b);
const aiVector3D v15 = aiVector3D(-c, 0.0, -b);
const aiVector3D v16 = aiVector3D(0.0, b, c);
const aiVector3D v17 = aiVector3D(0.0, -b, c);
const aiVector3D v18 = aiVector3D(0.0, b, -c);
const aiVector3D v19 = aiVector3D(0.0, -b, -c);
ADD_PENTAGON(v0, v8, v9, v4, v16);
ADD_PENTAGON(v0, v12, v13, v1, v8);
@ -291,12 +291,12 @@ unsigned int StandardShapes::MakeOctahedron(std::vector<aiVector3D>& positions)
{
positions.reserve(positions.size()+24);
const aiVector3D v0 = aiVector3D(1.0f, 0.f, 0.f) ;
const aiVector3D v1 = aiVector3D(-1.0f, 0.f, 0.f);
const aiVector3D v2 = aiVector3D(0.f, 1.0f, 0.f);
const aiVector3D v3 = aiVector3D(0.f, -1.0f, 0.f);
const aiVector3D v4 = aiVector3D(0.f, 0.f, 1.0f);
const aiVector3D v5 = aiVector3D(0.f, 0.f, -1.0f);
const aiVector3D v0 = aiVector3D(1.0, 0.0, 0.0) ;
const aiVector3D v1 = aiVector3D(-1.0, 0.0, 0.0);
const aiVector3D v2 = aiVector3D(0.0, 1.0, 0.0);
const aiVector3D v3 = aiVector3D(0.0, -1.0, 0.0);
const aiVector3D v4 = aiVector3D(0.0, 0.0, 1.0);
const aiVector3D v5 = aiVector3D(0.0, 0.0, -1.0);
ADD_TRIANGLE(v4,v0,v2);
ADD_TRIANGLE(v4,v2,v1);
@ -316,13 +316,13 @@ unsigned int StandardShapes::MakeTetrahedron(std::vector<aiVector3D>& positions)
{
positions.reserve(positions.size()+9);
const float a = 1.41421f/3.f;
const float b = 2.4494f/3.f;
const ai_real a = 1.41421/3.0;
const ai_real b = 2.4494/3.0;
const aiVector3D v0 = aiVector3D(0.f,0.f,1.f);
const aiVector3D v1 = aiVector3D(2*a,0,-1.f/3.f);
const aiVector3D v2 = aiVector3D(-a,b,-1.f/3.f);
const aiVector3D v3 = aiVector3D(-a,-b,-1.f/3.f);
const aiVector3D v0 = aiVector3D(0.0,0.0,1.0);
const aiVector3D v1 = aiVector3D(2*a,0,-1.0/3.0);
const aiVector3D v2 = aiVector3D(-a,b,-1.0/3.0);
const aiVector3D v3 = aiVector3D(-a,-b,-1.0/3.0);
ADD_TRIANGLE(v0,v1,v2);
ADD_TRIANGLE(v0,v2,v3);
@ -337,16 +337,16 @@ unsigned int StandardShapes::MakeHexahedron(std::vector<aiVector3D>& positions,
bool polygons /*= false*/)
{
positions.reserve(positions.size()+36);
const float length = 1.f/1.73205080f;
const ai_real length = 1.0/1.73205080;
const aiVector3D v0 = aiVector3D(-1.f,-1.f,-1.f)*length;
const aiVector3D v1 = aiVector3D(1.f,-1.f,-1.f)*length;
const aiVector3D v2 = aiVector3D(1.f,1.f,-1.f)*length;
const aiVector3D v3 = aiVector3D(-1.f,1.f,-1.f)*length;
const aiVector3D v4 = aiVector3D(-1.f,-1.f,1.f)*length;
const aiVector3D v5 = aiVector3D(1.f,-1.f,1.f)*length;
const aiVector3D v6 = aiVector3D(1.f,1.f,1.f)*length;
const aiVector3D v7 = aiVector3D(-1.f,1.f,1.f)*length;
const aiVector3D v0 = aiVector3D(-1.0,-1.0,-1.0)*length;
const aiVector3D v1 = aiVector3D(1.0,-1.0,-1.0)*length;
const aiVector3D v2 = aiVector3D(1.0,1.0,-1.0)*length;
const aiVector3D v3 = aiVector3D(-1.0,1.0,-1.0)*length;
const aiVector3D v4 = aiVector3D(-1.0,-1.0,1.0)*length;
const aiVector3D v5 = aiVector3D(1.0,-1.0,1.0)*length;
const aiVector3D v6 = aiVector3D(1.0,1.0,1.0)*length;
const aiVector3D v7 = aiVector3D(-1.0,1.0,1.0)*length;
ADD_QUAD(v0,v3,v2,v1);
ADD_QUAD(v0,v1,v5,v4);
@ -382,8 +382,8 @@ void StandardShapes::MakeSphere(unsigned int tess,
// ------------------------------------------------------------------------------------------------
// Build a cone
void StandardShapes::MakeCone(float height,float radius1,
float radius2,unsigned int tess,
void StandardShapes::MakeCone(ai_real height,ai_real radius1,
ai_real radius2,unsigned int tess,
std::vector<aiVector3D>& positions,bool bOpen /*= false */)
{
// Sorry, a cone with less than 3 segments makes ABSOLUTELY NO SENSE
@ -396,7 +396,7 @@ void StandardShapes::MakeCone(float height,float radius1,
radius1 = std::fabs(radius1);
radius2 = std::fabs(radius2);
float halfHeight = height / 2;
ai_real halfHeight = height / 2.0;
// radius1 is always the smaller one
if (radius2 > radius1)
@ -407,7 +407,7 @@ void StandardShapes::MakeCone(float height,float radius1,
else old = SIZE_MAX;
// Use a large epsilon to check whether the cone is pointy
if (radius1 < (radius2-radius1)*10e-3f)radius1 = 0.f;
if (radius1 < (radius2-radius1)*10e-3)radius1 = 0.0;
// We will need 3*2 verts per segment + 3*2 verts per segment
// if the cone is closed
@ -415,20 +415,20 @@ void StandardShapes::MakeCone(float height,float radius1,
positions.reserve(positions.size () + mem);
// Now construct all segments
const float angle_delta = (float)AI_MATH_TWO_PI / tess;
const float angle_max = (float)AI_MATH_TWO_PI;
const ai_real angle_delta = (ai_real)AI_MATH_TWO_PI / tess;
const ai_real angle_max = (ai_real)AI_MATH_TWO_PI;
float s = 1.f; // std::cos(angle == 0);
float t = 0.f; // std::sin(angle == 0);
ai_real s = 1.0; // std::cos(angle == 0);
ai_real t = 0.0; // std::sin(angle == 0);
for (float angle = 0.f; angle < angle_max; )
for (ai_real angle = 0.0; angle < angle_max; )
{
const aiVector3D v1 = aiVector3D (s * radius1, -halfHeight, t * radius1 );
const aiVector3D v2 = aiVector3D (s * radius2, halfHeight, t * radius2 );
const float next = angle + angle_delta;
float s2 = std::cos(next);
float t2 = std::sin(next);
const ai_real next = angle + angle_delta;
ai_real s2 = std::cos(next);
ai_real t2 = std::sin(next);
const aiVector3D v3 = aiVector3D (s2 * radius2, halfHeight, t2 * radius2 );
const aiVector3D v4 = aiVector3D (s2 * radius1, -halfHeight, t2 * radius1 );
@ -445,7 +445,7 @@ void StandardShapes::MakeCone(float height,float radius1,
// generate the end 'cap'
positions.push_back(aiVector3D(s * radius2, halfHeight, t * radius2 ));
positions.push_back(aiVector3D(s2 * radius2, halfHeight, t2 * radius2 ));
positions.push_back(aiVector3D(0.f, halfHeight, 0.f));
positions.push_back(aiVector3D(0.0, halfHeight, 0.0));
if (radius1)
@ -453,7 +453,7 @@ void StandardShapes::MakeCone(float height,float radius1,
// generate the other end 'cap'
positions.push_back(aiVector3D(s * radius1, -halfHeight, t * radius1 ));
positions.push_back(aiVector3D(s2 * radius1, -halfHeight, t2 * radius1 ));
positions.push_back(aiVector3D(0.f, -halfHeight, 0.f));
positions.push_back(aiVector3D(0.0, -halfHeight, 0.0));
}
}
@ -472,7 +472,7 @@ void StandardShapes::MakeCone(float height,float radius1,
// ------------------------------------------------------------------------------------------------
// Build a circle
void StandardShapes::MakeCircle(float radius, unsigned int tess,
void StandardShapes::MakeCircle(ai_real radius, unsigned int tess,
std::vector<aiVector3D>& positions)
{
// Sorry, a circle with less than 3 segments makes ABSOLUTELY NO SENSE
@ -484,21 +484,21 @@ void StandardShapes::MakeCircle(float radius, unsigned int tess,
// We will need 3 vertices per segment
positions.reserve(positions.size()+tess*3);
const float angle_delta = (float)AI_MATH_TWO_PI / tess;
const float angle_max = (float)AI_MATH_TWO_PI;
const ai_real angle_delta = (ai_real)AI_MATH_TWO_PI / tess;
const ai_real angle_max = (ai_real)AI_MATH_TWO_PI;
float s = 1.f; // std::cos(angle == 0);
float t = 0.f; // std::sin(angle == 0);
ai_real s = 1.0; // std::cos(angle == 0);
ai_real t = 0.0; // std::sin(angle == 0);
for (float angle = 0.f; angle < angle_max; )
for (ai_real angle = 0.0; angle < angle_max; )
{
positions.push_back(aiVector3D(s * radius,0.f,t * radius));
positions.push_back(aiVector3D(s * radius,0.0,t * radius));
angle += angle_delta;
s = std::cos(angle);
t = std::sin(angle);
positions.push_back(aiVector3D(s * radius,0.f,t * radius));
positions.push_back(aiVector3D(s * radius,0.0,t * radius));
positions.push_back(aiVector3D(0.f,0.f,0.f));
positions.push_back(aiVector3D(0.0,0.0,0.0));
}
}

View File

@ -174,8 +174,8 @@ public:
* no 'end caps'
* @param positions Receives output triangles
*/
static void MakeCone(float height,float radius1,
float radius2,unsigned int tess,
static void MakeCone(ai_real height,ai_real radius1,
ai_real radius2,unsigned int tess,
std::vector<aiVector3D>& positions,bool bOpen= false);
@ -189,7 +189,7 @@ public:
* @param tess Number of segments.
* @param positions Receives output triangles.
*/
static void MakeCircle(float radius, unsigned int tess,
static void MakeCircle(ai_real radius, unsigned int tess,
std::vector<aiVector3D>& positions);
};

View File

@ -83,7 +83,7 @@ KeyIterator::KeyIterator(const std::vector<aiVectorKey>* _objPos,
// ------------------------------------------------------------------------------------------------
template <class T>
inline T Interpolate(const T& one, const T& two, float val)
inline T Interpolate(const T& one, const T& two, ai_real val)
{
return one + (two-one)*val;
}
@ -134,7 +134,7 @@ void KeyIterator::operator ++()
const aiVectorKey& last = targetObjPos->at(nextTargetObjPos);
const aiVectorKey& first = targetObjPos->at(nextTargetObjPos-1);
curTargetPosition = Interpolate(first.mValue, last.mValue, (float) (
curTargetPosition = Interpolate(first.mValue, last.mValue, (ai_real) (
(curTime-first.mTime) / (last.mTime-first.mTime) ));
}
@ -155,7 +155,7 @@ void KeyIterator::operator ++()
const aiVectorKey& last = objPos->at(nextObjPos);
const aiVectorKey& first = objPos->at(nextObjPos-1);
curPosition = Interpolate(first.mValue, last.mValue, (float) (
curPosition = Interpolate(first.mValue, last.mValue, (ai_real) (
(curTime-first.mTime) / (last.mTime-first.mTime)));
}
@ -220,7 +220,7 @@ void TargetAnimationHelper::Process(std::vector<aiVectorKey>* distanceTrack)
// diff vector
aiVector3D diff = tposition - position;
float f = diff.Length();
ai_real f = diff.Length();
// output distance vector
if (f)

View File

@ -119,7 +119,7 @@ public:
/**
* @brief The upper limit for hints.
*/
static const unsigned int MaxLenHint = 200;
static const unsigned int MaxLenHint = 200;
public:
@ -224,7 +224,7 @@ public:
/** Set a floating-point configuration property.
* @see SetPropertyInteger()
*/
bool SetPropertyFloat(const char* szName, float fValue);
bool SetPropertyFloat(const char* szName, ai_real fValue);
// -------------------------------------------------------------------
/** Set a string configuration property.
@ -269,8 +269,8 @@ public:
/** Get a floating-point configuration property
* @see GetPropertyInteger()
*/
float GetPropertyFloat(const char* szName,
float fErrorReturn = 10e10f) const;
ai_real GetPropertyFloat(const char* szName,
ai_real fErrorReturn = 10e10) const;
// -------------------------------------------------------------------
/** Get a string configuration property

View File

@ -267,11 +267,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef AI_DOUBLE_PRECISION
typedef double ai_real;
typedef signed long long int ai_int;
/* Tiny macro to convert from radians to degrees and back */
#define AI_DEG_TO_RAD(x) ((x)*0.0174532925)
#define AI_RAD_TO_DEG(x) ((x)*57.2957795)
#else
typedef float ai_real;
typedef signed int ai_int;
/* Tiny macro to convert from radians to degrees and back */
#define AI_DEG_TO_RAD(x) ((x)*0.0174532925f)
#define AI_RAD_TO_DEG(x) ((x)*57.2957795f)

View File

@ -509,6 +509,14 @@ enum aiPropertyTypeInfo
*/
aiPTI_Float = 0x1,
/** Array of double-precision (64 Bit) floats
*
* It is possible to use aiGetMaterialInteger[Array]() (or the C++-API
* aiMaterial::Get()) to query properties stored in floating-point format.
* The material system performs the type conversion automatically.
*/
aiPTI_Double = 0x2,
/** The material property is an aiString.
*
* Arrays of strings aren't possible, aiGetMaterialString() (or the
@ -818,6 +826,12 @@ public:
unsigned int type = 0,
unsigned int index = 0);
aiReturn AddProperty (const double* pInput,
unsigned int pNumValues,
const char* pKey,
unsigned int type = 0,
unsigned int index = 0);
aiReturn AddProperty (const aiUVTransform* pInput,
unsigned int pNumValues,
const char* pKey,

View File

@ -201,6 +201,18 @@ inline aiReturn aiMaterial::AddProperty(const float* pInput,
pKey,type,index,aiPTI_Float);
}
// ---------------------------------------------------------------------------
inline aiReturn aiMaterial::AddProperty(const double* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
unsigned int index)
{
return AddBinaryProperty((const void*)pInput,
pNumValues * sizeof(float),
pKey,type,index,aiPTI_Double);
}
// ---------------------------------------------------------------------------
inline aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput,
const unsigned int pNumValues,

View File

@ -100,7 +100,7 @@ if(AddGTest_FOUND)
)
add_definitions(-DASSIMP_TEST_MODELS_DIR="${CMAKE_CURRENT_LIST_DIR}/models")
SET_PROPERTY( TARGET assimp PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX} )
add_dependencies( unit gtest )

View File

@ -49,45 +49,45 @@ class utMatrix4x4Test : public ::testing::Test {
TEST_F( utMatrix4x4Test, badIndexOperatorTest ) {
aiMatrix4x4 m;
float *a0 = m[ 4 ];
ai_real *a0 = m[ 4 ];
EXPECT_EQ( NULL, a0 );
}
TEST_F( utMatrix4x4Test, indexOperatorTest ) {
aiMatrix4x4 m;
float *a0 = m[ 0 ];
EXPECT_FLOAT_EQ( 1.0f, *a0 );
float *a1 = a0+1;
EXPECT_FLOAT_EQ( 0.0f, *a1 );
float *a2 = a0 + 2;
EXPECT_FLOAT_EQ( 0.0f, *a2 );
float *a3 = a0 + 3;
EXPECT_FLOAT_EQ( 0.0f, *a3 );
ai_real *a0 = m[ 0 ];
EXPECT_FLOAT_EQ( 1.0, *a0 );
ai_real *a1 = a0+1;
EXPECT_FLOAT_EQ( 0.0, *a1 );
ai_real *a2 = a0 + 2;
EXPECT_FLOAT_EQ( 0.0, *a2 );
ai_real *a3 = a0 + 3;
EXPECT_FLOAT_EQ( 0.0, *a3 );
float *a4 = m[ 1 ];
EXPECT_FLOAT_EQ( 0.0f, *a4 );
float *a5 = a4 + 1;
EXPECT_FLOAT_EQ( 1.0f, *a5 );
float *a6 = a4 + 2;
EXPECT_FLOAT_EQ( 0.0f, *a6 );
float *a7 = a4 + 3;
EXPECT_FLOAT_EQ( 0.0f, *a7 );
ai_real *a4 = m[ 1 ];
EXPECT_FLOAT_EQ( 0.0, *a4 );
ai_real *a5 = a4 + 1;
EXPECT_FLOAT_EQ( 1.0, *a5 );
ai_real *a6 = a4 + 2;
EXPECT_FLOAT_EQ( 0.0, *a6 );
ai_real *a7 = a4 + 3;
EXPECT_FLOAT_EQ( 0.0, *a7 );
float *a8 = m[ 2 ];
EXPECT_FLOAT_EQ( 0.0f, *a8 );
float *a9 = a8 + 1;
EXPECT_FLOAT_EQ( 0.0f, *a9 );
float *a10 = a8 + 2;
EXPECT_FLOAT_EQ( 1.0f, *a10 );
float *a11 = a8 + 3;
EXPECT_FLOAT_EQ( 0.0f, *a11 );
ai_real *a8 = m[ 2 ];
EXPECT_FLOAT_EQ( 0.0, *a8 );
ai_real *a9 = a8 + 1;
EXPECT_FLOAT_EQ( 0.0, *a9 );
ai_real *a10 = a8 + 2;
EXPECT_FLOAT_EQ( 1.0, *a10 );
ai_real *a11 = a8 + 3;
EXPECT_FLOAT_EQ( 0.0, *a11 );
float *a12 = m[ 3 ];
EXPECT_FLOAT_EQ( 0.0f, *a12 );
float *a13 = a12 + 1;
EXPECT_FLOAT_EQ( 0.0f, *a13 );
float *a14 = a12 + 2;
EXPECT_FLOAT_EQ( 0.0f, *a14 );
float *a15 = a12 + 3;
EXPECT_FLOAT_EQ( 1.0f, *a15 );
}
ai_real *a12 = m[ 3 ];
EXPECT_FLOAT_EQ( 0.0, *a12 );
ai_real *a13 = a12 + 1;
EXPECT_FLOAT_EQ( 0.0, *a13 );
ai_real *a14 = a12 + 2;
EXPECT_FLOAT_EQ( 0.0, *a14 );
ai_real *a15 = a12 + 3;
EXPECT_FLOAT_EQ( 1.0, *a15 );
}

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2016, 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
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
@ -25,16 +25,16 @@ conditions are met:
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
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
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
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
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.
---------------------------------------------------------------------------
*/
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Main.h"
const char* AICMD_MSG_INFO_HELP_E =
const char* AICMD_MSG_INFO_HELP_E =
"assimp info <file> [-r]\n"
"\tPrint basic structure of a 3D model\n"
"\t-r,--raw: No postprocessing, do a raw import\n";
@ -150,11 +150,11 @@ void FindSpecialPoints(const aiScene* scene,const aiNode* root,aiVector3D specia
// -----------------------------------------------------------------------------------
void FindSpecialPoints(const aiScene* scene,aiVector3D special_points[3])
{
special_points[0] = aiVector3D(1e10f,1e10f,1e10f);
special_points[1] = aiVector3D(-1e10f,-1e10f,-1e10f);
special_points[0] = aiVector3D(1e10,1e10,1e10);
special_points[1] = aiVector3D(-1e10,-1e10,-1e10);
FindSpecialPoints(scene,scene->mRootNode,special_points);
special_points[2] = 0.5f*(special_points[0]+special_points[1]);
special_points[2] = (special_points[0]+special_points[1])*(ai_real)0.5;
}
// -----------------------------------------------------------------------------------
@ -181,7 +181,7 @@ std::string FindPTypes(const aiScene* scene)
}
// -----------------------------------------------------------------------------------
void PrintHierarchy(const aiNode* root, unsigned int maxnest, unsigned int maxline,
void PrintHierarchy(const aiNode* root, unsigned int maxnest, unsigned int maxline,
unsigned int cline, unsigned int cnest=0)
{
if (cline++ >= maxline || cnest >= maxnest) {
@ -245,7 +245,7 @@ int Assimp_Info (const char* const* params, unsigned int num)
globalImporter->GetMemoryRequirements(mem);
static const char* format_string =
static const char* format_string =
"Memory consumption: %i B\n"
"Nodes: %i\n"
"Maximum depth %i\n"
@ -349,4 +349,3 @@ int Assimp_Info (const char* const* params, unsigned int num)
printf("\n");
return 0;
}