Cubiquity for Unity3D
 All Classes Namespaces Functions Variables Enumerator Properties Events Pages
VolumeData Class Reference

Base class representing the actual 3D grid of voxel values. More...

Inheritance diagram for VolumeData:
ColoredCubesVolumeData TerrainVolumeData

Detailed Description

This class primarily serves as a light-weight wrapper around the voxel databases which are used by the Cubiquity engine, allowing them to be treated as Unity3D assets. The voxel databases themselves are typically stored in the 'Streaming Assets' or 'Temporary Cache' folder (depending on the usage scenario), with the actual path being specified by the 'fullPathToVoxelDatabase' property. The VolumeData and it's subclasses then forward requests such as finding the dimensions of the voxel data or getting/setting the values of the individual voxels.

An instance of VolumeData can be created from an existing voxel database, or it can create an empty voxel database on demand. The class also abstracts the properties and functionality which are common to all types of volume data regardless of the type of the underlying voxel. Note that users should not interact with the VolumeData directly but should instead work with one of the derived classes.

See Also
TerrainVolumeData, ColoredCubesVolumeData

Static Public Member Functions

static VolumeDataType CreateFromVoxelDatabase< VolumeDataType > (string relativePathToVoxelDatabase)
 
static VolumeDataType CreateEmptyVolumeData< VolumeDataType > (Region region)
 
static VolumeDataType CreateEmptyVolumeData< VolumeDataType > (Region region, string relativePathToVoxelDatabase)
 

Properties

Region enclosingRegion [get]
 Gets the dimensions of the VolumeData. More...
 
string fullPathToVoxelDatabase [get]
 Gets the full path to the voxel database which backs this instance. More...
 

Member Function Documentation

static VolumeDataType VolumeData.CreateEmptyVolumeData< VolumeDataType > ( Region  region)
static

This function will normally be used if you want to create volume data at runtime. Because no filename is provided the voxel database will be a temporary file and will be deleted when the volume data is destroyed. If you wish to create a persistant volume data then you should use the other version of this function.

Note that it therefore does not make sense to serialize instances of VolumeData created with this version of the function. The 'hideFlags' property is automatically set to 'HideFlags.DontSave' to prevent you from doing this.

Parameters
regionA Region instance specifying the dimensions of the volume data. You should not later try to access voxels outside of this range.
Type Constraints
VolumeDataType :VolumeData 
static VolumeDataType VolumeData.CreateEmptyVolumeData< VolumeDataType > ( Region  region,
string  relativePathToVoxelDatabase 
)
static

This version of the function accepts a filename which will be given to the voxel database which is created. The path is relative to Paths.voxelDatabases and the voxel database will not be deleted when the volume data is destroyed, so you have the option to reuse it later. Note that you should only use this function from edit mode, as otherwise the streaming assets folder might not be writable (particularly standalone builds).

Parameters
regionA Region instance specifying the dimensions of the volume data. You should not later try to access voxels outside of this range.
relativePathToVoxelDatabaseThe path where the voxel database should be created, repative to the location given by Paths.voxelDatabases.
Type Constraints
VolumeDataType :VolumeData 
static VolumeDataType VolumeData.CreateFromVoxelDatabase< VolumeDataType > ( string  relativePathToVoxelDatabase)
static

It is possible for Cubiquity voxel databse files to be created outside of the Cubiquity for Unity3D ecosystem (see the user manual if you are not clear on the difference between 'Cubiquity and 'Cubiquity for Unity3D'). For example, the Cubiquity SDK contains importers for converting a variety of external file formats into voxel databases. This function provides a way for you to create volume data which is linked to such a user provided voxel database.

Parameters
relativePathToVoxelDatabaseThe path to the .vdb files which should be relative to the location given by Paths.voxelDatabases.
Type Constraints
VolumeDataType :VolumeData 

Property Documentation

Region VolumeData.enclosingRegion
get

Cubiquity voxel databases (and by extension the VolumeData) have a fixed size which is specified on creation. You should not attempt to access and location outside of this range.

Returns
The dimensions of the volume. The values are inclusive, so you can safely access the voxel at the positions given by Region.lowerCorner and Region.upperCorner.
string VolumeData.fullPathToVoxelDatabase
get

The full path to the voxel database is derived from the relative path which you can optionally specify at creation time, and the base path which depends on the way the instance was created. See CreateEmptyVolumeData<VolumeDataType>() and CreateFromVoxelDatabase<VolumeDataType>() for more information about how the base path is chosen.

This property is provided mostly for informational and debugging purposes as you are unlikely to directly make use of it.

Returns
The full path to the voxel database

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