13 #include "HeightField.h"
23 iData =
new Bin[cols*rows];
30 Bin *GetBin(
int col,
int row)
32 if (col < 0 || col >= iCols)
return NULL;
33 if (row < 0 || row >= iRows)
return NULL;
34 return iData + iCols*row + col;
36 int GetMemoryUsed()
const
38 int bins = iCols * iRows;
40 for (
int i = 0; i < bins; i++)
41 bytes += (
sizeof(
int) * iData[i].GetSize());
64 uint NumVerts()
const {
return m_vert.GetSize(); }
65 uint NumTris()
const {
return m_tri.GetSize()/3; }
67 void AddVert(
const DPoint2 &p,
float z);
69 void AddTri(
int v1,
int v2,
int v3,
int surface_type = -1);
74 bool Read(
const char *fname);
77 bool Write(
const char *fname,
bool progress_callback(
int) = NULL)
const;
80 bool ReadDXF(
const char *fname,
bool progress_callback(
int) = NULL);
81 bool ReadADF(
const char *fname,
bool progress_callback(
int) = NULL);
82 bool ReadGMS(
const char *fname,
bool progress_callback(
int) = NULL);
83 bool ReadPLY(
const char *fname,
bool progress_callback(
int) = NULL);
84 bool WriteGMS(
const char *fname,
bool progress_callback(
int) = NULL)
const;
85 bool WriteDAE(
const char *fname,
bool progress_callback(
int) = NULL)
const;
86 bool WriteWRL(
const char *fname,
bool progress_callback(
int) = NULL)
const;
87 bool WriteOBJ(
const char *fname,
bool progress_callback(
int) = NULL)
const;
88 bool WritePLY(
const char *fname,
bool progress_callback(
int) = NULL)
const;
89 bool WriteDXF(
const char *fname,
bool progress_callback(
int) = NULL)
const;
92 uint AddSurfaceType(
const vtString &surface_texture,
bool bTiled =
false);
93 void SetSurfaceType(
int iTri,
int surface_type);
95 bool ComputeExtents();
97 void Scale(
float fFactor);
98 void VertOffset(
float fAmount);
102 void GetVert(
int v,
DPoint2 &p,
float &z)
const { p = m_vert.
GetAt(v); z = m_z[v]; }
103 void GetTri(
int t,
int &v0,
int &v1,
int &v2)
const { v0 = m_tri[t*3]; v1 = m_tri[t*3+1]; v2 = m_tri[t*3+2]; }
104 int *GetAtTri(
int t)
const {
return m_tri.GetData() + (t*3); }
107 virtual bool FindAltitudeOnEarth(
const DPoint2 &p,
float &fAltitude,
108 bool bTrue =
false)
const;
110 bool bTrue =
false,
int iCultureFlags=0,
FPoint3 *vNormal = NULL)
const;
114 FPoint3 &result)
const {
return false; }
121 bool HasVertexNormals()
const {
return m_vert_normal.GetSize() != 0; }
124 int MemoryNeededToLoad()
const;
130 bool _ReadTin(FILE *fp);
131 bool _ReadTinHeader(FILE *fp);
132 bool _ReadTinBody(FILE *fp);
133 bool _ReadTinOld(FILE *fp);
135 void _UpdateIndicesInInBin(
int bin);
136 void _CompareBins(
int bin1,
int bin2);
145 vtStringArray m_surftypes;
157 int m_file_data_start, m_file_verts, m_file_tris;