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.

114 lines
3.6 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
  5. * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file c3d_render_base.h
  26. * @brief
  27. */
  28. #ifndef C3D_RENDER_BASE_H
  29. #define C3D_RENDER_BASE_H
  30. #include <pcb_base_frame.h>
  31. #include "../3d_canvas/cinfo3d_visu.h"
  32. #include <reporter.h>
  33. /**
  34. * This is a base class to hold data and functions for render targets.
  35. */
  36. class C3D_RENDER_BASE
  37. {
  38. // Operations
  39. public:
  40. explicit C3D_RENDER_BASE( CINFO3D_VISU &aSettings );
  41. virtual ~C3D_RENDER_BASE() = 0;
  42. /**
  43. * @brief SetCurWindowSize - Before each render, the canvas will tell the
  44. * render what is the size of its windows, so render can take actions if it
  45. * changed.
  46. * @param aSize: the current size of the render window
  47. */
  48. virtual void SetCurWindowSize( const wxSize &aSize ) = 0;
  49. /**
  50. * @brief Redraw - Ask to redraw the view
  51. * @param aIsMoving: if the user is moving the scene, it should be render in
  52. * preview mode
  53. * @param aStatusTextReporter: a pointer to the status progress reporter
  54. * @return it will return true if the render would like to redraw again
  55. */
  56. virtual bool Redraw( bool aIsMoving, REPORTER *aStatusTextReporter = NULL ) = 0;
  57. /**
  58. * @brief ReloadRequest - !TODO: this must be reviewed to add flags to
  59. * improve specific render
  60. */
  61. void ReloadRequest() { m_reloadRequested = true; }
  62. /**
  63. * @brief IsReloadRequestPending - Query if there is a pending reload request
  64. * @return true if it wants to reload, false if there is no reload pending
  65. */
  66. bool IsReloadRequestPending() const { return m_reloadRequested; }
  67. /**
  68. * @brief GetWaitForEditingTimeOut - Give the interface the time (in ms)
  69. * that it should wait for editing or movements before
  70. * (this works for display preview mode)
  71. * @return a value in miliseconds
  72. */
  73. virtual int GetWaitForEditingTimeOut() = 0;
  74. // Attributes
  75. protected:
  76. /// settings refrence in use for this render
  77. CINFO3D_VISU &m_settings;
  78. /// flag if the opengl specific for this render was already initialized
  79. bool m_is_opengl_initialized;
  80. /// !TODO: this must be reviewed in order to flag change types
  81. bool m_reloadRequested;
  82. /// The window size that this camera is working.
  83. wxSize m_windowSize;
  84. /**
  85. * Trace mask used to enable or disable the trace output of this class.
  86. * The debug output can be turned on by setting the WXTRACE environment variable to
  87. * "KI_TRACE_3D_RENDER". See the wxWidgets documentation on wxLogTrace for
  88. * more information.
  89. */
  90. static const wxChar *m_logTrace;
  91. };
  92. #endif // C3D_RENDER_BASE_H