Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
vtTin3d.h
1 //
2 // vtTin3d.h
3 //
4 // Copyright (c) 2002-2011 Virtual Terrain Project
5 // Free for all uses, see license.txt for details.
6 //
7 
8 #ifndef TIN3DH
9 #define TIN3DH
10 
11 #include "vtdata/vtTin.h"
12 #include "vtdata/HeightField.h"
13 
18 
24 class vtTin3d : public vtTin, public osg::Referenced
25 {
26 public:
27  vtTin3d();
28 
29  bool Read(const char *fname);
30 
31  vtGeode *CreateGeometry(bool bDropShadowMesh, int m_matidx = 0);
32  vtGeode *GetGeometry() { return m_pGeode; }
33  void SetTextureMaterials(vtMaterialArray *pMats);
34 
35  // implement HeightField3d virtual methods
36  virtual bool FindAltitudeAtPoint(const FPoint3 &p3, float &fAltitude,
37  bool bTrue = false, int iCultureFlags = 0,
38  FPoint3 *vNormal = NULL) const;
39  virtual bool CastRayToSurface(const FPoint3 &point, const FPoint3 &dir,
40  FPoint3 &result) const;
41 
42  FPoint3 FindVectorToClosestVertex(const FPoint3 &pos);
43 
44 protected:
45  virtual void MakeSurfaceMaterials();
46 
47  vtArray<vtMesh*> m_Meshes;
48  vtMaterialArrayPtr m_pMats;
49  vtGeode *m_pGeode;
50  vtGeode *m_pDropGeode;
51 };
52 typedef osg::ref_ptr<vtTin3d> vtTin3dPtr;
53  // Group tin
55 
56 #endif // TIN3DH