leaf-node-collada.h
Go to the documentation of this file.
1 //
2 // leaf-node-collada.h
3 // gepetto-viewer
4 //
5 // Created by Justin Carpentier, Anthony Couret, Mathieu Geisert in November 2014.
6 // Copyright (c) 2014 LAAS-CNRS. All rights reserved.
7 //
8 
9 #ifndef GEPETTO_VIEWER_LEAFNODECOLLADA_HH
10 #define GEPETTO_VIEWER_LEAFNODECOLLADA_HH
11 
12 #include <osgDB/ReadFile>
13 
14 #include <gepetto/viewer/node.h>
16 
17 
18 namespace gepetto {
19 namespace viewer {
20  DEF_CLASS_SMART_PTR(LeafNodeCollada)
21 
22 
23  class LeafNodeCollada : public Node
24  {
25  private:
26 
27  std::string collada_file_path_;
28  std::string texture_file_path_;
29 
31  LeafNodeColladaWeakPtr weak_ptr_;
32 
34  ::osg::GroupRefPtr group_ptr_;
35  ::osg::NodeRefPtr collada_ptr_;
36 
37  BackfaceDrawingProperty backfaceDrawing_;
38 
39  void init();
40 
41  /* Default constructor */
42  LeafNodeCollada(const std::string& name, const std::string& collada_file_path);
43  LeafNodeCollada(const std::string& name, const std::string& collada_file_path, const osgVector4& color);
44  LeafNodeCollada(const std::string& name, const ::osg::NodeRefPtr& node, const std::string& collada_file_path);
45  /* Copy constructor */
46  LeafNodeCollada(const LeafNodeCollada& other);
47 
49  void initWeakPtr (LeafNodeColladaWeakPtr other_weak_ptr);
50 
51  //static void setColor(osg::NodeRefPtr osgNode_ptr,const osgVector4& color);
52 
53  protected:
54  public:
57  static LeafNodeColladaPtr_t create(const std::string& name, ::osg::NodeRefPtr mesh, const std::string& collada_file_path);
58  static LeafNodeColladaPtr_t create(const std::string& name, const std::string& collada_file_path);
59  static LeafNodeColladaPtr_t create(const std::string& name, const std::string& collada_file_path, const osgVector4& color);
60 
63  static LeafNodeColladaPtr_t createCopy(LeafNodeColladaPtr_t other);
64 
67  virtual LeafNodeColladaPtr_t clone(void) const;
68 
70  ::osg::NodeRefPtr getColladaPtr(void);
71 
75  virtual LeafNodeColladaPtr_t copy() const { return clone(); }
76 
79  LeafNodeColladaPtr_t self(void) const;
80 
81  void setColor(const osgVector4& color);
82 
83  osgVector4 getColor () const;
84 
85  void setTexture(const std::string& image_path);
86 
87  const std::string& meshFilePath () const;
88 
89  const std::string& textureFilePath () const;
90 
91  virtual void setAlpha(const float& alpha);
92  virtual osg::ref_ptr<osg::Node> getOsgNode() const;
93 
95  void removeLightSources ();
96 
98 
100  virtual ~LeafNodeCollada();
101 
102  };
103 } /* namespace viewer */
104 } /* namespace gepetto */
105 
106 #endif /* GEPETTO_VIEWER_LEAFNODECOLLADA_HH */
SCENE_VIEWER_ACCEPT_VISITOR
Definition: leaf-node-collada.h:97
Definition: leaf-node-collada.h:23
Definition: properties.h:16
::osg::Vec4f osgVector4
Definition: config-osg.h:110
virtual LeafNodeColladaPtr_t copy() const
Proceed to a copy of the currend object as clone.
Definition: leaf-node-collada.h:75
Definition: action-search-bar.hh:27
#define DEF_CLASS_SMART_PTR(className)
Definition: macros.h:50
Abstract base class of 3D objects in a scene.
Definition: node.h:28