| Line |
Branch |
Exec |
Source |
| 1 |
|
|
// |
| 2 |
|
|
// leaf-node-box.h |
| 3 |
|
|
// gepetto-viewer |
| 4 |
|
|
// |
| 5 |
|
|
// Created by Justin Carpentier, Mathieu Geisert in November 2014. |
| 6 |
|
|
// Copyright (c) 2014 LAAS-CNRS. All rights reserved. |
| 7 |
|
|
// |
| 8 |
|
|
|
| 9 |
|
|
#ifndef GEPETTO_VIEWER_LEAFNODEBOX_HH |
| 10 |
|
|
#define GEPETTO_VIEWER_LEAFNODEBOX_HH |
| 11 |
|
|
|
| 12 |
|
|
#include <gepetto/viewer/node-drawable.h> |
| 13 |
|
|
|
| 14 |
|
|
namespace gepetto { |
| 15 |
|
|
namespace viewer { |
| 16 |
|
|
DEF_CLASS_SMART_PTR(LeafNodeBox) |
| 17 |
|
|
|
| 18 |
|
|
/** Implementation of the Box GraphicalObject in OSG render engine */ |
| 19 |
|
|
class LeafNodeBox : public NodeDrawable { |
| 20 |
|
|
private: |
| 21 |
|
|
/** Associated weak pointer */ |
| 22 |
|
|
LeafNodeBoxWeakPtr weak_ptr_; |
| 23 |
|
|
|
| 24 |
|
|
/** Associated Box Shape */ |
| 25 |
|
|
::osg::BoxRefPtr box_ptr_; |
| 26 |
|
|
|
| 27 |
|
|
void init(); |
| 28 |
|
|
|
| 29 |
|
|
/* Default constructor */ |
| 30 |
|
|
LeafNodeBox(const std::string &name, const osgVector3 &half_axis); |
| 31 |
|
|
LeafNodeBox(const std::string &name, const osgVector3 &half_axis, |
| 32 |
|
|
const osgVector4 &color); |
| 33 |
|
|
|
| 34 |
|
|
/* Copy constructor */ |
| 35 |
|
|
LeafNodeBox(const LeafNodeBox &other); |
| 36 |
|
|
|
| 37 |
|
|
/** Initialize weak_ptr */ |
| 38 |
|
|
void initWeakPtr(LeafNodeBoxWeakPtr other_weak_ptr); |
| 39 |
|
|
|
| 40 |
|
|
protected: |
| 41 |
|
|
public: |
| 42 |
|
|
/** Static method which create a new box defined by the half_axis vector |
| 43 |
|
|
*/ |
| 44 |
|
|
static LeafNodeBoxPtr_t create(const std::string &name, |
| 45 |
|
|
const osgVector3 &half_axis); |
| 46 |
|
|
static LeafNodeBoxPtr_t create(const std::string &name, |
| 47 |
|
|
const osgVector3 &half_axis, |
| 48 |
|
|
const osgVector4 &color); |
| 49 |
|
|
|
| 50 |
|
|
/** Static method for creating a clone of box other with the copy constructor |
| 51 |
|
|
*/ |
| 52 |
|
|
static LeafNodeBoxPtr_t createCopy(LeafNodeBoxPtr_t other); |
| 53 |
|
|
|
| 54 |
|
|
/** Proceed to a clonage of the current object defined by the copy constructor |
| 55 |
|
|
*/ |
| 56 |
|
|
virtual LeafNodeBoxPtr_t clone(void) const; |
| 57 |
|
|
|
| 58 |
|
|
/** Copy |
| 59 |
|
|
\brief Proceed to a copy of the currend object as clone |
| 60 |
|
|
*/ |
| 61 |
|
✗ |
virtual NodePtr_t copy() const { return clone(); } |
| 62 |
|
|
|
| 63 |
|
|
/** Return a shared pointer of the current object |
| 64 |
|
|
*/ |
| 65 |
|
|
LeafNodeBoxPtr_t self(void) const; |
| 66 |
|
|
|
| 67 |
|
|
/** Fix the new half axis of the box |
| 68 |
|
|
* Note : half axis must be positive vector |
| 69 |
|
|
*/ |
| 70 |
|
|
void setHalfAxis(const osgVector3 &half_axis); |
| 71 |
|
|
|
| 72 |
|
✗ |
osgVector3 getHalfAxis() const { return box_ptr_->getHalfLengths(); } |
| 73 |
|
|
|
| 74 |
|
✗ |
SCENE_VIEWER_ACCEPT_VISITOR; |
| 75 |
|
|
|
| 76 |
|
|
/** Destructor */ |
| 77 |
|
|
virtual ~LeafNodeBox(); |
| 78 |
|
|
}; |
| 79 |
|
|
} /* namespace viewer */ |
| 80 |
|
|
} /* namespace gepetto */ |
| 81 |
|
|
|
| 82 |
|
|
#endif /* GEPETTO_VIEWER_LEAFNODEBOX_HH */ |
| 83 |
|
|
|