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.

88 lines
2.5 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015-2017 Cirilo Bernardo <cirilo.bernardo@gmail.com>
  5. * Copyright The 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 sg_shape.h
  26. */
  27. #ifndef SG_SHAPE_H
  28. #define SG_SHAPE_H
  29. #include <vector>
  30. #include "3d_cache/sg/sg_node.h"
  31. class SGAPPEARANCE;
  32. class SGFACESET;
  33. /**
  34. * Define a complex 3D shape for a scenegraph object.
  35. */
  36. class SGSHAPE : public SGNODE
  37. {
  38. public:
  39. SGSHAPE( SGNODE* aParent );
  40. virtual ~SGSHAPE();
  41. virtual bool SetParent( SGNODE* aParent, bool notify = true ) override;
  42. SGNODE* FindNode(const char* aNodeName, const SGNODE* aCaller) override;
  43. bool AddRefNode( SGNODE* aNode ) override;
  44. bool AddChildNode( SGNODE* aNode ) override;
  45. void ReNameNodes( void ) override;
  46. bool WriteVRML( std::ostream& aFile, bool aReuseFlag ) override;
  47. bool WriteCache( std::ostream& aFile, SGNODE* parentNode ) override;
  48. bool ReadCache( std::istream& aFile, SGNODE* parentNode ) override;
  49. bool Prepare( const glm::dmat4* aTransform, S3D::MATLIST& materials,
  50. std::vector< SMESH >& meshes );
  51. void unlinkChildNode( const SGNODE* aNode ) override;
  52. void unlinkRefNode( const SGNODE* aNode ) override;
  53. private:
  54. void unlinkNode( const SGNODE* aNode, bool isChild );
  55. bool addNode( SGNODE* aNode, bool isChild );
  56. public:
  57. // owned node
  58. SGAPPEARANCE* m_Appearance;
  59. SGFACESET* m_FaceSet;
  60. // referenced nodes
  61. SGAPPEARANCE* m_RAppearance;
  62. SGFACESET* m_RFaceSet;
  63. };
  64. /*
  65. p.107
  66. Shape {
  67. appearance NULL
  68. geometry NULL
  69. }
  70. */
  71. #endif // SG_SHAPE_H