writeOBJ.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_WRITEOBJ_H
  9. #define IGL_WRITEOBJ_H
  10. #include "igl_inline.h"
  11. // History:
  12. // return type changed from void to bool Alec 20 Sept 2011
  13. #include <Eigen/Core>
  14. #include <string>
  15. namespace igl
  16. {
  17. // Write a mesh in an ascii obj file
  18. // Inputs:
  19. // str path to outputfile
  20. // V #V by 3 mesh vertex positions
  21. // F #F by 3|4 mesh indices into V
  22. // CN #CN by 3 normal vectors
  23. // FN #F by 3|4 corner normal indices into CN
  24. // TC #TC by 2|3 texture coordinates
  25. // FTC #F by 3|4 corner texture coord indices into TC
  26. // Returns true on success, false on error
  27. //
  28. // Known issues: Horrifyingly, this does not have the same order of
  29. // parameters as readOBJ.
  30. template <
  31. typename DerivedV,
  32. typename DerivedF,
  33. typename DerivedCN,
  34. typename DerivedFN,
  35. typename DerivedTC,
  36. typename DerivedFTC>
  37. IGL_INLINE bool writeOBJ(
  38. const std::string str,
  39. const Eigen::PlainObjectBase<DerivedV>& V,
  40. const Eigen::PlainObjectBase<DerivedF>& F,
  41. const Eigen::PlainObjectBase<DerivedCN>& CN,
  42. const Eigen::PlainObjectBase<DerivedFN>& FN,
  43. const Eigen::PlainObjectBase<DerivedTC>& TC,
  44. const Eigen::PlainObjectBase<DerivedFTC>& FTC);
  45. template <typename DerivedV, typename DerivedF>
  46. IGL_INLINE bool writeOBJ(
  47. const std::string str,
  48. const Eigen::PlainObjectBase<DerivedV>& V,
  49. const Eigen::PlainObjectBase<DerivedF>& F);
  50. }
  51. #ifndef IGL_STATIC_LIBRARY
  52. # include "writeOBJ.cpp"
  53. #endif
  54. #endif