Choreonoid  1.8
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
cnoid::SgMesh Class Reference

#include <SceneDrawables.h>

Inheritance diagram for cnoid::SgMesh:
cnoid::SgMeshBase cnoid::SgObject cnoid::ClonableReferenced cnoid::Referenced

Classes

class  Box
 
class  Capsule
 
class  Cone
 
class  Cylinder
 
class  Mesh
 
class  Sphere
 

Public Types

enum  PrimitiveType {
  MeshType, BoxType, SphereType, CylinderType,
  ConeType, CapsuleType, MESH = MeshType, BOX = BoxType,
  SPHERE = SphereType, CYLINDER = CylinderType, CONE = ConeType, CAPSULE = CapsuleType
}
 
enum  ExtraDivisionMode {
  ExtraDivisionPreferred = 0, ExtraDivisionX = 1, ExtraDivisionY = 2, ExtraDivisionZ = 4,
  ExtraDivisionAll = ExtraDivisionX | ExtraDivisionY | ExtraDivisionZ
}
 This mode is only valid for the box primitive. More...
 
typedef Eigen::Map< Array3i > TriangleRef
 
typedef Eigen::Map< const Array3i > ConstTriangleRef
 
typedef stdx::variant< Mesh, Box, Sphere, Cylinder, Cone, CapsulePrimitive
 
- Public Types inherited from cnoid::SgObject
enum  Attribute {
  Node = 1 << 0, GroupNode = 1 << 1, TransformNode = 1 << 2, Composite = 1 << 3,
  Geometry = 1 << 4, Appearance = 1 << 5, NodeDecoration = 1 << 6, Marker = 1 << 7,
  Operable = 1 << 8, MaxAttributeBit = 9, GroupAttribute = GroupNode, NodeDecorationGroup = NodeDecoration,
  MarkerAttribute = Marker
}
 
typedef std::set< SgObject * > ParentContainer
 
typedef ParentContainer::iterator parentIter
 
typedef ParentContainer::const_iterator const_parentIter
 

Public Member Functions

 SgMesh ()
 
 SgMesh (const SgMesh &org, CloneMap *cloneMap=nullptr)
 
virtual void updateBoundingBox () override
 
const SgIndexArraytriangleVertices () const
 
SgIndexArraytriangleVertices ()
 
bool hasTriangles () const
 
int numTriangles () const
 
void setNumTriangles (int n)
 
void reserveNumTriangles (int n)
 
TriangleRef triangle (int index)
 
ConstTriangleRef triangle (int index) const
 
void setTriangle (int index, int v0, int v1, int v2)
 
TriangleRef newTriangle ()
 
TriangleRef addTriangle ()
 
void addTriangles (std::initializer_list< Array3i > il)
 
void addTriangle (int v0, int v1, int v2)
 
 SgMesh (Primitive primitive)
 
const int primitiveType () const
 
template<class TPrimitive >
const TPrimitive & primitive () const
 
void setPrimitive (Primitive prim)
 
int divisionNumber () const
 The value is -1 when the division number is not explicitly specified. More...
 
void setDivisionNumber (int n)
 
int extraDivisionNumber () const
 The value is -1 when the extra division number is not explicitly specified. More...
 
void setExtraDivisionNumber (int n)
 
int extraDivisionMode () const
 
void setExtraDivisionMode (int mode)
 
void transform (const Affine3 &T)
 
void transform (const Affine3f &T)
 
void translate (const Vector3f &translation)
 
void rotate (const Matrix3f &R)
 
- Public Member Functions inherited from cnoid::SgMeshBase
virtual int numChildObjects () const override
 
virtual SgObjectchildObject (int index) override
 
const BoundingBoxboundingBox () const
 
void setBoundingBox (const BoundingBox &bb)
 
void setBoundingBox (const BoundingBoxf &bb)
 
bool hasVertices () const
 
SgVertexArrayvertices ()
 
const SgVertexArrayvertices () const
 
SgVertexArraysetVertices (SgVertexArray *vertices)
 
SgVertexArraygetOrCreateVertices (int size=0)
 
bool hasNormals () const
 
SgNormalArraynormals ()
 
const SgNormalArraynormals () const
 
SgNormalArraysetNormals (SgNormalArray *normals)
 
SgNormalArraygetOrCreateNormals ()
 
bool hasColors () const
 
SgColorArraycolors ()
 
const SgColorArraycolors () const
 
SgColorArraysetColors (SgColorArray *colors)
 
SgColorArraygetOrCreateColors (int size=0)
 
bool hasTexCoords () const
 
SgTexCoordArraytexCoords ()
 
const SgTexCoordArraytexCoords () const
 
SgTexCoordArraysetTexCoords (SgTexCoordArray *texCoords)
 
SgTexCoordArraygetOrCreateTexCoords ()
 
bool hasFaceVertexIndices () const
 
const SgIndexArrayfaceVertexIndices () const
 
SgIndexArrayfaceVertexIndices ()
 
bool hasNormalIndices () const
 
const SgIndexArraynormalIndices () const
 
SgIndexArraynormalIndices ()
 
bool hasColorIndices () const
 
const SgIndexArraycolorIndices () const
 
SgIndexArraycolorIndices ()
 
bool hasTexCoordIndices () const
 
const SgIndexArraytexCoordIndices () const
 
SgIndexArraytexCoordIndices ()
 
float creaseAngle () const
 
void setCreaseAngle (float angle)
 
bool isSolid () const
 
void setSolid (bool on)
 
- Public Member Functions inherited from cnoid::SgObject
SgObjectclone () const
 
SgObjectclone (CloneMap &cloneMap) const
 
void setAttribute (int attr)
 
void setAttributes (int attrs)
 
int attributes () const
 
bool hasAttribute (int attr) const
 
bool hasAttributes (int attrs) const
 
const std::string & name () const
 
void setName (const std::string &name)
 
SignalProxy< void(const SgUpdate &update)> sigUpdated ()
 
void notifyUpdate (SgUpdate &update)
 
void notifyUpdate (int action=SgUpdate::Modified)
 
void addParent (SgObject *parent, SgUpdateRef update=nullptr)
 
void removeParent (SgObject *parent)
 
int numParents () const
 
bool hasParents () const
 
const_parentIter parentBegin () const
 
const_parentIter parentEnd () const
 
SignalProxy< void(bool on)> sigGraphConnection ()
 
bool hasValidBoundingBoxCache () const
 
void invalidateBoundingBox ()
 
void setBoundingBoxCacheReady () const
 
bool hasUri () const
 
const std::string & uri () const
 
bool hasAbsoluteUri () const
 
const std::string & absoluteUri () const
 
bool hasUriFragment () const
 
const std::string & uriFragment () const
 
void setUriByFilePathAndBaseDirectory (const std::string &filePath, const std::string &baseDirectory)
 
void setUriByFilePathAndCurrentDirectory (const std::string &filePath)
 
void setUri (const std::string &uri, const std::string &absoluteUri)
 
void setUriFragment (const std::string &fragment)
 
void clearUri ()
 
bool isNode () const
 
SgNodetoNode ()
 
bool isGroupNode () const
 
SgGrouptoGroupNode ()
 
bool isTransformNode () const
 
SgTransformtoTransformNode ()
 
- Public Member Functions inherited from cnoid::Referenced
virtual ~Referenced ()
 

Protected Member Functions

virtual ReferenceddoClone (CloneMap *cloneMap) const override
 
- Protected Member Functions inherited from cnoid::SgMeshBase
 SgMeshBase ()
 
 SgMeshBase (const SgMeshBase &org, CloneMap *cloneMap=nullptr)
 
 ~SgMeshBase ()
 
- Protected Member Functions inherited from cnoid::SgObject
 SgObject ()
 
 SgObject (const SgObject &org)
 
void notifyUpperNodesOfUpdate (SgUpdate &update)
 
void notifyUpperNodesOfUpdate (SgUpdate &update, bool doInvalidateBoundingBox)
 
- Protected Member Functions inherited from cnoid::Referenced
 Referenced ()
 
 Referenced (const Referenced &)
 
int refCount () const
 

Additional Inherited Members

- Static Public Member Functions inherited from cnoid::SgObject
static bool checkNonNodeCloning (const CloneMap &cloneMap)
 
static void setNonNodeCloning (CloneMap &cloneMap, bool on)
 
- Protected Attributes inherited from cnoid::SgMeshBase
BoundingBox bbox
 
SgVertexArrayPtr vertices_
 
SgIndexArray faceVertexIndices_
 
SgNormalArrayPtr normals_
 
SgIndexArray normalIndices_
 
SgColorArrayPtr colors_
 
SgIndexArray colorIndices_
 
SgTexCoordArrayPtr texCoords_
 
SgIndexArray texCoordIndices_
 
float creaseAngle_
 
bool isSolid_
 

Member Typedef Documentation

◆ ConstTriangleRef

typedef Eigen::Map<const Array3i> cnoid::SgMesh::ConstTriangleRef

◆ Primitive

◆ TriangleRef

typedef Eigen::Map<Array3i> cnoid::SgMesh::TriangleRef

Member Enumeration Documentation

◆ ExtraDivisionMode

This mode is only valid for the box primitive.

Enumerator
ExtraDivisionPreferred 
ExtraDivisionX 
ExtraDivisionY 
ExtraDivisionZ 
ExtraDivisionAll 

◆ PrimitiveType

Enumerator
MeshType 
BoxType 
SphereType 
CylinderType 
ConeType 
CapsuleType 
MESH 
BOX 
SPHERE 
CYLINDER 
CONE 
CAPSULE 

Constructor & Destructor Documentation

◆ SgMesh() [1/3]

SgMesh::SgMesh ( )

◆ SgMesh() [2/3]

SgMesh::SgMesh ( const SgMesh org,
CloneMap cloneMap = nullptr 
)

◆ SgMesh() [3/3]

SgMesh::SgMesh ( Primitive  primitive)

Member Function Documentation

◆ addTriangle() [1/2]

TriangleRef cnoid::SgMesh::addTriangle ( )
inline

◆ addTriangle() [2/2]

void cnoid::SgMesh::addTriangle ( int  v0,
int  v1,
int  v2 
)
inline

◆ addTriangles()

void cnoid::SgMesh::addTriangles ( std::initializer_list< Array3i >  il)
inline

◆ divisionNumber()

int cnoid::SgMesh::divisionNumber ( ) const
inline

The value is -1 when the division number is not explicitly specified.

◆ doClone()

Referenced * SgMesh::doClone ( CloneMap cloneMap) const
overrideprotectedvirtual

Reimplemented from cnoid::SgObject.

◆ extraDivisionMode()

int cnoid::SgMesh::extraDivisionMode ( ) const
inline

◆ extraDivisionNumber()

int cnoid::SgMesh::extraDivisionNumber ( ) const
inline

The value is -1 when the extra division number is not explicitly specified.

◆ hasTriangles()

bool cnoid::SgMesh::hasTriangles ( ) const
inline

◆ newTriangle()

TriangleRef cnoid::SgMesh::newTriangle ( )
inline

◆ numTriangles()

int cnoid::SgMesh::numTriangles ( ) const
inline

◆ primitive()

template<class TPrimitive >
const TPrimitive& cnoid::SgMesh::primitive ( ) const
inline

◆ primitiveType()

const int cnoid::SgMesh::primitiveType ( ) const
inline

◆ reserveNumTriangles()

void cnoid::SgMesh::reserveNumTriangles ( int  n)
inline

◆ rotate()

void SgMesh::rotate ( const Matrix3f &  R)

◆ setDivisionNumber()

void cnoid::SgMesh::setDivisionNumber ( int  n)
inline

◆ setExtraDivisionMode()

void cnoid::SgMesh::setExtraDivisionMode ( int  mode)
inline

◆ setExtraDivisionNumber()

void cnoid::SgMesh::setExtraDivisionNumber ( int  n)
inline

◆ setNumTriangles()

void cnoid::SgMesh::setNumTriangles ( int  n)
inline

◆ setPrimitive()

void cnoid::SgMesh::setPrimitive ( Primitive  prim)
inline

◆ setTriangle()

void cnoid::SgMesh::setTriangle ( int  index,
int  v0,
int  v1,
int  v2 
)
inline

◆ transform() [1/2]

void SgMesh::transform ( const Affine3 T)

◆ transform() [2/2]

void SgMesh::transform ( const Affine3f &  T)

◆ translate()

void SgMesh::translate ( const Vector3f &  translation)

◆ triangle() [1/2]

TriangleRef cnoid::SgMesh::triangle ( int  index)
inline

◆ triangle() [2/2]

ConstTriangleRef cnoid::SgMesh::triangle ( int  index) const
inline

◆ triangleVertices() [1/2]

SgIndexArray& cnoid::SgMesh::triangleVertices ( )
inline

◆ triangleVertices() [2/2]

const SgIndexArray& cnoid::SgMesh::triangleVertices ( ) const
inline

Triangle indices (triangles variable) should be CCW.

◆ updateBoundingBox()

void SgMesh::updateBoundingBox ( )
overridevirtual

Reimplemented from cnoid::SgMeshBase.


The documentation for this class was generated from the following files: