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.

138 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 Cirilo Bernardo <cirilo.bernardo@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. /**
  24. * @file 3d_plugin.h
  25. * describes the runtime-loadable interface to support loading
  26. * and parsing of 3D models.
  27. */
  28. #ifndef PLUGIN_3D_H
  29. #define PLUGIN_3D_H
  30. //
  31. // KICAD_PLUGIN CLASS INTERFACE
  32. //
  33. // WARNING: DO NOT EDIT THIS FILE OUTSIDE THE KICAD TREE
  34. //
  35. // Note: the plugin class name must match the name expected by the loader
  36. #define KICAD_PLUGIN_CLASS "PLUGIN_3D"
  37. #define MAJOR 1
  38. #define MINOR 0
  39. #define REVISION 0
  40. #define PATCH 0
  41. #include "../kicad_plugin.h"
  42. KICAD_PLUGIN_EXPORT char const* GetKicadPluginClass( void )
  43. {
  44. return KICAD_PLUGIN_CLASS;
  45. }
  46. KICAD_PLUGIN_EXPORT void GetClassVersion( unsigned char* Major,
  47. unsigned char* Minor, unsigned char* Revision, unsigned char* Patch )
  48. {
  49. if( Major )
  50. *Major = MAJOR;
  51. if( Minor )
  52. *Minor = MINOR;
  53. if( Revision )
  54. *Revision = REVISION;
  55. if( Patch )
  56. *Patch = PATCH;
  57. return;
  58. }
  59. KICAD_PLUGIN_EXPORT bool CheckClassVersion( unsigned char Major,
  60. unsigned char Minor, unsigned char Revision, unsigned char Patch )
  61. {
  62. if( Major != MAJOR )
  63. return false;
  64. // at the moment there are no incompatibility rules other than the Major Version check
  65. return true;
  66. }
  67. class SCENEGRAPH;
  68. /**
  69. * Function GetNExtensions
  70. *
  71. * @return the number of extensions supported by the plugin
  72. */
  73. KICAD_PLUGIN_EXPORT int GetNExtensions( void );
  74. /**
  75. * Function GetModelExtension
  76. *
  77. * @param aIndex is the extension to return; valid values are
  78. * 0 to GetNExtensions() - 1.
  79. * @return the requested extension or a null string if aIndex
  80. * was invalid.
  81. */
  82. KICAD_PLUGIN_EXPORT char const* GetModelExtension( int aIndex );
  83. /**
  84. * Function GetNFilters
  85. * @returns the number of file filters
  86. */
  87. KICAD_PLUGIN_EXPORT int GetNFilters( void );
  88. /**
  89. * Function GetFileFilter
  90. *
  91. * @return the file filter string for the given index
  92. */
  93. KICAD_PLUGIN_EXPORT char const* GetFileFilter( int aIndex );
  94. /**
  95. * Function CanRender
  96. *
  97. * @return true if the plugin can render a model, that is
  98. * the Load() function is implemented
  99. */
  100. KICAD_PLUGIN_EXPORT bool CanRender( void );
  101. /**
  102. * Function Load
  103. * reads the model file and creates a generic display structure
  104. *
  105. * @param aFileName is the full path of the model file
  106. * @param aModel is a handle to a null pointer; on successful
  107. * reading of the model data aModel will point to a representation
  108. * for rendering
  109. * @param returns true if the model was successfully loaded and false
  110. * if there is no rendering support for the model or there were
  111. * problems reading the model
  112. */
  113. KICAD_PLUGIN_EXPORT SCENEGRAPH* Load( char const* aFileName );
  114. #endif // PLUGIN_3D_H