AvogadroLibs 1.98.1
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | List of all members
MeshGeometry Class Reference

The MeshGeometry is used for triangle mesh geometry. More...

#include <avogadro/rendering/meshgeometry.h>

Inheritance diagram for MeshGeometry:
Drawable ArcSector Quad

Classes

struct  PackedVertex
 

Public Member Functions

 MeshGeometry (const MeshGeometry &other)
 
MeshGeometryoperator= (MeshGeometry)
 
void accept (Visitor &) override
 
void render (const Camera &camera) override
 Render the mesh geometry.
 
void clear () override
 
size_t vertexCount () const
 
size_t indexCount () const
 
size_t triangleCount () const
 
Core::Array< PackedVertexvertices ()
 
Core::Array< unsigned int > triangles ()
 
unsigned int addVertices (const Core::Array< Vector3f > &vertices, const Core::Array< Vector3f > &normals, const Core::Array< Vector4ub > &colors)
 
unsigned int addVertices (const Core::Array< Vector3f > &vertices, const Core::Array< Vector3f > &normals, const Core::Array< Vector3ub > &colors)
 
unsigned int addVertices (const Core::Array< Vector3f > &vertices, const Core::Array< Vector3f > &normals)
 
void addTriangle (unsigned int index1, unsigned int index2, unsigned int index3)
 
void addTriangles (const Core::Array< unsigned int > &indices)
 
void setColor (const Vector3ub &c)
 
Vector3ub color () const
 
void setOpacity (unsigned char opacity_)
 
unsigned char opacity () const
 
- Public Member Functions inherited from Drawable
 Drawable (const Drawable &other)
 
Drawableoperator= (Drawable)
 
const GeometryNodeparent () const
 Get a pointer to the drawable object's parent.
 
GeometryNodeparent ()
 
void setVisible (bool visibility)
 Set the visibility of the drawable object.
 
bool isVisible () const
 Get the current visibility of the drawable.
 
Identifieridentifier ()
 
const Identifieridentifier () const
 
virtual std::multimap< float, Identifierhits (const Vector3f &rayOrigin, const Vector3f &rayEnd, const Vector3f &rayDirection) const
 
virtual Core::Array< IdentifierareaHits (const Frustrum &f) const
 
void setRenderPass (RenderPass pass)
 
RenderPass renderPass () const
 

Static Public Attributes

static const unsigned int InvalidIndex
 

Additional Inherited Members

- Protected Member Functions inherited from Drawable
void setParent (GeometryNode *parent)
 Set the parent node for the node.
 
- Protected Attributes inherited from Drawable
GeometryNodem_parent
 
bool m_visible
 
RenderPass m_renderPass
 
Identifier m_identifier
 

Detailed Description

Author
Marcus D. Hanwell

Member Function Documentation

◆ accept()

void accept ( Visitor )
overridevirtual

Accept a visit from our friendly visitor.

Reimplemented from Drawable.

◆ render()

void render ( const Camera camera)
overridevirtual
Parameters
cameraThe current camera to be used for rendering.

Reimplemented from Drawable.

◆ addVertices() [1/3]

unsigned int addVertices ( const Core::Array< Vector3f > &  vertices,
const Core::Array< Vector3f > &  normals,
const Core::Array< Vector4ub > &  colors 
)

Add vertices to the object. Note that this just adds vertices to the object. Use addTriangles with size_t indices to actually draw them.

Parameters
verticesThe 3D vertex points to add to the drawable.
normalsThe normal direction at the vertex.
colorsVertex color. If not specified, use the current color() and opacity(). If the 3 component color is set, the current opacity() is used.
Note
All arrays must be the same length, or this function call will fail, returning InvalidIndex.
Returns
The index of the first vertex added by this call, used to specify element arrays for the actual triangles.

◆ addVertices() [2/3]

unsigned int addVertices ( const Core::Array< Vector3f > &  vertices,
const Core::Array< Vector3f > &  normals,
const Core::Array< Vector3ub > &  colors 
)

Add vertices to the object. Note that this just adds vertices to the object. Use addTriangles with size_t indices to actually draw them.

Parameters
verticesThe 3D vertex points to add to the drawable.
normalsThe normal direction at the vertex.
colorsVertex color. If not specified, use the current color() and opacity(). If the 3 component color is set, the current opacity() is used.
Note
All arrays must be the same length, or this function call will fail, returning InvalidIndex.
Returns
The index of the first vertex added by this call, used to specify element arrays for the actual triangles.

◆ addVertices() [3/3]

unsigned int addVertices ( const Core::Array< Vector3f > &  vertices,
const Core::Array< Vector3f > &  normals 
)

Add vertices to the object. Note that this just adds vertices to the object. Use addTriangles with size_t indices to actually draw them.

Parameters
verticesThe 3D vertex points to add to the drawable.
normalsThe normal direction at the vertex.
colorsVertex color. If not specified, use the current color() and opacity(). If the 3 component color is set, the current opacity() is used.
Note
All arrays must be the same length, or this function call will fail, returning InvalidIndex.
Returns
The index of the first vertex added by this call, used to specify element arrays for the actual triangles.

◆ addTriangle()

void addTriangle ( unsigned int  index1,
unsigned int  index2,
unsigned int  index3 
)

Add triangles to the mesh. Triangles are specified as 3-tuples of vertex indices. Must call addVertices first, and use the return value to obtain the valid index range.

◆ addTriangles()

void addTriangles ( const Core::Array< unsigned int > &  indices)

Add triangles to the mesh. Triangles are specified as 3-tuples of vertex indices. Must call addVertices first, and use the return value to obtain the valid index range.

◆ clear()

void clear ( )
overridevirtual

Clear the contents of the node.

Reimplemented from Drawable.

◆ vertexCount()

size_t vertexCount ( ) const

Get the number of vertices.

◆ indexCount()

size_t indexCount ( ) const

Get the number of vertices.

◆ triangleCount()

size_t triangleCount ( ) const

Get the number of triangles.

◆ setColor()

void setColor ( const Vector3ub &  c)

The default color of the mesh. This is used to set the color of new vertices when no explicit vertex color is specified.

◆ color()

Vector3ub color ( ) const

The default color of the mesh. This is used to set the color of new vertices when no explicit vertex color is specified.

◆ setOpacity()

void setOpacity ( unsigned char  opacity_)

The default opacity of the mesh. This is used when either no explicit vertex color is specified, or a three component color is used.

◆ opacity()

unsigned char opacity ( ) const

The default opacity of the mesh. This is used when either no explicit vertex color is specified, or a three component color is used.


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