Workspace 6.21.5
Public Types | Public Member Functions | Static Public Attributes | List of all members
Hdf5SceneSerializer Class Reference

Helper class for writing SceneItem data to the Workspace Hdf5 format. More...

#include <HDF5/hdf5sceneserializer.h>

Inheritance diagram for Hdf5SceneSerializer:
[legend]

Public Types

typedef Mesh::MeshModelInterface::int_type int_type
 
using MeshSourceMap = QMap< QString, Mesh::MeshModelSource * >
 
typedef QList< Rendering::SceneItem * > SceneItemList
 
typedef Mesh::MeshModelInterface::size_type size_type
 
typedef QMap< QString, const DataExecution::DataFactory * > StateTypeMap
 

Public Member Functions

 Hdf5SceneSerializer (hid_t &file)
 
bool readTransformHierarchy (Rendering::Transform &transform, SceneItemList &newSceneItems, MeshSourceMap &meshSources, Rendering::Shader &shader, const QString &subtreePath=QString(), const QString &modelIdPrefix=QString()) const
 
bool readVersion (size_type &version) const
 
bool writeMeshInstance (const QString &meshId, const QString &instanceId, const QString &transformPath=QString())
 
bool writeTransform (const QString &transformId, const Mesh::TransformMatrix &matrix, const QString &transformPath=QString())
 
bool writeVersion ()
 
- Public Member Functions inherited from BasicTextLogger
 BasicTextLogger ()
 
virtual ~BasicTextLogger ()
 
void logLine (const Application::LogManager::MessageCategory &category, const QString &msg) const
 
void logLine (const QString &msg) const
 
void logText (const Application::LogManager::MessageCategory &category, const QString &msg) const
 
void logText (const QString &msg) const
 

Static Public Attributes

static const hid_t LONG_STRING_DATATYPE = H5Tcopy(H5T_C_S1)
 
static const int LONG_STRING_DATATYPE_LENGTH = 255
 
static const size_t MAX_NAME_LENGTH = 1024
 

Detailed Description

See also
CSIRO::Mesh::Hdf5MeshSerializer

The format is capable of storing an entire scene hierarchy, each MeshModelInstance referencing a mesh (each with potentially multiple LODs) in the same file.

Workspace Hdf5 Scene v1 Format (stored in HDF5)

g: root/ a: format_version (int) g: meshes/ (see Hdf5MeshSerializer) ... g: instances/ g: transform_id g: instance_id a: referenced_mesh_id (long string)

Member Typedef Documentation

◆ int_type

◆ MeshSourceMap

using MeshSourceMap = QMap<QString, Mesh::MeshModelSource*>

◆ SceneItemList

◆ size_type

◆ StateTypeMap

typedef QMap<QString, const DataExecution::DataFactory*> StateTypeMap

Constructor & Destructor Documentation

◆ Hdf5SceneSerializer()

Hdf5SceneSerializer ( hid_t &  file)
Parameters
fileThe HDF5 file to which we are reading / writing scene hierarchy data.

Member Function Documentation

◆ readTransformHierarchy()

bool readTransformHierarchy ( Rendering::Transform transform,
SceneItemList newSceneItems,
MeshSourceMap meshSources,
Rendering::Shader shader,
const QString &  subtreePath = QString(),
const QString &  modelIdPrefix = QString() 
) const
Parameters
transform(out) Root transform into which all SceneItems will be added as children. Note that the transform will not "own" the newly created SceneItems, as these will be stored in the newSceneItems list.
newSceneItems(out) SceneItemList into which to store all newly created SceneItems that are loaded from file. It is the responsibility of calling code to delete these when they are no longer needed.
meshSources(out) MeshSourceMap into which newly created MeshModelSources are stored as meshes are read from the file. It is the responsibility of calling code to delete these when they are no longer needed.
shaderThe shader to attach to each newly created MeshModelInstance object.
subtreePathAbsolute path to the subtree in the "instances" section of the HDF5 file that we with to read. Callers will generally leave this as the empty string.
modelIdPrefixThe prefix of the modelId
Returns
true if the transform hierarchy was able to be read from file successfully; false if some HDF5 error occurs, such as the file not existing or being invalid.

◆ readVersion()

bool readVersion ( size_type version) const
Parameters
version(out) Variable into which the version will be written upon successful read.
Returns
true if the version info could be read, false if a HDF5 error occurs.

◆ writeMeshInstance()

bool writeMeshInstance ( const QString &  meshId,
const QString &  instanceId,
const QString &  transformPath = QString() 
)
Parameters
meshIdThe ID of the mesh data that this instance refers to. This should refer to a group path under the "meshes" section of the HDF5 file.
instanceIdThe unique identifier of this MeshModelInstance.
transformPathThe absolute path to this instance in the scene hierarchy in the HDF5 file.
Returns

◆ writeTransform()

bool writeTransform ( const QString &  transformId,
const Mesh::TransformMatrix matrix,
const QString &  transformPath = QString() 
)
Parameters
transformIdThe unique identifier of the transform being written.
matrixThe 4x4 transform matrix.
transformPathThe path to the transform in the file. For example, the empty string would be at the root, while a specific path would point to its location in the tree.
Returns
true if the transform is able to be written, false if a HDF5 error occurs.

◆ writeVersion()

bool writeVersion ( )
Returns
true if the version number was written successfully, false otherwise.

Member Data Documentation

◆ LONG_STRING_DATATYPE

const hid_t LONG_STRING_DATATYPE = H5Tcopy(H5T_C_S1)
static

Long string datatype used to store mesh references. We don't use HDF5 links because we don't need to jump to the data using the HDF5 API: rather we use our Hdf5MeshModelInstance instead.

◆ LONG_STRING_DATATYPE_LENGTH

const int LONG_STRING_DATATYPE_LENGTH = 255
static

Long string datatype length

◆ MAX_NAME_LENGTH

const size_t MAX_NAME_LENGTH = 1024
static

Maximum name length