GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/viewer/leaf-node-collada.h Lines: 0 2 0.0 %
Date: 2024-04-14 11:13:22 Branches: 0 2 0.0 %

Line Branch Exec Source
1
//
2
//  leaf-node-collada.h
3
//  gepetto-viewer
4
//
5
//  Created by Justin Carpentier, Anthony Couret, Mathieu Geisert in November
6
//  2014. 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 <gepetto/viewer/properties.h>
14
15
#include <osgDB/ReadFile>
16
17
namespace gepetto {
18
namespace viewer {
19
DEF_CLASS_SMART_PTR(LeafNodeCollada)
20
21
/** Implementation of the Collada GraphicalObject in OSG render */
22
class LeafNodeCollada : public Node {
23
 private:
24
  std::string collada_file_path_;
25
  std::string texture_file_path_;
26
27
  /** Associated weak pointer */
28
  LeafNodeColladaWeakPtr weak_ptr_;
29
30
  /** Associated Node Shape */
31
  ::osg::GroupRefPtr group_ptr_;
32
  ::osg::NodeRefPtr collada_ptr_;
33
34
  BackfaceDrawingProperty backfaceDrawing_;
35
36
  /** Save options to properly destroy mesh when deleting the node */
37
  osg::ref_ptr<osgDB::Options> options_;
38
39
  void init();
40
41
  /* Default constructor */
42
  LeafNodeCollada(const std::string& name,
43
                  const std::string& collada_file_path);
44
  LeafNodeCollada(const std::string& name, const std::string& collada_file_path,
45
                  const osgVector4& color);
46
  LeafNodeCollada(const std::string& name, const ::osg::NodeRefPtr& node,
47
                  const std::string& collada_file_path);
48
  /* Copy constructor */
49
  LeafNodeCollada(const LeafNodeCollada& other);
50
51
  /** Initialize weak_ptr */
52
  void initWeakPtr(LeafNodeColladaWeakPtr other_weak_ptr);
53
54
 protected:
55
 public:
56
  /** Static method which create a new LeafNodeCollada
57
   */
58
  static LeafNodeColladaPtr_t create(const std::string& name,
59
                                     ::osg::NodeRefPtr mesh,
60
                                     const std::string& collada_file_path);
61
  static LeafNodeColladaPtr_t create(const std::string& name,
62
                                     const std::string& collada_file_path);
63
  static LeafNodeColladaPtr_t create(const std::string& name,
64
                                     const std::string& collada_file_path,
65
                                     const osgVector4& color);
66
67
  /** Static method for creating a clone of LeafNodeCollada other
68
   */
69
  static LeafNodeColladaPtr_t createCopy(LeafNodeColladaPtr_t other);
70
71
  /** Proceed to a clonage of the current object defined by the copy constructor
72
   */
73
  virtual LeafNodeColladaPtr_t clone(void) const;
74
75
  /** Returns a pointer to the NodeRefPtr  */
76
  ::osg::NodeRefPtr getColladaPtr(void);
77
78
  /** Copy
79
   \brief Proceed to a copy of the currend object as clone
80
   */
81
  virtual LeafNodeColladaPtr_t copy() const { return clone(); }
82
83
  /** Return a shared pointer of the current object
84
   */
85
  LeafNodeColladaPtr_t self(void) const;
86
87
  void setColor(const osgVector4& color);
88
89
  osgVector4 getColor() const;
90
91
  void setTexture(const std::string& image_path);
92
93
  const std::string& meshFilePath() const;
94
95
  const std::string& textureFilePath() const;
96
97
  virtual void setAlpha(const float& alpha);
98
  virtual osg::ref_ptr<osg::Node> getOsgNode() const;
99
100
  /// Remove any osg::LightSource of this mesh.
101
  void removeLightSources();
102
103
  /// Apply the current scale permanently to the node.
104
  void applyScale();
105
106
  SCENE_VIEWER_ACCEPT_VISITOR;
107
108
  /** Remove this object from cache */
109
  void removeFromCache();
110
111
  /** Destructor */
112
  virtual ~LeafNodeCollada();
113
};
114
} /* namespace viewer */
115
} /* namespace gepetto */
116
117
#endif /* GEPETTO_VIEWER_LEAFNODECOLLADA_HH */