Fixed PR Quality Review Issues

pull/2736/head
bzt 2019-10-29 18:42:10 +01:00
parent 0baec5f0bd
commit a622e109a0
3 changed files with 4539 additions and 11 deletions

View File

@ -174,15 +174,14 @@ void M3DExporter::doExport (
// recursive node walker
void M3DExporter::NodeWalk(const aiNode* pNode, aiMatrix4x4 m)
{
unsigned int i, j, k, l, n, mi, idx;
unsigned int i, j, k, l, n, idx;
aiMatrix4x4 nm = m * pNode->mTransformation;
m3dv_t vertex;
m3dti_t ti;
for(i = 0; i < pNode->mNumMeshes; i++) {
const aiMesh *mesh = mScene->mMeshes[pNode->mMeshes[i]];
mi = (M3D_INDEX)-1U;
unsigned int mi = (M3D_INDEX)-1U;
if(mScene->mMaterials) {
// get the material for this mesh
mi = addMaterial(mScene->mMaterials[mesh->mMaterialIndex]);
@ -263,7 +262,7 @@ uint32_t M3DExporter::mkColor(aiColor4D* c)
// add a material to the output
M3D_INDEX M3DExporter::addMaterial(const aiMaterial *mat)
{
unsigned int i, j, k, mi = -1U;
unsigned int i, j, mi = -1U;
aiColor4D c;
aiString name;
ai_real f;
@ -290,7 +289,7 @@ M3D_INDEX M3DExporter::addMaterial(const aiMaterial *mat)
m3d->material[mi].numprop = 0;
m3d->material[mi].prop = NULL;
// iterate through the material property table and see what we got
for(k = 0;
for(unsigned int k = 0;
k < sizeof(m3d_propertytypes)/sizeof(m3d_propertytypes[0]);
k++) {
if(m3d_propertytypes[k].format == m3dpf_map)

View File

@ -486,7 +486,7 @@ void M3DImporter::importBones(unsigned int parentid, aiNode *pParent)
// bone, so we have to convert between the two conceptually different representation forms
void M3DImporter::importAnimations()
{
unsigned int i, j, k, l, n, pos, ori;
unsigned int i, j, k, l, pos, ori;
double t;
m3da_t *a;
@ -511,6 +511,7 @@ void M3DImporter::importAnimations()
pAnim->mNumChannels = m3d->numbone;
pAnim->mChannels = new aiNodeAnim*[pAnim->mNumChannels];
for(l = 0; l < m3d->numbone; l++) {
unsigned int n;
pAnim->mChannels[l] = new aiNodeAnim;
pAnim->mChannels[l]->mNodeName = aiString(std::string(m3d->bone[l].name));
// now n is the size of positions / orientations arrays
@ -628,8 +629,7 @@ void M3DImporter::calculateOffsetMatrix(aiNode *pNode, aiMatrix4x4 *m)
void M3DImporter::populateMesh(aiMesh *pMesh, std::vector<aiFace> *faces, std::vector<aiVector3D> *vertices,
std::vector<aiVector3D> *normals, std::vector<aiVector3D> *texcoords, std::vector<aiColor4D> *colors,
std::vector<unsigned int> *vertexids) {
unsigned int i, j, k, s;
aiNode *pNode;
unsigned int i, j, k;
ai_assert(pMesh != nullptr);
ai_assert(faces != nullptr);
@ -670,6 +670,7 @@ void M3DImporter::populateMesh(aiMesh *pMesh, std::vector<aiFace> *faces, std::v
if(pMesh->mNumBones) {
pMesh->mBones = new aiBone*[pMesh->mNumBones];
for(i = 0; i < m3d->numbone; i++) {
aiNode *pNode;
pMesh->mBones[i] = new aiBone;
pMesh->mBones[i]->mName = aiString(std::string(m3d->bone[i].name));
pMesh->mBones[i]->mNumWeights = 0;
@ -683,7 +684,7 @@ void M3DImporter::populateMesh(aiMesh *pMesh, std::vector<aiFace> *faces, std::v
if(vertexids->size()) {
// first count how many vertices we have per bone
for(i = 0; i < vertexids->size(); i++) {
s = m3d->vertex[vertexids->at(i)].skinid;
unsigned int s = m3d->vertex[vertexids->at(i)].skinid;
if(s != -1U && s!= -2U) {
for(k = 0; k < M3D_NUMBONE && m3d->skin[s].weight[k] > 0.0; k++) {
aiString name = aiString(std::string(m3d->bone[m3d->skin[s].boneid[k]].name));
@ -706,7 +707,7 @@ void M3DImporter::populateMesh(aiMesh *pMesh, std::vector<aiFace> *faces, std::v
}
// fill up with data
for(i = 0; i < vertexids->size(); i++) {
s = m3d->vertex[vertexids->at(i)].skinid;
unsigned int s = m3d->vertex[vertexids->at(i)].skinid;
if(s != -1U && s!= -2U) {
for(k = 0; k < M3D_NUMBONE && m3d->skin[s].weight[k] > 0.0; k++) {
aiString name = aiString(std::string(m3d->bone[m3d->skin[s].boneid[k]].name));

View File

@ -1 +0,0 @@
../../../m3d.h

4529
code/M3D/m3d.h 100644

File diff suppressed because it is too large Load Diff