Carna Version 3.3.3
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Carna::helpers::PointMarkerHelper Class Reference

Simplifies the creation and maintenance of point markers. More...

#include <PointMarkerHelper.h>

Public Member Functions

 PointMarkerHelper (unsigned int geometryType, unsigned int pointSize=DEFAULT_POINT_SIZE)
 Instantiates.
 
 PointMarkerHelper (unsigned int geometryType, unsigned int meshRole, unsigned int materialRole, unsigned int pointSize=DEFAULT_POINT_SIZE)
 
 ~PointMarkerHelper ()
 Releases all previously acquired materials.
 
void releaseGeometryFeatures ()
 Releases all previously acquired materials. Invoke this method when it is sure that no further markers will be created.
 
base::GeometrycreatePointMarker () const
 Creates new point marker of preferred pixel size, colored differently than the last point marker created by any PointMarkerHelper instance.
 
base::GeometrycreatePointMarker (unsigned int pointSize) const
 Creates new point marker of pointSize colored differently than the last point marker created by any PointMarkerHelper instance. This method creates a new material each time it is used.
 
base::GeometrycreatePointMarker (const base::Color &color) const
 Creates new point marker of preferred pixel size with color. This method creates a new material each time it is used.
 
base::GeometrycreatePointMarker (const base::Color &color, unsigned int pointSize) const
 Creates new point marker of pointSize with color. This method creates a new material each time it is used.
 

Static Public Member Functions

static void resetDefaultColor ()
 Resets the color that the next invocation to the argument-less version of createPointMarker uses.
 

Public Attributes

const unsigned int geometryType
 Holds the markers' geometry type.
 
const unsigned int meshRole
 Holds the role used to attach the mesh to the markers.
 
const unsigned int materialRole
 Holds the role used to attach the material to the markers.
 
const unsigned int pointSize
 Holds the preferred pixel size of the markers.
 

Static Public Attributes

static const unsigned int DEFAULT_POINT_SIZE = 6
 Holds the default point marker pixel size.
 

Detailed Description

Simplifies the creation and maintenance of point markers.

A point marker is considered a 2D shape of fixed pixel size that is yet positioned in 3D space. Point markers are rendered as point-primitives and using the pointmarker material shader. That material shader produces the white edge around the markers.

Each instance of this class creates point markers of a preferred pixel size. It provides basically two methods for the creation of point markers. The first type takes no arguments and creates point markers from a predefined color palette and using the preferred pixel size. This method is a little faster in theory because it recycles materials once they have been instantiated for a particular color. The other methods take the color, the pixel size, or both as arguments and repeat the instantiation of a material every time they are used.

The following example creates a sequence of marker points in rotating colors:

helpers::PointMarkerHelper markers( GEOMETRY_TYPE_OPAQUE );
const float maxOffset = 300;
const unsigned int markersCount = 10;
for( unsigned int i = 0; i < markersCount; ++i )
{
const float x = -maxOffset + i * 2 * maxOffset / ( markersCount - 1 );
base::Geometry* const marker = markers.createPointMarker();
root->attachChild( marker );
}
Defines scene graph leafs. Instances of this class represent visible geometry that can be rendered....
Definition Geometry.h:60
math::Matrix4f localTransform
Defines the location, rotation and scale of this spatial in relation to it's parent....
Definition Spatial.h:132
Simplifies the creation and maintenance of point markers.
Matrix4f translation4f(float x, float y, float z)
Returns matrix that translates homogeneous coordinates.
Definition math.h:271
exemplary rendering from code above
Author
Leonid Kostrykin
Date
31.3.15

Definition at line 60 of file PointMarkerHelper.h.

Constructor & Destructor Documentation

◆ PointMarkerHelper()

Carna::helpers::PointMarkerHelper::PointMarkerHelper ( unsigned int  geometryType,
unsigned int  meshRole,
unsigned int  materialRole,
unsigned int  pointSize = DEFAULT_POINT_SIZE 
)
explicit

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Member Function Documentation

◆ createPointMarker()

base::Geometry * Carna::helpers::PointMarkerHelper::createPointMarker ( ) const

Creates new point marker of preferred pixel size, colored differently than the last point marker created by any PointMarkerHelper instance.

This method cycles through a predefined palette of colors. It recycles the materials instantiates once per color.

◆ releaseGeometryFeatures()

void Carna::helpers::PointMarkerHelper::releaseGeometryFeatures ( )

Releases all previously acquired materials. Invoke this method when it is sure that no further markers will be created.

Invoking this method and than instantiating markers will cause redundant base::Material instantiations.

Member Data Documentation

◆ DEFAULT_POINT_SIZE

const unsigned int Carna::helpers::PointMarkerHelper::DEFAULT_POINT_SIZE = 6
static

Holds the default point marker pixel size.

Definition at line 73 of file PointMarkerHelper.h.

◆ geometryType

const unsigned int Carna::helpers::PointMarkerHelper::geometryType

Holds the markers' geometry type.

Definition at line 95 of file PointMarkerHelper.h.

◆ materialRole

const unsigned int Carna::helpers::PointMarkerHelper::materialRole

Holds the role used to attach the material to the markers.

Definition at line 97 of file PointMarkerHelper.h.

◆ meshRole

const unsigned int Carna::helpers::PointMarkerHelper::meshRole

Holds the role used to attach the mesh to the markers.

Definition at line 96 of file PointMarkerHelper.h.

◆ pointSize

const unsigned int Carna::helpers::PointMarkerHelper::pointSize

Holds the preferred pixel size of the markers.

Definition at line 98 of file PointMarkerHelper.h.


The documentation for this class was generated from the following file: