/xbmc/visualizations/Vortex/VortexVis/Core/Mesh.cpp

http://github.com/xbmc/xbmc · C++ · 62 lines · 33 code · 8 blank · 21 comment · 4 complexity · 8c50c08d002e23990af9fad60e5fdf49 MD5 · raw file

  1. /*
  2. * Copyright Š 2010-2013 Team XBMC
  3. * http://xbmc.org
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. */
  19. #include "Mesh.h"
  20. #include <new>
  21. #include <stdio.h>
  22. Mesh::Mesh()
  23. {
  24. m_iRefCount = 1;
  25. m_pMesh = NULL;
  26. }
  27. Mesh::~Mesh()
  28. {
  29. if ( m_pMesh )
  30. {
  31. m_pMesh->Release();
  32. m_pMesh = NULL;
  33. }
  34. }
  35. //--------------------
  36. // reference counting
  37. //--------------------
  38. void Mesh::AddRef()
  39. {
  40. m_iRefCount++;
  41. }
  42. void Mesh::Release()
  43. {
  44. if ( --m_iRefCount == 0 )
  45. delete this;
  46. }
  47. void Mesh::CreateTextMesh( string& InString, bool bCentered )
  48. {
  49. if ( m_pMesh )
  50. {
  51. m_pMesh->Release();
  52. }
  53. m_pMesh = Renderer::CreateD3DXTextMesh( InString.c_str(), bCentered );
  54. }