cee::vis::MarkupPartInstancedGeometry Class Reference

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...
 
- 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...
 

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 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...
 
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 Color3fsingleColor () 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...
 
- 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...
 
Inheritance diagram for cee::vis::MarkupPartInstancedGeometry:
cee::vis::MarkupPart cee::RefCountedObject

Detailed Description

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

Member Enumeration Documentation

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

cee::BoundingBox cee::vis::MarkupPartInstancedGeometry::boundingBox ( ) const
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.

See also
setEyeLiftFactor
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.

See also
setPolygonOffsetFactor
int cee::vis::MarkupPartInstancedGeometry::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::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.

void cee::vis::MarkupPartInstancedGeometry::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::MarkupPartInstancedGeometry::setSingleColor ( const Color3f color)

Sets the color of the triangles.

void cee::vis::MarkupPartInstancedGeometry::setTransformation ( const Mat4d matrix)
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.

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

Returns the current transformation matrix for the part.

Implements cee::vis::MarkupPart.

MarkupPartInstancedGeometry::PartType cee::vis::MarkupPartInstancedGeometry::type ( ) const
virtual

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

Implements cee::vis::MarkupPart.