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 <gepetto/viewer/node.h>
13 #include <osgDB/ReadFile>
14 
15 
16 namespace gepetto {
17 namespace viewer {
18  DEF_CLASS_SMART_PTR(LeafNodeCollada)
19 
20 
21  class LeafNodeCollada : public Node
22  {
23  private:
24 
25  std::string collada_file_path_;
26  std::string texture_file_path_;
27 
29  LeafNodeColladaWeakPtr weak_ptr_;
30 
32  ::osg::GroupRefPtr group_ptr_;
33  ::osg::NodeRefPtr collada_ptr_;
34 
35  void init();
36 
37  /* Default constructor */
38  LeafNodeCollada(const std::string& name, const std::string& collada_file_path);
39  LeafNodeCollada(const std::string& name, const std::string& collada_file_path, const osgVector4& color);
40  LeafNodeCollada(const std::string& name, const ::osg::NodeRefPtr& node, const std::string& collada_file_path);
41  /* Copy constructor */
42  LeafNodeCollada(const LeafNodeCollada& other);
43 
45  void initWeakPtr (LeafNodeColladaWeakPtr other_weak_ptr);
46 
47  //static void setColor(osg::NodeRefPtr osgNode_ptr,const osgVector4& color);
48 
49  protected:
50  public:
53  static LeafNodeColladaPtr_t create(const std::string& name, ::osg::NodeRefPtr mesh, const std::string& collada_file_path);
54  static LeafNodeColladaPtr_t create(const std::string& name, const std::string& collada_file_path);
55  static LeafNodeColladaPtr_t create(const std::string& name, const std::string& collada_file_path, const osgVector4& color);
56 
59  static LeafNodeColladaPtr_t createCopy(LeafNodeColladaPtr_t other);
60 
63  virtual LeafNodeColladaPtr_t clone(void) const;
64 
66  ::osg::NodeRefPtr getColladaPtr(void);
67 
71  virtual LeafNodeColladaPtr_t copy() const { return clone(); }
72 
75  LeafNodeColladaPtr_t self(void) const;
76 
77  void setColor(const osgVector4& color);
78 
79  osgVector4 getColor () const;
80 
81  void setTexture(const std::string& image_path);
82 
83  const std::string& meshFilePath () const;
84 
85  const std::string& textureFilePath () const;
86 
87  virtual void setAlpha(const float& alpha);
88  virtual osg::ref_ptr<osg::Node> getOsgNode() const;
89 
91  void removeLightSources ();
92 
94 
96  virtual ~LeafNodeCollada();
97 
98  };
99 } /* namespace viewer */
100 } /* namespace gepetto */
101 
102 #endif /* GEPETTO_VIEWER_LEAFNODECOLLADA_HH */
SCENE_VIEWER_ACCEPT_VISITOR
Definition: leaf-node-collada.h:93
Definition: leaf-node-collada.h:21
::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:71
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:27