ArcGIS Procedural Runtime
3.2.10650
|
#include <EncodePreparator.h>
Classes | |
class | FinalizedInstance |
struct | FinalizedInstanceBase |
class | PreparationFlags |
Public Types | |
typedef std::vector< FinalizedInstance > | InstanceVector |
enum | MeshProperties { ALL_MESH_FACES_CONVEX = 1 << 0, ALL_MESH_FACES_PLANAR = 1 << 1 } |
Public Member Functions | |
virtual void | add (prt::Cache *cache, const ShapePtr &shape, const prt::AttributeMap *initialShapeAttributes, const ReportsPtr &reports=ReportsPtr())=0 |
virtual void | add (prt::Cache *cache, const prtx::InitialShape &initialShape, size_t initialShapeIndex)=0 |
virtual void | clear ()=0 |
virtual void | fetchFinalizedInstances (InstanceVector &instances, const PreparationFlags &flags, prt::SimpleOutputCallbacks *cbForLogStats=nullptr)=0 |
virtual void | getBoundingBox (prtx::BoundingBox &bbox)=0 |
virtual uint64_t | getUsedMem (bool considerInstanceCounts=false) const =0 |
Static Public Member Functions | |
static EncodePreparatorPtr | create (bool enforceTextureConsistency, NamePreparator &namePreparator, const NamePreparator::NamespacePtr &nsMeshes, const NamePreparator::NamespacePtr &nsMaterials, const MaterialTransformer *materialTransformer=0) |
static uint32_t | getInitialShapePseudoShapeId (size_t initialShapeIndex) |
Static Public Attributes | |
static const prtx::DoubleVector | IDENTITY |
Protected Member Functions | |
EncodePreparator (const EncodePreparator &)=delete | |
EncodePreparator & | operator= (const EncodePreparator &)=delete |
Static Protected Member Functions | |
static FinalizedInstanceBase & | getBase (FinalizedInstance &instance) |
The EncodePreparator is the most important tool for encoder authors. It implements common geometry encoding tasks. Its main purpose is to gather prtx::Shape objects from the generated shape tree and create exportable groups of prtx::Geometry objects with associated prtx::Mesh, prtx::Material and prtx::Texture objects. It identifies identical geometry, material and texture instances and allows for their efficient sharing (e.g. to implement instancing).
The preparation process is triggered by calling fetchFinalizedInstances and can be controlled by setting the appropriate PreparationFlags.
A simple usage example looks like this:
Mesh property type.
Enumerator | |
---|---|
ALL_MESH_FACES_CONVEX | All faces of mesh are convex. |
ALL_MESH_FACES_PLANAR | All faces of mesh are planar. |
|
pure virtual |
Adds a shape to the preparator.
cache | A valid cache. It is used to determine if the shape geometry is re-used (instanced). |
shape | The shape to add. Typically a shape created by a ShapeIterator subclass. |
initialShapeAttributes | The attributes of the corresponding initial shape. |
reports | Optional reports to process for this shape. |
|
pure virtual |
Adds an initial shape to the preparator. This can be used to directly encode the geometry of an initial shape.
cache | A valid cache. It is used to determine if the shape geometry is re-used (instanced). |
initialShape | The initial shape to add. |
initialShapeIndex | The current index of the initial shape in the encode sequence. |
|
pure virtual |
Resets the preparator
|
static |
Factory member function to create an encode preparator instance. Typically, an encoder should keep one preparator instance during its life-time to perform multiple add and fetch operations.
[in] | enforceTextureConsistency | Matches the materials to the corresponding meshes. If true, any textures without corresponding texture coordinates in the mesh(es) will be deleted from the corresponding materials. |
[in] | namePreparator | See NamePreparator |
[in] | nsMeshes | The namespace for mesh names. |
[in] | nsMaterials | The namespace for material names. |
|
pure virtual |
Create geometry instances with corresponding transformations from the accumulated shapes and resets the preparator. Please note that a material and texture pool is kept during the whole lifetime of the preparator in order to detect identical materials and textures.
Any unused vertex attribute data (e.g. unused vertex coordinates) are removed from the meshes regardless of the preparator flags.
[out] | instances | Receives the instances. |
flags | Preparation flags to control the preparation process. | |
cbForLogStats | optional pointer to a prt::SimpleOutputCallbacks instance. If provided some option-dependent stats might be written to logStats(). |
|
pure virtual |
Returns the world-space bounding box of the accumulated geometry. Will be reset after calling fetchFinalizedInstances.
|
static |
When adding an initial shape the encode preparator assigns a pseudo shape id that is then available in the finalized instance. This function returns this pseudo shape id.
initialShapeIndex | The current index of the initial shape in question. |
|
pure virtual |
Returns an estimate of how much memory (in bytes) is consumed by the content added so far.