Public Types | |
enum | VisualizerGeometryType { GEOMETRY_TYPE_RECTANGLE = 1 , GEOMETRY_TYPE_TRIANGLE = 2 , GEOMETRY_TYPE_POINT = 3 , GEOMETRY_TYPE_LINE = 4 } |
Enum representing different types of visualizer geometry. More... | |
Public Member Functions | |
GeometryHandler () | |
Constructor for the GeometryHandler class. | |
void | allocateBufferSize (size_t primitive_count, VisualizerGeometryType geometry_type) |
Pre-allocate space in geometry buffers for known number of patches and triangles. | |
void | addGeometry (size_t UUID, const VisualizerGeometryType &geometry_type, const std::vector< helios::vec3 > &vertices, const helios::RGBAcolor &color, const std::vector< helios::vec2 > &uvs, int textureID, bool override_texture_color, bool has_glyph_texture, uint coordinate_system, bool visible_flag, bool iscontextgeometry, int size=0) |
Adds a geometric element to the geometry handler using provided vertices, color, UV mapping, and texture details. | |
void | markDirty (size_t UUID) |
Mark a geometry primitive as modified. | |
const std::unordered_set< size_t > & | getDirtyUUIDs () const |
Retrieve the set of modified primitives. | |
void | clearDirtyUUIDs () |
Clear the list of modified primitives. | |
bool | doesGeometryExist (size_t UUID) const |
std::vector< size_t > | getAllGeometryIDs () const |
size_t | getPrimitiveCount (bool include_deleted=true) const |
size_t | getRectangleCount (bool include_deleted=true) const |
Retrieves the count of rectangles in the geometry handler. | |
size_t | getTriangleCount (bool include_deleted=true) const |
Retrieves the number of triangles in the geometry. | |
size_t | getPointCount (bool include_deleted=true) const |
Retrieves the count of points in the geometry. | |
size_t | getLineCount (bool include_deleted=true) const |
Retrieves the count of line geometries. | |
const std::vector< int > * | getFaceIndexData_ptr (VisualizerGeometryType geometry_type) const |
Retrieves a pointer to the face index data. | |
void | setVertices (size_t UUID, const std::vector< helios::vec3 > &vertices) |
Sets the vertices for a geometry element identified by a unique UUID. | |
std::vector< helios::vec3 > | getVertices (size_t UUID) const |
Retrieves the vertices associated with the geometry of a given UUID. | |
const std::vector< float > * | getVertexData_ptr (VisualizerGeometryType geometry_type) const |
Retrieves a pointer to the vertex data. | |
helios::vec3 | getNormal (size_t UUID) const |
Retrieves the normal vector associated with the geometry of a given UUID. | |
const std::vector< float > * | getNormalData_ptr (VisualizerGeometryType geometry_type) const |
Retrieves a pointer to the normal data. | |
void | setColor (size_t UUID, const helios::RGBAcolor &color) |
Sets the color for the geometry identified by a specific UUID. | |
helios::RGBAcolor | getColor (size_t UUID) const |
Retrieves the color associated with a specific UUID. | |
const std::vector< float > * | getColorData_ptr (VisualizerGeometryType geometry_type) const |
Retrieves a pointer to the color data. | |
void | setUVs (size_t UUID, const std::vector< helios::vec2 > &uvs) |
Assigns UV coordinates to the specified geometry by UUID. | |
std::vector< helios::vec2 > | getUVs (size_t UUID) const |
Retrieves the UV coordinates associated with a specific geometry UUID. | |
const std::vector< float > * | getUVData_ptr (VisualizerGeometryType geometry_type) const |
Retrieves a pointer to the UV data. | |
void | setTextureID (size_t UUID, int textureID) |
Sets the texture ID for the given geometry identified by its UUID. | |
int | getTextureID (size_t UUID) const |
Retrieves the texture ID associated with the given UUID. | |
const std::vector< int > * | getTextureIDData_ptr (VisualizerGeometryType geometry_type) const |
Retrieves a pointer to the texture ID data. | |
void | overrideTextureColor (size_t UUID) |
Overrides the texture color attribute for a given geometry primitive. | |
void | useTextureColor (size_t UUID) |
Enables texture color usage for the specified geometry. | |
const std::vector< int > * | getTextureFlagData_ptr (VisualizerGeometryType geometry_type) const |
Retrieves a pointer to the texture flag data. | |
void | setVisibility (size_t UUID, bool isvisible) |
Sets the visibility state for a given geometry component. | |
bool | isPrimitiveVisible (size_t UUID) const |
Checks if a primitive with the given UUID is visible. | |
const std::vector< char > * | getVisibilityFlagData_ptr (VisualizerGeometryType geometry_type) const |
Retrieves a pointer to the vector containing visibility flag data. | |
const std::vector< int > * | getCoordinateFlagData_ptr (VisualizerGeometryType geometry_type) const |
Retrieves a pointer to the coordinate flag data associated with the specified geometry type. | |
void | setSize (size_t UUID, float size) |
Sets the size for a geometry element identified by its UUID. | |
float | getSize (size_t UUID) const |
Retrieves the size value associated with a specific UUID. | |
const std::vector< float > * | getSizeData_ptr (VisualizerGeometryType geometry_type) const |
Retrieves a pointer to the size data associated with the specified geometry type. | |
bool | getDeleteFlag (size_t UUID) const |
void | deleteGeometry (size_t UUID) |
Marks a geometry resource identified by its unique UUID for deletion. | |
void | deleteGeometry (const std::vector< size_t > &UUIDs) |
Marks a geometry resource identified by its unique UUID for deletion. | |
void | clearAllGeometry () |
Clears all geometry data managed by the GeometryHandler. | |
void | clearContextGeometry () |
Clears context-specific geometry data. | |
void | getDomainBoundingBox (helios::vec2 &xbounds, helios::vec2 &ybounds, helios::vec2 &zbounds) const |
Computes the axis-aligned bounding box for the geometry domain. | |
void | getDomainBoundingSphere (helios::vec3 ¢er, helios::vec3 &radius) const |
Computes the bounding sphere of the domain. | |
size_t | sampleUUID () |
Generates and returns a random unique identifier value as a size_t. | |
const PrimitiveIndexMap & | getIndexMap (size_t UUID) const |
Retrieve internal buffer indices for a primitive. | |
Static Public Member Functions | |
static char | getVertexCount (const VisualizerGeometryType &geometry_type) |
Returns the vertex count for a given geometry type. | |
Static Public Attributes | |
static constexpr std::array< VisualizerGeometryType, 4 > | all_geometry_types = {GEOMETRY_TYPE_RECTANGLE, GEOMETRY_TYPE_TRIANGLE, GEOMETRY_TYPE_POINT, GEOMETRY_TYPE_LINE} |
Definition at line 22 of file GeometryHandler.h.
Enum representing different types of visualizer geometry.
This enumeration is used to define the geometry types that can be handled by the visualizer.
Definition at line 32 of file GeometryHandler.h.
|
inline |
Constructor for the GeometryHandler class.
Definition at line 35 of file GeometryHandler.h.
void GeometryHandler::addGeometry | ( | size_t | UUID, |
const VisualizerGeometryType & | geometry_type, | ||
const std::vector< helios::vec3 > & | vertices, | ||
const helios::RGBAcolor & | color, | ||
const std::vector< helios::vec2 > & | uvs, | ||
int | textureID, | ||
bool | override_texture_color, | ||
bool | has_glyph_texture, | ||
uint | coordinate_system, | ||
bool | visible_flag, | ||
bool | iscontextgeometry, | ||
int | size = 0 |
||
) |
Adds a geometric element to the geometry handler using provided vertices, color, UV mapping, and texture details.
There are three different ways to call this method based on how the geometry should be colored:
There are four different geometric types that can be added:
[in] | UUID | Unique identifier for the triangle. |
[in] | geometry_type | |
[in] | vertices | 3D vertex positions of the geometry, provided as a vector of vec3's. |
[in] | color | RGBA color to apply to the geometry. |
[in] | uvs | UV texture coordinates for the geometry, provided as a vector of vec2's. |
[in] | textureID | Identifier for the texture to use. |
[in] | override_texture_color | Boolean flag indicating whether to override the texture with the color provided. |
has_glyph_texture | ||
[in] | coordinate_system | Coordinate system to be used when specifying spatial coordinates. Should be one of "Visualizer::COORDINATES_WINDOW_NORMALIZED" or "Visualizer::COORDINATES_CARTESIAN". |
[in] | visible_flag | Boolean flag to determine if the geometry is initially visible. |
[in] | iscontextgeometry | True if geometry is from the Context, false if geometry is added manually through the visualizer |
[in] | size | [optional] Size of the point or line in pixel units. This is ignored for GEOMETRY_TYPE_PATCH and GEOMETRY_TYPE_TRIANGLE. |
Definition at line 35 of file GeometryHandler.cpp.
void GeometryHandler::allocateBufferSize | ( | size_t | primitive_count, |
VisualizerGeometryType | geometry_type | ||
) |
Pre-allocate space in geometry buffers for known number of patches and triangles.
This calls the std::vector::reserve() method to pre-allocate space in the geometry buffers for the specified number of patches and triangles.
[in] | primitive_count | Number of patches to allocate space for |
geometry_type |
Definition at line 18 of file GeometryHandler.cpp.
void GeometryHandler::clearAllGeometry | ( | ) |
Clears all geometry data managed by the GeometryHandler.
Resets all associated data structures for geometry types and resets counters for deleted primitives.
Definition at line 669 of file GeometryHandler.cpp.
void GeometryHandler::clearContextGeometry | ( | ) |
Clears context-specific geometry data.
Marks context-associated geometry data for deletion based on predefined flags and defragments the buffers.
Definition at line 695 of file GeometryHandler.cpp.
void GeometryHandler::clearDirtyUUIDs | ( | ) |
Clear the list of modified primitives.
Definition at line 949 of file GeometryHandler.cpp.
void GeometryHandler::deleteGeometry | ( | const std::vector< size_t > & | UUIDs | ) |
Marks a geometry resource identified by its unique UUID for deletion.
[in] | UUIDs | Vector of identifiers of the geometry resource to delete. |
Definition at line 663 of file GeometryHandler.cpp.
void GeometryHandler::deleteGeometry | ( | size_t | UUID | ) |
Marks a geometry resource identified by its unique UUID for deletion.
[in] | UUID | Identifier of the geometry resource to delete. |
Definition at line 643 of file GeometryHandler.cpp.
bool GeometryHandler::doesGeometryExist | ( | size_t | UUID | ) | const |
Definition at line 192 of file GeometryHandler.cpp.
std::vector< size_t > GeometryHandler::getAllGeometryIDs | ( | ) | const |
Definition at line 196 of file GeometryHandler.cpp.
helios::RGBAcolor GeometryHandler::getColor | ( | size_t | UUID | ) | const |
Retrieves the color associated with a specific UUID.
[in] | UUID | Unique identifier of the geometry whose color is to be retrieved. |
Definition at line 379 of file GeometryHandler.cpp.
const std::vector< float > * GeometryHandler::getColorData_ptr | ( | VisualizerGeometryType | geometry_type | ) | const |
Retrieves a pointer to the color data.
[in] | geometry_type | The type of visualizer geometry for which the color data is requested. |
Definition at line 395 of file GeometryHandler.cpp.
const std::vector< int > * GeometryHandler::getCoordinateFlagData_ptr | ( | VisualizerGeometryType | geometry_type | ) | const |
Retrieves a pointer to the coordinate flag data associated with the specified geometry type.
[in] | geometry_type | The type of visualizer geometry for which the coordinate flag data is requested. |
Definition at line 589 of file GeometryHandler.cpp.
bool GeometryHandler::getDeleteFlag | ( | size_t | UUID | ) | const |
Definition at line 631 of file GeometryHandler.cpp.
const std::unordered_set< size_t > & GeometryHandler::getDirtyUUIDs | ( | ) | const |
Retrieve the set of modified primitives.
Definition at line 945 of file GeometryHandler.cpp.
void GeometryHandler::getDomainBoundingBox | ( | helios::vec2 & | xbounds, |
helios::vec2 & | ybounds, | ||
helios::vec2 & | zbounds | ||
) | const |
Computes the axis-aligned bounding box for the geometry domain.
[out] | xbounds | Outputs the minimum and maximum x-coordinates in the domain. |
[out] | ybounds | Outputs the minimum and maximum y-coordinates in the domain. |
[out] | zbounds | Outputs the minimum and maximum z-coordinates in the domain. |
Definition at line 715 of file GeometryHandler.cpp.
void GeometryHandler::getDomainBoundingSphere | ( | helios::vec3 & | center, |
helios::vec3 & | radius | ||
) | const |
Computes the bounding sphere of the domain.
[out] | center | The computed center of the bounding sphere. |
[out] | radius | The computed radius of the bounding sphere. |
Definition at line 755 of file GeometryHandler.cpp.
const std::vector< int > * GeometryHandler::getFaceIndexData_ptr | ( | VisualizerGeometryType | geometry_type | ) | const |
Retrieves a pointer to the face index data.
[in] | geometry_type | The type of visualizer geometry for which the face index data is requested. |
Definition at line 264 of file GeometryHandler.cpp.
const GeometryHandler::PrimitiveIndexMap & GeometryHandler::getIndexMap | ( | size_t | UUID | ) | const |
Retrieve internal buffer indices for a primitive.
Definition at line 774 of file GeometryHandler.cpp.
size_t GeometryHandler::getLineCount | ( | bool | include_deleted = true | ) | const |
Retrieves the count of line geometries.
[in] | include_deleted | [optional] If true, includes geometries marked as deleted in the count. Defaults to false. |
Definition at line 254 of file GeometryHandler.cpp.
helios::vec3 GeometryHandler::getNormal | ( | size_t | UUID | ) | const |
Retrieves the normal vector associated with the geometry of a given UUID.
[in] | UUID | Unique identifier representing the geometry whose normal needs to be fetched. |
Definition at line 335 of file GeometryHandler.cpp.
const std::vector< float > * GeometryHandler::getNormalData_ptr | ( | VisualizerGeometryType | geometry_type | ) | const |
Retrieves a pointer to the normal data.
[in] | geometry_type | The type of visualizer geometry for which the normal data is requested. |
Definition at line 354 of file GeometryHandler.cpp.
size_t GeometryHandler::getPointCount | ( | bool | include_deleted = true | ) | const |
Retrieves the count of points in the geometry.
[in] | include_deleted | [optional] If true, includes points marked as deleted in the count. Otherwise, only non-deleted points are counted. |
Definition at line 244 of file GeometryHandler.cpp.
size_t GeometryHandler::getPrimitiveCount | ( | bool | include_deleted = true | ) | const |
Definition at line 209 of file GeometryHandler.cpp.
size_t GeometryHandler::getRectangleCount | ( | bool | include_deleted = true | ) | const |
Retrieves the count of rectangles in the geometry handler.
[in] | include_deleted | [optional] If true, includes rectangles marked as deleted in the count. |
Definition at line 224 of file GeometryHandler.cpp.
float GeometryHandler::getSize | ( | size_t | UUID | ) | const |
Retrieves the size value associated with a specific UUID.
[in] | UUID | Unique identifier of the geometry whose size is to be retrieved. |
Definition at line 611 of file GeometryHandler.cpp.
const std::vector< float > * GeometryHandler::getSizeData_ptr | ( | VisualizerGeometryType | geometry_type | ) | const |
Retrieves a pointer to the size data associated with the specified geometry type.
[in] | geometry_type | The type of visualizer geometry for which the size data is requested. |
Definition at line 624 of file GeometryHandler.cpp.
const std::vector< int > * GeometryHandler::getTextureFlagData_ptr | ( | VisualizerGeometryType | geometry_type | ) | const |
Retrieves a pointer to the texture flag data.
[in] | geometry_type | The type of visualizer geometry for which the texture flag data is requested. |
Definition at line 547 of file GeometryHandler.cpp.
int GeometryHandler::getTextureID | ( | size_t | UUID | ) | const |
Retrieves the texture ID associated with the given UUID.
[in] | UUID | Unique identifier for the geometry object. |
Definition at line 482 of file GeometryHandler.cpp.
const std::vector< int > * GeometryHandler::getTextureIDData_ptr | ( | VisualizerGeometryType | geometry_type | ) | const |
Retrieves a pointer to the texture ID data.
[in] | geometry_type | The type of visualizer geometry for which the texture ID data is requested. |
Definition at line 495 of file GeometryHandler.cpp.
size_t GeometryHandler::getTriangleCount | ( | bool | include_deleted = true | ) | const |
Retrieves the number of triangles in the geometry.
[in] | include_deleted | [optional] If true, includes triangles marked as deleted in the count. |
Definition at line 234 of file GeometryHandler.cpp.
const std::vector< float > * GeometryHandler::getUVData_ptr | ( | VisualizerGeometryType | geometry_type | ) | const |
Retrieves a pointer to the UV data.
[in] | geometry_type | The type of visualizer geometry for which the UV data is requested. |
Definition at line 455 of file GeometryHandler.cpp.
std::vector< helios::vec2 > GeometryHandler::getUVs | ( | size_t | UUID | ) | const |
Retrieves the UV coordinates associated with a specific geometry UUID.
[in] | UUID | A unique identifier representing the geometry whose UV coordinates are to be fetched. |
Definition at line 433 of file GeometryHandler.cpp.
|
static |
Returns the vertex count for a given geometry type.
[in] | geometry_type | The type of visualizer geometry for which the vertex count is required. |
Definition at line 924 of file GeometryHandler.cpp.
const std::vector< float > * GeometryHandler::getVertexData_ptr | ( | VisualizerGeometryType | geometry_type | ) | const |
Retrieves a pointer to the vertex data.
[in] | geometry_type | The type of visualizer geometry for which the vertex data is requested. |
Definition at line 328 of file GeometryHandler.cpp.
std::vector< helios::vec3 > GeometryHandler::getVertices | ( | size_t | UUID | ) | const |
Retrieves the vertices associated with the geometry of a given UUID.
[in] | UUID | Unique identifier representing the geometry whose vertices need to be fetched. |
Definition at line 305 of file GeometryHandler.cpp.
const std::vector< char > * GeometryHandler::getVisibilityFlagData_ptr | ( | VisualizerGeometryType | geometry_type | ) | const |
Retrieves a pointer to the vector containing visibility flag data.
[in] | geometry_type | The type of visualizer geometry for which the visibility flag data is requested. |
Definition at line 582 of file GeometryHandler.cpp.
bool GeometryHandler::isPrimitiveVisible | ( | size_t | UUID | ) | const |
Checks if a primitive with the given UUID is visible.
[in] | UUID | The unique identifier of the primitive to check. |
Definition at line 569 of file GeometryHandler.cpp.
void GeometryHandler::markDirty | ( | size_t | UUID | ) |
Mark a geometry primitive as modified.
Definition at line 941 of file GeometryHandler.cpp.
void GeometryHandler::overrideTextureColor | ( | size_t | UUID | ) |
Overrides the texture color attribute for a given geometry primitive.
[in] | UUID | The unique identifier for the geometry primitive. |
Definition at line 502 of file GeometryHandler.cpp.
size_t GeometryHandler::sampleUUID | ( | ) |
Generates and returns a random unique identifier value as a size_t.
Definition at line 765 of file GeometryHandler.cpp.
void GeometryHandler::setColor | ( | size_t | UUID, |
const helios::RGBAcolor & | color | ||
) |
Sets the color for the geometry identified by a specific UUID.
[in] | UUID | The unique identifier of the geometry to modify. |
[in] | color | The RGBA color to set for the specified geometry. |
Definition at line 361 of file GeometryHandler.cpp.
void GeometryHandler::setSize | ( | size_t | UUID, |
float | size | ||
) |
Sets the size for a geometry element identified by its UUID.
[in] | UUID | The unique identifier of the geometry element. |
[in] | size | The size value to set for the geometry element. |
Definition at line 596 of file GeometryHandler.cpp.
void GeometryHandler::setTextureID | ( | size_t | UUID, |
int | textureID | ||
) |
Sets the texture ID for the given geometry identified by its UUID.
[in] | UUID | Unique identifier of the geometry. |
[in] | textureID | Texture identifier to associate with the specified geometry. |
Definition at line 462 of file GeometryHandler.cpp.
void GeometryHandler::setUVs | ( | size_t | UUID, |
const std::vector< helios::vec2 > & | uvs | ||
) |
Assigns UV coordinates to the specified geometry by UUID.
[in] | UUID | A unique identifier for the geometry to which UV coordinates are being assigned. |
[in] | uvs | A collection of UV coordinates to set for the specified geometry. The size of this vector must match the vertex count of the geometry. |
Definition at line 402 of file GeometryHandler.cpp.
void GeometryHandler::setVertices | ( | size_t | UUID, |
const std::vector< helios::vec3 > & | vertices | ||
) |
Sets the vertices for a geometry element identified by a unique UUID.
Updates the geometry buffer with the specified 3D vertex positions. The number of vertices in the provided vector must correspond to the expected vertex count based on the geometry type associated with the given UUID.
[in] | UUID | Unique identifier for the geometry element to update. |
[in] | vertices | 3D vertex positions to set, provided as a vector of helios::vec3. |
Definition at line 271 of file GeometryHandler.cpp.
void GeometryHandler::setVisibility | ( | size_t | UUID, |
bool | isvisible | ||
) |
Sets the visibility state for a given geometry component.
[in] | UUID | The unique identifier of the geometry component. |
[in] | isvisible | The visibility state to set (true for visible, false for hidden). |
Definition at line 554 of file GeometryHandler.cpp.
void GeometryHandler::useTextureColor | ( | size_t | UUID | ) |
Enables texture color usage for the specified geometry.
[in] | UUID | Unique identifier associated with the geometry for which texture color will be enabled. |
Definition at line 526 of file GeometryHandler.cpp.
|
staticconstexpr |
Definition at line 412 of file GeometryHandler.h.