cee::vis::MarkupPartTriangles Class Reference

A MarkupModel part for drawing triangles. More...

Public Member Functions

 MarkupPartTriangles ()
 Constructs an empty part. More...
 
 MarkupPartTriangles (const Color3f &color, float opacity, float polygonOffsetFactor, float eyeLiftFactor)
 Constructs a part with the given settings. More...
 
virtual PartType type () const
 Returns the type of the part. Always MarkupPart::TRIANGLES. More...
 
virtual BoundingBox boundingBox () const
 Returns the current bounding box of the part. More...
 
virtual void setPriority (int priority)
 Sets render priority of the part. More...
 
virtual int priority () const
 Returns the render priority of the part. More...
 
virtual const Mat4dtransformation () const
 Returns the current transformation matrix for the part. More...
 
virtual void setTransformation (const Mat4d &matrix)
 Sets the transformation matrix to use for the part. More...
 
const Color3fcolor () const
 Returns the color of the triangles. More...
 
void setColor (const Color3f &color)
 Sets the color of the triangles. More...
 
float opacity () const
 Returns the opacity of the triangles. More...
 
void setOpacity (float opacity)
 Sets the opacity of the triangles. More...
 
bool lighting () const
 Returns true if lighting is enabled for this part. More...
 
void setLighting (bool enable)
 Sets if the triangles should be lit (true) or unlit (false) More...
 
float polygonOffsetFactor () const
 Returns the polygon offset factor for the triangles. More...
 
void setPolygonOffsetFactor (float factor)
 Sets the polygon offset factor for the triangles. More...
 
float eyeLiftFactor () const
 Returns the eye lift factor of the triangles. More...
 
void setEyeLiftFactor (float factor)
 Sets the eye lift factor for the triangles. More...
 
void add (const Vec3d &vertex1, const Vec3d &vertex2, const Vec3d &vertex3)
 Adds a triangle to the part. More...
 
void add (const std::vector< Vec3d > &vertices)
 Adds a set of triangles to the part. More...
 
size_t count () const
 Returns the number of triangles. More...
 
void removeAll ()
 Removes all triangles from the part. More...
 
const std::vector< Vec3d > & vertices () const
 Returns the vertices of all triangles in the part. More...
 
- Public Member Functions inherited from cee::vis::MarkupPart
bool visible () const
 Returns true if the part is visible. More...
 
void setVisible (bool visible)
 Sets if the part should be visible or not. More...
 
- Public Member Functions inherited from cee::RefCountedObject
void addRef () const
 Increments the reference count for this object. More...
 
void release () const
 Decrements the reference count for this object. More...
 
int refCount () const
 Returns the reference count for this object. More...
 
void setRefCountZero () const
 Sets the ref count to zero, but DOES NOT delete the object. More...
 

Static Public Member Functions

static PtrRef< MarkupPartTrianglescreate (const std::vector< Vec3d > &vertices, const Color3f &color, float opacity=1.0f, float polygonOffsetFactor=0.0f, float eyeLiftFactor=0.0f)
 Returns a newly created part with the given triangles and settings. More...
 

Additional Inherited Members

- Public Types inherited from cee::vis::MarkupPart
enum  PartType {
  LABELS, TEXTS_3D, TRIANGLES, INSTANCED_GEOMETRY,
  LINES, POINTS, ARROWS, FIXED_SIZE_ARROW,
  FIXED_SIZE_SPHERE, FIXED_SIZE_IMAGE_GLYPH
}
 Enum specifying the type of MarkupPart. More...
 
Inheritance diagram for cee::vis::MarkupPartTriangles:
cee::vis::MarkupPart cee::RefCountedObject

Detailed Description

A MarkupModel part for drawing triangles.

The part can contain any number of triangles, but all triangles will share the same settings for

  • color
  • opacity
  • polygon offset factor. Moving the polygons slightly in the z buffer. Used in cooperation with eye lift to control draw order with items in the same plane.
  • eye lift factor. A factor to move the points towards the camera. This is used to control item drawn in the same plane.
See also
MarkupModel

Constructor & Destructor Documentation

cee::vis::MarkupPartTriangles::MarkupPartTriangles ( )

Constructs an empty part.

cee::vis::MarkupPartTriangles::MarkupPartTriangles ( const Color3f color,
float  opacity,
float  polygonOffsetFactor,
float  eyeLiftFactor 
)

Constructs a part with the given settings.

  • color: The color for all triangles in the part
  • opacity: The opacity for all triangles. 1.0 is opaque and 0.0 is fully transparent (invisible)
  • polygonOffsetFactor: Moving the polygons slightly in the z buffer. Used in cooperation with eye lift to control draw order with items in the same plane.
  • eyeLiftFactor: A factor to move the lines towards the camera. This is used to control item drawn in the same plane.

Member Function Documentation

void cee::vis::MarkupPartTriangles::add ( const Vec3d vertex1,
const Vec3d vertex2,
const Vec3d vertex3 
)

Adds a triangle to the part.

The vertices should be given in counter-clockwise order.

void cee::vis::MarkupPartTriangles::add ( const std::vector< Vec3d > &  vertices)

Adds a set of triangles to the part.

Each triangle is described by three vertices and should be given in counter-clockwise order.

cee::BoundingBox cee::vis::MarkupPartTriangles::boundingBox ( ) const
virtual

Returns the current bounding box of the part.

Implements cee::vis::MarkupPart.

const Color3f & cee::vis::MarkupPartTriangles::color ( ) const

Returns the color of the triangles.

size_t cee::vis::MarkupPartTriangles::count ( ) const

Returns the number of triangles.

PtrRef< MarkupPartTriangles > cee::vis::MarkupPartTriangles::create ( const std::vector< Vec3d > &  vertices,
const Color3f color,
float  opacity = 1.0f,
float  polygonOffsetFactor = 0.0f,
float  eyeLiftFactor = 0.0f 
)
static

Returns a newly created part with the given triangles and settings.

The returned part will have vertices.size()/3 triangles, defined in counter clock-wise order.

  • color: The color for all triangles in the part . opacity: The opacity for all triangles. 1.0 is opaque and 0.0 is fully transparent (invisible)
  • polygonOffsetFactor: Moving the polygons slightly in the z buffer. Used in cooperation with eye lift to control draw order with items in the same plane.
  • eyeLiftFactor: A factor to move the lines towards the camera. This is used to control item drawn in the same plane.
float cee::vis::MarkupPartTriangles::eyeLiftFactor ( ) const

Returns the eye lift factor of the triangles.

See also
setEyeLiftFactor
bool cee::vis::MarkupPartTriangles::lighting ( ) const

Returns true if lighting is enabled for this part.

float cee::vis::MarkupPartTriangles::opacity ( ) const

Returns the opacity of the triangles.

1.0 is opaque and 0.0 is fully transparent (invisible).

float cee::vis::MarkupPartTriangles::polygonOffsetFactor ( ) const

Returns the polygon offset factor for the triangles.

See also
setPolygonOffsetFactor
int cee::vis::MarkupPartTriangles::priority ( ) const
virtual

Returns the render priority of the part.

The default priority is cee::UNDEFINED_INT. In this case the priority will be set to 99 if the opacity is less than 0.999. Else set to 10.

See also
setPriority
opacity

Implements cee::vis::MarkupPart.

void cee::vis::MarkupPartTriangles::removeAll ( )

Removes all triangles from the part.

void cee::vis::MarkupPartTriangles::setColor ( const Color3f color)

Sets the color of the triangles.

void cee::vis::MarkupPartTriangles::setEyeLiftFactor ( float  factor)

Sets the eye lift factor for the triangles.

The eye lift factor specifies if the triangles should be moved towards the camera (or away from the camera if the factor is negative).

This is useful for controlling the ordering of items that are defined in the same plane.

void cee::vis::MarkupPartTriangles::setLighting ( bool  enable)

Sets if the triangles should be lit (true) or unlit (false)

void cee::vis::MarkupPartTriangles::setOpacity ( float  opacity)

Sets the opacity of the triangles.

1.0 is opaque and 0.0 is fully transparent (invisible).

Note
Setting the opacity may change the render priority.
See also
setPriority
void cee::vis::MarkupPartTriangles::setPolygonOffsetFactor ( float  factor)

Sets the polygon offset factor for the triangles.

The factor controls the moving of the polygons slightly in the z buffer. Both positive and negative factors can be used to move forward and backward in the z buffer.

Used in cooperation with eye lift to control draw order with items in the same plane.

void cee::vis::MarkupPartTriangles::setPriority ( int  priority)
virtual

Sets render priority of the part.

The render priority determines the order in which parts get rendered. Parts with lower priorities get rendered first. The default priority is cee::UNDEFINED_INT. In this case the priority will be set to 99 if the opacity is less than 0.999. Else set to 10. Setting the priority to another value will override this.

See also
opacity

Implements cee::vis::MarkupPart.

void cee::vis::MarkupPartTriangles::setTransformation ( const Mat4d matrix)
virtual

Sets the transformation matrix to use for the part.

Implements cee::vis::MarkupPart.

const Mat4d & cee::vis::MarkupPartTriangles::transformation ( ) const
virtual

Returns the current transformation matrix for the part.

Implements cee::vis::MarkupPart.

MarkupPart::PartType cee::vis::MarkupPartTriangles::type ( ) const
virtual

Returns the type of the part. Always MarkupPart::TRIANGLES.

Implements cee::vis::MarkupPart.

const std::vector< Vec3d > & cee::vis::MarkupPartTriangles::vertices ( ) const

Returns the vertices of all triangles in the part.