Merge pull request #1055 from assimp/issue_957

Fix compiler warnings related to issue 957.
pull/1056/head
Kim Kulling 2016-11-03 19:11:56 +01:00 committed by GitHub
commit c849e0108d
24 changed files with 113 additions and 106 deletions

View File

@ -369,14 +369,13 @@ struct Material
{
//! Default constructor. Builds a default name for the material
Material()
:
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.0),
mBumpHeight (1.0),
mTwoSided (false)
: mDiffuse ( ai_real( 0.6 ), ai_real( 0.6 ), ai_real( 0.6 ) ) // FIX ... we won't want object to be black
, mSpecularExponent ( ai_real( 0.0 ) )
, mShininessStrength ( ai_real( 1.0 ) )
, mShading(Discreet3DS::Gouraud)
, mTransparency ( ai_real( 1.0 ) )
, mBumpHeight ( ai_real( 1.0 ) )
, mTwoSided (false)
{
static int iCnt = 0;

View File

@ -1172,8 +1172,9 @@ void Discreet3DSImporter::ParseMaterialChunk()
// NOTE: transparency, not opacity
if (is_qnan(*pcf))
*pcf = 1.0;
else *pcf = 1.0 - *pcf * (ai_real)0xFFFF / 100.0;
*pcf = ai_real( 1.0 );
else
*pcf = ai_real( 1.0 ) - *pcf * (ai_real)0xFFFF / ai_real( 100.0 );
}
break;
@ -1202,8 +1203,9 @@ void Discreet3DSImporter::ParseMaterialChunk()
ai_real* pcf = &mScene->mMaterials.back().mShininessStrength;
*pcf = ParsePercentageChunk();
if (is_qnan(*pcf))
*pcf = 0.0;
else *pcf *= (ai_real)0xffff / 100.0;
*pcf = ai_real( 0.0 );
else
*pcf *= (ai_real)0xffff / ai_real( 100.0 );
}
break;
@ -1211,8 +1213,9 @@ void Discreet3DSImporter::ParseMaterialChunk()
{ // This is the self illumination strength of the material
ai_real f = ParsePercentageChunk();
if (is_qnan(f))
f = 0.0;
else f *= (ai_real)0xFFFF / 100.0;
f = ai_real( 0.0 );
else
f *= (ai_real)0xFFFF / ai_real( 100.0 );
mScene->mMaterials.back().mEmissive = aiColor3D(f,f,f);
}
break;
@ -1272,7 +1275,7 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut)
case Discreet3DS::CHUNK_PERCENTD:
// Manually parse the blend factor
pcOut->mTextureBlend = stream->GetF8();
pcOut->mTextureBlend = ai_real( stream->GetF8() );
break;
case Discreet3DS::CHUNK_PERCENTF:
@ -1282,7 +1285,7 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut)
case Discreet3DS::CHUNK_PERCENTW:
// Manually parse the blend factor
pcOut->mTextureBlend = (ai_real)((uint16_t)stream->GetI2()) / 100.0;
pcOut->mTextureBlend = (ai_real)((uint16_t)stream->GetI2()) / ai_real( 100.0 );
break;
case Discreet3DS::CHUNK_MAT_MAP_USCALE:
@ -1355,8 +1358,7 @@ ai_real Discreet3DSImporter::ParsePercentageChunk()
// ------------------------------------------------------------------------------------------------
// Read a color chunk. If a percentage chunk is found instead it is read as a grayscale color
void Discreet3DSImporter::ParseColorChunk(aiColor3D* out,
bool acceptPercent)
void Discreet3DSImporter::ParseColorChunk( aiColor3D* out, bool acceptPercent )
{
ai_assert(out != NULL);
@ -1389,13 +1391,16 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out,
case Discreet3DS::CHUNK_LINRGBB:
bGamma = true;
case Discreet3DS::CHUNK_RGBB:
if (sizeof(char) * 3 > diff) {
{
if ( sizeof( char ) * 3 > diff ) {
*out = clrError;
return;
}
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;
const ai_real invVal = ai_real( 1.0 ) / ai_real( 255.0 );
out->r = ( ai_real ) ( uint8_t ) stream->GetI1() * invVal;
out->g = ( ai_real ) ( uint8_t ) stream->GetI1() * invVal;
out->b = ( ai_real ) ( uint8_t ) stream->GetI1() * invVal;
}
break;
// Percentage chunks are accepted, too.
@ -1409,7 +1414,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out,
case Discreet3DS::CHUNK_PERCENTW:
if (acceptPercent && 1 <= diff) {
out->g = out->b = out->r = (ai_real)(uint8_t)stream->GetI1() / 255.0;
out->g = out->b = out->r = (ai_real)(uint8_t)stream->GetI1() / ai_real( 255.0 );
break;
}
*out = clrError;

View File

@ -227,7 +227,7 @@ std::string TextureConverted_ID;
// check that all textures has same size
if(src_texture_4check.size() > 1)
{
for(uint8_t i = 0, i_e = (src_texture_4check.size() - 1); i < i_e; i++)
for (size_t i = 0, i_e = (src_texture_4check.size() - 1); i < i_e; i++)
{
if((src_texture_4check[i]->Width != src_texture_4check[i + 1]->Width) || (src_texture_4check[i]->Height != src_texture_4check[i + 1]->Height) ||
(src_texture_4check[i]->Depth != src_texture_4check[i + 1]->Depth))

View File

@ -618,7 +618,8 @@ void Parser::ParseLV2MaterialBlock(ASE::Material& mat)
if (TokenMatch(filePtr,"MATERIAL_TRANSPARENCY",21))
{
ParseLV4MeshFloat(mat.mTransparency);
mat.mTransparency = 1.0 - mat.mTransparency;continue;
mat.mTransparency = ai_real( 1.0 ) - mat.mTransparency;
continue;
}
// material self illumination
if (TokenMatch(filePtr,"MATERIAL_SELFILLUM",18))

View File

@ -150,7 +150,7 @@ void ColladaExporter::WriteFile()
// Writes the asset header
void ColladaExporter::WriteHeader()
{
static const ai_real epsilon = 0.00001;
static const ai_real epsilon = ai_real( 0.00001 );
static const aiQuaternion x_rot(aiMatrix3x3(
0, -1, 0,
1, 0, 0,

View File

@ -1071,7 +1071,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
continue;
// resolve the data pointers for all anim channels. Find the minimum time while we're at it
ai_real startTime = 1e20, endTime = -1e20;
ai_real startTime = ai_real( 1e20 ), endTime = ai_real( -1e20 );
for( std::vector<Collada::ChannelEntry>::iterator it = entries.begin(); it != entries.end(); ++it)
{
Collada::ChannelEntry& e = *it;
@ -1152,7 +1152,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
resultTrafos.push_back( mat);
// find next point in time to evaluate. That's the closest frame larger than the current in any channel
ai_real nextTime = 1e20;
ai_real nextTime = ai_real( 1e20 );
for( std::vector<Collada::ChannelEntry>::iterator it = entries.begin(); it != entries.end(); ++it)
{
Collada::ChannelEntry& channelElement = *it;

View File

@ -3075,7 +3075,7 @@ aiMatrix4x4 ColladaParser::CalculateResultTransform( const std::vector<Transform
case TF_ROTATE:
{
aiMatrix4x4 rot;
ai_real angle = tf.f[3] * ai_real( AI_MATH_PI) / 180.0;
ai_real angle = tf.f[3] * ai_real( AI_MATH_PI) / ai_real( 180.0 );
aiVector3D axis( tf.f[0], tf.f[1], tf.f[2]);
aiMatrix4x4::Rotation( angle, axis, rot);
res *= rot;

View File

@ -52,7 +52,7 @@ namespace {
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;
const static ai_real angle_epsilon = ai_real( 0.95 );
}
// ------------------------------------------------------------------------------------------------
@ -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 ai_real LOWER_LIMIT = 0.1;
const static ai_real UPPER_LIMIT = 0.9;
const static ai_real LOWER_LIMIT = ai_real( 0.1 );
const static ai_real UPPER_LIMIT = ai_real( 0.9 );
const static ai_real LOWER_EPSILON = 10e-3;
const static ai_real UPPER_EPSILON = 1.0-10e-3;
const static ai_real LOWER_EPSILON = ai_real( 10e-3 );
const static ai_real UPPER_EPSILON = ai_real( 1.0-10e-3 );
for (unsigned int fidx = 0; fidx < mesh->mNumFaces;++fidx)
{

View File

@ -154,7 +154,7 @@ bool GenVertexNormalsProcess::GenMeshVertexNormals (aiMesh* pMesh, unsigned int
// check whether we can reuse the SpatialSort of a previous step.
SpatialSort* vertexFinder = NULL;
SpatialSort _vertexFinder;
ai_real posEpsilon = 1e-5;
ai_real posEpsilon = ai_real( 1e-5 );
if (shared) {
std::vector<std::pair<SpatialSort,ai_real> >* avf;
shared->GetProperty(AI_SPP_SPATIAL_SORT,avf);

View File

@ -542,7 +542,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
{
aiVectorKey& key = anim->mPositionKeys[i];
const ai_real dt = (i * in.speed * 0.001 );
const ai_real dt = (i * in.speed * ai_real( 0.001 ) );
const ai_real u = dt - std::floor(dt);
const int idx = (int)std::floor(dt) % size;
@ -556,9 +556,9 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
const ai_real u2 = u*u;
const ai_real u3 = u2*2;
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 h1 = ai_real( 2.0 ) * u3 - ai_real( 3.0 ) * u2 + ai_real( 1.0 );
const ai_real h2 = ai_real( -2.0 ) * u3 + ai_real( 3.0 ) * u3;
const ai_real h3 = u3 - ai_real( 2.0 ) * u3;
const ai_real h4 = u3 - u2;
// compute the spline tangents

View File

@ -116,10 +116,10 @@ private:
explicit Animator(AT t = UNKNOWN)
: type (t)
, speed (0.001)
, direction (0.0,1.0,0.0)
, circleRadius (1.0)
, tightness (0.5f)
, speed ( ai_real( 0.001 ) )
, direction ( ai_real( 0.0 ), ai_real( 1.0 ), ai_real( 0.0 ) )
, circleRadius ( ai_real( 1.0) )
, tightness ( ai_real( 0.5 ) )
, loop (true)
, timeForWay (100)
{

View File

@ -286,7 +286,7 @@ void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat)
{
float fGloss;
if (mIsLWO2) {
fGloss = std::pow( surf.mGlossiness*10.0+2.0, 2.0);
fGloss = std::pow( surf.mGlossiness*ai_real( 10.0 )+ ai_real( 2.0 ), ai_real( 2.0 ) );
}
else
{
@ -312,7 +312,7 @@ void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat)
// 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.8;
clr.g = clr.b = clr.r = surf.mLuminosity*ai_real( 0.8 );
pcMat->AddProperty<aiColor3D>(&clr,1,AI_MATKEY_COLOR_EMISSIVE);
// opacity ... either additive or default-blended, please

View File

@ -261,13 +261,13 @@ inline void LatLngNormalToVec3(uint16_t p_iNormal, ai_real* p_afOut)
{
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;
const ai_real invVal( ai_real( 1.0 ) / ai_real( 128.0 ) );
lat *= ai_real( 3.141926 ) * invVal;
lng *= ai_real( 3.141926 ) * invVal;
p_afOut[0] = std::cos(lat) * std::sin(lng);
p_afOut[1] = std::sin(lat) * std::sin(lng);
p_afOut[2] = std::cos(lng);
return;
p_afOut[ 0 ] = std::cos(lat) * std::sin(lng);
p_afOut[ 1 ] = std::sin(lat) * std::sin(lng);
p_afOut[ 2 ] = std::cos(lng);
}

View File

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

View File

@ -242,7 +242,7 @@ void OFFImporter::InternReadFile( const std::string& pFile,
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials];
aiMaterial* pcMat = new aiMaterial();
aiColor4D clr(0.6,0.6,0.6,1.0);
aiColor4D clr( ai_real( 0.6 ), ai_real( 0.6 ), ai_real( 0.6 ), ai_real( 1.0 ) );
pcMat->AddProperty(&clr,1,AI_MATKEY_COLOR_DIFFUSE);
pScene->mMaterials[0] = pcMat;

View File

@ -201,11 +201,11 @@ struct Material
//! Constructor
Material()
: diffuse (0.6,0.6,0.6)
, alpha (1.0)
, shineness (0.0)
: diffuse ( ai_real( 0.6 ), ai_real( 0.6 ), ai_real( 0.6 ) )
, alpha (ai_real( 1.0 ) )
, shineness ( ai_real( 0.0) )
, illumination_model (1)
, ior (1.0)
, ior ( ai_real( 1.0 ) )
{
// empty
for (size_t i = 0; i < TextureTypeCount; ++i)

View File

@ -93,7 +93,7 @@ void OgreImporter::ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIO
// Create materials that can be found and parsed via the IOSystem.
for (size_t i=0, len=mesh->NumSubMeshes(); i<len; ++i)
{
SubMeshXml *submesh = mesh->GetSubMesh(i);
SubMeshXml *submesh = mesh->GetSubMesh( static_cast<uint16_t>(i));
if (submesh && !submesh->materialRef.empty())
{
aiMaterial *material = ReadMaterial(pFile, pIOHandler, submesh->materialRef);

View File

@ -690,7 +690,7 @@ void PretransformVertices::Execute( aiScene* pScene)
// find the dominant axis
aiVector3D d = max-min;
const ai_real div = std::max(d.x,std::max(d.y,d.z))*0.5;
const ai_real div = std::max(d.x,std::max(d.y,d.z))*ai_real( 0.5);
d = min + d * (ai_real)0.5;
for (unsigned int a = 0; a < pScene->mNumMeshes; ++a) {

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 (10e10, 10e10, 10e10);
max = aiVector3D (-10e10,-10e10,-10e10);
min = aiVector3D ( ai_real( 10e10 ), ai_real( 10e10 ), ai_real( 10e10 ) );
max = aiVector3D ( ai_real( -10e10 ), ai_real( -10e10 ), ai_real( -10e10 ) );
for (unsigned int i = 0;i < mesh->mNumVertices;++i)
{
const aiVector3D v = m * mesh->mVertices[i];
@ -144,7 +144,7 @@ void FindMeshCenterTransformed (aiMesh* mesh, aiVector3D& out,
// -------------------------------------------------------------------------------
ai_real ComputePositionEpsilon(const aiMesh* pMesh)
{
const ai_real epsilon = 1e-4;
const ai_real epsilon = ai_real( 1e-4 );
// calculate the position bounds so we have a reliable epsilon to check position differences against
aiVector3D minVec, maxVec;
@ -157,7 +157,7 @@ ai_real ComputePositionEpsilon(const aiMesh* const* pMeshes, size_t num)
{
ai_assert( NULL != pMeshes );
const ai_real epsilon = 1e-4;
const ai_real epsilon = ai_real( 1e-4 );
// calculate the position bounds so we have a reliable epsilon to check position differences against
aiVector3D minVec, maxVec, mi, ma;

View File

@ -709,7 +709,7 @@ static void ReadLightInfo(aiLight* light, StreamReaderLE* stream)
// 99% and 1% percentiles.
// OpenGL: I = cos(angle)^E
// Solving: angle = acos(I^(1/E))
ai_real E = 1.0 / std::max(spotExponent, (ai_real)0.00001);
ai_real E = ai_real( 1.0 ) / std::max(spotExponent, (ai_real)0.00001);
ai_real inner = std::acos(std::pow((ai_real)0.99, E));
ai_real outer = std::acos(std::pow((ai_real)0.01, E));

View File

@ -168,8 +168,7 @@ void addFacesToMesh(aiMesh* pMesh)
// ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure.
void STLImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler)
void STLImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler )
{
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
@ -189,7 +188,7 @@ void STLImporter::InternReadFile( const std::string& pFile,
this->mBuffer = &mBuffer2[0];
// the default vertex color is light gray.
clrColorDefault.r = clrColorDefault.g = clrColorDefault.b = clrColorDefault.a = 0.6;
clrColorDefault.r = clrColorDefault.g = clrColorDefault.b = clrColorDefault.a = (ai_real) 0.6;
// allocate a single node
pScene->mRootNode = new aiNode();
@ -217,13 +216,13 @@ void STLImporter::InternReadFile( const std::string& pFile,
s.Set(AI_DEFAULT_MATERIAL_NAME);
pcMat->AddProperty(&s, AI_MATKEY_NAME);
aiColor4D clrDiffuse(0.6,0.6,0.6,1.0);
aiColor4D clrDiffuse(ai_real(0.6),ai_real(0.6),ai_real(0.6),ai_real(1.0));
if (bMatClr) {
clrDiffuse = clrColorDefault;
}
pcMat->AddProperty(&clrDiffuse,1,AI_MATKEY_COLOR_DIFFUSE);
pcMat->AddProperty(&clrDiffuse,1,AI_MATKEY_COLOR_SPECULAR);
clrDiffuse = aiColor4D(0.05,0.05,0.05,1.0);
clrDiffuse = aiColor4D( ai_real( 0.05), ai_real( 0.05), ai_real( 0.05), ai_real( 1.0));
pcMat->AddProperty(&clrDiffuse,1,AI_MATKEY_COLOR_AMBIENT);
pScene->mNumMaterials = 1;
@ -416,10 +415,11 @@ bool STLImporter::LoadBinaryFile()
// read the default vertex color for facets
bIsMaterialise = true;
DefaultLogger::get()->info("STL: Taking code path for Materialise files");
clrColorDefault.r = (*sz2++) / 255.0;
clrColorDefault.g = (*sz2++) / 255.0;
clrColorDefault.b = (*sz2++) / 255.0;
clrColorDefault.a = (*sz2++) / 255.0;
const ai_real invByte = (ai_real)1.0 / ( ai_real )255.0;
clrColorDefault.r = (*sz2++) * invByte;
clrColorDefault.g = (*sz2++) * invByte;
clrColorDefault.b = (*sz2++) * invByte;
clrColorDefault.a = (*sz2++) * invByte;
break;
}
}
@ -481,17 +481,18 @@ bool STLImporter::LoadBinaryFile()
}
aiColor4D* clr = &pMesh->mColors[0][i*3];
clr->a = 1.0;
const ai_real invVal( (ai_real)1.0 / ( ai_real )31.0 );
if (bIsMaterialise) // this is reversed
{
clr->r = (color & 0x31u) / 31.0;
clr->g = ((color & (0x31u<<5))>>5u) / 31.0;
clr->b = ((color & (0x31u<<10))>>10u) / 31.0;
clr->r = (color & 0x31u) *invVal;
clr->g = ((color & (0x31u<<5))>>5u) *invVal;
clr->b = ((color & (0x31u<<10))>>10u) *invVal;
}
else
{
clr->b = (color & 0x31u) / 31.0;
clr->g = ((color & (0x31u<<5))>>5u) / 31.0;
clr->r = ((color & (0x31u<<10))>>10u) / 31.0;
clr->b = (color & 0x31u) *invVal;
clr->g = ((color & (0x31u<<5))>>5u) *invVal;
clr->r = ((color & (0x31u<<10))>>10u) *invVal;
}
// assign the color to all vertices of the face
*(clr+1) = *clr;

View File

@ -132,7 +132,7 @@ 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);
ai_real sizeEstimate = ownpos.Length() * 0.18;
ai_real sizeEstimate = ownpos.Length() * ai_real( 0.18 );
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0, 0.0));
mVertices.push_back( aiVector3D( 0.0, sizeEstimate, 0.0));

View File

@ -193,8 +193,8 @@ unsigned int StandardShapes::MakeIcosahedron(std::vector<aiVector3D>& positions)
{
positions.reserve(positions.size()+60);
const ai_real t = (1.0 + 2.236067977)/2.0;
const ai_real s = std::sqrt(1.0 + t*t);
const ai_real t = ( ai_real( 1.0 )+ ai_real( 2.236067977 ) ) / ai_real( 2.0 );
const ai_real s = std::sqrt(ai_real(1.0) + t*t);
const aiVector3D v0 = aiVector3D(t,1.0, 0.0)/s;
const aiVector3D v1 = aiVector3D(-t,1.0, 0.0)/s;
@ -243,9 +243,9 @@ unsigned int StandardShapes::MakeDodecahedron(std::vector<aiVector3D>& positions
{
positions.reserve(positions.size()+108);
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 ai_real a = ai_real( 1.0 ) / ai_real(1.7320508);
const ai_real b = std::sqrt(( ai_real( 3.0 )- ai_real( 2.23606797))/ ai_real( 6.0) );
const ai_real c = std::sqrt(( ai_real( 3.0 )+ ai_real( 2.23606797f))/ ai_real( 6.0) );
const aiVector3D v0 = aiVector3D(a,a,a);
const aiVector3D v1 = aiVector3D(a,a,-a);
@ -315,13 +315,14 @@ unsigned int StandardShapes::MakeTetrahedron(std::vector<aiVector3D>& positions)
{
positions.reserve(positions.size()+9);
const ai_real a = 1.41421/3.0;
const ai_real b = 2.4494/3.0;
const ai_real invThree = ai_real( 1.0 ) / ai_real( 3.0 );
const ai_real a = ai_real( 1.41421 ) * invThree;
const ai_real b = ai_real( 2.4494 ) * invThree;
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);
const aiVector3D v1 = aiVector3D(2*a,0,-invThree );
const aiVector3D v2 = aiVector3D(-a,b,-invThree );
const aiVector3D v3 = aiVector3D(-a,-b,-invThree );
ADD_TRIANGLE(v0,v1,v2);
ADD_TRIANGLE(v0,v2,v3);
@ -336,7 +337,7 @@ unsigned int StandardShapes::MakeHexahedron(std::vector<aiVector3D>& positions,
bool polygons /*= false*/)
{
positions.reserve(positions.size()+36);
const ai_real length = 1.0/1.73205080;
const ai_real length = ai_real(1.0)/ai_real(1.73205080);
const aiVector3D v0 = aiVector3D(-1.0,-1.0,-1.0)*length;
const aiVector3D v1 = aiVector3D(1.0,-1.0,-1.0)*length;
@ -395,7 +396,7 @@ void StandardShapes::MakeCone(ai_real height,ai_real radius1,
radius1 = std::fabs(radius1);
radius2 = std::fabs(radius2);
ai_real halfHeight = height / 2.0;
ai_real halfHeight = height / ai_real(2.0);
// radius1 is always the smaller one
if (radius2 > radius1)

View File

@ -376,7 +376,7 @@ namespace o3dgc
if (quantMode == O3DGC_SC3DMC_DIAG_BB)
{
Real diag = 0.0;
Real diag = Real( 0.0 );
Real r;
for(unsigned long d = 0; d < dim; ++d)
{