A MarkupModel part useful for fast rendering of a lot of geometries with the same shape. More...
Public Types | |
enum | PrimitiveType { TRIANGLES, LINES } |
Geometry primitive type. More... | |
![]() | |
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... | |
Public Member Functions | |
MarkupPartInstancedGeometry () | |
Constructs an empty part. More... | |
MarkupPartInstancedGeometry (const Color3f &singleColor, float polygonOffsetFactor, float eyeLiftFactor) | |
Constructs a part with the given settings. More... | |
virtual PartType | type () const |
Returns the type of the part. Always MarkupPart::INSTANCED_GEOMETRY. 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 Mat4d & | transformation () 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... | |
void | setGeometry (PrimitiveType primitiveType, const std::vector< unsigned int > &indices, const std::vector< Vec3d > &vertices) |
Sets the geometry to be instanced. More... | |
const std::vector< unsigned int > & | geometryIndices () const |
Returns the vertices of the instanced geometry. More... | |
const std::vector< Vec3d > & | geometryVertices () const |
Returns the vertices of the instanced geometry. More... | |
PrimitiveType | geometryPrimitiveType () const |
Returns the primitive type of the instanced geometry. More... | |
const Color3f & | singleColor () const |
Returns the color of the triangles. More... | |
void | setSingleColor (const Color3f &color) |
Sets the color of the triangles. More... | |
bool | fixedPixelSize () const |
Returns the fixed pixel size. More... | |
void | setFixedPixelSize (bool fixedSize) |
Sets the fixed pixel size. 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 | setInstanceTransformArray (const std::vector< Mat4d > &transformArr) |
Sets an array with a matrix for each instance. More... | |
void | setInstanceColorArray (const std::vector< Color3f > &colorArr) |
Sets an array with a color for each instance. More... | |
void | addInstance (const Mat4d &transform) |
Adds an instance to the part. More... | |
void | addInstance (const Mat4d &transform, const Color3f &color) |
Adds an instance with color to the part. More... | |
size_t | instanceCount () const |
Returns the number of triangles. More... | |
void | removeAllInstances () |
Removes all instances from the part. More... | |
![]() | |
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... | |
![]() | |
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... | |
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.
Geometry primitive type.
cee::vis::MarkupPartInstancedGeometry::MarkupPartInstancedGeometry | ( | ) |
Constructs an empty part.
cee::vis::MarkupPartInstancedGeometry::MarkupPartInstancedGeometry | ( | const Color3f & | singleColor, |
float | polygonOffsetFactor, | ||
float | eyeLiftFactor | ||
) |
Constructs a part with the given settings.
void cee::vis::MarkupPartInstancedGeometry::addInstance | ( | const Mat4d & | transform | ) |
Adds an instance to the part.
void cee::vis::MarkupPartInstancedGeometry::addInstance | ( | const Mat4d & | transform, |
const Color3f & | color | ||
) |
Adds an instance with color to the part.
|
virtual |
Returns the current bounding box of the part.
Implements cee::vis::MarkupPart.
float cee::vis::MarkupPartInstancedGeometry::eyeLiftFactor | ( | ) | const |
Returns the eye lift factor of the triangles.
bool cee::vis::MarkupPartInstancedGeometry::fixedPixelSize | ( | ) | const |
Returns the fixed pixel size.
const std::vector< unsigned int > & cee::vis::MarkupPartInstancedGeometry::geometryIndices | ( | ) | const |
Returns the vertices of the instanced geometry.
MarkupPartInstancedGeometry::PrimitiveType cee::vis::MarkupPartInstancedGeometry::geometryPrimitiveType | ( | ) | const |
Returns the primitive type of the instanced geometry.
const std::vector< Vec3d > & cee::vis::MarkupPartInstancedGeometry::geometryVertices | ( | ) | const |
Returns the vertices of the instanced geometry.
size_t cee::vis::MarkupPartInstancedGeometry::instanceCount | ( | ) | const |
Returns the number of triangles.
float cee::vis::MarkupPartInstancedGeometry::polygonOffsetFactor | ( | ) | const |
Returns the polygon offset factor for the triangles.
|
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.
Implements cee::vis::MarkupPart.
void cee::vis::MarkupPartInstancedGeometry::removeAllInstances | ( | ) |
Removes all instances from the part.
void cee::vis::MarkupPartInstancedGeometry::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::MarkupPartInstancedGeometry::setFixedPixelSize | ( | bool | fixedSize | ) |
Sets the fixed pixel size.
void cee::vis::MarkupPartInstancedGeometry::setGeometry | ( | PrimitiveType | primitiveType, |
const std::vector< unsigned int > & | indices, | ||
const std::vector< Vec3d > & | vertices | ||
) |
Sets the geometry to be instanced.
void cee::vis::MarkupPartInstancedGeometry::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 cee::vis::MarkupPartInstancedGeometry::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 cee::vis::MarkupPartInstancedGeometry::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.
|
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.
Implements cee::vis::MarkupPart.
void cee::vis::MarkupPartInstancedGeometry::setSingleColor | ( | const Color3f & | color | ) |
Sets the color of the triangles.
|
virtual |
Sets the transformation matrix to use for the part.
Implements cee::vis::MarkupPart.
const Color3f & cee::vis::MarkupPartInstancedGeometry::singleColor | ( | ) | const |
Returns the color of the triangles.
|
virtual |
Returns the current transformation matrix for the part.
Implements cee::vis::MarkupPart.
|
virtual |
Returns the type of the part. Always MarkupPart::INSTANCED_GEOMETRY.
Implements cee::vis::MarkupPart.