cee::vis::MarkupPartInstancedGeometry

class MarkupPartInstancedGeometry : public MarkupPart

A MarkupModel part useful for fast rendering of a lot of geometries with the same shape.

The geometry can be triangles or lines, and is defined with the setGeometry() method. This geometry is then rendered once for every provided transformation matrix (using the setInstanceTransformArray()) method. An optional per primitive color can be set with the setInstanceColorArray() method.

See also

MarkupModel

Public Types

enum PrimitiveType

Geometry primitive type.

Values:

enumerator TRIANGLES
enumerator LINES

Public Functions

MarkupPartInstancedGeometry()

Constructs an empty part.

MarkupPartInstancedGeometry(const Color3f &singleColor, float polygonOffsetFactor, float eyeLiftFactor)

Constructs a part with the given settings.

virtual PartType type() const

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

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

opacity

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.

void setGeometry(PrimitiveType primitiveType, const std::vector<unsigned int> &indices, const std::vector<Vec3d> &vertices)

Sets the geometry to be instanced.

const std::vector<unsigned int> &geometryIndices() const

Returns the vertices of the instanced geometry.

const std::vector<Vec3d> &geometryVertices() const

Returns the vertices of the instanced geometry.

PrimitiveType geometryPrimitiveType() const

Returns the primitive type of the instanced geometry.

const Color3f &singleColor() const

Returns the color of the triangles.

void setSingleColor(const Color3f &color)

Sets the color of the triangles.

bool fixedPixelSize() const

Returns the fixed pixel size.

void setFixedPixelSize(bool fixedSize)

Sets the fixed pixel size.

float polygonOffsetFactor() const

Returns the polygon offset factor for the triangles.

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

setEyeLiftFactor

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 setInstanceTransformArray(const std::vector<Mat4d> &transformArr)

Sets an array with a matrix for each instance.

Note that the array needs to be in sync with any color array

void setInstanceColorArray(const std::vector<Color3f> &colorArr)

Sets an array with a color for each instance.

Note that the array needs to be in sync with the transform array

void addInstance(const Mat4d &transform)

Adds an instance to the part.

void addInstance(const Mat4d &transform, const Color3f &color)

Adds an instance with color to the part.

size_t instanceCount() const

Returns the number of triangles.

void removeAllInstances()

Removes all instances from the part.