pull/1085/head
Kim Kulling 2016-11-27 16:44:03 +01:00
commit 181f78687f
80 changed files with 402 additions and 382 deletions

View File

@ -690,7 +690,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,
pcOut->mChildren = new aiNode*[pcIn->mChildren.size()];
// Recursively process all children
const unsigned int size = pcIn->mChildren.size();
const unsigned int size = static_cast<unsigned int>(pcIn->mChildren.size());
for (unsigned int i = 0; i < size;++i)
{
pcOut->mChildren[i] = new aiNode();
@ -742,7 +742,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut)
DefaultLogger::get()->warn("No hierarchy information has been found in the file. ");
pcOut->mRootNode->mNumChildren = pcOut->mNumMeshes +
mScene->mCameras.size() + mScene->mLights.size();
static_cast<unsigned int>(mScene->mCameras.size() + mScene->mLights.size());
pcOut->mRootNode->mChildren = new aiNode* [ pcOut->mRootNode->mNumChildren ];
pcOut->mRootNode->mName.Set("<3DSDummyRoot>");

View File

@ -87,7 +87,7 @@ namespace {
const std::size_t chunk_size = head_pos - chunk_start_pos;
writer.SetCurrentPos(chunk_start_pos + SIZE_OFFSET);
writer.PutU4(chunk_size);
writer.PutU4(static_cast<uint32_t>(chunk_size));
writer.SetCurrentPos(head_pos);
}

View File

@ -343,12 +343,12 @@ void AMFImporter::Postprocess_AddMetadata(const std::list<CAMFImporter_NodeEleme
if(sceneNode.mMetaData != nullptr) throw DeadlyImportError("Postprocess. MetaData member in node are not nullptr. Something went wrong.");
// copy collected metadata to output node.
sceneNode.mMetaData = aiMetadata::Alloc( metadataList.size() );
sceneNode.mMetaData = aiMetadata::Alloc( static_cast<unsigned int>(metadataList.size()) );
size_t meta_idx( 0 );
for(const CAMFImporter_NodeElement_Metadata& metadata: metadataList)
{
sceneNode.mMetaData->Set(meta_idx++, metadata.Type, aiString(metadata.Value));
sceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx++), metadata.Type, aiString(metadata.Value));
}
}// if(!metadataList.empty())
}
@ -437,9 +437,9 @@ std::list<unsigned int> mesh_idx;
// create new face and store it.
complex_face.Face.mNumIndices = 3;
complex_face.Face.mIndices = new unsigned int[3];
complex_face.Face.mIndices[0] = tri_al.V[0];
complex_face.Face.mIndices[1] = tri_al.V[1];
complex_face.Face.mIndices[2] = tri_al.V[2];
complex_face.Face.mIndices[0] = static_cast<unsigned int>(tri_al.V[0]);
complex_face.Face.mIndices[1] = static_cast<unsigned int>(tri_al.V[1]);
complex_face.Face.mIndices[2] = static_cast<unsigned int>(tri_al.V[2]);
complex_faces_list.push_back(complex_face);
}
}// for(const CAMFImporter_NodeElement* ne_volume_child: ne_volume->Child)
@ -508,7 +508,7 @@ std::list<unsigned int> mesh_idx;
{
for(size_t vi = 0; vi < face.Face.mNumIndices; vi++)
{
if(face.Face.mIndices[vi] == pIdx_From) face.Face.mIndices[vi] = pIdx_To;
if(face.Face.mIndices[vi] == pIdx_From) face.Face.mIndices[vi] = static_cast<unsigned int>(pIdx_To);
}
}
};// auto VertexIndex_Replace = [](std::list<SComplexFace>& pFaceList, const size_t pIdx_From, const size_t pIdx_To) -> void
@ -563,7 +563,7 @@ std::list<unsigned int> mesh_idx;
// set geometry and colors (vertices)
//
// copy faces/triangles
tmesh->mNumFaces = face_list_cur.size();
tmesh->mNumFaces = static_cast<unsigned int>(face_list_cur.size());
tmesh->mFaces = new aiFace[tmesh->mNumFaces];
// Create vertices list and optimize indices. Optimisation mean following.In AMF all volumes use one big list of vertices. And one volume
@ -619,7 +619,7 @@ std::list<unsigned int> mesh_idx;
{
vert_arr.push_back(vert_arr.at(face_cur.Face.mIndices[idx_ind]));
col_arr.push_back(face_color);
face_cur.Face.mIndices[idx_ind] = vert_idx_new++;
face_cur.Face.mIndices[idx_ind] = static_cast<unsigned int>(vert_idx_new++);
}
}// if(face_cur.Color != nullptr)
}// for(const SComplexFace& face_cur: face_list_cur)
@ -639,10 +639,10 @@ std::list<unsigned int> mesh_idx;
for(size_t i = 0, i_e = VertexCount_Max * 2; i < i_e; i++) idx_vert_used[i] = false;
// This ID's will be used when set materials ID in scene.
tmesh->mMaterialIndex = PostprocessHelper_GetTextureID_Or_Create(face_list_cur.front().TexMap->TextureID_R,
tmesh->mMaterialIndex = static_cast<unsigned int>(PostprocessHelper_GetTextureID_Or_Create(face_list_cur.front().TexMap->TextureID_R,
face_list_cur.front().TexMap->TextureID_G,
face_list_cur.front().TexMap->TextureID_B,
face_list_cur.front().TexMap->TextureID_A);
face_list_cur.front().TexMap->TextureID_A));
texcoord_arr.resize(VertexCount_Max * 2);
for(const SComplexFace& face_cur: face_list_cur)
{
@ -662,7 +662,7 @@ std::list<unsigned int> mesh_idx;
vert_arr.push_back(vert_arr.at(idx_vert));
col_arr.push_back(col_arr.at(idx_vert));
texcoord_arr.at(idx_vert_new) = face_cur.TexMap->TextureCoordinate[idx_ind];
face_cur.Face.mIndices[idx_ind] = idx_vert_new++;
face_cur.Face.mIndices[idx_ind] = static_cast<unsigned int>(idx_vert_new++);
}
}// for(size_t idx_ind = 0; idx_ind < face_cur.Face.mNumIndices; idx_ind++)
}// for(const SComplexFace& face_cur: face_list_cur)
@ -675,7 +675,7 @@ std::list<unsigned int> mesh_idx;
//
// copy collected data to mesh
//
tmesh->mNumVertices = vert_arr.size();
tmesh->mNumVertices = static_cast<unsigned int>(vert_arr.size());
tmesh->mVertices = new aiVector3D[tmesh->mNumVertices];
tmesh->mColors[0] = new aiColor4D[tmesh->mNumVertices];
tmesh->mFaces = new aiFace[face_list_cur.size()];
@ -693,7 +693,7 @@ std::list<unsigned int> mesh_idx;
for(const SComplexFace& face_cur: face_list_cur) tmesh->mFaces[idx_face++] = face_cur.Face;
// store new aiMesh
mesh_idx.push_back(pMeshList.size());
mesh_idx.push_back(static_cast<unsigned int>(pMeshList.size()));
pMeshList.push_back(tmesh);
}// for(const std::list<SComplexFace>& face_list_cur: complex_faces_toplist)
}// if(ne_child->Type == CAMFImporter_NodeElement::ENET_Volume)
@ -704,7 +704,7 @@ std::list<unsigned int> mesh_idx;
{
std::list<unsigned int>::const_iterator mit = mesh_idx.begin();
pSceneNode.mNumMeshes = mesh_idx.size();
pSceneNode.mNumMeshes = static_cast<unsigned int>(mesh_idx.size());
pSceneNode.mMeshes = new unsigned int[pSceneNode.mNumMeshes];
for(size_t i = 0; i < pSceneNode.mNumMeshes; i++) pSceneNode.mMeshes[i] = *mit++;
}// if(mesh_idx.size() > 0)
@ -779,7 +779,7 @@ std::list<aiNode*> ch_node;
size_t ch_idx = 0;
con_node->mNumChildren = ch_node.size();
con_node->mNumChildren = static_cast<unsigned int>(ch_node.size());
con_node->mChildren = new aiNode*[con_node->mNumChildren];
for(aiNode* node: ch_node) con_node->mChildren[ch_idx++] = node;
@ -899,7 +899,7 @@ nl_clean_loop:
{
std::list<aiNode*>::const_iterator nl_it = node_list.begin();
pScene->mRootNode->mNumChildren = node_list.size();
pScene->mRootNode->mNumChildren = static_cast<unsigned int>(node_list.size());
pScene->mRootNode->mChildren = new aiNode*[pScene->mRootNode->mNumChildren];
for(size_t i = 0; i < pScene->mRootNode->mNumChildren; i++)
{
@ -916,14 +916,14 @@ nl_clean_loop:
{
std::list<aiMesh*>::const_iterator ml_it = mesh_list.begin();
pScene->mNumMeshes = mesh_list.size();
pScene->mNumMeshes = static_cast<unsigned int>(mesh_list.size());
pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
for(size_t i = 0; i < pScene->mNumMeshes; i++) pScene->mMeshes[i] = *ml_it++;
}// if(mesh_list.size() > 0)
//
// Textures
pScene->mNumTextures = mTexture_Converted.size();
pScene->mNumTextures = static_cast<unsigned int>(mTexture_Converted.size());
if(pScene->mNumTextures > 0)
{
size_t idx;
@ -933,8 +933,8 @@ nl_clean_loop:
for(const SPP_Texture& tex_convd: mTexture_Converted)
{
pScene->mTextures[idx] = new aiTexture;
pScene->mTextures[idx]->mWidth = tex_convd.Width;
pScene->mTextures[idx]->mHeight = tex_convd.Height;
pScene->mTextures[idx]->mWidth = static_cast<unsigned int>(tex_convd.Width);
pScene->mTextures[idx]->mHeight = static_cast<unsigned int>(tex_convd.Height);
pScene->mTextures[idx]->pcData = (aiTexel*)tex_convd.Data;
// texture format description.
strcpy(pScene->mTextures[idx]->achFormatHint, tex_convd.FormatHint);
@ -943,7 +943,7 @@ nl_clean_loop:
// Create materials for embedded textures.
idx = 0;
pScene->mNumMaterials = mTexture_Converted.size();
pScene->mNumMaterials = static_cast<unsigned int>(mTexture_Converted.size());
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials];
for(const SPP_Texture& tex_convd: mTexture_Converted)
{

View File

@ -737,7 +737,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
AssbinChunkWriter uncompressedStream( NULL, 0 );
WriteBinaryScene( &uncompressedStream, pScene );
uLongf uncompressedSize = uncompressedStream.Tell();
uLongf uncompressedSize = static_cast<uLongf>(uncompressedStream.Tell());
uLongf compressedSize = (uLongf)(uncompressedStream.Tell() * 1.001 + 12.);
uint8_t* compressedBuffer = new uint8_t[ compressedSize ];

View File

@ -659,7 +659,7 @@ void AssbinImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
if (compressed)
{
uLongf uncompressedSize = Read<uint32_t>(stream);
uLongf compressedSize = stream->FileSize() - stream->Tell();
uLongf compressedSize = static_cast<uLongf>(stream->FileSize() - stream->Tell());
unsigned char * compressedData = new unsigned char[ compressedSize ];
stream->Read( compressedData, 1, compressedSize );

View File

@ -331,7 +331,7 @@ void B3DImporter::ReadVRTS(){
int sz=12+(_vflags&1?12:0)+(_vflags&2?16:0)+(_tcsets*_tcsize*4);
int n_verts=ChunkSize()/sz;
int v0=_vertices.size();
int v0=static_cast<int>(_vertices.size());
_vertices.resize( v0+n_verts );
for( int i=0;i<n_verts;++i ){
@ -404,7 +404,7 @@ void B3DImporter::ReadTRIS( int v0 ){
void B3DImporter::ReadMESH(){
/*int matid=*/ReadInt();
int v0=_vertices.size();
int v0= static_cast<int>(_vertices.size());
while( ChunkSize() ){
string t=ReadChunk();
@ -462,17 +462,17 @@ void B3DImporter::ReadKEYS( aiNodeAnim *nodeAnim ){
}
if( flags & 1 ){
nodeAnim->mNumPositionKeys=trans.size();
nodeAnim->mNumPositionKeys=static_cast<unsigned int>(trans.size());
nodeAnim->mPositionKeys=to_array( trans );
}
if( flags & 2 ){
nodeAnim->mNumScalingKeys=scale.size();
nodeAnim->mNumScalingKeys=static_cast<unsigned int>(scale.size());
nodeAnim->mScalingKeys=to_array( scale );
}
if( flags & 4 ){
nodeAnim->mNumRotationKeys=rot.size();
nodeAnim->mNumRotationKeys=static_cast<unsigned int>(rot.size());
nodeAnim->mRotationKeys=to_array( rot );
}
}
@ -506,7 +506,7 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){
aiMatrix4x4 tform=trans * rot * scale;
int nodeid=_nodes.size();
int nodeid=static_cast<int>(_nodes.size());
aiNode *node=new aiNode( name );
_nodes.push_back( node );
@ -521,9 +521,9 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){
while( ChunkSize() ){
string t=ReadChunk();
if( t=="MESH" ){
int n=_meshes.size();
unsigned int n= static_cast<unsigned int>(_meshes.size());
ReadMESH();
for( int i=n;i<(int)_meshes.size();++i ){
for( unsigned int i=n;i<static_cast<unsigned int>(_meshes.size());++i ){
meshes.push_back( i );
}
}else if( t=="BONE" ){
@ -544,10 +544,10 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){
ExitChunk();
}
node->mNumMeshes=meshes.size();
node->mNumMeshes= static_cast<unsigned int>(meshes.size());
node->mMeshes=to_array( meshes );
node->mNumChildren=children.size();
node->mNumChildren=static_cast<unsigned int>(children.size());
node->mChildren=to_array( children );
return node;
@ -645,7 +645,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
aiNode *bnode=_nodes[i];
bone->mName=bnode->mName;
bone->mNumWeights=weights.size();
bone->mNumWeights= static_cast<unsigned int>(weights.size());
bone->mWeights=to_array( weights );
aiMatrix4x4 mat=bnode->mTransformation;
@ -655,7 +655,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
}
bone->mOffsetMatrix=mat.Inverse();
}
mesh->mNumBones=bones.size();
mesh->mNumBones= static_cast<unsigned int>(bones.size());
mesh->mBones=to_array( bones );
}
}
@ -667,21 +667,21 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
if( !_materials.size() ){
_materials.push_back( new aiMaterial );
}
scene->mNumMaterials=_materials.size();
scene->mNumMaterials= static_cast<unsigned int>(_materials.size());
scene->mMaterials=to_array( _materials );
//meshes
scene->mNumMeshes=_meshes.size();
scene->mNumMeshes= static_cast<unsigned int>(_meshes.size());
scene->mMeshes=to_array( _meshes );
//animations
if( _animations.size()==1 && _nodeAnims.size() ){
aiAnimation *anim=_animations.back();
anim->mNumChannels=_nodeAnims.size();
anim->mNumChannels=static_cast<unsigned int>(_nodeAnims.size());
anim->mChannels=to_array( _nodeAnims );
scene->mNumAnimations=_animations.size();
scene->mNumAnimations=static_cast<unsigned int>(_animations.size());
scene->mAnimations=to_array( _animations );
}

View File

@ -237,7 +237,7 @@ aiNode* BVHLoader::ReadNode()
// add the child nodes if there are any
if( childNodes.size() > 0)
{
node->mNumChildren = childNodes.size();
node->mNumChildren = static_cast<unsigned int>(childNodes.size());
node->mChildren = new aiNode*[node->mNumChildren];
std::copy( childNodes.begin(), childNodes.end(), node->mChildren);
}
@ -443,7 +443,7 @@ void BVHLoader::CreateAnimation( aiScene* pScene)
anim->mDuration = double( mAnimNumFrames - 1);
// now generate the tracks for all nodes
anim->mNumChannels = mNodes.size();
anim->mNumChannels = static_cast<unsigned int>(mNodes.size());
anim->mChannels = new aiNodeAnim*[anim->mNumChannels];
// FIX: set the array elements to NULL to ensure proper deletion if an exception is thrown

View File

@ -180,7 +180,7 @@ void BlenderBMeshConverter::AddFace( int v1, int v2, int v3, int v4 )
// TODO - Work out how materials work
face.mat_nr = 0;
triMesh->mface.push_back( face );
triMesh->totface = triMesh->mface.size( );
triMesh->totface = static_cast<int>(triMesh->mface.size( ));
}
// ------------------------------------------------------------------------------------------------

View File

@ -59,6 +59,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StreamReader.h"
#include "MemoryIOWrapper.h"
#include <cctype>
#include <cstdint>
// zlib is needed for compressed blend files
@ -423,7 +424,7 @@ void BlenderImporter::ResolveImage(aiMaterial* out, const Material* mat, const M
// check if the file contents are bundled with the BLEND file
if (img->packedfile) {
name.data[0] = '*';
name.length = 1+ ASSIMP_itoa10(name.data+1,MAXLEN-1,conv_data.textures->size());
name.length = 1+ ASSIMP_itoa10(name.data+1,static_cast<unsigned int>(MAXLEN-1), static_cast<int32_t>(conv_data.textures->size()));
conv_data.textures->push_back(new aiTexture());
aiTexture* tex = conv_data.textures->back();
@ -1230,7 +1231,7 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers
if (conv_data.meshes->size() > old) {
node->mMeshes = new unsigned int[node->mNumMeshes = static_cast<unsigned int>(conv_data.meshes->size()-old)];
for (unsigned int i = 0; i < node->mNumMeshes; ++i) {
node->mMeshes[i] = i + old;
node->mMeshes[i] = static_cast<unsigned int>(i + old);
}
}}
break;

View File

@ -412,9 +412,9 @@ float BlenderTessellatorP2T::FindLargestMatrixElem( const aiMatrix3x3& mtx ) con
{
float result = 0.0f;
for ( size_t x = 0; x < 3; ++x )
for ( unsigned int x = 0; x < 3; ++x )
{
for ( size_t y = 0; y < 3; ++y )
for ( unsigned int y = 0; y < 3; ++y )
{
result = p2tMax( std::fabs( mtx[ x ][ y ] ), result );
}
@ -429,9 +429,9 @@ aiMatrix3x3 BlenderTessellatorP2T::ScaleMatrix( const aiMatrix3x3& mtx, float sc
{
aiMatrix3x3 result;
for ( size_t x = 0; x < 3; ++x )
for ( unsigned int x = 0; x < 3; ++x )
{
for ( size_t y = 0; y < 3; ++y )
for ( unsigned int y = 0; y < 3; ++y )
{
result[ x ][ y ] = mtx[ x ][ y ] * scale;
}

View File

@ -181,7 +181,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
if (n->type == Node::TYPE_MESH) {
Mesh& mesh = (Mesh&)(*n.get());
if (mesh.vertex_positions.size() && mesh.texture_coords.size()) {
pScene->mNumMeshes += mesh.temp_map.size();
pScene->mNumMeshes += static_cast<unsigned int>(mesh.temp_map.size());
}
}
}

View File

@ -179,7 +179,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
nda->mNodeName.length = (size_t)(ot-nda->mNodeName.data);
}
anim->mNumChannels = anims_temp.size();
anim->mNumChannels = static_cast<unsigned int>(anims_temp.size());
if (!anim->mNumChannels)
throw DeadlyImportError("CSM: Empty $order section");

View File

@ -524,7 +524,7 @@ void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial*
} else
{
if( pKey )
poSurface.exist = pSrcMat->Get( pKey, pType, pIndex, poSurface.color) == aiReturn_SUCCESS;
poSurface.exist = pSrcMat->Get( pKey, static_cast<unsigned int>(pType), static_cast<unsigned int>(pIndex), poSurface.color) == aiReturn_SUCCESS;
}
}
@ -691,7 +691,7 @@ void ColladaExporter::WriteMaterials()
materials[a].shininess.exist = mat->Get( AI_MATKEY_SHININESS, materials[a].shininess.value) == aiReturn_SUCCESS;
materials[a].transparency.exist = mat->Get( AI_MATKEY_OPACITY, materials[a].transparency.value) == aiReturn_SUCCESS;
materials[a].transparency.value = 1 - materials[a].transparency.value;
materials[a].transparency.value = materials[a].transparency.value;
materials[a].index_refraction.exist = mat->Get( AI_MATKEY_REFRACTI, materials[a].index_refraction.value) == aiReturn_SUCCESS;
}
@ -827,7 +827,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
// texture coords
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a)
{
if( mesh->HasTextureCoords( a) )
if( mesh->HasTextureCoords(static_cast<unsigned int>(a)) )
{
WriteFloatArray( idstr + "-tex" + to_string(a), mesh->mNumUVComponents[a] == 3 ? FloatType_TexCoord3 : FloatType_TexCoord2,
(ai_real*) mesh->mTextureCoords[a], mesh->mNumVertices);
@ -837,7 +837,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
// vertex colors
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a)
{
if( mesh->HasVertexColors( a) )
if( mesh->HasVertexColors(static_cast<unsigned int>(a)) )
WriteFloatArray( idstr + "-color" + to_string(a), FloatType_Color, (ai_real*) mesh->mColors[a], mesh->mNumVertices);
}
@ -849,12 +849,12 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
mOutput << startstr << "<input semantic=\"NORMAL\" source=\"#" << idstrEscaped << "-normals\" />" << endstr;
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
{
if( mesh->HasTextureCoords( a) )
if( mesh->HasTextureCoords(static_cast<unsigned int>(a)) )
mOutput << startstr << "<input semantic=\"TEXCOORD\" source=\"#" << idstrEscaped << "-tex" << a << "\" " /*<< "set=\"" << a << "\"" */ << " />" << endstr;
}
for( size_t a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a )
{
if( mesh->HasVertexColors( a) )
if( mesh->HasVertexColors(static_cast<unsigned int>(a) ) )
mOutput << startstr << "<input semantic=\"COLOR\" source=\"#" << idstrEscaped << "-color" << a << "\" " /*<< set=\"" << a << "\"" */ << " />" << endstr;
}
@ -899,7 +899,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
mOutput << startstr << "<input offset=\"0\" semantic=\"VERTEX\" source=\"#" << idstrEscaped << "-vertices\" />" << endstr;
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
{
if( mesh->HasTextureCoords( a) )
if( mesh->HasTextureCoords(static_cast<unsigned int>(a) ) )
mOutput << startstr << "<input offset=\"0\" semantic=\"TEXCOORD\" source=\"#" << idstrEscaped << "-tex" << a << "\" set=\"" << a << "\" />" << endstr;
}
@ -1129,7 +1129,7 @@ void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode)
PushTag();
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
{
if( mesh->HasTextureCoords( a) )
if( mesh->HasTextureCoords( static_cast<unsigned int>(a) ) )
// semantic as in <texture texcoord=...>
// input_semantic as in <input semantic=...>
// input_set as in <input set=...>

View File

@ -58,6 +58,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "time.h"
#include "math.h"
#include <algorithm>
#include <cstdint>
#include <numeric>
#include "Defines.h"
@ -240,7 +242,7 @@ aiNode* ColladaLoader::BuildHierarchy( const ColladaParser& pParser, const Colla
ResolveNodeInstances(pParser,pNode,instances);
// add children. first the *real* ones
node->mNumChildren = pNode->mChildren.size()+instances.size();
node->mNumChildren = static_cast<unsigned int>(pNode->mChildren.size()+instances.size());
node->mChildren = new aiNode*[node->mNumChildren];
for( size_t a = 0; a < pNode->mChildren.size(); a++)
@ -506,7 +508,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
std::map<std::string, size_t>::const_iterator matIt = mMaterialIndexByName.find( meshMaterial);
unsigned int matIdx;
if( matIt != mMaterialIndexByName.end())
matIdx = matIt->second;
matIdx = static_cast<unsigned int>(matIt->second);
else
matIdx = 0;
@ -553,11 +555,19 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
}
// now place all mesh references we gathered in the target node
pTarget->mNumMeshes = newMeshRefs.size();
pTarget->mNumMeshes = static_cast<unsigned int>(newMeshRefs.size());
if( newMeshRefs.size())
{
struct UIntTypeConverter
{
unsigned int operator()(const size_t& v) const
{
return static_cast<unsigned int>(v);
}
};
pTarget->mMeshes = new unsigned int[pTarget->mNumMeshes];
std::copy( newMeshRefs.begin(), newMeshRefs.end(), pTarget->mMeshes);
std::transform( newMeshRefs.begin(), newMeshRefs.end(), pTarget->mMeshes, UIntTypeConverter());
}
}
@ -572,10 +582,10 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
// count the vertices addressed by its faces
const size_t numVertices = std::accumulate( pSrcMesh->mFaceSize.begin() + pStartFace,
pSrcMesh->mFaceSize.begin() + pStartFace + pSubMesh.mNumFaces, 0);
pSrcMesh->mFaceSize.begin() + pStartFace + pSubMesh.mNumFaces, size_t(0));
// copy positions
dstMesh->mNumVertices = numVertices;
dstMesh->mNumVertices = static_cast<unsigned int>(numVertices);
dstMesh->mVertices = new aiVector3D[numVertices];
std::copy( pSrcMesh->mPositions.begin() + pStartVertex, pSrcMesh->mPositions.begin() +
pStartVertex + numVertices, dstMesh->mVertices);
@ -634,16 +644,16 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
// create faces. Due to the fact that each face uses unique vertices, we can simply count up on each vertex
size_t vertex = 0;
dstMesh->mNumFaces = pSubMesh.mNumFaces;
dstMesh->mNumFaces = static_cast<unsigned int>(pSubMesh.mNumFaces);
dstMesh->mFaces = new aiFace[dstMesh->mNumFaces];
for( size_t a = 0; a < dstMesh->mNumFaces; ++a)
{
size_t s = pSrcMesh->mFaceSize[ pStartFace + a];
aiFace& face = dstMesh->mFaces[a];
face.mNumIndices = s;
face.mNumIndices = static_cast<unsigned int>(s);
face.mIndices = new unsigned int[s];
for( size_t b = 0; b < s; ++b)
face.mIndices[b] = vertex++;
face.mIndices[b] = static_cast<unsigned int>(vertex++);
}
// create bones if given
@ -710,7 +720,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
if( weight > 0.0f)
{
aiVertexWeight w;
w.mVertexId = a - pStartVertex;
w.mVertexId = static_cast<unsigned int>(a - pStartVertex);
w.mWeight = weight;
dstBones[jointIndex].push_back( w);
}
@ -724,7 +734,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
numRemainingBones++;
// create bone array and copy bone weights one by one
dstMesh->mNumBones = numRemainingBones;
dstMesh->mNumBones = static_cast<unsigned int>(numRemainingBones);
dstMesh->mBones = new aiBone*[numRemainingBones];
size_t boneCount = 0;
for( size_t a = 0; a < numBones; ++a)
@ -748,7 +758,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
bone->mOffsetMatrix.c2 = ReadFloat( jointMatrixAcc, jointMatrices, a, 9);
bone->mOffsetMatrix.c3 = ReadFloat( jointMatrixAcc, jointMatrices, a, 10);
bone->mOffsetMatrix.c4 = ReadFloat( jointMatrixAcc, jointMatrices, a, 11);
bone->mNumWeights = dstBones[a].size();
bone->mNumWeights = static_cast<unsigned int>(dstBones[a].size());
bone->mWeights = new aiVertexWeight[bone->mNumWeights];
std::copy( dstBones[a].begin(), dstBones[a].end(), bone->mWeights);
@ -798,7 +808,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
// Stores all meshes in the given scene
void ColladaLoader::StoreSceneMeshes( aiScene* pScene)
{
pScene->mNumMeshes = mMeshes.size();
pScene->mNumMeshes = static_cast<unsigned int>(mMeshes.size());
if( mMeshes.size() > 0)
{
pScene->mMeshes = new aiMesh*[mMeshes.size()];
@ -811,7 +821,7 @@ void ColladaLoader::StoreSceneMeshes( aiScene* pScene)
// Stores all cameras in the given scene
void ColladaLoader::StoreSceneCameras( aiScene* pScene)
{
pScene->mNumCameras = mCameras.size();
pScene->mNumCameras = static_cast<unsigned int>(mCameras.size());
if( mCameras.size() > 0)
{
pScene->mCameras = new aiCamera*[mCameras.size()];
@ -824,7 +834,7 @@ void ColladaLoader::StoreSceneCameras( aiScene* pScene)
// Stores all lights in the given scene
void ColladaLoader::StoreSceneLights( aiScene* pScene)
{
pScene->mNumLights = mLights.size();
pScene->mNumLights = static_cast<unsigned int>(mLights.size());
if( mLights.size() > 0)
{
pScene->mLights = new aiLight*[mLights.size()];
@ -837,7 +847,7 @@ void ColladaLoader::StoreSceneLights( aiScene* pScene)
// Stores all textures in the given scene
void ColladaLoader::StoreSceneTextures( aiScene* pScene)
{
pScene->mNumTextures = mTextures.size();
pScene->mNumTextures = static_cast<unsigned int>(mTextures.size());
if( mTextures.size() > 0)
{
pScene->mTextures = new aiTexture*[mTextures.size()];
@ -850,7 +860,7 @@ void ColladaLoader::StoreSceneTextures( aiScene* pScene)
// Stores all materials in the given scene
void ColladaLoader::StoreSceneMaterials( aiScene* pScene)
{
pScene->mNumMaterials = newMats.size();
pScene->mNumMaterials = static_cast<unsigned int>(newMats.size());
if (newMats.size() > 0) {
pScene->mMaterials = new aiMaterial*[newMats.size()];
@ -891,7 +901,7 @@ void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pPars
combinedAnim->mName = aiString( std::string( "combinedAnim_") + char( '0' + a));
combinedAnim->mDuration = templateAnim->mDuration;
combinedAnim->mTicksPerSecond = templateAnim->mTicksPerSecond;
combinedAnim->mNumChannels = collectedAnimIndices.size() + 1;
combinedAnim->mNumChannels = static_cast<unsigned int>(collectedAnimIndices.size() + 1);
combinedAnim->mChannels = new aiNodeAnim*[combinedAnim->mNumChannels];
// add the template anim as first channel by moving its aiNodeAnim to the combined animation
combinedAnim->mChannels[0] = templateAnim->mChannels[0];
@ -923,7 +933,7 @@ void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pPars
// now store all anims in the scene
if( !mAnims.empty())
{
pScene->mNumAnimations = mAnims.size();
pScene->mNumAnimations = static_cast<unsigned int>(mAnims.size());
pScene->mAnimations = new aiAnimation*[mAnims.size()];
std::copy( mAnims.begin(), mAnims.end(), pScene->mAnimations);
}
@ -1207,9 +1217,9 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
{
aiNodeAnim* dstAnim = new aiNodeAnim;
dstAnim->mNodeName = nodeName;
dstAnim->mNumPositionKeys = resultTrafos.size();
dstAnim->mNumRotationKeys= resultTrafos.size();
dstAnim->mNumScalingKeys = resultTrafos.size();
dstAnim->mNumPositionKeys = static_cast<unsigned int>(resultTrafos.size());
dstAnim->mNumRotationKeys= static_cast<unsigned int>(resultTrafos.size());
dstAnim->mNumScalingKeys = static_cast<unsigned int>(resultTrafos.size());
dstAnim->mPositionKeys = new aiVectorKey[resultTrafos.size()];
dstAnim->mRotationKeys = new aiQuatKey[resultTrafos.size()];
dstAnim->mScalingKeys = new aiVectorKey[resultTrafos.size()];
@ -1237,7 +1247,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
{
aiAnimation* anim = new aiAnimation;
anim->mName.Set( pName);
anim->mNumChannels = anims.size();
anim->mNumChannels = static_cast<unsigned int>(anims.size());
anim->mChannels = new aiNodeAnim*[anims.size()];
std::copy( anims.begin(), anims.end(), anim->mChannels);
anim->mDuration = 0.0f;
@ -1520,13 +1530,13 @@ aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pPars
// and copy texture data
tex->mHeight = 0;
tex->mWidth = imIt->second.mImageData.size();
tex->mWidth = static_cast<unsigned int>(imIt->second.mImageData.size());
tex->pcData = (aiTexel*)new char[tex->mWidth];
memcpy(tex->pcData,&imIt->second.mImageData[0],tex->mWidth);
// setup texture reference string
result.data[0] = '*';
result.length = 1 + ASSIMP_itoa10(result.data+1,MAXLEN-1,mTextures.size());
result.length = 1 + ASSIMP_itoa10(result.data+1,static_cast<unsigned int>(MAXLEN-1),static_cast<int32_t>(mTextures.size()));
// and add this texture to the list
mTextures.push_back(tex);

View File

@ -2534,7 +2534,7 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
aiColor4D result(0, 0, 0, 1);
for (size_t i = 0; i < pInput.mResolved->mSize; ++i)
{
result[i] = obj[pInput.mResolved->mSubOffset[i]];
result[static_cast<unsigned int>(i)] = obj[pInput.mResolved->mSubOffset[i]];
}
pMesh->mColors[pInput.mIndex].push_back(result);
} else

View File

@ -172,7 +172,7 @@ private:
mesh->mName.Set(name);
meshes.push_back(mesh);
meshIds.push_back(meshIdx);
meshIds.push_back(static_cast<unsigned long>(meshIdx));
meshIdx++;
}

View File

@ -123,19 +123,19 @@ voidpf IOSystem2Unzip::open(voidpf opaque, const char* filename, int mode) {
uLong IOSystem2Unzip::read(voidpf /*opaque*/, voidpf stream, void* buf, uLong size) {
IOStream* io_stream = (IOStream*) stream;
return io_stream->Read(buf, 1, size);
return static_cast<uLong>(io_stream->Read(buf, 1, size));
}
uLong IOSystem2Unzip::write(voidpf /*opaque*/, voidpf stream, const void* buf, uLong size) {
IOStream* io_stream = (IOStream*) stream;
return io_stream->Write(buf, 1, size);
return static_cast<uLong>(io_stream->Write(buf, 1, size));
}
long IOSystem2Unzip::tell(voidpf /*opaque*/, voidpf stream) {
IOStream* io_stream = (IOStream*) stream;
return io_stream->Tell();
return static_cast<long>(io_stream->Tell());
}
long IOSystem2Unzip::seek(voidpf /*opaque*/, voidpf stream, uLong offset, int origin) {

View File

@ -223,8 +223,8 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
unsigned int vcount = 0, icount = 0;
for (const DXF::Block& bl : output.blocks) {
for (std::shared_ptr<const DXF::PolyLine> pl : bl.lines) {
vcount += pl->positions.size();
icount += pl->counts.size();
vcount += static_cast<unsigned int>(pl->positions.size());
icount += static_cast<unsigned int>(pl->counts.size());
}
}
@ -296,7 +296,7 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
for(const DXF::PolyLine* pl : corr[elem.second]){
// sum over all faces since we need to 'verbosify' them.
cvert += std::accumulate(pl->counts.begin(),pl->counts.end(),0);
cface += pl->counts.size();
cface += static_cast<unsigned int>(pl->counts.size());
}
aiVector3D* verts = mesh->mVertices = new aiVector3D[cvert];
@ -705,7 +705,7 @@ void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output)
// closed polyline?
if (line.flags & DXF_POLYLINE_FLAG_CLOSED) {
line.indices.push_back(line.positions.size()-1);
line.indices.push_back(static_cast<unsigned int>(line.positions.size()-1));
line.indices.push_back(0);
line.counts.push_back(2);
}
@ -906,7 +906,7 @@ void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output)
line.counts.push_back(cnt);
for (unsigned int i = 0; i < cnt; ++i) {
line.indices.push_back(line.positions.size());
line.indices.push_back(static_cast<unsigned int>(line.positions.size()));
line.positions.push_back(vip[i]);
line.colors.push_back(clr);
}

View File

@ -137,7 +137,7 @@ void DeboneProcess::Execute( aiScene* pScene)
const aiString *find = newMeshes[b].second?&newMeshes[b].second->mName:0;
aiNode *theNode = find?pScene->mRootNode->FindNode(*find):0;
std::pair<unsigned int,aiNode*> push_pair(meshes.size(),theNode);
std::pair<unsigned int,aiNode*> push_pair(static_cast<unsigned int>(meshes.size()),theNode);
mSubMeshIndices[a].push_back(push_pair);
meshes.push_back(newMeshes[b].first);
@ -156,13 +156,13 @@ void DeboneProcess::Execute( aiScene* pScene)
}
else {
// Mesh is kept unchanged - store it's new place in the mesh array
mSubMeshIndices[a].push_back(std::pair<unsigned int,aiNode*>(meshes.size(),(aiNode*)0));
mSubMeshIndices[a].push_back(std::pair<unsigned int,aiNode*>(static_cast<unsigned int>(meshes.size()),(aiNode*)0));
meshes.push_back(srcMesh);
}
}
// rebuild the scene's mesh array
pScene->mNumMeshes = meshes.size();
pScene->mNumMeshes = static_cast<unsigned int>(meshes.size());
delete [] pScene->mMeshes;
pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
std::copy( meshes.begin(), meshes.end(), pScene->mMeshes);
@ -382,7 +382,7 @@ void DeboneProcess::UpdateNode(aiNode* pNode) const
// this will require two passes
unsigned int m = pNode->mNumMeshes, n = mSubMeshIndices.size();
unsigned int m = static_cast<unsigned int>(pNode->mNumMeshes), n = static_cast<unsigned int>(mSubMeshIndices.size());
// first pass, look for meshes which have not moved
@ -390,7 +390,7 @@ void DeboneProcess::UpdateNode(aiNode* pNode) const
unsigned int srcIndex = pNode->mMeshes[a];
const std::vector< std::pair< unsigned int,aiNode* > > &subMeshes = mSubMeshIndices[srcIndex];
unsigned int nSubmeshes = subMeshes.size();
unsigned int nSubmeshes = static_cast<unsigned int>(subMeshes.size());
for(unsigned int b=0;b<nSubmeshes;b++) {
if(!subMeshes[b].second) {
@ -404,7 +404,7 @@ void DeboneProcess::UpdateNode(aiNode* pNode) const
for(unsigned int a=0;a<n;a++)
{
const std::vector< std::pair< unsigned int,aiNode* > > &subMeshes = mSubMeshIndices[a];
unsigned int nSubmeshes = subMeshes.size();
unsigned int nSubmeshes = static_cast<unsigned int>(subMeshes.size());
for(unsigned int b=0;b<nSubmeshes;b++) {
if(subMeshes[b].second == pNode) {
@ -417,7 +417,7 @@ void DeboneProcess::UpdateNode(aiNode* pNode) const
delete [] pNode->mMeshes; pNode->mMeshes = NULL;
}
pNode->mNumMeshes = newMeshList.size();
pNode->mNumMeshes = static_cast<unsigned int>(newMeshList.size());
if(pNode->mNumMeshes) {
pNode->mMeshes = new unsigned int[pNode->mNumMeshes];

View File

@ -1075,7 +1075,7 @@ void Converter::SetupNodeMetadata( const Model& model, aiNode& nd )
// create metadata on node
std::size_t numStaticMetaData = 2;
aiMetadata* data = aiMetadata::Alloc( unparsedProperties.size() + numStaticMetaData );
aiMetadata* data = aiMetadata::Alloc( static_cast<unsigned int>(unparsedProperties.size() + numStaticMetaData) );
nd.mMetaData = data;
int index = 0;
@ -2961,10 +2961,10 @@ Converter::KeyFrameListList Converter::GetKeyframeList( const std::vector<const
//get values within the start/stop time window
std::shared_ptr<KeyTimeList> Keys( new KeyTimeList() );
std::shared_ptr<KeyValueList> Values( new KeyValueList() );
const int count = curve->GetKeys().size();
const size_t count = curve->GetKeys().size();
Keys->reserve( count );
Values->reserve( count );
for ( int n = 0; n < count; n++ )
for (size_t n = 0; n < count; n++ )
{
int64_t k = curve->GetKeys().at( n );
if ( k >= adj_start && k <= adj_stop )
@ -3065,7 +3065,7 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
const KeyTimeList::value_type timeA = std::get<0>(kfl)->at( id0 );
const KeyTimeList::value_type timeB = std::get<0>(kfl)->at( id1 );
const ai_real factor = timeB == timeA ? 0. : static_cast<ai_real>( ( time - timeA ) ) / ( timeB - timeA );
const ai_real factor = timeB == timeA ? ai_real(0.) : static_cast<ai_real>( ( time - timeA ) ) / ( timeB - timeA );
const ai_real interpValue = static_cast<ai_real>( valueA + ( valueB - valueA ) * factor );
result[ std::get<2>(kfl) ] = interpValue;

View File

@ -600,7 +600,7 @@ public:
}
const int textureCount() const {
return textures.size();
return static_cast<int>(textures.size());
}
const BlendMode GetBlendMode() const
{

View File

@ -165,7 +165,7 @@ void FBXImporter::InternReadFile( const std::string& pFile,
bool is_binary = false;
if (!strncmp(begin,"Kaydara FBX Binary",18)) {
is_binary = true;
TokenizeBinary(tokens,begin,contents.size());
TokenizeBinary(tokens,begin,static_cast<unsigned int>(contents.size()));
}
else {
Tokenize(tokens,begin);

View File

@ -583,7 +583,7 @@ void ReadBinaryDataArray(char type, uint32_t count, const char*& data, const cha
zstream.next_in = reinterpret_cast<Bytef*>( const_cast<char*>(data) );
zstream.avail_in = comp_len;
zstream.avail_out = buff.size();
zstream.avail_out = static_cast<uInt>(buff.size());
zstream.next_out = reinterpret_cast<Bytef*>(&*buff.begin());
const int ret = inflate(&zstream, Z_FINISH);

View File

@ -109,7 +109,7 @@ void FilterPolygon(std::vector<IfcVector3>& resultpoly)
}
IfcVector3 vmin, vmax;
ArrayBounds(resultpoly.data(), resultpoly.size(), vmin, vmax);
ArrayBounds(resultpoly.data(), static_cast<unsigned int>(resultpoly.size()), vmin, vmax);
// filter our IfcFloat points - those may happen if a point lies
// directly on the intersection line or directly on the clipping plane
@ -132,7 +132,7 @@ void WritePolygon(std::vector<IfcVector3>& resultpoly, TempMesh& result)
if( resultpoly.size() > 2 )
{
result.verts.insert(result.verts.end(), resultpoly.begin(), resultpoly.end());
result.vertcnt.push_back(resultpoly.size());
result.vertcnt.push_back(static_cast<unsigned int>(resultpoly.size()));
}
}
@ -589,7 +589,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
// to result mesh unchanged
if( !startedInside )
{
outvertcnt.push_back(blackside.size());
outvertcnt.push_back(static_cast<unsigned int>(blackside.size()));
outvert.insert(outvert.end(), blackside.begin(), blackside.end());
continue;
}

View File

@ -70,7 +70,7 @@ bool ProcessPolyloop(const IfcPolyLoop& loop, TempMesh& meshout, ConversionData&
++cnt;
}
meshout.vertcnt.push_back(cnt);
meshout.vertcnt.push_back(static_cast<unsigned int>(cnt));
// zero- or one- vertex polyloops simply ignored
if (meshout.vertcnt.back() > 1) {
@ -180,7 +180,7 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
// fill a mesh with ONLY the main polygon
TempMesh temp;
temp.verts.reserve(outer_polygon_size);
temp.vertcnt.push_back(outer_polygon_size);
temp.vertcnt.push_back(static_cast<unsigned int>(outer_polygon_size));
std::copy(outer_vit, outer_vit+outer_polygon_size,
std::back_inserter(temp.verts));
@ -305,8 +305,8 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
for(size_t i = 0; i < size; ++i ) {
out.push_back(out[i*4]);
}
result.vertcnt.push_back(size);
result.vertcnt.push_back(size);
result.vertcnt.push_back(static_cast<unsigned int>(size));
result.vertcnt.push_back(static_cast<unsigned int>(size));
}
IfcMatrix4 trafo;
@ -638,7 +638,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
out.push_back(in[i]);
}
curmesh.vertcnt.push_back(in.size());
curmesh.vertcnt.push_back(static_cast<unsigned int>(in.size()));
if( openings && in.size() > 2 ) {
if( GenerateOpenings(*conv.apply_openings, nors, temp, true, true, dir) ) {
++sides_with_v_openings;
@ -665,7 +665,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
std::shared_ptr<TempMesh> profile2D = std::shared_ptr<TempMesh>(new TempMesh());
profile2D->verts.insert(profile2D->verts.end(), in.begin(), in.end());
profile2D->vertcnt.push_back(in.size());
profile2D->vertcnt.push_back(static_cast<unsigned int>(in.size()));
conv.collect_openings->push_back(TempOpening(&solid, dir, profile, profile2D));
ai_assert(result.IsEmpty());
@ -810,7 +810,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
aiMesh* const mesh = meshtmp->ToMesh();
if(mesh) {
mesh->mMaterialIndex = matid;
mesh_indices.push_back(conv.meshes.size());
mesh_indices.push_back(static_cast<unsigned int>(conv.meshes.size()));
conv.meshes.push_back(mesh);
return true;
}
@ -827,9 +827,8 @@ void AssignAddedMeshes(std::vector<unsigned int>& mesh_indices,aiNode* nd,
std::sort(mesh_indices.begin(),mesh_indices.end());
std::vector<unsigned int>::iterator it_end = std::unique(mesh_indices.begin(),mesh_indices.end());
const size_t size = std::distance(mesh_indices.begin(),it_end);
nd->mNumMeshes = static_cast<unsigned int>(std::distance(mesh_indices.begin(),it_end));
nd->mNumMeshes = size;
nd->mMeshes = new unsigned int[nd->mNumMeshes];
for(unsigned int i = 0; i < nd->mNumMeshes; ++i) {
nd->mMeshes[i] = mesh_indices[i];

View File

@ -707,7 +707,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
}
if (!properties.empty()) {
aiMetadata* data = aiMetadata::Alloc( properties.size() );
aiMetadata* data = aiMetadata::Alloc( static_cast<unsigned int>(properties.size()) );
unsigned int index( 0 );
for ( const Metadata::value_type& kv : properties ) {
data->Set( index++, kv.first, aiString( kv.second ) );

View File

@ -159,7 +159,7 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat
FillMaterial(mat.get(), surf, conv);
conv.materials.push_back(mat.release());
unsigned int matindex = conv.materials.size() - 1;
unsigned int matindex = static_cast<unsigned int>(conv.materials.size() - 1);
conv.cached_materials[surf] = matindex;
return matindex;
}

View File

@ -364,7 +364,7 @@ void InsertWindowContours(const ContourVector& contours,
}
if (const size_t d = curmesh.verts.size()-old) {
curmesh.vertcnt.push_back(d);
curmesh.vertcnt.push_back(static_cast<unsigned int>(d));
std::reverse(curmesh.verts.rbegin(),curmesh.verts.rbegin()+d);
}
if (n == very_first_hit) {
@ -549,7 +549,7 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
clipper.Execute(ClipperLib::ctIntersection,clipped,ClipperLib::pftNonZero,ClipperLib::pftNonZero);
for(const ClipperLib::ExPolygon& ex : clipped) {
iold.push_back(ex.outer.size());
iold.push_back(static_cast<unsigned int>(ex.outer.size()));
for(const ClipperLib::IntPoint& point : ex.outer) {
vold.push_back(IfcVector3(
from_int64(point.X),

View File

@ -59,7 +59,7 @@ void ProcessPolyLine(const IfcPolyline& def, TempMesh& meshout, ConversionData&
ConvertCartesianPoint(t,cp);
meshout.verts.push_back(t);
}
meshout.vertcnt.push_back(meshout.verts.size());
meshout.vertcnt.push_back(static_cast<unsigned int>(meshout.verts.size()));
}
// ------------------------------------------------------------------------------------------------
@ -80,7 +80,7 @@ bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& con
IFCImporter::LogError(cv.s+ " (error occurred while processing curve)");
return false;
}
meshout.vertcnt.push_back(meshout.verts.size());
meshout.vertcnt.push_back(static_cast<unsigned int>(meshout.verts.size()));
return true;
}

View File

@ -180,7 +180,7 @@ IfcVector3 TempMesh::ComputePolygonNormal(const IfcVector3* vtcs, size_t cnt, bo
}
IfcVector3 nor;
NewellNormal<3, 3, 3>(nor, cnt, &temp[0], &temp[1], &temp[2]);
NewellNormal<3, 3, 3>(nor, static_cast<int>(cnt), &temp[0], &temp[1], &temp[2]);
return normalize ? nor.Normalize() : nor;
}
@ -548,7 +548,7 @@ void ConvertCartesianPoint(IfcVector3& out, const IfcCartesianPoint& in)
{
out = IfcVector3();
for(size_t i = 0; i < in.Coordinates.size(); ++i) {
out[i] = in.Coordinates[i];
out[static_cast<unsigned int>(i)] = in.Coordinates[i];
}
}
@ -564,7 +564,7 @@ void ConvertDirection(IfcVector3& out, const IfcDirection& in)
{
out = IfcVector3();
for(size_t i = 0; i < in.DirectionRatios.size(); ++i) {
out[i] = in.DirectionRatios[i];
out[static_cast<unsigned int>(i)] = in.DirectionRatios[i];
}
const IfcFloat len = out.Length();
if (len<1e-6) {

View File

@ -215,7 +215,7 @@ void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMateri
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;
meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-6u);
// LEFT SIDE
meshes.push_back( BuildSingleQuadMesh(
@ -223,7 +223,7 @@ void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMateri
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;
meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-5u);
// BACK SIDE
meshes.push_back( BuildSingleQuadMesh(
@ -231,7 +231,7 @@ void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMateri
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;
meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-4u);
// RIGHT SIDE
meshes.push_back( BuildSingleQuadMesh(
@ -239,7 +239,7 @@ void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMateri
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;
meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-3u);
// TOP SIDE
meshes.push_back( BuildSingleQuadMesh(
@ -247,7 +247,7 @@ void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMateri
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;
meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-2u);
// BOTTOM SIDE
meshes.push_back( BuildSingleQuadMesh(
@ -255,7 +255,7 @@ void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMateri
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;
meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-1u);
}
// ------------------------------------------------------------------------------------------------
@ -642,7 +642,7 @@ void SetupMapping (aiMaterial* mat, aiTextureMapping mode, const aiVector3D& axi
delete[] mat->mProperties;
mat->mProperties = new aiMaterialProperty*[p.size()*2];
mat->mNumAllocated = p.size()*2;
mat->mNumAllocated = static_cast<unsigned int>(p.size()*2);
}
mat->mNumProperties = (unsigned int)p.size();
::memcpy(mat->mProperties,&p[0],sizeof(void*)*mat->mNumProperties);

View File

@ -654,7 +654,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
uint32_t fileSize = 0;
if (fileIO)
{
fileSize = fileIO->FileSize();
fileSize = static_cast<uint32_t>(fileIO->FileSize());
pimpl->mIOHandler->Close( fileIO );
}
@ -790,7 +790,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
BaseProcess* process = pimpl->mPostProcessingSteps[a];
pimpl->mProgressHandler->UpdatePostProcess( a, pimpl->mPostProcessingSteps.size() );
pimpl->mProgressHandler->UpdatePostProcess(static_cast<int>(a), static_cast<int>(pimpl->mPostProcessingSteps.size()) );
if( process->IsActive( pFlags)) {
if (profiler) {
@ -825,7 +825,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
}
#endif // ! DEBUG
}
pimpl->mProgressHandler->UpdatePostProcess( pimpl->mPostProcessingSteps.size(), pimpl->mPostProcessingSteps.size() );
pimpl->mProgressHandler->UpdatePostProcess( static_cast<int>(pimpl->mPostProcessingSteps.size()), static_cast<int>(pimpl->mPostProcessingSteps.size()) );
// update private scene flags
if( pimpl->mScene )

View File

@ -565,7 +565,7 @@ void AnimResolver::ExtractAnimChannel(aiNodeAnim** out, unsigned int flags /*= 0
std::vector<aiVectorKey> keys;
GetKeys(keys,trans_x,trans_y,trans_z,flags);
anim->mPositionKeys = new aiVectorKey[ anim->mNumPositionKeys = keys.size() ];
anim->mPositionKeys = new aiVectorKey[ anim->mNumPositionKeys = static_cast<unsigned int>(keys.size()) ];
std::copy(keys.begin(),keys.end(),anim->mPositionKeys);
}
@ -574,7 +574,7 @@ void AnimResolver::ExtractAnimChannel(aiNodeAnim** out, unsigned int flags /*= 0
std::vector<aiVectorKey> keys;
GetKeys(keys,rotat_x,rotat_y,rotat_z,flags);
anim->mRotationKeys = new aiQuatKey[ anim->mNumRotationKeys = keys.size() ];
anim->mRotationKeys = new aiQuatKey[ anim->mNumRotationKeys = static_cast<unsigned int>(keys.size()) ];
// convert heading, pitch, bank to quaternion
// mValue.x=Heading=Rot(Y), mValue.y=Pitch=Rot(X), mValue.z=Bank=Rot(Z)
@ -594,7 +594,7 @@ void AnimResolver::ExtractAnimChannel(aiNodeAnim** out, unsigned int flags /*= 0
std::vector<aiVectorKey> keys;
GetKeys(keys,scale_x,scale_y,scale_z,flags);
anim->mScalingKeys = new aiVectorKey[ anim->mNumScalingKeys = keys.size() ];
anim->mScalingKeys = new aiVectorKey[ anim->mNumScalingKeys = static_cast<unsigned int>(keys.size()) ];
std::copy(keys.begin(),keys.end(),anim->mScalingKeys);
}
}

View File

@ -426,7 +426,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
}
// Generate nodes to render the mesh. Store the source layer in the mParent member of the nodes
unsigned int num = apcMeshes.size() - meshStart;
unsigned int num = static_cast<unsigned int>(apcMeshes.size() - meshStart);
if (layer.mName != "<LWODefault>" || num > 0) {
aiNode* pcNode = new aiNode();
apcNodes[layer.mIndex] = pcNode;

View File

@ -902,7 +902,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
anim->mTicksPerSecond = fps;
anim->mDuration = last-(first-1); /* fixme ... zero or one-based?*/
anim->mChannels = new aiNodeAnim*[anim->mNumChannels = anims.size()];
anim->mChannels = new aiNodeAnim*[anim->mNumChannels = static_cast<unsigned int>(anims.size())];
std::copy(anims.begin(),anims.end(),anim->mChannels);
}

View File

@ -129,9 +129,9 @@ void LimitBoneWeightsProcess::ProcessMesh( aiMesh* pMesh)
std::sort( vit->begin(), vit->end());
// now kill everything beyond the maximum count
unsigned int m = vit->size();
unsigned int m = static_cast<unsigned int>(vit->size());
vit->erase( vit->begin() + mMaxWeights, vit->end());
removed += m-vit->size();
removed += static_cast<unsigned int>(m-vit->size());
// and renormalize the weights
float sum = 0.0f;

View File

@ -709,7 +709,7 @@ void MD3Importer::ConvertPath(const char* texture_name, const char* header_name,
}
}
else len2 = std::min (len1, (size_t)(end2 - texture_name ));
if (!ASSIMP_strincmp(texture_name,header_name,len2)) {
if (!ASSIMP_strincmp(texture_name,header_name,static_cast<unsigned int>(len2))) {
// Use the file name only
out = end2+1;
return;

View File

@ -228,8 +228,8 @@ void MD5Importer::MakeDataUnique (MD5::MeshDesc& meshSrc)
std::vector<bool> abHad(meshSrc.mVertices.size(),false);
// allocate enough storage to keep the output structures
const unsigned int iNewNum = meshSrc.mFaces.size()*3;
unsigned int iNewIndex = meshSrc.mVertices.size();
const unsigned int iNewNum = static_cast<unsigned int>(meshSrc.mFaces.size()*3);
unsigned int iNewIndex = static_cast<unsigned int>(meshSrc.mVertices.size());
meshSrc.mVertices.resize(iNewNum);
// try to guess how much storage we'll need for new weights
@ -719,16 +719,16 @@ void MD5Importer::LoadMD5CameraFile ()
// every cut is written to a separate aiAnimation
if (!cuts.size()) {
cuts.push_back(0);
cuts.push_back(frames.size()-1);
cuts.push_back(static_cast<unsigned int>(frames.size()-1));
}
else {
cuts.insert(cuts.begin(),0);
if (cuts.back() < frames.size()-1)
cuts.push_back(frames.size()-1);
cuts.push_back(static_cast<unsigned int>(frames.size()-1));
}
pScene->mNumAnimations = cuts.size()-1;
pScene->mNumAnimations = static_cast<unsigned int>(cuts.size()-1);
aiAnimation** tmp = pScene->mAnimations = new aiAnimation*[pScene->mNumAnimations];
for (std::vector<unsigned int>::const_iterator it = cuts.begin(); it != cuts.end()-1; ++it) {

View File

@ -423,7 +423,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
for (unsigned int i = 0; i < groups.size(); ++i) {
TempGroup& g = groups[i];
if (g.mat == UINT_MAX) {
g.mat = materials.size()-1;
g.mat = static_cast<unsigned int>(materials.size()-1);
}
}
}
@ -483,7 +483,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
m->mMaterialIndex = g.mat;
m->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
m->mFaces = new aiFace[m->mNumFaces = g.triangles.size()];
m->mFaces = new aiFace[m->mNumFaces = static_cast<unsigned int>(g.triangles.size())];
m->mNumVertices = m->mNumFaces*3;
// storage for vertices - verbose format, as requested by the postprocessing pipeline

View File

@ -529,7 +529,7 @@ aiReturn aiMaterial::AddProperty (const aiString* pInput,
s[1] = static_cast<uint32_t>(pInput->length);
return AddBinaryProperty(s+1,
pInput->length+1+4,
static_cast<unsigned int>(pInput->length+1+4),
pKey,
type,
index,
@ -537,7 +537,7 @@ aiReturn aiMaterial::AddProperty (const aiString* pInput,
}
ai_assert(sizeof(size_t)==4);
return AddBinaryProperty(pInput,
pInput->length+1+4,
static_cast<unsigned int>(pInput->length+1+4),
pKey,
type,
index,

View File

@ -257,7 +257,7 @@ void NDOImporter::InternReadFile( const std::string& pFile,
}
aiMesh* mesh = new aiMesh();
mesh->mNumFaces=face_table.size();
mesh->mNumFaces=static_cast<unsigned int>(face_table.size());
aiFace* faces = mesh->mFaces = new aiFace[mesh->mNumFaces];
vertices.clear();
@ -279,7 +279,7 @@ void NDOImporter::InternReadFile( const std::string& pFile,
next_edge = obj.edges[cur_edge].edge[4];
next_vert = obj.edges[cur_edge].edge[0];
}
indices.push_back( vertices.size() );
indices.push_back( static_cast<unsigned int>(vertices.size()) );
vertices.push_back(obj.vertices[ next_vert ].val);
cur_edge = next_edge;
@ -288,11 +288,11 @@ void NDOImporter::InternReadFile( const std::string& pFile,
}
}
f.mIndices = new unsigned int[f.mNumIndices = indices.size()];
f.mIndices = new unsigned int[f.mNumIndices = static_cast<unsigned int>(indices.size())];
std::copy(indices.begin(),indices.end(),f.mIndices);
}
mesh->mVertices = new aiVector3D[mesh->mNumVertices = vertices.size()];
mesh->mVertices = new aiVector3D[mesh->mNumVertices = static_cast<unsigned int>(vertices.size())];
std::copy(vertices.begin(),vertices.end(),mesh->mVertices);
if (mesh->mNumVertices) {

View File

@ -152,7 +152,7 @@ void ObjFileImporter::InternReadFile( const std::string &file, aiScene* pScene,
/*unsigned int progress = 0;
unsigned int progressCounter = 0;
const unsigned int updateProgressEveryBytes = 100 * 1024;
const unsigned int progressTotal = (3*m_Buffer.size()/updateProgressEveryBytes);*/
const unsigned int progressTotal = static_cast<unsigned int>(3*m_Buffer.size()/updateProgressEveryBytes);*/
// process all '\'
/*std::vector<char> ::iterator iter = m_Buffer.begin();
while (iter != m_Buffer.end())
@ -326,10 +326,10 @@ aiMesh *ObjFileImporter::createTopology( const ObjFile::Model* pModel, const Obj
ai_assert( NULL != inp );
if (inp->m_PrimitiveType == aiPrimitiveType_LINE) {
pMesh->mNumFaces += inp->m_vertices.size() - 1;
pMesh->mNumFaces += static_cast<unsigned int>(inp->m_vertices.size() - 1);
pMesh->mPrimitiveTypes |= aiPrimitiveType_LINE;
} else if (inp->m_PrimitiveType == aiPrimitiveType_POINT) {
pMesh->mNumFaces += inp->m_vertices.size();
pMesh->mNumFaces += static_cast<unsigned int>(inp->m_vertices.size());
pMesh->mPrimitiveTypes |= aiPrimitiveType_POINT;
} else {
++pMesh->mNumFaces;
@ -600,9 +600,6 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc
mat->AddProperty<int>( &sm, 1, AI_MATKEY_SHADING_MODEL);
// multiplying the specular exponent with 2 seems to yield better results
pCurrentMaterial->shineness *= 4.f;
// Adding material colors
mat->AddProperty( &pCurrentMaterial->ambient, 1, AI_MATKEY_COLOR_AMBIENT );
mat->AddProperty( &pCurrentMaterial->diffuse, 1, AI_MATKEY_COLOR_DIFFUSE );

View File

@ -307,49 +307,49 @@ void ObjFileMtlImporter::getTexture() {
int clampIndex = -1;
const char *pPtr( &(*m_DataIt) );
if ( !ASSIMP_strincmp( pPtr, DiffuseTexture.c_str(), DiffuseTexture.size() ) ) {
if ( !ASSIMP_strincmp( pPtr, DiffuseTexture.c_str(), static_cast<unsigned int>(DiffuseTexture.size()) ) ) {
// Diffuse texture
out = & m_pModel->m_pCurrentMaterial->texture;
clampIndex = ObjFile::Material::TextureDiffuseType;
} else if ( !ASSIMP_strincmp( pPtr,AmbientTexture.c_str(),AmbientTexture.size() ) ) {
} else if ( !ASSIMP_strincmp( pPtr,AmbientTexture.c_str(), static_cast<unsigned int>(AmbientTexture.size()) ) ) {
// Ambient texture
out = & m_pModel->m_pCurrentMaterial->textureAmbient;
clampIndex = ObjFile::Material::TextureAmbientType;
} else if (!ASSIMP_strincmp( pPtr, SpecularTexture.c_str(), SpecularTexture.size())) {
} else if (!ASSIMP_strincmp( pPtr, SpecularTexture.c_str(), static_cast<unsigned int>(SpecularTexture.size()) ) ) {
// Specular texture
out = & m_pModel->m_pCurrentMaterial->textureSpecular;
clampIndex = ObjFile::Material::TextureSpecularType;
} else if ( !ASSIMP_strincmp( pPtr, OpacityTexture.c_str(), OpacityTexture.size() ) ) {
} else if ( !ASSIMP_strincmp( pPtr, OpacityTexture.c_str(), static_cast<unsigned int>(OpacityTexture.size()) ) ) {
// Opacity texture
out = & m_pModel->m_pCurrentMaterial->textureOpacity;
clampIndex = ObjFile::Material::TextureOpacityType;
} else if (!ASSIMP_strincmp( pPtr, EmmissiveTexture.c_str(), EmmissiveTexture.size())) {
} else if (!ASSIMP_strincmp( pPtr, EmmissiveTexture.c_str(), static_cast<unsigned int>(EmmissiveTexture.size()) ) ) {
// Emissive texture
out = & m_pModel->m_pCurrentMaterial->textureEmissive;
clampIndex = ObjFile::Material::TextureEmissiveType;
} else if ( !ASSIMP_strincmp( pPtr, EmmissiveTexture_1.c_str(), EmmissiveTexture_1.size() ) ) {
} else if ( !ASSIMP_strincmp( pPtr, EmmissiveTexture_1.c_str(), static_cast<unsigned int>(EmmissiveTexture_1.size()) ) ) {
// Emissive texture
out = &m_pModel->m_pCurrentMaterial->textureEmissive;
clampIndex = ObjFile::Material::TextureEmissiveType;
} else if ( !ASSIMP_strincmp( pPtr, BumpTexture1.c_str(), BumpTexture1.size() ) ||
!ASSIMP_strincmp( pPtr, BumpTexture2.c_str(), BumpTexture2.size() ) ||
!ASSIMP_strincmp( pPtr, BumpTexture3.c_str(), BumpTexture3.size() ) ) {
} else if ( !ASSIMP_strincmp( pPtr, BumpTexture1.c_str(), static_cast<unsigned int>(BumpTexture1.size()) ) ||
!ASSIMP_strincmp( pPtr, BumpTexture2.c_str(), static_cast<unsigned int>(BumpTexture2.size()) ) ||
!ASSIMP_strincmp( pPtr, BumpTexture3.c_str(), static_cast<unsigned int>(BumpTexture3.size()) ) ) {
// Bump texture
out = & m_pModel->m_pCurrentMaterial->textureBump;
clampIndex = ObjFile::Material::TextureBumpType;
} else if (!ASSIMP_strincmp( pPtr,NormalTexture.c_str(), NormalTexture.size())) {
} else if (!ASSIMP_strincmp( pPtr,NormalTexture.c_str(), static_cast<unsigned int>(NormalTexture.size()) ) ) {
// Normal map
out = & m_pModel->m_pCurrentMaterial->textureNormal;
clampIndex = ObjFile::Material::TextureNormalType;
} else if(!ASSIMP_strincmp( pPtr, ReflectionTexture.c_str(), ReflectionTexture.size() ) ) {
} else if(!ASSIMP_strincmp( pPtr, ReflectionTexture.c_str(), static_cast<unsigned int>(ReflectionTexture.size()) ) ) {
// Reflection texture(s)
//Do nothing here
return;
} else if (!ASSIMP_strincmp( pPtr, DisplacementTexture.c_str(), DisplacementTexture.size() ) ) {
} else if (!ASSIMP_strincmp( pPtr, DisplacementTexture.c_str(), static_cast<unsigned int>(DisplacementTexture.size()) ) ) {
// Displacement texture
out = &m_pModel->m_pCurrentMaterial->textureDisp;
clampIndex = ObjFile::Material::TextureDispType;
} else if (!ASSIMP_strincmp( pPtr, SpecularityTexture.c_str(),SpecularityTexture.size() ) ) {
} else if (!ASSIMP_strincmp( pPtr, SpecularityTexture.c_str(), static_cast<unsigned int>(SpecularityTexture.size()) ) ) {
// Specularity scaling (glossiness)
out = & m_pModel->m_pCurrentMaterial->textureSpecularity;
clampIndex = ObjFile::Material::TextureSpecularityType;
@ -394,7 +394,7 @@ void ObjFileMtlImporter::getTextureOption(bool &clamp, int &clampIndex, aiString
//skip option key and value
int skipToken = 1;
if (!ASSIMP_strincmp(pPtr, ClampOption.c_str(), ClampOption.size()))
if (!ASSIMP_strincmp(pPtr, ClampOption.c_str(), static_cast<unsigned int>(ClampOption.size())))
{
DataArrayIt it = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
char value[3];
@ -406,7 +406,7 @@ void ObjFileMtlImporter::getTextureOption(bool &clamp, int &clampIndex, aiString
skipToken = 2;
}
else if( !ASSIMP_strincmp( pPtr, TypeOption.c_str(), TypeOption.size() ) )
else if( !ASSIMP_strincmp( pPtr, TypeOption.c_str(), static_cast<unsigned int>(TypeOption.size()) ) )
{
DataArrayIt it = getNextToken<DataArrayIt>( m_DataIt, m_DataItEnd );
char value[ 12 ];
@ -449,22 +449,22 @@ void ObjFileMtlImporter::getTextureOption(bool &clamp, int &clampIndex, aiString
skipToken = 2;
}
else if (!ASSIMP_strincmp(pPtr, BlendUOption.c_str(), BlendUOption.size())
|| !ASSIMP_strincmp(pPtr, BlendVOption.c_str(), BlendVOption.size())
|| !ASSIMP_strincmp(pPtr, BoostOption.c_str(), BoostOption.size())
|| !ASSIMP_strincmp(pPtr, ResolutionOption.c_str(), ResolutionOption.size())
|| !ASSIMP_strincmp(pPtr, BumpOption.c_str(), BumpOption.size())
|| !ASSIMP_strincmp(pPtr, ChannelOption.c_str(), ChannelOption.size()))
else if (!ASSIMP_strincmp(pPtr, BlendUOption.c_str(), static_cast<unsigned int>(BlendUOption.size()))
|| !ASSIMP_strincmp(pPtr, BlendVOption.c_str(), static_cast<unsigned int>(BlendVOption.size()))
|| !ASSIMP_strincmp(pPtr, BoostOption.c_str(), static_cast<unsigned int>(BoostOption.size()))
|| !ASSIMP_strincmp(pPtr, ResolutionOption.c_str(), static_cast<unsigned int>(ResolutionOption.size()))
|| !ASSIMP_strincmp(pPtr, BumpOption.c_str(), static_cast<unsigned int>(BumpOption.size()))
|| !ASSIMP_strincmp(pPtr, ChannelOption.c_str(), static_cast<unsigned int>(ChannelOption.size())))
{
skipToken = 2;
}
else if (!ASSIMP_strincmp(pPtr, ModifyMapOption.c_str(), ModifyMapOption.size()))
else if (!ASSIMP_strincmp(pPtr, ModifyMapOption.c_str(), static_cast<unsigned int>(ModifyMapOption.size())))
{
skipToken = 3;
}
else if ( !ASSIMP_strincmp(pPtr, OffsetOption.c_str(), OffsetOption.size())
|| !ASSIMP_strincmp(pPtr, ScaleOption.c_str(), ScaleOption.size())
|| !ASSIMP_strincmp(pPtr, TurbulenceOption.c_str(), TurbulenceOption.size())
else if ( !ASSIMP_strincmp(pPtr, OffsetOption.c_str(), static_cast<unsigned int>(OffsetOption.size()))
|| !ASSIMP_strincmp(pPtr, ScaleOption.c_str(), static_cast<unsigned int>(ScaleOption.size()))
|| !ASSIMP_strincmp(pPtr, TurbulenceOption.c_str(), static_cast<unsigned int>(TurbulenceOption.size()))
)
{
skipToken = 4;

View File

@ -104,7 +104,7 @@ void ObjFileParser::parseFile( IOStreamBuffer<char> &streamBuffer ) {
// only update every 100KB or it'll be too slow
//const unsigned int updateProgressEveryBytes = 100 * 1024;
unsigned int progressCounter = 0;
const unsigned int bytesToProcess = streamBuffer.size();
const unsigned int bytesToProcess = static_cast<unsigned int>(streamBuffer.size());
const unsigned int progressTotal = 3 * bytesToProcess;
const unsigned int progressOffset = bytesToProcess;
unsigned int processed = 0;
@ -118,7 +118,7 @@ void ObjFileParser::parseFile( IOStreamBuffer<char> &streamBuffer ) {
// Handle progress reporting
const size_t filePos( streamBuffer.getFilePos() );
if ( lastFilePos < filePos ) {
processed += filePos;
processed += static_cast<unsigned int>(filePos);
lastFilePos = filePos;
progressCounter++;
m_progress->UpdateFileRead( progressOffset + processed * 2, progressTotal );
@ -377,9 +377,9 @@ void ObjFileParser::getFace( aiPrimitiveType type ) {
ObjFile::Face *face = new ObjFile::Face( type );
bool hasNormal = false;
const int vSize = m_pModel->m_Vertices.size();
const int vtSize = m_pModel->m_TextureCoord.size();
const int vnSize = m_pModel->m_Normals.size();
const int vSize = static_cast<unsigned int>(m_pModel->m_Vertices.size());
const int vtSize = static_cast<unsigned int>(m_pModel->m_TextureCoord.size());
const int vnSize = static_cast<unsigned int>(m_pModel->m_Normals.size());
const bool vt = (!m_pModel->m_TextureCoord.empty());
const bool vn = (!m_pModel->m_Normals.empty());
@ -772,7 +772,7 @@ void ObjFileParser::createMesh( const std::string &meshName )
ai_assert( NULL != m_pModel );
m_pModel->m_pCurrentMesh = new ObjFile::Mesh( meshName );
m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh );
unsigned int meshId = m_pModel->m_Meshes.size()-1;
unsigned int meshId = static_cast<unsigned int>(m_pModel->m_Meshes.size()-1);
if ( NULL != m_pModel->m_pCurrent )
{
m_pModel->m_pCurrent->m_Meshes.push_back( meshId );

View File

@ -483,7 +483,7 @@ void OgreBinarySerializer::ReadSubMesh(Mesh *mesh)
NormalizeBoneWeights(submesh->vertexData);
submesh->index = mesh->subMeshes.size();
submesh->index = static_cast<unsigned int>(mesh->subMeshes.size());
mesh->subMeshes.push_back(submesh);
}

View File

@ -77,7 +77,7 @@ void OgreImporter::ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIO
aiMaterial *material = ReadMaterial(pFile, pIOHandler, submesh->materialRef);
if (material)
{
submesh->materialIndex = materials.size();
submesh->materialIndex = static_cast<int>(materials.size());
materials.push_back(material);
}
}
@ -99,7 +99,7 @@ void OgreImporter::ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIO
aiMaterial *material = ReadMaterial(pFile, pIOHandler, submesh->materialRef);
if (material)
{
submesh->materialIndex = materials.size();
submesh->materialIndex = static_cast<int>(materials.size());
materials.push_back(material);
}
}
@ -110,7 +110,7 @@ void OgreImporter::ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIO
void OgreImporter::AssignMaterials(aiScene *pScene, std::vector<aiMaterial*> &materials)
{
pScene->mNumMaterials = materials.size();
pScene->mNumMaterials = static_cast<unsigned int>(materials.size());
if (pScene->mNumMaterials > 0)
{
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials];

View File

@ -274,12 +274,12 @@ AssimpVertexBoneWeightList IVertexData::AssimpBoneWeights(size_t vertices)
AssimpVertexBoneWeightList weights;
for(size_t vi=0; vi<vertices; ++vi)
{
VertexBoneAssignmentList &vertexWeights = boneAssignmentsMap[vi];
VertexBoneAssignmentList &vertexWeights = boneAssignmentsMap[static_cast<unsigned int>(vi)];
for (VertexBoneAssignmentList::const_iterator iter=vertexWeights.begin(), end=vertexWeights.end();
iter!=end; ++iter)
{
std::vector<aiVertexWeight> &boneWeights = weights[iter->boneIndex];
boneWeights.push_back(aiVertexWeight(vi, iter->weight));
boneWeights.push_back(aiVertexWeight(static_cast<unsigned int>(vi), iter->weight));
}
}
return weights;
@ -319,7 +319,7 @@ uint32_t VertexData::VertexSize(uint16_t source) const
for(const auto &element : vertexElements)
{
if (element.source == source)
size += element.Size();
size += static_cast<uint32_t>(element.Size());
}
return size;
}
@ -460,7 +460,7 @@ void Mesh::ConvertToAssimpScene(aiScene* dest)
}
// Setup
dest->mNumMeshes = NumSubMeshes();
dest->mNumMeshes = static_cast<unsigned int>(NumSubMeshes());
dest->mMeshes = new aiMesh*[dest->mNumMeshes];
// Create root node
@ -471,7 +471,7 @@ void Mesh::ConvertToAssimpScene(aiScene* dest)
// Export meshes
for(size_t i=0; i<dest->mNumMeshes; ++i) {
dest->mMeshes[i] = subMeshes[i]->ConvertToAssimpMesh(this);
dest->mRootNode->mMeshes[i] = i;
dest->mRootNode->mMeshes[i] = static_cast<unsigned int>(i);
}
// Export skeleton
@ -481,7 +481,7 @@ void Mesh::ConvertToAssimpScene(aiScene* dest)
if (!skeleton->bones.empty())
{
BoneList rootBones = skeleton->RootBones();
dest->mRootNode->mNumChildren = rootBones.size();
dest->mRootNode->mNumChildren = static_cast<unsigned int>(rootBones.size());
dest->mRootNode->mChildren = new aiNode*[dest->mRootNode->mNumChildren];
for(size_t i=0, len=rootBones.size(); i<len; ++i)
@ -493,7 +493,7 @@ void Mesh::ConvertToAssimpScene(aiScene* dest)
// Animations
if (!skeleton->animations.empty())
{
dest->mNumAnimations = skeleton->animations.size();
dest->mNumAnimations = static_cast<unsigned int>(skeleton->animations.size());
dest->mAnimations = new aiAnimation*[dest->mNumAnimations];
for(size_t i=0, len=skeleton->animations.size(); i<len; ++i)
@ -572,7 +572,7 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent)
// Assimp required unique vertices, we need to convert from Ogres shared indexing.
size_t uniqueVertexCount = dest->mNumFaces * 3;
dest->mNumVertices = uniqueVertexCount;
dest->mNumVertices = static_cast<unsigned int>(uniqueVertexCount);
dest->mVertices = new aiVector3D[dest->mNumVertices];
// Source streams
@ -604,7 +604,7 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent)
{
if (uv1Element->type == VertexElement::VET_FLOAT2 || uv1Element->type == VertexElement::VET_FLOAT3)
{
dest->mNumUVComponents[0] = uv1Element->ComponentCount();
dest->mNumUVComponents[0] = static_cast<unsigned int>(uv1Element->ComponentCount());
dest->mTextureCoords[0] = new aiVector3D[dest->mNumVertices];
}
else
@ -617,7 +617,7 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent)
{
if (uv2Element->type == VertexElement::VET_FLOAT2 || uv2Element->type == VertexElement::VET_FLOAT3)
{
dest->mNumUVComponents[1] = uv2Element->ComponentCount();
dest->mNumUVComponents[1] = static_cast<unsigned int>(uv2Element->ComponentCount());
dest->mTextureCoords[1] = new aiVector3D[dest->mNumVertices];
}
else
@ -665,11 +665,11 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent)
const size_t newIndex = pos + v;
// Write face index
face.mIndices[v] = newIndex;
face.mIndices[v] = static_cast<unsigned int>(newIndex);
// Ogres vertex index to ref into the source buffers.
const size_t ogreVertexIndex = ogreFace.mIndices[v];
src->AddVertexMapping(ogreVertexIndex, newIndex);
src->AddVertexMapping(static_cast<uint32_t>(ogreVertexIndex), static_cast<uint32_t>(newIndex));
// Position
positions->Seek((vWidthPosition * ogreVertexIndex) + positionsElement->offset, aiOrigin_SET);
@ -704,7 +704,7 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent)
AssimpVertexBoneWeightList weights = src->AssimpBoneWeights(dest->mNumVertices);
std::set<uint16_t> referencedBones = src->ReferencedBonesByWeights();
dest->mNumBones = referencedBones.size();
dest->mNumBones = static_cast<unsigned int>(referencedBones.size());
dest->mBones = new aiBone*[dest->mNumBones];
size_t assimpBoneIndex = 0;
@ -758,7 +758,7 @@ SubMeshXml *MeshXml::GetSubMesh(uint16_t index) const
void MeshXml::ConvertToAssimpScene(aiScene* dest)
{
// Setup
dest->mNumMeshes = NumSubMeshes();
dest->mNumMeshes = static_cast<unsigned int>(NumSubMeshes());
dest->mMeshes = new aiMesh*[dest->mNumMeshes];
// Create root node
@ -770,7 +770,7 @@ void MeshXml::ConvertToAssimpScene(aiScene* dest)
for(size_t i=0; i<dest->mNumMeshes; ++i)
{
dest->mMeshes[i] = subMeshes[i]->ConvertToAssimpMesh(this);
dest->mRootNode->mMeshes[i] = i;
dest->mRootNode->mMeshes[i] = static_cast<unsigned int>(i);
}
// Export skeleton
@ -780,7 +780,7 @@ void MeshXml::ConvertToAssimpScene(aiScene* dest)
if (!skeleton->bones.empty())
{
BoneList rootBones = skeleton->RootBones();
dest->mRootNode->mNumChildren = rootBones.size();
dest->mRootNode->mNumChildren = static_cast<unsigned int>(rootBones.size());
dest->mRootNode->mChildren = new aiNode*[dest->mRootNode->mNumChildren];
for(size_t i=0, len=rootBones.size(); i<len; ++i)
@ -792,7 +792,7 @@ void MeshXml::ConvertToAssimpScene(aiScene* dest)
// Animations
if (!skeleton->animations.empty())
{
dest->mNumAnimations = skeleton->animations.size();
dest->mNumAnimations = static_cast<unsigned int>(skeleton->animations.size());
dest->mAnimations = new aiAnimation*[dest->mNumAnimations];
for(size_t i=0, len=skeleton->animations.size(); i<len; ++i)
@ -840,7 +840,7 @@ aiMesh *SubMeshXml::ConvertToAssimpMesh(MeshXml *parent)
// Assimp required unique vertices, we need to convert from Ogres shared indexing.
size_t uniqueVertexCount = dest->mNumFaces * 3;
dest->mNumVertices = uniqueVertexCount;
dest->mNumVertices = static_cast<unsigned int>(uniqueVertexCount);
dest->mVertices = new aiVector3D[dest->mNumVertices];
VertexDataXml *src = (!usesSharedVertexData ? vertexData : parent->sharedVertexData);
@ -875,11 +875,11 @@ aiMesh *SubMeshXml::ConvertToAssimpMesh(MeshXml *parent)
const size_t newIndex = pos + v;
// Write face index
face.mIndices[v] = newIndex;
face.mIndices[v] = static_cast<unsigned int>(newIndex);
// Ogres vertex index to ref into the source buffers.
const size_t ogreVertexIndex = ogreFace.mIndices[v];
src->AddVertexMapping(ogreVertexIndex, newIndex);
src->AddVertexMapping(static_cast<uint32_t>(ogreVertexIndex), static_cast<uint32_t>(newIndex));
// Position
dest->mVertices[newIndex] = src->positions[ogreVertexIndex];
@ -904,7 +904,7 @@ aiMesh *SubMeshXml::ConvertToAssimpMesh(MeshXml *parent)
AssimpVertexBoneWeightList weights = src->AssimpBoneWeights(dest->mNumVertices);
std::set<uint16_t> referencedBones = src->ReferencedBonesByWeights();
dest->mNumBones = referencedBones.size();
dest->mNumBones = static_cast<unsigned int>(referencedBones.size());
dest->mBones = new aiBone*[dest->mNumBones];
size_t assimpBoneIndex = 0;
@ -958,7 +958,7 @@ aiAnimation *Animation::ConvertToAssimpAnimation()
// Tracks
if (!tracks.empty())
{
anim->mNumChannels = tracks.size();
anim->mNumChannels = static_cast<unsigned int>(tracks.size());
anim->mChannels = new aiNodeAnim*[anim->mNumChannels];
for(size_t i=0, len=tracks.size(); i<len; ++i)
@ -1099,7 +1099,7 @@ aiNode *Bone::ConvertToAssimpNode(Skeleton *skeleton, aiNode *parentNode)
// Children
if (!children.empty())
{
node->mNumChildren = children.size();
node->mNumChildren = static_cast<unsigned int>(children.size());
node->mChildren = new aiNode*[node->mNumChildren];
for(size_t i=0, len=children.size(); i<len; ++i)
@ -1122,7 +1122,7 @@ aiBone *Bone::ConvertToAssimpBone(Skeleton * /*parent*/, const std::vector<aiVer
if (!boneWeights.empty())
{
bone->mNumWeights = boneWeights.size();
bone->mNumWeights = static_cast<unsigned int>(boneWeights.size());
bone->mWeights = new aiVertexWeight[boneWeights.size()];
memcpy(bone->mWeights, &boneWeights[0], boneWeights.size() * sizeof(aiVertexWeight));
}
@ -1158,9 +1158,9 @@ aiNodeAnim *VertexAnimationTrack::ConvertToAssimpAnimationNode(Skeleton *skeleto
nodeAnim->mPositionKeys = new aiVectorKey[numKeyframes];
nodeAnim->mRotationKeys = new aiQuatKey[numKeyframes];
nodeAnim->mScalingKeys = new aiVectorKey[numKeyframes];
nodeAnim->mNumPositionKeys = numKeyframes;
nodeAnim->mNumRotationKeys = numKeyframes;
nodeAnim->mNumScalingKeys = numKeyframes;
nodeAnim->mNumPositionKeys = static_cast<unsigned int>(numKeyframes);
nodeAnim->mNumRotationKeys = static_cast<unsigned int>(numKeyframes);
nodeAnim->mNumScalingKeys = static_cast<unsigned int>(numKeyframes);
for(size_t kfi=0; kfi<numKeyframes; ++kfi)
{

View File

@ -623,7 +623,7 @@ void OgreXmlSerializer::ReadSubMesh(MeshXml *mesh)
SkipCurrentNode();
}
submesh->index = mesh->subMeshes.size();
submesh->index = static_cast<unsigned int>(mesh->subMeshes.size());
mesh->subMeshes.push_back(submesh);
}

View File

@ -518,7 +518,7 @@ void OpenGEXImporter::handleObjectRefNode( DDLNode *node, aiScene *pScene ) {
// when we are dealing with a geometry node prepare the mesh cache
if ( m_tokenType == Grammar::GeometryNodeToken ) {
m_currentNode->mNumMeshes = objRefNames.size();
m_currentNode->mNumMeshes = static_cast<unsigned int>(objRefNames.size());
m_currentNode->mMeshes = new unsigned int[ objRefNames.size() ];
if ( !objRefNames.empty() ) {
m_unresolvedRefStack.push_back( new RefInfo( m_currentNode, RefInfo::MeshRef, objRefNames ) );
@ -863,9 +863,9 @@ void OpenGEXImporter::handleIndexArrayNode( ODDLParser::DDLNode *node, aiScene *
}
const size_t numItems( countDataArrayListItems( vaList ) );
m_currentMesh->mNumFaces = numItems;
m_currentMesh->mNumFaces = static_cast<unsigned int>(numItems);
m_currentMesh->mFaces = new aiFace[ numItems ];
m_currentMesh->mNumVertices = numItems * 3;
m_currentMesh->mNumVertices = static_cast<unsigned int>(numItems * 3);
m_currentMesh->mVertices = new aiVector3D[ m_currentMesh->mNumVertices ];
bool hasColors( false );
if ( m_currentVertices.m_numColors > 0 ) {
@ -1086,7 +1086,7 @@ void OpenGEXImporter::copyMeshes( aiScene *pScene ) {
return;
}
pScene->mNumMeshes = m_meshCache.size();
pScene->mNumMeshes = static_cast<unsigned int>(m_meshCache.size());
pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes ];
std::copy( m_meshCache.begin(), m_meshCache.end(), pScene->mMeshes );
}
@ -1099,7 +1099,7 @@ void OpenGEXImporter::copyCameras( aiScene *pScene ) {
return;
}
pScene->mNumCameras = m_cameraCache.size();
pScene->mNumCameras = static_cast<unsigned int>(m_cameraCache.size());
pScene->mCameras = new aiCamera*[ pScene->mNumCameras ];
std::copy( m_cameraCache.begin(), m_cameraCache.end(), pScene->mCameras );
}
@ -1112,7 +1112,7 @@ void OpenGEXImporter::copyLights( aiScene *pScene ) {
return;
}
pScene->mNumLights = m_lightCache.size();
pScene->mNumLights = static_cast<unsigned int>(m_lightCache.size());
pScene->mLights = new aiLight*[ pScene->mNumLights ];
std::copy( m_lightCache.begin(), m_lightCache.end(), pScene->mLights );
}
@ -1133,7 +1133,7 @@ void OpenGEXImporter::resolveReferences() {
const std::string &name( currentRefInfo->m_Names[ i ] );
ReferenceMap::const_iterator it( m_mesh2refMap.find( name ) );
if( m_mesh2refMap.end() != it ) {
unsigned int meshIdx = m_mesh2refMap[ name ];
unsigned int meshIdx = static_cast<unsigned int>(m_mesh2refMap[ name ]);
node->mMeshes[ i ] = meshIdx;
}
}
@ -1156,7 +1156,7 @@ void OpenGEXImporter::createNodeTree( aiScene *pScene ) {
return;
}
pScene->mRootNode->mNumChildren = m_root->m_children.size();
pScene->mRootNode->mNumChildren = static_cast<unsigned int>(m_root->m_children.size());
pScene->mRootNode->mChildren = new aiNode*[ pScene->mRootNode->mNumChildren ];
std::copy( m_root->m_children.begin(), m_root->m_children.end(), pScene->mRootNode->mChildren );
}

View File

@ -230,7 +230,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list<aiNode*>& no
else nd->mChildren = NULL;
}
nd->mNumChildren = child_nodes.size();
nd->mNumChildren = static_cast<unsigned int>(child_nodes.size());
aiNode** tmp = nd->mChildren;
for (std::list<aiNode*>::iterator it = child_nodes.begin(); it != child_nodes.end(); ++it) {
@ -238,7 +238,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list<aiNode*>& no
node->mParent = nd;
}
nodes_out += child_nodes.size();
nodes_out += static_cast<unsigned int>(child_nodes.size());
}
// ------------------------------------------------------------------------------------------------

View File

@ -145,7 +145,7 @@ void OptimizeMeshesProcess::Execute( aiScene* pScene)
meshes.resize( 0 );
ai_assert(output.size() <= num_old);
mScene->mNumMeshes = output.size();
mScene->mNumMeshes = static_cast<unsigned int>(output.size());
std::copy(output.begin(),output.end(),mScene->mMeshes);
if (output.size() != num_old) {
@ -199,7 +199,7 @@ void OptimizeMeshesProcess::ProcessNode( aiNode* pNode)
} else {
output.push_back(mScene->mMeshes[im]);
}
im = output.size()-1;
im = static_cast<unsigned int>(output.size()-1);
}
}

View File

@ -397,7 +397,7 @@ void PretransformVertices::BuildWCSMeshes(std::vector<aiMesh*>& out, aiMesh** in
out.push_back(ntz);
node->mMeshes[i] = numIn + out.size() - 1;
node->mMeshes[i] = static_cast<unsigned int>(numIn + out.size() - 1);
}
}
}
@ -483,7 +483,7 @@ void PretransformVertices::Execute( aiScene* pScene)
memcpy(npp,pScene->mMeshes,sizeof(aiMesh*)*pScene->mNumMeshes);
memcpy(npp+pScene->mNumMeshes,&apcOutMeshes[0],sizeof(aiMesh*)*apcOutMeshes.size());
pScene->mNumMeshes += apcOutMeshes.size();
pScene->mNumMeshes += static_cast<unsigned int>(apcOutMeshes.size());
delete[] pScene->mMeshes; pScene->mMeshes = npp;
}

View File

@ -308,7 +308,7 @@ aiMesh* MakeSubmesh(const aiMesh *pMesh, const std::vector<unsigned int> &subMes
for(unsigned int j=0;j<f.mNumIndices;j++) {
if(vMap[f.mIndices[j]]==UINT_MAX) {
vMap[f.mIndices[j]] = numSubVerts++;
vMap[f.mIndices[j]] = static_cast<unsigned int>(numSubVerts++);
}
}
}
@ -320,8 +320,8 @@ aiMesh* MakeSubmesh(const aiMesh *pMesh, const std::vector<unsigned int> &subMes
// create all the arrays for this mesh if the old mesh contained them
oMesh->mNumFaces = subMeshFaces.size();
oMesh->mNumVertices = numSubVerts;
oMesh->mNumFaces = static_cast<unsigned int>(subMeshFaces.size());
oMesh->mNumVertices = static_cast<unsigned int>(numSubVerts);
oMesh->mVertices = new aiVector3D[numSubVerts];
if( pMesh->HasNormals() ) {
oMesh->mNormals = new aiVector3D[numSubVerts];
@ -332,12 +332,12 @@ aiMesh* MakeSubmesh(const aiMesh *pMesh, const std::vector<unsigned int> &subMes
oMesh->mBitangents = new aiVector3D[numSubVerts];
}
for( size_t a = 0; pMesh->HasTextureCoords( a) ; ++a ) {
for( size_t a = 0; pMesh->HasTextureCoords(static_cast<unsigned int>(a)) ; ++a ) {
oMesh->mTextureCoords[a] = new aiVector3D[numSubVerts];
oMesh->mNumUVComponents[a] = pMesh->mNumUVComponents[a];
}
for( size_t a = 0; pMesh->HasVertexColors( a); ++a ) {
for( size_t a = 0; pMesh->HasVertexColors( static_cast<unsigned int>(a)); ++a ) {
oMesh->mColors[a] = new aiColor4D[numSubVerts];
}

View File

@ -330,14 +330,14 @@ void Q3BSPFileImporter::CreateNodes( const Q3BSP::Q3BSPModel *pModel, aiScene* p
}
}
pParent->mNumChildren = MeshArray.size();
pParent->mNumChildren = static_cast<unsigned int>(MeshArray.size());
pParent->mChildren = new aiNode*[ pScene->mRootNode->mNumChildren ];
for ( size_t i=0; i<NodeArray.size(); i++ )
{
aiNode *pNode = NodeArray[ i ];
pNode->mParent = pParent;
pParent->mChildren[ i ] = pNode;
pParent->mChildren[ i ]->mMeshes[ 0 ] = i;
pParent->mChildren[ i ]->mMeshes[ 0 ] = static_cast<unsigned int>(i);
}
}
@ -364,9 +364,9 @@ aiNode *Q3BSPFileImporter::CreateTopology( const Q3BSP::Q3BSPModel *pModel,
pMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
pMesh->mFaces = new aiFace[ numTriangles ];
pMesh->mNumFaces = numTriangles;
pMesh->mNumFaces = static_cast<unsigned int>(numTriangles);
pMesh->mNumVertices = numVerts;
pMesh->mNumVertices = static_cast<unsigned int>(numVerts);
pMesh->mVertices = new aiVector3D[ numVerts ];
pMesh->mNormals = new aiVector3D[ numVerts ];
pMesh->mTextureCoords[ 0 ] = new aiVector3D[ numVerts ];
@ -515,7 +515,7 @@ void Q3BSPFileImporter::createMaterials( const Q3BSP::Q3BSPModel *pModel, aiScen
pScene->mMaterials[ pScene->mNumMaterials ] = pMatHelper;
pScene->mNumMaterials++;
}
pScene->mNumTextures = mTextures.size();
pScene->mNumTextures = static_cast<unsigned int>(mTextures.size());
pScene->mTextures = new aiTexture*[ pScene->mNumTextures ];
std::copy( mTextures.begin(), mTextures.end(), pScene->mTextures );
}
@ -649,7 +649,7 @@ bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *pMode
size_t texSize = pTextureStream->FileSize();
aiTexture *pTexture = new aiTexture;
pTexture->mHeight = 0;
pTexture->mWidth = texSize;
pTexture->mWidth = static_cast<unsigned int>(texSize);
unsigned char *pData = new unsigned char[ pTexture->mWidth ];
size_t readSize = pTextureStream->Read( pData, sizeof( unsigned char ), pTexture->mWidth );
(void)readSize;
@ -663,7 +663,7 @@ bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *pMode
aiString name;
name.data[ 0 ] = '*';
name.length = 1 + ASSIMP_itoa10( name.data + 1, MAXLEN-1, mTextures.size() );
name.length = 1 + ASSIMP_itoa10( name.data + 1, static_cast<unsigned int>(MAXLEN-1), static_cast<int32_t>(mTextures.size()) );
pArchive->Close( pTextureStream );
@ -721,7 +721,7 @@ bool Q3BSPFileImporter::importLightmap( const Q3BSP::Q3BSPModel *pModel, aiScene
aiString name;
name.data[ 0 ] = '*';
name.length = 1 + ASSIMP_itoa10( name.data + 1, MAXLEN-1, mTextures.size() );
name.length = 1 + ASSIMP_itoa10( name.data + 1, static_cast<unsigned int>(MAXLEN-1), static_cast<int32_t>(mTextures.size()) );
pMatHelper->AddProperty( &name,AI_MATKEY_TEXTURE_LIGHTMAP( 1 ) );
mTextures.push_back( pTexture );

View File

@ -73,19 +73,19 @@ voidpf IOSystem2Unzip::open(voidpf opaque, const char* filename, int mode) {
uLong IOSystem2Unzip::read(voidpf /*opaque*/, voidpf stream, void* buf, uLong size) {
IOStream* io_stream = (IOStream*) stream;
return io_stream->Read(buf, 1, size);
return static_cast<uLong>(io_stream->Read(buf, 1, size));
}
uLong IOSystem2Unzip::write(voidpf /*opaque*/, voidpf stream, const void* buf, uLong size) {
IOStream* io_stream = (IOStream*) stream;
return io_stream->Write(buf, 1, size);
return static_cast<uLong>(io_stream->Write(buf, 1, size));
}
long IOSystem2Unzip::tell(voidpf /*opaque*/, voidpf stream) {
IOStream* io_stream = (IOStream*) stream;
return io_stream->Tell();
return static_cast<long>(io_stream->Tell());
}
long IOSystem2Unzip::seek(voidpf /*opaque*/, voidpf stream, uLong offset, int origin) {

View File

@ -131,7 +131,7 @@ static SIBEdge& GetEdge(SIBMesh* mesh, uint32_t posA, uint32_t posB)
SIBEdge edge;
edge.creased = false;
edge.faceA = edge.faceB = 0xffffffff;
mesh->edgeMap[pair] = mesh->edges.size();
mesh->edgeMap[pair] = static_cast<uint32_t>(mesh->edges.size());
mesh->edges.push_back(edge);
return mesh->edges.back();
}
@ -246,7 +246,7 @@ static void ReadFaces(SIBMesh* mesh, StreamReaderLE* stream)
mesh->idx[pos-1] = numPoints;
uint32_t *idx = &mesh->idx[pos];
mesh->faceStart.push_back(pos-1);
mesh->faceStart.push_back(static_cast<uint32_t>(pos-1));
mesh->mtls.push_back(0);
// Read all the position data.
@ -387,9 +387,9 @@ static void ConnectFaces(SIBMesh* mesh)
// This gives potentially undesirable normals when used
// with non-2-manifold surfaces, but then so does Silo to begin with.
if (edge.faceA == 0xffffffff)
edge.faceA = faceIdx;
edge.faceA = static_cast<uint32_t>(faceIdx);
else
edge.faceB = faceIdx;
edge.faceB = static_cast<uint32_t>(faceIdx);
prev = next;
}
@ -498,7 +498,7 @@ static void CalculateNormals(SIBMesh* mesh)
{
uint32_t pos = idx[i*N+POS];
uint32_t nrm = idx[i*N+NRM];
aiVector3D vtxNorm = CalculateVertexNormal(mesh, faceIdx, pos, faceNormals);
aiVector3D vtxNorm = CalculateVertexNormal(mesh, static_cast<uint32_t>(faceIdx), pos, faceNormals);
mesh->nrm[nrm] = vtxNorm;
}
}
@ -588,7 +588,7 @@ static void ReadShape(SIB* sib, StreamReaderLE* stream)
for (unsigned pt=0;pt<face.mNumIndices;pt++,idx+=N)
{
size_t vtxIdx = dest.vtx.size();
face.mIndices[pt] = vtxIdx;
face.mIndices[pt] = static_cast<unsigned int>(vtxIdx);
// De-index it. We don't need to validate here as
// we did it when creating the data.
@ -623,14 +623,14 @@ static void ReadShape(SIB* sib, StreamReaderLE* stream)
aiMesh* mesh = new aiMesh;
mesh->mName = name;
mesh->mNumFaces = src.faces.size();
mesh->mNumFaces = static_cast<unsigned int>(src.faces.size());
mesh->mFaces = new aiFace[mesh->mNumFaces];
mesh->mNumVertices = src.vtx.size();
mesh->mNumVertices = static_cast<unsigned int>(src.vtx.size());
mesh->mVertices = new aiVector3D[mesh->mNumVertices];
mesh->mNormals = new aiVector3D[mesh->mNumVertices];
mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
mesh->mNumUVComponents[0] = 2;
mesh->mMaterialIndex = n;
mesh->mMaterialIndex = static_cast<unsigned int>(n);
for (unsigned i=0;i<mesh->mNumVertices;i++)
{
@ -866,9 +866,9 @@ void SIBImporter::InternReadFile(const std::string& pFile,
sib.insts.clear();
// Transfer to the aiScene.
pScene->mNumMaterials = sib.mtls.size();
pScene->mNumMeshes = sib.meshes.size();
pScene->mNumLights = sib.lights.size();
pScene->mNumMaterials = static_cast<unsigned int>(sib.mtls.size());
pScene->mNumMeshes = static_cast<unsigned int>(sib.meshes.size());
pScene->mNumLights = static_cast<unsigned int>(sib.lights.size());
pScene->mMaterials = pScene->mNumMaterials ? new aiMaterial*[pScene->mNumMaterials] : NULL;
pScene->mMeshes = pScene->mNumMeshes ? new aiMesh*[pScene->mNumMeshes] : NULL;
pScene->mLights = pScene->mNumLights ? new aiLight*[pScene->mNumLights] : NULL;
@ -883,7 +883,7 @@ void SIBImporter::InternReadFile(const std::string& pFile,
size_t childIdx = 0;
aiNode *root = new aiNode();
root->mName.Set("<SIBRoot>");
root->mNumChildren = sib.objs.size() + sib.lights.size();
root->mNumChildren = static_cast<unsigned int>(sib.objs.size() + sib.lights.size());
root->mChildren = root->mNumChildren ? new aiNode*[root->mNumChildren] : NULL;
pScene->mRootNode = root;
@ -897,10 +897,10 @@ void SIBImporter::InternReadFile(const std::string& pFile,
node->mParent = root;
node->mTransformation = obj.axis;
node->mNumMeshes = obj.meshCount;
node->mNumMeshes = static_cast<unsigned int>(obj.meshCount);
node->mMeshes = node->mNumMeshes ? new unsigned[node->mNumMeshes] : NULL;
for (unsigned i=0;i<node->mNumMeshes;i++)
node->mMeshes[i] = obj.meshIdx + i;
node->mMeshes[i] = static_cast<unsigned int>(obj.meshIdx + i);
// Mark instanced objects as being so.
if (n >= firstInst)

View File

@ -245,7 +245,7 @@ void STLImporter::LoadASCIIFile()
positionBuffer.reserve(sizeEstimate);
normalBuffer.reserve(sizeEstimate);
while (IsAsciiSTL(sz, bufferEnd - sz))
while (IsAsciiSTL(sz, static_cast<unsigned int>(bufferEnd - sz)))
{
aiMesh* pMesh = new aiMesh();
pMesh->mMaterialIndex = 0;
@ -367,8 +367,8 @@ void STLImporter::LoadASCIIFile()
pMesh->mNumFaces = 0;
throw DeadlyImportError("Normal buffer size does not match position buffer size");
}
pMesh->mNumFaces = positionBuffer.size() / 3;
pMesh->mNumVertices = positionBuffer.size();
pMesh->mNumFaces = static_cast<unsigned int>(positionBuffer.size() / 3);
pMesh->mNumVertices = static_cast<unsigned int>(positionBuffer.size());
pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
memcpy(pMesh->mVertices, &positionBuffer[0].x, pMesh->mNumVertices * sizeof(aiVector3D));
positionBuffer.clear();

View File

@ -91,7 +91,7 @@ void SceneCombiner::AddNodeHashes(aiNode* node, std::set<unsigned int>& hashes)
// Add node name to hashing set if it is non-empty - empty nodes are allowed
// and they can't have any anims assigned so its absolutely safe to duplicate them.
if (node->mName.length) {
hashes.insert( SuperFastHash(node->mName.data,node->mName.length) );
hashes.insert( SuperFastHash(node->mName.data, static_cast<uint32_t>(node->mName.length)) );
}
// Process all children recursively
@ -115,7 +115,7 @@ void SceneCombiner::AddNodePrefixes(aiNode* node, const char* prefix, unsigned i
// Search for matching names
bool SceneCombiner::FindNameMatch(const aiString& name, std::vector<SceneHelper>& input, unsigned int cur)
{
const unsigned int hash = SuperFastHash(name.data, name.length);
const unsigned int hash = SuperFastHash(name.data, static_cast<uint32_t>(name.length));
// Check whether we find a positive match in one of the given sets
for (unsigned int i = 0; i < input.size(); ++i) {
@ -133,7 +133,7 @@ void SceneCombiner::AddNodePrefixesChecked(aiNode* node, const char* prefix, uns
std::vector<SceneHelper>& input, unsigned int cur)
{
ai_assert(NULL != prefix);
const unsigned int hash = SuperFastHash(node->mName.data,node->mName.length);
const unsigned int hash = SuperFastHash(node->mName.data, static_cast<uint32_t>(node->mName.length));
// Check whether we find a positive match in one of the given sets
for (unsigned int i = 0; i < input.size(); ++i) {
@ -325,7 +325,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
for (unsigned int a = 0; a < src[i]->mNumAnimations;++a) {
aiAnimation* anim = src[i]->mAnimations[a];
src[i].hashes.insert(SuperFastHash(anim->mName.data,anim->mName.length));
src[i].hashes.insert(SuperFastHash(anim->mName.data,static_cast<uint32_t>(anim->mName.length)));
}
}
}
@ -487,7 +487,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
aiAnimation** ppAnims = dest->mAnimations = (dest->mNumAnimations
? new aiAnimation*[dest->mNumAnimations] : NULL);
for ( int n = src.size()-1; n >= 0 ;--n ) /* !!! important !!! */
for ( int n = static_cast<int>(src.size()-1); n >= 0 ;--n ) /* !!! important !!! */
{
SceneHelper* cur = &src[n];
aiNode* node;

View File

@ -85,7 +85,7 @@ SkeletonMeshBuilder::SkeletonMeshBuilder( aiScene* pScene, aiNode* root, bool bK
void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode)
{
// add a joint entry for the node.
const unsigned int vertexStartIndex = mVertices.size();
const unsigned int vertexStartIndex = static_cast<unsigned int>(mVertices.size());
// now build the geometry.
if( pNode->mNumChildren > 0 && !mKnobsOnly)
@ -108,7 +108,7 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode)
aiVector3D front = (up ^ orth).Normalize();
aiVector3D side = (front ^ up).Normalize();
unsigned int localVertexStart = mVertices.size();
unsigned int localVertexStart = static_cast<unsigned int>(mVertices.size());
mVertices.push_back( -front * distanceToChild * (ai_real)0.1);
mVertices.push_back( childpos);
mVertices.push_back( -side * distanceToChild * (ai_real)0.1);
@ -170,7 +170,7 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode)
mFaces.push_back( Face( vertexStartIndex + 21, vertexStartIndex + 22, vertexStartIndex + 23));
}
unsigned int numVertices = mVertices.size() - vertexStartIndex;
unsigned int numVertices = static_cast<unsigned int>(mVertices.size() - vertexStartIndex);
if( numVertices > 0)
{
// create a bone affecting all the newly created vertices
@ -208,14 +208,14 @@ aiMesh* SkeletonMeshBuilder::CreateMesh()
aiMesh* mesh = new aiMesh();
// add points
mesh->mNumVertices = mVertices.size();
mesh->mNumVertices = static_cast<unsigned int>(mVertices.size());
mesh->mVertices = new aiVector3D[mesh->mNumVertices];
std::copy( mVertices.begin(), mVertices.end(), mesh->mVertices);
mesh->mNormals = new aiVector3D[mesh->mNumVertices];
// add faces
mesh->mNumFaces = mFaces.size();
mesh->mNumFaces = static_cast<unsigned int>(mFaces.size());
mesh->mFaces = new aiFace[mesh->mNumFaces];
for( unsigned int a = 0; a < mesh->mNumFaces; a++)
{
@ -240,7 +240,7 @@ aiMesh* SkeletonMeshBuilder::CreateMesh()
}
// add the bones
mesh->mNumBones = mBones.size();
mesh->mNumBones = static_cast<unsigned int>(mBones.size());
mesh->mBones = new aiBone*[mesh->mNumBones];
std::copy( mBones.begin(), mBones.end(), mesh->mBones);

View File

@ -108,7 +108,7 @@ void SpatialSort::Append( const aiVector3D* pPositions, unsigned int pNumPositio
// store position by index and distance
ai_real distance = *vec * mPlaneNormal;
mPositions.push_back( Entry( a+initial, *vec, distance));
mPositions.push_back( Entry( static_cast<unsigned int>(a+initial), *vec, distance));
}
if (pFinalize) {

View File

@ -188,7 +188,7 @@ void CatmullClarkSubdivider::Subdivide (
}
outmeshes.push_back(NULL);inmeshes.push_back(i);
maptbl.push_back(s);
maptbl.push_back(static_cast<unsigned int>(s));
}
// Do the actual subdivision on the preallocated storage. InternSubdivide

View File

@ -100,8 +100,8 @@ void KeyIterator::operator ++()
// to our current position on the time line
double d0,d1;
d0 = objPos->at ( std::min<unsigned int> ( nextObjPos, objPos->size()-1) ).mTime;
d1 = targetObjPos->at( std::min<unsigned int> ( nextTargetObjPos, targetObjPos->size()-1) ).mTime;
d0 = objPos->at ( std::min ( nextObjPos, static_cast<unsigned int>(objPos->size()-1)) ).mTime;
d1 = targetObjPos->at( std::min ( nextTargetObjPos, static_cast<unsigned int>(targetObjPos->size()-1)) ).mTime;
// Easiest case - all are identical. In this
// case we don't need to interpolate so we can

View File

@ -333,7 +333,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
std::vector<Unreal::TempMat>::iterator nt = std::find(materials.begin(),materials.end(),mat);
if (nt == materials.end()) {
// add material
tri.matIndex = materials.size();
tri.matIndex = static_cast<unsigned int>(materials.size());
mat.numFaces = 1;
materials.push_back(mat);

View File

@ -934,7 +934,7 @@ void X3DImporter::GeometryHelper_CoordIdxStr2FacesArr(const std::list<int32_t>&
default: prim_type |= aiPrimitiveType_POLYGON; break;
}
tface.mNumIndices = ts;
tface.mNumIndices = static_cast<unsigned int>(ts);
tface.mIndices = new unsigned int[ts];
memcpy(tface.mIndices, inds.data(), ts * sizeof(unsigned int));
pFaces.push_back(tface);
@ -1329,7 +1329,7 @@ aiMesh* X3DImporter::GeometryHelper_MakeMesh(const std::list<int32_t>& pCoordIdx
size_t ts = faces.size();
// faces
tmesh->mFaces = new aiFace[ts];
tmesh->mNumFaces = ts;
tmesh->mNumFaces = static_cast<unsigned int>(ts);
for(size_t i = 0; i < ts; i++) tmesh->mFaces[i] = faces.at(i);
// vertices
@ -1337,7 +1337,7 @@ aiMesh* X3DImporter::GeometryHelper_MakeMesh(const std::list<int32_t>& pCoordIdx
ts = pVertices.size();
tmesh->mVertices = new aiVector3D[ts];
tmesh->mNumVertices = ts;
tmesh->mNumVertices = static_cast<unsigned int>(ts);
for ( size_t i = 0; i < ts; i++ )
{
tmesh->mVertices[ i ] = *vit++;
@ -1701,7 +1701,7 @@ void X3DImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSy
{
std::list<aiMesh*>::const_iterator it = mesh_list.begin();
pScene->mNumMeshes = mesh_list.size();
pScene->mNumMeshes = static_cast<unsigned int>(mesh_list.size());
pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
for(size_t i = 0; i < pScene->mNumMeshes; i++) pScene->mMeshes[i] = *it++;
}
@ -1710,7 +1710,7 @@ void X3DImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSy
{
std::list<aiMaterial*>::const_iterator it = mat_list.begin();
pScene->mNumMaterials = mat_list.size();
pScene->mNumMaterials = static_cast<unsigned int>(mat_list.size());
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials];
for(size_t i = 0; i < pScene->mNumMaterials; i++) pScene->mMaterials[i] = *it++;
}
@ -1719,7 +1719,7 @@ void X3DImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSy
{
std::list<aiLight*>::const_iterator it = light_list.begin();
pScene->mNumLights = light_list.size();
pScene->mNumLights = static_cast<unsigned int>(light_list.size());
pScene->mLights = new aiLight*[pScene->mNumLights];
for(size_t i = 0; i < pScene->mNumLights; i++) pScene->mLights[i] = *it++;
}

View File

@ -347,8 +347,8 @@ void X3DImporter::ParseNode_Geometry3D_ElevationGrid()
((CX3DImporter_NodeElement_ElevationGrid*)ne)->NumIndices = 2;// will be holded as line set.
for(size_t i = 0, i_e = (grid_alias.Vertices.size() - 1); i < i_e; i++)
{
grid_alias.CoordIdx.push_back(i);
grid_alias.CoordIdx.push_back(i + 1);
grid_alias.CoordIdx.push_back(static_cast<int32_t>(i));
grid_alias.CoordIdx.push_back(static_cast<int32_t>(i + 1));
grid_alias.CoordIdx.push_back(-1);
}
}
@ -758,7 +758,7 @@ void X3DImporter::ParseNode_Geometry3D_Extrusion()
if(beginCap)
{
// add cap as polygon. vertices of cap are places at begin, so just add numbers from zero.
for(size_t i = 0, i_e = crossSection.size(); i < i_e; i++) ext_alias.CoordIndex.push_back(i);
for(size_t i = 0, i_e = crossSection.size(); i < i_e; i++) ext_alias.CoordIndex.push_back(static_cast<int32_t>(i));
// add delimiter
ext_alias.CoordIndex.push_back(-1);
@ -769,7 +769,7 @@ void X3DImporter::ParseNode_Geometry3D_Extrusion()
// add cap as polygon. vertices of cap are places at end, as for beginCap use just sequence of numbers but with offset.
size_t beg = (pointset_arr.size() - 1) * crossSection.size();
for(size_t i = beg, i_e = (beg + crossSection.size()); i < i_e; i++) ext_alias.CoordIndex.push_back(i);
for(size_t i = beg, i_e = (beg + crossSection.size()); i < i_e; i++) ext_alias.CoordIndex.push_back(static_cast<int32_t>(i));
// add delimiter
ext_alias.CoordIndex.push_back(-1);
@ -795,14 +795,20 @@ void X3DImporter::ParseNode_Geometry3D_Extrusion()
if(cri != cr_last)
{
MACRO_FACE_ADD_QUAD(ccw, ext_alias.CoordIndex,
spi * cr_sz + cri, right_col * cr_sz + cri, right_col * cr_sz + cri + 1, spi * cr_sz + cri + 1);
static_cast<int32_t>(spi * cr_sz + cri),
static_cast<int32_t>(right_col * cr_sz + cri),
static_cast<int32_t>(right_col * cr_sz + cri + 1),
static_cast<int32_t>(spi * cr_sz + cri + 1));
// add delimiter
ext_alias.CoordIndex.push_back(-1);
}
else if(cross_closed)// if cross curve is closed then one more quad is needed: between first and last points of curve.
{
MACRO_FACE_ADD_QUAD(ccw, ext_alias.CoordIndex,
spi * cr_sz + cri, right_col * cr_sz + cri, right_col * cr_sz + 0, spi * cr_sz + 0);
static_cast<int32_t>(spi * cr_sz + cri),
static_cast<int32_t>(right_col * cr_sz + cri),
static_cast<int32_t>(right_col * cr_sz + 0),
static_cast<int32_t>(spi * cr_sz + 0));
// add delimiter
ext_alias.CoordIndex.push_back(-1);
}

View File

@ -253,7 +253,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
tarr.reserve(tnemesh.Vertices.size());
for(std::list<aiVector3D>::iterator it = tnemesh.Vertices.begin(); it != tnemesh.Vertices.end(); it++) tarr.push_back(*it);
*pMesh = StandardShapes::MakeMesh(tarr, tnemesh.NumIndices);// create mesh from vertices using Assimp help.
*pMesh = StandardShapes::MakeMesh(tarr, static_cast<unsigned int>(tnemesh.NumIndices));// create mesh from vertices using Assimp help.
return;// mesh is build, nothing to do anymore.
}
@ -272,7 +272,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
tarr.reserve(tnemesh.Vertices.size());
for(std::list<aiVector3D>::iterator it = tnemesh.Vertices.begin(); it != tnemesh.Vertices.end(); it++) tarr.push_back(*it);
*pMesh = StandardShapes::MakeMesh(tarr, tnemesh.NumIndices);// create mesh from vertices using Assimp help.
*pMesh = StandardShapes::MakeMesh(tarr, static_cast<unsigned int>(tnemesh.NumIndices));// create mesh from vertices using Assimp help.
return;// mesh is build, nothing to do anymore.
}
@ -669,7 +669,7 @@ void X3DImporter::Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeEle
{
std::list<aiNode*>::const_iterator it = SceneNode_Child.begin();
pSceneNode.mNumChildren = SceneNode_Child.size();
pSceneNode.mNumChildren = static_cast<unsigned int>(SceneNode_Child.size());
pSceneNode.mChildren = new aiNode*[pSceneNode.mNumChildren];
for(size_t i = 0; i < pSceneNode.mNumChildren; i++) pSceneNode.mChildren[i] = *it++;
}
@ -678,7 +678,7 @@ void X3DImporter::Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeEle
{
std::list<unsigned int>::const_iterator it = SceneNode_Mesh.begin();
pSceneNode.mNumMeshes = SceneNode_Mesh.size();
pSceneNode.mNumMeshes = static_cast<unsigned int>(SceneNode_Mesh.size());
pSceneNode.mMeshes = new unsigned int[pSceneNode.mNumMeshes];
for(size_t i = 0; i < pSceneNode.mNumMeshes; i++) pSceneNode.mMeshes[i] = *it++;
}
@ -702,7 +702,7 @@ void X3DImporter::Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& p
if(tmesh != nullptr)
{
// if mesh successfully built then add data about it to arrays
pNodeMeshInd.push_back(pSceneMeshList.size());
pNodeMeshInd.push_back(static_cast<unsigned int>(pSceneMeshList.size()));
pSceneMeshList.push_back(tmesh);
// keep mesh type. Need above for texture coordinate generation.
mesh_type = (*it)->Type;
@ -714,7 +714,7 @@ void X3DImporter::Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& p
if(tmat != nullptr)
{
// if material successfully built then add data about it to array
mat_ind = pSceneMaterialList.size();
mat_ind = static_cast<unsigned int>(pSceneMaterialList.size());
pSceneMaterialList.push_back(tmat);
}
}
@ -765,7 +765,7 @@ void X3DImporter::Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pN
}
// copy collected metadata to output node.
pSceneNode.mMetaData = aiMetadata::Alloc( meta_list.size() );
pSceneNode.mMetaData = aiMetadata::Alloc( static_cast<unsigned int>(meta_list.size()) );
meta_idx = 0;
for(std::list<CX3DImporter_NodeElement*>::const_iterator it = meta_list.begin(); it != meta_list.end(); it++, meta_idx++)
{
@ -776,22 +776,22 @@ void X3DImporter::Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pN
if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaBoolean)
{
if(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.size() > 0)
pSceneNode.mMetaData->Set(meta_idx, cur_meta->Name, *(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.begin()));
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, *(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.begin()));
}
else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaDouble)
{
if(((CX3DImporter_NodeElement_MetaDouble*)cur_meta)->Value.size() > 0)
pSceneNode.mMetaData->Set(meta_idx, cur_meta->Name, (float)*(((CX3DImporter_NodeElement_MetaDouble*)cur_meta)->Value.begin()));
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, (float)*(((CX3DImporter_NodeElement_MetaDouble*)cur_meta)->Value.begin()));
}
else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaFloat)
{
if(((CX3DImporter_NodeElement_MetaFloat*)cur_meta)->Value.size() > 0)
pSceneNode.mMetaData->Set(meta_idx, cur_meta->Name, *(((CX3DImporter_NodeElement_MetaFloat*)cur_meta)->Value.begin()));
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, *(((CX3DImporter_NodeElement_MetaFloat*)cur_meta)->Value.begin()));
}
else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaInteger)
{
if(((CX3DImporter_NodeElement_MetaInteger*)cur_meta)->Value.size() > 0)
pSceneNode.mMetaData->Set(meta_idx, cur_meta->Name, *(((CX3DImporter_NodeElement_MetaInteger*)cur_meta)->Value.begin()));
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, *(((CX3DImporter_NodeElement_MetaInteger*)cur_meta)->Value.begin()));
}
else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaString)
{
@ -799,7 +799,7 @@ void X3DImporter::Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pN
{
aiString tstr(((CX3DImporter_NodeElement_MetaString*)cur_meta)->Value.begin()->data());
pSceneNode.mMetaData->Set(meta_idx, cur_meta->Name, tstr);
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, tstr);
}
}
else

View File

@ -524,7 +524,7 @@ void X3DImporter::ParseNode_Rendering_LineSet()
{
if(*vc_it < 2) throw DeadlyImportError("LineSet. vertexCount shall be greater than or equal to two.");
for(int32_t i = 0; i < *vc_it; i++) ne_alias.CoordIndex.push_back(coord_num++);// add vertices indices
for(int32_t i = 0; i < *vc_it; i++) ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num++));// add vertices indices
ne_alias.CoordIndex.push_back(-1);// add face delimiter.
}
@ -678,17 +678,17 @@ void X3DImporter::ParseNode_Rendering_TriangleFanSet()
{
// 2 1
// 0
ne_alias.CoordIndex.push_back(coord_num_first);// first vertex is a center and always is [0].
ne_alias.CoordIndex.push_back(coord_num_prev++);
ne_alias.CoordIndex.push_back(coord_num_prev);
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num_first));// first vertex is a center and always is [0].
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num_prev++));
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num_prev));
}
else
{
// 1 2
// 0
ne_alias.CoordIndex.push_back(coord_num_first);// first vertex is a center and always is [0].
ne_alias.CoordIndex.push_back(coord_num_prev + 1);
ne_alias.CoordIndex.push_back(coord_num_prev++);
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num_first));// first vertex is a center and always is [0].
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num_prev + 1));
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num_prev++));
}// if(ccw) else
ne_alias.CoordIndex.push_back(-1);// add face delimiter.
@ -875,17 +875,17 @@ void X3DImporter::ParseNode_Rendering_TriangleStripSet()
{
// 0 2
// 1
ne_alias.CoordIndex.push_back(coord_num0);
ne_alias.CoordIndex.push_back(coord_num1);
ne_alias.CoordIndex.push_back(coord_num2);
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num0));
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num1));
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num2));
}
else
{
// 0 1
// 2
ne_alias.CoordIndex.push_back(coord_num0);
ne_alias.CoordIndex.push_back(coord_num2);
ne_alias.CoordIndex.push_back(coord_num1);
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num0));
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num2));
ne_alias.CoordIndex.push_back(static_cast<int32_t>(coord_num1));
}// if(ccw) else
ne_alias.CoordIndex.push_back(-1);// add face delimiter.

View File

@ -286,7 +286,7 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec
// or referenced material, it should already have a valid index
if( sourceMesh->mFaceMaterials.size() > 0)
{
mesh->mMaterialIndex = sourceMesh->mMaterials[b].sceneIndex;
mesh->mMaterialIndex = static_cast<unsigned int>(sourceMesh->mMaterials[b].sceneIndex);
} else
{
mesh->mMaterialIndex = 0;

View File

@ -711,7 +711,7 @@ unsigned int XGLImporter::ResolveMaterialRef(TempScope& scope)
const std::string& s = GetElementName();
if (s == "mat") {
ReadMaterial(scope);
return scope.materials_linear.size()-1;
return static_cast<unsigned int>(scope.materials_linear.size()-1);
}
const int id = ReadIndexFromText();

View File

@ -926,7 +926,7 @@ Ref<Buffer> buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer);
// Read data from buffer and place it in BinaryStream for decoder.
// Just "Count" because always is used type equivalent to uint8_t.
bstream.LoadFromBuffer(&buf->GetPointer()[pCompression_Open3DGC.Offset], pCompression_Open3DGC.Count);
bstream.LoadFromBuffer(&buf->GetPointer()[pCompression_Open3DGC.Offset], static_cast<unsigned long>(pCompression_Open3DGC.Count));
// After decoding header we can get size of primitives.
if(decoder.DecodeHeader(ifs, bstream) != o3dgc::O3DGC_OK) throw DeadlyImportError("GLTF: can not decode Open3DGC header.");
@ -970,9 +970,9 @@ Ref<Buffer> buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer);
{
// size = number_of_elements * components_per_element * size_of_component.
// Note. But as you can see above, at first we are use this variable in meaning "count". After checking count of objects...
size_t tval = ifs.GetNFloatAttribute(idx);
size_t tval = ifs.GetNFloatAttribute(static_cast<unsigned long>(idx));
switch(ifs.GetFloatAttributeType(idx))
switch(ifs.GetFloatAttributeType(static_cast<unsigned long>(idx)))
{
case o3dgc::O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_TEXCOORD:
// Check situation when encoded data contain texture coordinates but primitive not.
@ -986,15 +986,15 @@ Ref<Buffer> buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer);
}
else
{
ifs.SetNFloatAttribute(idx, 0);// Disable decoding this attribute.
ifs.SetNFloatAttribute(static_cast<unsigned long>(idx), 0ul);// Disable decoding this attribute.
}
break;
default:
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(idx)));
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(static_cast<unsigned long>(idx))));
}
tval *= ifs.GetFloatAttributeDim(idx) * sizeof(o3dgc::Real);// After checking count of objects we can get size of array.
tval *= ifs.GetFloatAttributeDim(static_cast<unsigned long>(idx)) * sizeof(o3dgc::Real);// After checking count of objects we can get size of array.
size_floatattr[idx] = tval;
decoded_data_size += tval;
}
@ -1002,8 +1002,8 @@ Ref<Buffer> buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer);
for(size_t idx = 0, idx_end = size_intattr.size(); idx < idx_end; idx++)
{
// size = number_of_elements * components_per_element * size_of_component. See float attributes note.
size_t tval = ifs.GetNIntAttribute(idx);
switch( ifs.GetIntAttributeType( idx ) )
size_t tval = ifs.GetNIntAttribute(static_cast<unsigned long>(idx));
switch( ifs.GetIntAttributeType(static_cast<unsigned long>(idx) ) )
{
case o3dgc::O3DGC_IFS_INT_ATTRIBUTE_TYPE_UNKOWN:
case o3dgc::O3DGC_IFS_INT_ATTRIBUTE_TYPE_INDEX:
@ -1012,10 +1012,10 @@ Ref<Buffer> buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer);
break;
default:
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(idx)));
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(static_cast<unsigned long>(idx))));
}
tval *= ifs.GetIntAttributeDim(idx) * sizeof(long);// See float attributes note.
tval *= ifs.GetIntAttributeDim(static_cast<unsigned long>(idx)) * sizeof(long);// See float attributes note.
size_intattr[idx] = tval;
decoded_data_size += tval;
}
@ -1039,24 +1039,24 @@ Ref<Buffer> buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer);
for(size_t idx = 0, idx_end = size_floatattr.size(), idx_texcoord = 0; idx < idx_end; idx++)
{
switch(ifs.GetFloatAttributeType(idx))
switch(ifs.GetFloatAttributeType(static_cast<unsigned long>(idx)))
{
case o3dgc::O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_TEXCOORD:
if(idx_texcoord < primitives[0].attributes.texcoord.size())
{
// See above about absent attributes.
ifs.SetFloatAttribute(idx, (o3dgc::Real* const)(decoded_data + get_buf_offset(primitives[0].attributes.texcoord[idx])));
ifs.SetFloatAttribute(static_cast<unsigned long>(idx), (o3dgc::Real* const)(decoded_data + get_buf_offset(primitives[0].attributes.texcoord[idx])));
idx_texcoord++;
}
break;
default:
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(idx)));
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(static_cast<unsigned long>(idx))));
}
}
for(size_t idx = 0, idx_end = size_intattr.size(); idx < idx_end; idx++) {
switch(ifs.GetIntAttributeType(idx)) {
switch(ifs.GetIntAttributeType(static_cast<unsigned int>(idx))) {
case o3dgc::O3DGC_IFS_INT_ATTRIBUTE_TYPE_UNKOWN:
case o3dgc::O3DGC_IFS_INT_ATTRIBUTE_TYPE_INDEX:
case o3dgc::O3DGC_IFS_INT_ATTRIBUTE_TYPE_JOINT_ID:
@ -1065,7 +1065,7 @@ Ref<Buffer> buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer);
// ifs.SetIntAttribute(idx, (long* const)(decoded_data + get_buf_offset(primitives[0].attributes.joint)));
default:
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(idx)));
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(static_cast<unsigned long>(idx))));
}
}

View File

@ -64,7 +64,7 @@ namespace glTF {
inline Value& MakeValue(Value& val, const std::vector<float> & r, MemoryPoolAllocator<>& al) {
val.SetArray();
val.Reserve(r.size(), al);
val.Reserve(static_cast<rapidjson::SizeType>(r.size()), al);
for (unsigned int i = 0; i < r.size(); ++i) {
val.PushBack(r[i], al);
}

View File

@ -111,7 +111,6 @@ glTFExporter::glTFExporter(const char* filename, IOSystem* pIOSystem, const aiSc
mScene = sceneCopy.get();
std::unique_ptr<Asset> asset();
mAsset.reset( new glTF::Asset( pIOSystem ) );
if (isBinary) {
@ -457,7 +456,7 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
aiMatrix4x4 tmpMatrix4;
CopyValue(aib->mOffsetMatrix, tmpMatrix4);
inverseBindMatricesData.push_back(tmpMatrix4);
jointNamesIndex = inverseBindMatricesData.size() - 1;
jointNamesIndex = static_cast<unsigned int>(inverseBindMatricesData.size() - 1);
}
// aib->mWeights =====> vertexWeightData
@ -687,13 +686,13 @@ void glTFExporter::ExportMeshes()
{
size_t num = comp_o3dgc_ifs.GetNumFloatAttributes();
comp_o3dgc_params.SetFloatAttributeQuantBits(num, quant_texcoord);
comp_o3dgc_params.SetFloatAttributePredMode(num, prediction_texcoord);
comp_o3dgc_ifs.SetNFloatAttribute(num, aim->mNumVertices);// number of elements.
comp_o3dgc_ifs.SetFloatAttributeDim(num, aim->mNumUVComponents[num_tc]);// components per element: aiVector3D => x * float
comp_o3dgc_ifs.SetFloatAttributeType(num, o3dgc::O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_TEXCOORD);
comp_o3dgc_ifs.SetFloatAttribute(num, (o3dgc::Real* const)&b->GetPointer()[idx_srcdata_tc[num_tc]]);
comp_o3dgc_ifs.SetNumFloatAttributes(num + 1);
comp_o3dgc_params.SetFloatAttributeQuantBits(static_cast<unsigned long>(num), quant_texcoord);
comp_o3dgc_params.SetFloatAttributePredMode(static_cast<unsigned long>(num), prediction_texcoord);
comp_o3dgc_ifs.SetNFloatAttribute(static_cast<unsigned long>(num), aim->mNumVertices);// number of elements.
comp_o3dgc_ifs.SetFloatAttributeDim(static_cast<unsigned long>(num), aim->mNumUVComponents[num_tc]);// components per element: aiVector3D => x * float
comp_o3dgc_ifs.SetFloatAttributeType(static_cast<unsigned long>(num), o3dgc::O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_TEXCOORD);
comp_o3dgc_ifs.SetFloatAttribute(static_cast<unsigned long>(num), (o3dgc::Real* const)&b->GetPointer()[idx_srcdata_tc[num_tc]]);
comp_o3dgc_ifs.SetNumFloatAttributes(static_cast<unsigned long>(num + 1));
}
// Coordinates indices
@ -741,7 +740,7 @@ void glTFExporter::ExportMeshes()
CopyValue(inverseBindMatricesData[idx_joint], invBindMatrixData[idx_joint]);
}
Ref<Accessor> invBindMatrixAccessor = ExportData(*mAsset, skinName, b, inverseBindMatricesData.size(), invBindMatrixData, AttribType::MAT4, AttribType::MAT4, ComponentType_FLOAT);
Ref<Accessor> invBindMatrixAccessor = ExportData(*mAsset, skinName, b, static_cast<unsigned int>(inverseBindMatricesData.size()), invBindMatrixData, AttribType::MAT4, AttribType::MAT4, ComponentType_FLOAT);
if (invBindMatrixAccessor) skinRef->inverseBindMatrices = invBindMatrixAccessor;
// Identity Matrix =====> skinRef->bindShapeMatrix

View File

@ -92,7 +92,7 @@ public:
// Remove null characters from the input sequence otherwise the parsing will utterly fail
unsigned int size = 0;
unsigned int size_max = data.size();
unsigned int size_max = static_cast<unsigned int>(data.size());
for(unsigned int i = 0; i < size_max; i++) {
if(data[i] != '\0') {
data[size++] = data[i];
@ -117,7 +117,7 @@ public:
return 0;
}
if(t+sizeToRead>data.size()) {
sizeToRead = data.size()-t;
sizeToRead = static_cast<int>(data.size()-t);
}
memcpy(buffer,&data.front()+t,sizeToRead);

View File

@ -383,7 +383,7 @@ namespace o3dgc
r = (maxTab[d] - minTab[d]);
diag += r*r;
}
diag = sqrt(diag);
diag = static_cast<Real>(sqrt(diag));
for(unsigned long d = 0; d < dim; ++d)
{
maxTab[d] = minTab[d] + diag;

View File

@ -96,7 +96,7 @@ void SweepContext::InitTriangulation()
void SweepContext::InitEdges(std::vector<Point*> polyline)
{
int num_points = polyline.size();
int num_points = static_cast<int>(polyline.size());
for (int i = 0; i < num_points; i++) {
int j = i < num_points - 1 ? i + 1 : 0;
edge_list.push_back(new Edge(*polyline[i], *polyline[j]));

View File

@ -158,7 +158,7 @@ inline AdvancingFront* SweepContext::front()
inline int SweepContext::point_count()
{
return points_.size();
return static_cast<int>(points_.size());
}
inline void SweepContext::set_head(Point* p1)

View File

@ -122,6 +122,10 @@ ELSE( WIN32 )
SET( platform_libs pthread )
ENDIF( WIN32 )
IF(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
ENDIF(MSVC)
target_link_libraries( unit assimp ${platform_libs} )
add_subdirectory(headercheck)

View File

@ -40,6 +40,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "UnitTestPCH.h"
#include "BlenderIntermediate.h"
#include "./../include/assimp/camera.h"
#include "./../include/assimp/light.h"
#include "./../include/assimp/mesh.h"
#include "./../include/assimp/texture.h"
using namespace ::Assimp;
using namespace ::Assimp::Blender;

View File

@ -292,14 +292,14 @@ uint32_t WriteBinaryTexture(const aiTexture* tex)
len += Write<unsigned int>(tex->mWidth);
len += Write<unsigned int>(tex->mHeight);
len += fwrite(tex->achFormatHint,1,4,out);
len += static_cast<uint32_t>(fwrite(tex->achFormatHint,1,4,out));
if(!shortened) {
if (!tex->mHeight) {
len += fwrite(tex->pcData,1,tex->mWidth,out);
len += static_cast<uint32_t>(fwrite(tex->pcData,1,tex->mWidth,out));
}
else {
len += fwrite(tex->pcData,1,tex->mWidth*tex->mHeight*4,out);
len += static_cast<uint32_t>(fwrite(tex->pcData,1,tex->mWidth*tex->mHeight*4,out));
}
}
@ -321,7 +321,7 @@ uint32_t WriteBinaryBone(const aiBone* b)
if (shortened) {
len += WriteBounds(b->mWeights,b->mNumWeights);
} // else write as usual
else len += fwrite(b->mWeights,1,b->mNumWeights*sizeof(aiVertexWeight),out);
else len += static_cast<uint32_t>(fwrite(b->mWeights,1,b->mNumWeights*sizeof(aiVertexWeight),out));
ChangeInteger(old,len);
return len;
@ -368,13 +368,13 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh)
if (shortened) {
len += WriteBounds(mesh->mVertices,mesh->mNumVertices);
} // else write as usual
else len += fwrite(mesh->mVertices,1,12*mesh->mNumVertices,out);
else len += static_cast<uint32_t>(fwrite(mesh->mVertices,1,12*mesh->mNumVertices,out));
}
if (mesh->mNormals) {
if (shortened) {
len += WriteBounds(mesh->mNormals,mesh->mNumVertices);
} // else write as usual
else len += fwrite(mesh->mNormals,1,12*mesh->mNumVertices,out);
else len += static_cast<uint32_t>(fwrite(mesh->mNormals,1,12*mesh->mNumVertices,out));
}
if (mesh->mTangents && mesh->mBitangents) {
if (shortened) {
@ -382,8 +382,8 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh)
len += WriteBounds(mesh->mBitangents,mesh->mNumVertices);
} // else write as usual
else {
len += fwrite(mesh->mTangents,1,12*mesh->mNumVertices,out);
len += fwrite(mesh->mBitangents,1,12*mesh->mNumVertices,out);
len += static_cast<uint32_t>(fwrite(mesh->mTangents,1,12*mesh->mNumVertices,out));
len += static_cast<uint32_t>(fwrite(mesh->mBitangents,1,12*mesh->mNumVertices,out));
}
}
for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_COLOR_SETS;++n) {
@ -393,7 +393,7 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh)
if (shortened) {
len += WriteBounds(mesh->mColors[n],mesh->mNumVertices);
} // else write as usual
else len += fwrite(mesh->mColors[n],16*mesh->mNumVertices,1,out);
else len += static_cast<uint32_t>(fwrite(mesh->mColors[n],16*mesh->mNumVertices,1,out));
}
for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_TEXTURECOORDS;++n) {
if (!mesh->mTextureCoords[n])
@ -405,7 +405,7 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh)
if (shortened) {
len += WriteBounds(mesh->mTextureCoords[n],mesh->mNumVertices);
} // else write as usual
else len += fwrite(mesh->mTextureCoords[n],12*mesh->mNumVertices,1,out);
else len += static_cast<uint32_t>(fwrite(mesh->mTextureCoords[n],12*mesh->mNumVertices,1,out));
}
// write faces. There are no floating-point calculations involved
@ -472,7 +472,7 @@ uint32_t WriteBinaryMaterialProperty(const aiMaterialProperty* prop)
len += Write<unsigned int>(prop->mDataLength);
len += Write<unsigned int>((unsigned int)prop->mType);
len += fwrite(prop->mData,1,prop->mDataLength,out);
len += static_cast<uint32_t>(fwrite(prop->mData,1,prop->mDataLength,out));
ChangeInteger(old,len);
return len;
@ -509,21 +509,21 @@ uint32_t WriteBinaryNodeAnim(const aiNodeAnim* nd)
len += WriteBounds(nd->mPositionKeys,nd->mNumPositionKeys);
} // else write as usual
else len += fwrite(nd->mPositionKeys,1,nd->mNumPositionKeys*sizeof(aiVectorKey),out);
else len += static_cast<uint32_t>(fwrite(nd->mPositionKeys,1,nd->mNumPositionKeys*sizeof(aiVectorKey),out));
}
if (nd->mRotationKeys) {
if (shortened) {
len += WriteBounds(nd->mRotationKeys,nd->mNumRotationKeys);
} // else write as usual
else len += fwrite(nd->mRotationKeys,1,nd->mNumRotationKeys*sizeof(aiQuatKey),out);
else len += static_cast<uint32_t>(fwrite(nd->mRotationKeys,1,nd->mNumRotationKeys*sizeof(aiQuatKey),out));
}
if (nd->mScalingKeys) {
if (shortened) {
len += WriteBounds(nd->mScalingKeys,nd->mNumScalingKeys);
} // else write as usual
else len += fwrite(nd->mScalingKeys,1,nd->mNumScalingKeys*sizeof(aiVectorKey),out);
else len += static_cast<uint32_t>(fwrite(nd->mScalingKeys,1,nd->mNumScalingKeys*sizeof(aiVectorKey),out));
}
ChangeInteger(old,len);

View File

@ -1537,7 +1537,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg,
SetTextColor(pcStruct->hDC,RGB(0xFF-r,0xFF-g,0xFF-b));
SetBkMode(pcStruct->hDC,TRANSPARENT);
TextOut(pcStruct->hDC,4,1,szText,strlen(szText));
TextOut(pcStruct->hDC,4,1,szText, static_cast<int>(strlen(szText)));
bDraw = true;
}
else if(IDC_LCOLOR2 == pcStruct->CtlID)
@ -1568,7 +1568,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg,
SetTextColor(pcStruct->hDC,RGB(0xFF-r,0xFF-g,0xFF-b));
SetBkMode(pcStruct->hDC,TRANSPARENT);
TextOut(pcStruct->hDC,4,1,szText,strlen(szText));
TextOut(pcStruct->hDC,4,1,szText, static_cast<int>(strlen(szText)));
bDraw = true;
}
else if(IDC_LCOLOR3 == pcStruct->CtlID)
@ -1597,7 +1597,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg,
SetTextColor(pcStruct->hDC,RGB(0xFF-r,0xFF-g,0xFF-b));
SetBkMode(pcStruct->hDC,TRANSPARENT);
TextOut(pcStruct->hDC,4,1,szText,strlen(szText));
TextOut(pcStruct->hDC,4,1,szText,static_cast<int>(strlen(szText)));
bDraw = true;
}
// draw the black border around the rects