- updated collada format in order to manage alpha channel colour

This commit is contained in:
granzuglia 2013-10-24 16:18:43 +00:00
parent f0487e1690
commit 993a2f70c7
2 changed files with 25 additions and 30 deletions

View File

@ -67,8 +67,8 @@ namespace io
//face //face
////wedg ////wedg
capability |= Mask::IOM_WEDGTEXCOORD;
capability |= Mask::IOM_WEDGNORMAL; capability |= Mask::IOM_WEDGNORMAL;
capability |= Mask::IOM_WEDGTEXCOORD;
return capability; return capability;
} }

View File

@ -120,28 +120,23 @@ namespace io {
return indtx; return indtx;
} }
//static int VertexColorAttribute(ColladaMesh& m,const QStringList face,const QStringList wc,const QDomNode wcsrc,const int meshfaceind,const int faceind, const int vertind,const int component) static int VertexColorAttribute(ColladaMesh& m,const QStringList face,const QStringList wc,const QDomNode wcsrc,const int faceind, const int vertind,const int colorcomponent)
//{ {
// int indcl = -1; int indcl = -1;
// if (!wcsrc.isNull()) if (!wcsrc.isNull())
// { {
// indcl = face.at(faceind).toInt(); indcl = face.at(faceind).toInt();
// assert(indcl * component < wc.size()); assert((colorcomponent == 4) || (colorcomponent == 3));
// assert((component == 4) || (component == 3)); assert(indcl * colorcomponent < wc.size());
// vcg::Color4b c; vcg::Color4b c;
// if (component == 3) if (colorcomponent == 3)
// c[3] = 255; c[3] = 255;
// for(unsigned int ii = 0;ii < component;++ii) for(unsigned int ii = 0;ii < colorcomponent;++ii)
// c[ii] = (unsigned char)(wc.at(indcl * component + ii).toFloat()*255.0); c[ii] = (unsigned char)(wc.at(indcl * colorcomponent + ii).toFloat()*255.0);
// /*m.vert[vertind].C() = vcg::Color4b( (unsigned char)(wc.at(indcl * component).toFloat()*255.0), m.vert[vertind].C() = c;
// (unsigned char)(wc.at(indcl * component + 1).toFloat()*255.0), }
// (unsigned char)(wc.at(indcl * component + 2).toFloat()*255.0), return indcl;
// (unsigned char)(wc.at(indcl * component + 3).toFloat()*255.0));*/ }
// m.vert[vertind].C() = c;
// }
// return indcl;
//}
static void FindStandardWedgeAttributes(WedgeAttribute& wed,const QDomNode nd,const QDomDocument doc) static void FindStandardWedgeAttributes(WedgeAttribute& wed,const QDomNode nd,const QDomDocument doc)
@ -167,7 +162,7 @@ namespace io {
wed.offtx = findStringListAttribute(wed.wt,wed.wtsrc,nd,doc,"TEXCOORD"); wed.offtx = findStringListAttribute(wed.wt,wed.wtsrc,nd,doc,"TEXCOORD");
wed.wcsrc = findNodeBySpecificAttributeValue(nd,"input","semantic","COLOR"); wed.wcsrc = findNodeBySpecificAttributeValue(nd,"input","semantic","COLOR");
if (!wed.wtsrc.isNull()) if (!wed.wcsrc.isNull())
{ {
QDomNode src = attributeSourcePerSimplex(nd,doc,"COLOR"); QDomNode src = attributeSourcePerSimplex(nd,doc,"COLOR");
if (isThereTag(src,"accessor")) if (isThereTag(src,"accessor"))
@ -419,12 +414,12 @@ namespace io {
assert(indvt + offset < m.vert.size()); assert(indvt + offset < m.vert.size());
m.face[ff].V(tt) = &(m.vert[indvt + offset]); m.face[ff].V(tt) = &(m.vert[indvt + offset]);
//if(tri::HasPerWedgeNormal(m)) if(tri::HasPerWedgeNormal(m))
// //WedgeNormalAttribute(m,face,wa.wn,wa.wnsrc,ff,jj + wa.offnm,tt); WedgeNormalAttribute(m,face,wa.wn,wa.wnsrc,ff,jj + wa.offnm,tt);
//if(tri::HasPerVertexColor(m)) if(tri::HasPerVertexColor(m))
//{ {
// //VertexColorAttribute(m,face,wa.wc,wa.wcsrc,ff,jj + wa.offcl,indvt + offset,wa.stridecl); VertexColorAttribute(m,face,wa.wc,wa.wcsrc,jj + wa.offcl,indvt + offset,wa.stridecl);
//} }
if(tri::HasPerWedgeTexCoord(m) && ind_txt != -1) if(tri::HasPerWedgeTexCoord(m) && ind_txt != -1)
{ {