Fixed obj writer working on wrong material blocks, double definition of variable
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@91 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -256,19 +256,22 @@ write(std::fstream& _out, BaseExporter& _be, Options _opt) const
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (useMatrial && _opt.check(Options::FaceColor) ){
|
if (useMatrial && _opt.check(Options::FaceColor) ){
|
||||||
int i;
|
int material = -1;
|
||||||
|
|
||||||
//color with alpha
|
//color with alpha
|
||||||
if ( _opt.color_has_alpha() ){
|
if ( _opt.color_has_alpha() ){
|
||||||
cA = color_cast<OpenMesh::Vec4f> (_be.colorA( FaceHandle(i) ));
|
cA = color_cast<OpenMesh::Vec4f> (_be.colorA( FaceHandle(i) ));
|
||||||
i = getMaterial(cA);
|
material = getMaterial(cA);
|
||||||
}else{
|
} else{
|
||||||
//and without alpha
|
//and without alpha
|
||||||
c = color_cast<OpenMesh::Vec3f> (_be.color( FaceHandle(i) ));
|
c = color_cast<OpenMesh::Vec3f> (_be.color( FaceHandle(i) ));
|
||||||
i = getMaterial(c);
|
material = getMaterial(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lastMat != i)
|
if(lastMat != material) {
|
||||||
_out << "usemtl mat" << i << std::endl;
|
_out << "usemtl mat" << material << std::endl;
|
||||||
|
lastMat = material;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_out << "f";
|
_out << "f";
|
||||||
|
|||||||
Reference in New Issue
Block a user