Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Fence3d.h
1 //
2 // Fence3d.h
3 //
4 // Copyright (c) 2001-2011 Virtual Terrain Project
5 // Free for all uses, see license.txt for details.
6 //
7 
8 #ifndef FENCE3DH
9 #define FENCE3DH
10 
11 #include "vtdata/Fence.h"
12 #include "vtdata/HeightField.h"
13 #include "Structure3d.h"
14 
17 
22 class vtFence3d : public vtFence, public vtStructure3d
23 {
24 public:
25  vtFence3d();
26 
27  // implement vtStructure3d methods
28  virtual bool CreateNode(vtTerrain *pTerr);
29  virtual bool IsCreated();
30  virtual vtGeode *GetGeom() { return m_pFenceGeom; }
31  virtual osg::Node *GetContained() { return m_pFenceGeom; }
32  virtual void DeleteNode();
33  virtual void ShowBounds(bool bShow);
34 
35  // implement vtFence methods
36  virtual void SetParams(const vtLinearParams &params);
37  virtual void ProfileChanged();
38 
39  void DestroyGeometry();
40 
41 protected:
42  void Init();
43  void LoadProfile();
44  void AddFencepost(const FPoint3 &p1, int iMatIdx);
45 
46  void AddWireMeshes(const FLine3 &p3);
47  void AddFlatConnectionMesh(const FLine3 &p3);
48  void AddThickConnectionMesh(const FLine3 &p3);
49  void AddProfileConnectionMesh(const FLine3 &p3);
50  void AddPostExtensions(const FLine3 &p3);
51 
52  void AddFenceMeshes(vtHeightField3d *pHeightField);
53 
54  vtGeodePtr m_pFenceGeom;
55  vtMesh *m_pHighlightMesh; // The wireframe highlight
56  bool m_bBuilt;
57  FLine3 m_Posts3d;
58  float m_fMaxGroundY;
59  FLine2 m_Profile;
60 };
61 
62 typedef class vtFence *vtFencePtr;
63  // Group struct
65 
66 #endif // FENCE3DH