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);
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
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++;
{
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++;
}
{
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++;
}
{
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++;
}
((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);
}
}
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);
// 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);
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);
}
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.
}
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.
}
{
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++;
}
{
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++;
}
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;
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);
}
}
}
// 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++)
{
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)
{
{
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
{
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.
}
{
// 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.
{
// 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.