opensubdiv_gl_mesh_fvar.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2013 Blender Foundation. All rights reserved.
  2. //
  3. // This program is free software; you can redistribute it and/or
  4. // modify it under the terms of the GNU General Public License
  5. // as published by the Free Software Foundation; either version 2
  6. // of the License, or (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software Foundation,
  15. // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. //
  17. // Author: Sergey Sharybin
  18. #ifndef OPENSUBDIV_GL_MESH_FVAR_H_
  19. #define OPENSUBDIV_GL_MESH_FVAR_H_
  20. // NOTE: This is a [sane(er)] port of previous ground work for getting UVs to
  21. // work. Still needs a lot of work to make it easy, correct and have proper
  22. // data ownership.
  23. #include <opensubdiv/far/topologyRefiner.h>
  24. #include <opensubdiv/far/patchTable.h>
  25. #include "internal/opensubdiv_util.h"
  26. namespace opensubdiv_capi {
  27. // The buffer which holds GPU resources for face-varying elements.
  28. class GLMeshFVarData {
  29. public:
  30. GLMeshFVarData();
  31. ~GLMeshFVarData();
  32. void release();
  33. void create(const OpenSubdiv::Far::TopologyRefiner *refiner,
  34. const OpenSubdiv::Far::PatchTable *patch_table,
  35. int fvar_width,
  36. const float *fvar_src_data);
  37. unsigned int texture_buffer;
  38. unsigned int offset_buffer;
  39. vector<int> channel_offsets;
  40. int fvar_width;
  41. };
  42. void interpolateFVarData(const OpenSubdiv::Far::TopologyRefiner &refiner,
  43. const vector<float> &uvs,
  44. vector<float> *fvar_data);
  45. } // namespace opensubdiv_capi
  46. #endif // OPENSUBDIV_GL_MESH_FVAR_H_