You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
869 B

  1. // This file is part of Eigen, a lightweight C++ template library
  2. // for linear algebra.
  3. //
  4. // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
  5. //
  6. // This Source Code Form is subject to the terms of the Mozilla
  7. // Public License v. 2.0. If a copy of the MPL was not distributed
  8. // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
  9. #ifndef EIGEN_ICOSPHERE_H
  10. #define EIGEN_ICOSPHERE_H
  11. #include <Eigen/Core>
  12. #include <vector>
  13. class IcoSphere
  14. {
  15. public:
  16. IcoSphere(unsigned int levels=1);
  17. const std::vector<Eigen::Vector3f>& vertices() const { return mVertices; }
  18. const std::vector<int>& indices(int level) const;
  19. void draw(int level);
  20. protected:
  21. void _subdivide();
  22. std::vector<Eigen::Vector3f> mVertices;
  23. std::vector<std::vector<int>*> mIndices;
  24. std::vector<int> mListIds;
  25. };
  26. #endif // EIGEN_ICOSPHERE_H