|
@@ -6,9 +6,9 @@
|
|
|
|
|
|
template <typename DerivedV, typename DerivedF>
|
|
|
IGL_INLINE bool igl::writeOBJ(
|
|
|
- const std::string str,
|
|
|
- const Eigen::PlainObjectBase<DerivedV>& V,
|
|
|
- const Eigen::PlainObjectBase<DerivedF>& F)
|
|
|
+ const std::string str,
|
|
|
+ const Eigen::PlainObjectBase<DerivedV>& V,
|
|
|
+ const Eigen::PlainObjectBase<DerivedF>& F)
|
|
|
{
|
|
|
std::ofstream s(str.c_str());
|
|
|
|
|
@@ -18,11 +18,15 @@ IGL_INLINE bool igl::writeOBJ(
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- for(int i=0;i<V.rows();++i)
|
|
|
- s << "v " << V(i,0) << " " << V(i,1) << " " << V(i,2) << std::endl;
|
|
|
+ for(int i=0;i<(int)V.rows();++i)
|
|
|
+ {
|
|
|
+ s << "v " << V(i,0) << " " << V(i,1) << " " << V(i,2) << std::endl;
|
|
|
+ }
|
|
|
|
|
|
- for(int i=0;i<F.rows();++i)
|
|
|
- s << "f " << F(i,0)+1 << " " << F(i,1)+1 << " " << F(i,2)+1 << std::endl;
|
|
|
+ for(int i=0;i<(int)F.rows();++i)
|
|
|
+ {
|
|
|
+ s << "f " << F(i,0)+1 << " " << F(i,1)+1 << " " << F(i,2)+1 << std::endl;
|
|
|
+ }
|
|
|
|
|
|
s.close();
|
|
|
return true;
|
|
@@ -30,13 +34,13 @@ IGL_INLINE bool igl::writeOBJ(
|
|
|
|
|
|
template <typename DerivedV, typename DerivedF, typename DerivedT>
|
|
|
IGL_INLINE bool igl::writeOBJ(
|
|
|
- const std::string str,
|
|
|
- const Eigen::PlainObjectBase<DerivedV>& V,
|
|
|
- const Eigen::PlainObjectBase<DerivedF>& F,
|
|
|
- const Eigen::PlainObjectBase<DerivedV>& CN,
|
|
|
- const Eigen::PlainObjectBase<DerivedF>& FN,
|
|
|
- const Eigen::PlainObjectBase<DerivedT>& TC,
|
|
|
- const Eigen::PlainObjectBase<DerivedF>& FTC)
|
|
|
+ const std::string str,
|
|
|
+ const Eigen::PlainObjectBase<DerivedV>& V,
|
|
|
+ const Eigen::PlainObjectBase<DerivedF>& F,
|
|
|
+ const Eigen::PlainObjectBase<DerivedV>& CN,
|
|
|
+ const Eigen::PlainObjectBase<DerivedF>& FN,
|
|
|
+ const Eigen::PlainObjectBase<DerivedT>& TC,
|
|
|
+ const Eigen::PlainObjectBase<DerivedF>& FTC)
|
|
|
{
|
|
|
FILE * obj_file = fopen(str.c_str(),"w");
|
|
|
if(NULL==obj_file)
|
|
@@ -45,19 +49,19 @@ IGL_INLINE bool igl::writeOBJ(
|
|
|
return false;
|
|
|
}
|
|
|
// Loop over V
|
|
|
- for(unsigned i = 0;i<V.rows();i++)
|
|
|
+ for(int i = 0;i<(int)V.rows();i++)
|
|
|
{
|
|
|
fprintf(obj_file,"v %0.15g %0.15g %0.15g\n",
|
|
|
- V(i,0),
|
|
|
- V(i,1),
|
|
|
- V(i,2)
|
|
|
- );
|
|
|
+ V(i,0),
|
|
|
+ V(i,1),
|
|
|
+ V(i,2)
|
|
|
+ );
|
|
|
}
|
|
|
bool write_N = CN.rows() >0;
|
|
|
|
|
|
if(write_N)
|
|
|
{
|
|
|
- for(unsigned i = 0;i<CN.rows();i++)
|
|
|
+ for(int i = 0;i<(int)CN.rows();i++)
|
|
|
{
|
|
|
fprintf(obj_file,"v %0.15g %0.15g %0.15g\n",
|
|
|
CN(i,0),
|
|
@@ -72,7 +76,7 @@ IGL_INLINE bool igl::writeOBJ(
|
|
|
|
|
|
if(write_texture_coords)
|
|
|
{
|
|
|
- for(unsigned i = 0;i<TC.rows();i++)
|
|
|
+ for(int i = 0;i<(int)TC.rows();i++)
|
|
|
{
|
|
|
fprintf(obj_file, "vt %0.15g %0.15g\n",TC(i,0),1-TC(i,1));
|
|
|
}
|
|
@@ -80,10 +84,10 @@ IGL_INLINE bool igl::writeOBJ(
|
|
|
}
|
|
|
|
|
|
// loop over F
|
|
|
- for(unsigned i = 0;i<F.rows();++i)
|
|
|
+ for(int i = 0;i<(int)F.rows();++i)
|
|
|
{
|
|
|
fprintf(obj_file,"f");
|
|
|
- for(unsigned j = 0; j<F.cols();++j)
|
|
|
+ for(int j = 0; j<(int)F.cols();++j)
|
|
|
{
|
|
|
// OBJ is 1-indexed
|
|
|
fprintf(obj_file," %u",F(i,j)+1);
|