writeOBJ.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. template <typename DerivedV, typename DerivedF, typename DerivedT>
  28. IGL_INLINE bool writeOBJ(
  29. const std::string str,
  30. const Eigen::PlainObjectBase<DerivedV>& V,
  31. const Eigen::PlainObjectBase<DerivedF>& F,
  32. const Eigen::PlainObjectBase<DerivedV>& CN,
  33. const Eigen::PlainObjectBase<DerivedF>& FN,
  34. const Eigen::PlainObjectBase<DerivedT>& TC,
  35. const Eigen::PlainObjectBase<DerivedF>& FTC);
  36. template <typename DerivedV, typename DerivedF>
  37. IGL_INLINE bool writeOBJ(
  38. const std::string str,
  39. const Eigen::PlainObjectBase<DerivedV>& V,
  40. const Eigen::PlainObjectBase<DerivedF>& F);
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. # include "writeOBJ.cpp"
  44. #endif
  45. #endif