Interface IMyStorage
ModAPI interface giving access to voxel functions
Namespace: VRage.ModAPI
Assembly: VRage.Game.dll
Syntax
public interface IMyStorage
Properties
Closed
Returns true if voxel storage was closed
Declaration
bool Closed { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
DeleteSupported
Returns if deletion is supported
Declaration
bool DeleteSupported { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
MarkedForClose
Returns true if the voxel storage is marked for a pending close
Declaration
bool MarkedForClose { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Size
The size of the voxel storage, in voxel coordinates
Declaration
Vector3I Size { get; }
Property Value
| Type | Description |
|---|---|
| Vector3I |
Methods
DeleteRange(MyStorageDataTypeFlags, Vector3I, Vector3I, Boolean)
Deletes content in cache and storage
Declaration
void DeleteRange(MyStorageDataTypeFlags dataToWrite, Vector3I voxelRangeMin, Vector3I voxelRangeMax, bool notify)
Parameters
| Type | Name | Description |
|---|---|---|
| MyStorageDataTypeFlags | dataToWrite | Content to delete |
| Vector3I | voxelRangeMin | From (Inclusive) |
| Vector3I | voxelRangeMax | To (Inclusive) |
| System.Boolean | notify | Notify that range changed |
ExecuteOperationFast<TVoxelOperator>(ref TVoxelOperator, MyStorageDataTypeFlags, ref Vector3I, ref Vector3I, Boolean)
Performs in-place voxel operation
Declaration
void ExecuteOperationFast<TVoxelOperator>(ref TVoxelOperator voxelOperator, MyStorageDataTypeFlags dataToWrite, ref Vector3I voxelRangeMin, ref Vector3I voxelRangeMax, bool notifyRangeChanged)
where TVoxelOperator : struct, IVoxelOperator, ValueType
Parameters
| Type | Name | Description |
|---|---|---|
| TVoxelOperator | voxelOperator | Function to be called over voxels |
| MyStorageDataTypeFlags | dataToWrite | Content to operate with |
| Vector3I | voxelRangeMin | From (Inclusive) |
| Vector3I | voxelRangeMax | To (Inclusive) |
| System.Boolean | notifyRangeChanged | Notify that range changed |
Type Parameters
| Name | Description |
|---|---|
| TVoxelOperator | Function to be called over voxels |
Intersect(ref BoundingBox, Boolean)
Returns the intersection with the storage region
Declaration
ContainmentType Intersect(ref BoundingBox box, bool lazy)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingBox | box | Position in local coordinates |
| System.Boolean | lazy | When true, you get less detailed results |
Returns
| Type | Description |
|---|---|
| ContainmentType | Containment type |
Intersect(ref LineD)
Returns true if the specific line intersects the storage region
Declaration
bool Intersect(ref LineD line)
Parameters
| Type | Name | Description |
|---|---|---|
| LineD | line | Line in local coordinates |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if line intersects |
NotifyRangeChanged(ref Vector3I, ref Vector3I, MyStorageDataTypeFlags)
Notify that range changed
Declaration
void NotifyRangeChanged(ref Vector3I voxelRangeMin, ref Vector3I voxelRangeMax, MyStorageDataTypeFlags dataChanged)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3I | voxelRangeMin | From (Inclusive) |
| Vector3I | voxelRangeMax | To (Inclusive) |
| MyStorageDataTypeFlags | dataChanged | Content that changed |
OverwriteAllMaterials(Byte)
Replaces all materials in range with the specific material
Declaration
void OverwriteAllMaterials(byte materialIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte | materialIndex |
PinAndExecute(Action)
Pins the voxel storage to prevent closing, then executes specified action. Unpins when action completes.
Declaration
void PinAndExecute(Action action)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Action | action | Action to execute |
PinAndExecute(Action<IMyStorage>)
Pins the voxel storage to prevent closing, then executes specified action. Unpins when action completes.
Declaration
void PinAndExecute(Action<IMyStorage> action)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Action<IMyStorage> | action | Action to execute |
ReadRange(MyStorageData, MyStorageDataTypeFlags, Int32, Vector3I, Vector3I)
Reads range of content and/or materials from specified LOD. If you want to write data back later, you must read LOD0 as that is the only writable one.
Declaration
void ReadRange(MyStorageData target, MyStorageDataTypeFlags dataToRead, int lodIndex, Vector3I lodVoxelRangeMin, Vector3I lodVoxelRangeMax)
Parameters
| Type | Name | Description |
|---|---|---|
| MyStorageData | target | Source from where to read data |
| MyStorageDataTypeFlags | dataToRead | Content to read |
| System.Int32 | lodIndex | Level of detail. 0 - most detailed |
| Vector3I | lodVoxelRangeMin | From (Inclusive) |
| Vector3I | lodVoxelRangeMax | To (Inclusive) |
ReadRange(MyStorageData, MyStorageDataTypeFlags, Int32, Vector3I, Vector3I, ref MyVoxelRequestFlags)
Reads range of content and/or materials from specified LOD. If you want to write data back later, you must read LOD0 as that is the only writable one.
Declaration
void ReadRange(MyStorageData target, MyStorageDataTypeFlags dataToRead, int lodIndex, Vector3I lodVoxelRangeMin, Vector3I lodVoxelRangeMax, ref MyVoxelRequestFlags requestFlags)
Parameters
| Type | Name | Description |
|---|---|---|
| MyStorageData | target | |
| MyStorageDataTypeFlags | dataToRead | |
| System.Int32 | lodIndex | |
| Vector3I | lodVoxelRangeMin | |
| Vector3I | lodVoxelRangeMax | |
| MyVoxelRequestFlags | requestFlags |
Reset(MyStorageDataTypeFlags)
Resets the data specified by flags to values from data provider, or default if no provider is assigned.
Declaration
void Reset(MyStorageDataTypeFlags dataToReset)
Parameters
| Type | Name | Description |
|---|---|---|
| MyStorageDataTypeFlags | dataToReset | Content that should be read from disk |
Save(out Byte[])
Gets compressed voxel data
Declaration
void Save(out byte[] outCompressedData)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | outCompressedData |
WriteRange(MyStorageData, MyStorageDataTypeFlags, Vector3I, Vector3I, Boolean, Boolean)
Writes range of content and/or materials from cache to storage. Note that this can only write to LOD0 (higher LODs must be computed based on that).
Declaration
void WriteRange(MyStorageData source, MyStorageDataTypeFlags dataToWrite, Vector3I voxelRangeMin, Vector3I voxelRangeMax, bool notify = true, bool skipCache = false)
Parameters
| Type | Name | Description |
|---|---|---|
| MyStorageData | source | |
| MyStorageDataTypeFlags | dataToWrite | |
| Vector3I | voxelRangeMin | From (Inclusive) |
| Vector3I | voxelRangeMax | To (Inclusive) |
| System.Boolean | notify | Notify that range changed |
| System.Boolean | skipCache | Skips cache |