cee::vis::MarkupPartTriangles
-
class MarkupPartTriangles : public MarkupPart
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
Public Functions
-
MarkupPartTriangles()
Constructs an empty part.
-
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.
-
virtual PartType type() const
Returns the type of the part. Always MarkupPart::TRIANGLES.
-
virtual BoundingBox boundingBox() const
Returns the current bounding box of the part.
-
virtual void setPriority(int priority)
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
-
virtual int priority() const
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 and opacity
-
virtual const Mat4d &transformation() const
Returns the current transformation matrix for the part.
-
virtual void setTransformation(const Mat4d &matrix)
Sets the transformation matrix to use for the part.
-
float opacity() const
Returns the opacity of the triangles.
1.0 is opaque and 0.0 is fully transparent (invisible).
-
void 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
-
bool lighting() const
Returns true if lighting is enabled for this part.
-
void setLighting(bool enable)
Sets if the triangles should be lit (true) or unlit (false)
-
float polygonOffsetFactor() const
Returns the polygon offset factor for the triangles.
See also
-
void 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.
-
float eyeLiftFactor() const
Returns the eye lift factor of the triangles.
See also
-
void 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 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 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.
-
size_t count() const
Returns the number of triangles.
-
void removeAll()
Removes all triangles from the part.
Public Static Functions
-
static PtrRef<MarkupPartTriangles> create(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.
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.