Initial commit

This commit is contained in:
John Senneker 2016-11-21 18:36:20 -05:00
parent 84c99ef920
commit 1abba4a694
2 changed files with 9 additions and 2 deletions

View File

@ -205,7 +205,7 @@ public:
{
if((mask & Mask::IOM_FACECOLOR) || (mask & Mask::IOM_WEDGTEXCOORD) || (mask & Mask::IOM_VERTTEXCOORD))
{
int index = Materials<SaveMeshType>::CreateNewMaterial(m,materialVec,material_num,fi);
int index = (*fi).mInd;
if(index == (int)materialVec.size())//inserts a new element material
{

View File

@ -51,6 +51,8 @@ namespace vcg {
template <class OpenMeshType>
class ImporterOBJ
{
private:
std::vector<Material> materials;
public:
static int &MRGBLineCount(){static int _MRGBLineCount=0; return _MRGBLineCount;}
@ -113,6 +115,7 @@ namespace vcg {
int tInd;
bool edge[3];// useless if the face is a polygon, no need to have variable length array
Color4b c;
int mInd;
};
struct ObjEdge
@ -254,7 +257,9 @@ namespace vcg {
stream.close();
return E_CANTOPEN;
}
std::vector<Material> materials; // materials vector
typename OpenMeshType::template PerMeshAttributeHandle<std::vector<Material>> hMaterial =
vcg::tri::Allocator<OpenMeshType>:: template GetPerMeshAttribute<std::vector<Material>>(m, std::string("materials"));
std::vector<Material> materials = hMaterial(); // materials vector
std::vector<ObjTexCoord> texCoords; // texture coordinates
std::vector<CoordType> normals; // vertex normals
std::vector<ObjIndexedFace> indexedFaces;
@ -585,6 +590,8 @@ namespace vcg {
// assigning face color
if( oi.mask & vcg::tri::io::Mask::IOM_FACECOLOR) ff.c = currentColor;
ff.mInd = currentMaterialIdx;
++numTriangles;
indexedFaces.push_back(ff);
}