SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | List of all members
smtk::geometry::GeometryForBackend< Format > Class Template Referenceabstract

A base class for objects which can provide renderable geometry in a specific format. More...

#include <GeometryForBackend.h>

Inheritance diagram for smtk::geometry::GeometryForBackend< Format >:
[legend]
Collaboration diagram for smtk::geometry::GeometryForBackend< Format >:
[legend]

Public Types

using DataType = Format
 
- Public Types inherited from smtk::geometry::Geometry
using GenerationNumber = size_t
 An integral type to hold monotonically increasing generation numbers (a.k.a. More...
 
using BoundingBox = std::array< double, 6 >
 A bounding box is represented as an array of 6 numbers, ordered xmin, xmax, ymin, ymax, zmin, zmax.
 
using Visitor = std::function< bool(const resource::PersistentObject::Ptr &, GenerationNumber)>
 The signature of functions used to visit all objects with tessellation data.
 
using Specification = std::tuple< smtk::resource::ResourcePtr, const smtk::geometry::Backend & >
 The data needed to request a geometry provider (a resource and backend). More...
 
using UniquePtr = std::unique_ptr< smtk::geometry::Geometry >
 The return type of the geometry-provider generator class. More...
 

Public Member Functions

 smtkTypeMacro (GeometryForBackend)
 
 smtkSuperclassMacro (Geometry)
 
virtual void update () const
 
virtual void geometricBounds (const Format &, BoundingBox &) const =0
 
virtual Format & data (const resource::PersistentObject::Ptr &) const =0
 Return the data associated with an object. More...
 
- Public Member Functions inherited from smtk::geometry::Geometry
 smtkTypeMacroBase (Geometry)
 
virtual const Backendbackend () const =0
 Every provider must indicate the backend for which it is specialized.
 
virtual ResourcePtr resource () const =0
 Every provider must indicate the resource it provides geometry for.
 
GenerationNumber lastModified () const
 Indication of when the geometry has last been updated. More...
 
virtual GenerationNumber generationNumber (const resource::PersistentObject::Ptr &) const =0
 Query methods. More...
 
virtual void bounds (const resource::PersistentObject::Ptr &, BoundingBox &bds) const =0
 Populate the bounds (bds) with the given object's bounds.
 
virtual bool readLockRequired () const
 Return true if the resource owning this geometryProvider must be read-locked before rendering prep. More...
 
virtual void visit (Visitor fn) const =0
 Visit each persistent object that has renderable geometry.
 
virtual void markModified (const resource::PersistentObject::Ptr &obj)=0
 Modfication methods. More...
 
virtual bool erase (const smtk::common::UUID &uid)=0
 Inform the geometry provider that an object is about to be or has been deleted. More...
 

Additional Inherited Members

- Static Public Attributes inherited from smtk::geometry::Geometry
static constexpr GenerationNumber Invalid = std::numeric_limits<GenerationNumber>::lowest()
 A special generation number that marks an object as having no geometric representation.
 
static constexpr GenerationNumber Initial = std::numeric_limits<GenerationNumber>::lowest() + 1
 The lowest valid generation number (which may be used as the initial value).
 
- Protected Attributes inherited from smtk::geometry::Geometry
std::atomic< GenerationNumberm_lastModified
 

Detailed Description

template<typename Format>
class smtk::geometry::GeometryForBackend< Format >

A base class for objects which can provide renderable geometry in a specific format.

All concrete geometry providers should inherit this class; it exists so that rendering backends can cast providers to a subclass that allows geometry to be fetched in a format they can handle.

The template parameter must be a type (struct, class, or primitive type) that meets the following requirements:

  1. The type must be castable to a boolean value that indicates whether the object is valid (true) or invalid (false).
  2. The type (Format) must have a default constructor that produces an invalid object.

Additionally, it is preferable (but not required) for the template parameter type to be move-constructible.

Member Function Documentation

◆ data()

template<typename Format >
virtual Format& smtk::geometry::GeometryForBackend< Format >::data ( const resource::PersistentObject::Ptr &  ) const
pure virtual

Return the data associated with an object.

Only call this method after ensuring that generationNumber(obj) != Invalid.


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