PathEngine home previous: Matching Edge Connectionsnext: 3D Content Processing
Contents, Programmers Guide, World Representation, 2D Content Processing, Managing Content Chunks

Managing Content Chunks

It is fairly common for content production to break down into an initial 'object construction' phase, where 'content chunks' (such as buildings, bridges and so on) are constructed in isolation, and a later 'world construction' phase, where these objects are then placed into the world.

PathEngine's content chunk functionality provides direct support for this kind of world building setup, in the form of iContentChunk objects.
These objects can be created during the object construction phase, saved to persistant storage, and then loaded back in and instanced during world construction.

The 'ContentChunks' example project provides a worked example of this functionality.

What can be represented by content chunks?

Content chunks will often represent something as simple as a single building with marked up building entrances, but are by no means limited to geometry of this form.
Content chunks may contain any amount of ground geometry, with no limit on the amount of portal markup, plus any number of anchors and pinned shapes.

The key constraint is that whenever the ground surfaces in a content chunk must connect to the external world when that chunk is placed (or to other content chunks), this needs to be specified in terms of the automated connection functionality (i.e. with either building entrance connections, or matching edge connections).

Creating content chunks

Content chunks include two components, a set of ground mesh elements and a set of anchors and pinned shapes.

When building a content chunk in the object construction phase, these elements are defined by the client application (which might be a plugin for the relevant content platform) by deriving from interfaces classes defined by PathEngine.

The ground elements of a content chunk are defined by a single object derived from iFaceVertexMesh.
This is the same interface as is used to drive the content processing in general, and has already been discussed here.

The anchor and shape elements of a content chunk are defined by a single object derived from iAnchorsAndPinnedShapes.
This encapsulates a set positions and placed shapes in the form of 'anchor' and 'pinned shape' content side representations.
(See Representing Positions on the Ground and Obstacle Placement.)

Once the relevant derived objects have been created, a content chunk can be created with iPathEngine::newContentChunk().

Saving and loading content chunks

Once a content chunk has been created during the object construction phase it can then be saved out with iContentChunk::save().
The content chunk can then be recreated at world construction time by passing the saved data into iPathEngine::loadContentChunk().

Pre-Validation

When working with very large worlds it's essential to make the content process as efficient as possible, and a key element of this is ensuring that data is validated as early as possible, with direct feedback to the relevant content creators.
To this end, PathEngine provides 'pre-validation' of content chunks when they are first created, during the object construction phase.

Because object placement information is usually only known at world construction time, the content chunk pre-validation is based on restricting the set of possible transforms to enable all possible transforms to be validated in advance.
Specifically, this means limiting object placement to a quantised set of rotations and permitting only integer scaling of the content chunk.
This restrictions have implications for the precision with which objects can be placed in the world, and on unit scale choices, so methods are supplied to support both restricted and unrestricted object placement.

If pre-validation is desired then iContentChunk::preValidate() should be called for content chunks at object construction time, and the chunks should then be placed with the restricted form of the placement methods.
Information about any pre-validation is saved out with the content chunk, and warnings issued by the restricted form placement methods whenever a chunk has not been correctly validated.

Instantiating content chunks

Content chunks can be instantiated (i.e. placed into the world), at world construction, time by calling either iContentChunk::instantiate() or iContentChunk::instantiate_FloatRotateAndScale() (depending on whether pre-validation is being used).
This generates an iContentChunkInstance, which can be queried for iFaceVertexMesh and iAnchorsAndPinnedShapes corresponding to the instanced geometry.


Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEnginenext: 3D Content Processing