Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SoVRLdmFileBorderReader.h
1/*=======================================================================
2** VSG_COPYRIGHT_TAG
3**=======================================================================*/
4/*=======================================================================
5** Author : Benjamin Grange (MMM YYYY)
6**=======================================================================*/
7
8#ifndef SO_LDM_BORDER_READER_H
9#define SO_LDM_BORDER_READER_H
10
11#include <Inventor/SbLinear.h>
12#include <Inventor/STL/map>
13#include <Inventor/STL/list>
14
15#include <Inventor/nodes/SoNode.h>
16#include <Inventor/fields/SoSubField.h>
17
18#include <Inventor/fields/SoSFNode.h>
19#include <Inventor/fields/SoSFInt32.h>
20#include <Inventor/fields/SoSFUInt32.h>
21#include <Inventor/fields/SoSFEnum.h>
22#include <Inventor/fields/SoSFFilePathString.h>
23#include <Inventor/threads/SbThread.h>
24#include <LDM/nodes/SoDataSet.h>
25#include <LDM/readers/SoVolumeReader.h>
26#include <LDM/readers/SoVRLdmFileReader.h>
27#include <LDM/SoLDMTopoOctree.h>
28
29#ifdef _MSC_VER
30#pragma warning( push )
31#pragma warning(disable:4251)
32#endif
33
34class SoLDMTopoOctree;
35class SoBufferObject;
36
47{
48 SO_FIELDCONTAINER_HEADER(SoVRLdmFileBorderReader);
49
50public:
51
59
64
68 virtual int setFilename(const SbString& filename);
69
73 virtual ReadError getDataChar( SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim ) override;
74
79 virtual int getBorderFlag();
80
83
85 virtual SoBufferObject* readTile(int index, const SbBox3i32& tilePosition);
86
88 virtual SbBool isThreadSafe() const;
89
95
98
99private:
100
102 void readTile(int index, const SbBox3i32& tilePosition, void* destBuffer);
103
104private:
107
108private:
111 class SoLDMBorderTopoOctree : public SoLDMTopoOctree
112 {
113 public:
114 void init(const SbVec3i32& dimension, const SbVec3i32& tileDim, const int border);
115 SbBox3i32 getTilePos(const SoLDMTileID& tileID) const;
116
117 private:
118 std::vector<int> m_deltaZOiv8;
119 };
120
121 //Tile size rounded to the nearest new power of 2
122 SbVec3i32 m_tileSizePow2;
123
124 SoVRLdmFileReader* m_internalLdmReader;
125
127 SoLDMBorderTopoOctree* m_topoOctreeVirtual;
128
130 SoLDMBorderTopoOctree* m_topoOcotreeReal;
131
133 BuildTileMethod m_buildMethod;
134
136 bool getIntersectingTiles(const SbBox3i32 &region, int resolution, SoLDM::TileIdVector &tiles);
137
139 template<typename T>
140 void copyBlock(void* destMem, void* srcMem, const SbVec3i32& blockDestPos, const SbBox3i32& blockSrcBox, const SbVec3i32& arrayDim);
141
142 template<typename T>
143 void copyScaledBlockUV(void* destMem, void* srcMem, const SbBox3i32& blockDestPos,
144 const SbBox3f& blockSrcUVWBox, const SbVec3i32& arrayDim);
145
147 SbBox3i32 getCroppedBox(const SbBox3i32& cropBox, const SbBox3i32& box, SbBox3i32& cropped);
148
150 void handleBorders(SbBox3i32& tileBox, int border);
151
152 SbBox3f computeBoxToExtract(const SbBox3i32& tileBox, const SbBox3i32& tileBoxCropped) const;
153
155 template<typename T>
156 inline T getInterpolatedValue(T* src, const SbVec3i32& arrayDim,
157 const SbVec3i32& ijk0, const SbVec3i32& ijk1,
158 const SbVec3f& factor);
159
160 inline static float trilinearInterpolate(const SbVec3f& factor, float v000, float v100, float v010, float v110,
161 float v001, float v101, float v011, float v111);
162
164 template<typename T>
165 static T getValue(T* src, const SbVec3i32& ijkSrc, const SbVec3i32& arrayDim);
166};
167
168#ifdef _MSC_VER
169#pragma warning( pop )
170#endif
171
172#endif /* _SO_DATA_ACCESS_READER_H */
173
3D box class.
Definition SbBox.h:649
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D box class.
Definition SbBox.h:96
Class for smart character strings.
Definition SbString.h:202
3D vector class.
Definition SbVec.h:932
3D vector class.
Definition SbVec.h:1517
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
DataType
Supported data type.
Definition SoDataSet.h:604
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Tile ID
Definition SoLDMTileID.h:63
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Octree t...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> LDM file...
BuildTileMethod
Enum use to set the method for building tiles in lower resolution from full resolution.
@ AVERAGE
Apply a average method on the the full resolution tile to build lower resolution tile.
@ DECIMATION
Apply a decimation on the the full resolution tile to build lower resolution tile.
virtual int getBorderFlag()
Returns the border flag.
virtual SbBool isThreadSafe() const
Return true as this reader is thread safe.
virtual SoBufferObject * readTile(int index, const SbBox3i32 &tilePosition)
Given an index, reads a tile if the data is organized in tiles (for LDM).
BuildTileMethod getBuildTileMethod()
Return the current method used to build tiles in lower resolution.
virtual SbBool getTileSize(SbVec3i32 &size)
Returns the size of a data tile.
virtual int setFilename(const SbString &filename)
Specifies the path of the file.
SoVRLdmFileBorderReader()
Default Constructor.
void setBuildTileMethod(BuildTileMethod method)
Set the method used to build tiles in lower resolution.
virtual ReadError getDataChar(SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim) override
Gets the characteristics (file header) of the data volume.
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> LDM file...
ReadError
Read error.
int SbBool
Boolean type.
Definition SbBase.h:87
std::vector< SoLDMTileID > TileIdVector
Vector of SoLDMTileID.
Definition SoLDM.h:81