SoLDMDataAccessGetData Method (Int32, SbVec3i32) |
Returns a reference to the block of data (LDM tile) which contains the voxel at dataPosition.
Namespace: OIV.LDM
The resolution is the power of 2 of the desired subsampling level (0:1/1, 1:1/2, 2:1/4, ...). In most cases you will pass 0 to request full resolution data.
The data is not copied. The reference is valid until OIV.LDM.SoLDMDataAccess.ReleaseData(OIV.LDM.SoLDMTileID) is called with the corresponding tile id or until the associated volumeData node is destroyed.
The LDM tile is locked in CPU memory until OIV.LDM.SoLDMDataAccess.ReleaseData(OIV.LDM.SoLDMTileID) is called. The application may lock multiple tiles in memory using this method. However these locked tiles count against the maximum CPU memory allowed for the volume. Locking too many tiles may reduce the rendered image quality because LDM does not have enough memory to load other tiles. A released tile will remain in memory (allowing quick re-access) for some period of time, depending on whether it is needed for rendering and (if not) on the value of OIV.LDM.Nodes.SoLDMResourceParameters.tileHalfLife.
This method is a good solution when the application needs to get the values of multiple voxels that are not part of a line, plane or box. After locking a tile, for each subsequent voxel, check if the voxel position is contained in the currently locked tile. You can use the intersect() method on the OIV.Inventor.SbBox3i32 tilePosition member of the OIV.LDM.SoLDMDataAccess.DataInfo struct for this test. If the voxel is in the current tile, compute the offset into the data buffer and get its value. If not, release the current tile (using OIV.LDM.SoLDMDataAccess.ReleaseData(OIV.LDM.SoLDMTileID)) and get the appropriate tile by calling OIV.LDM.SoLDMDataAccess.GetData(System.Int32, OIV.Inventor.SbBox3i32, OIV.Inventor.Devices.SoBufferObject) again.