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.
 
 
 

63 lines
1.8 KiB

  1. //
  2. // EasyMesh: A class about generating 3D mesh without using the hands
  3. // Mesh can be generated using C++ or lua code
  4. //
  5. // Copyright: (c) 2010-2015 Sam Hocevar <sam@hocevar.net>
  6. // (c) 2009-2015 Cédric Lecacheur <jordx@free.fr>
  7. // (c) 2009-2015 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
  8. // This program is free software; you can redistribute it and/or
  9. // modify it under the terms of the Do What The Fuck You Want To
  10. // Public License, Version 2, as published by Sam Hocevar. See
  11. // http://www.wtfpl.net/ for more details.
  12. //
  13. #include <lol/engine-internal.h>
  14. LOLFX_RESOURCE_DECLARE(shiny);
  15. namespace lol
  16. {
  17. //-----------------------------------------------------------------------------
  18. EasyMesh::EasyMesh()
  19. : m_build_data(nullptr)
  20. {
  21. m_cursors.push(0, 0);
  22. m_state = MeshRender::NeedData;
  23. }
  24. //-----------------------------------------------------------------------------
  25. EasyMesh::EasyMesh(const EasyMesh& em)
  26. {
  27. m_indices = em.m_indices;
  28. m_vert = em.m_vert;
  29. m_cursors = em.m_cursors;
  30. m_build_data = nullptr;
  31. if (em.m_build_data)
  32. m_build_data = new EasyMeshBuildData(*em.m_build_data);
  33. if (m_indices.count() && m_vert.count() && m_cursors.count())
  34. m_state = MeshRender::NeedConvert;
  35. else
  36. m_state = MeshRender::NeedData;
  37. }
  38. //-----------------------------------------------------------------------------
  39. bool EasyMesh::SetRender(bool should_render)
  40. {
  41. if (m_state == MeshRender::CanRender)
  42. {
  43. if (!should_render)
  44. m_state = MeshRender::IgnoreRender;
  45. return true;
  46. }
  47. else if (m_state == MeshRender::IgnoreRender)
  48. {
  49. if (should_render)
  50. m_state = MeshRender::CanRender;
  51. return true;
  52. }
  53. return false;
  54. }
  55. } /* namespace lol */