Umasoft
Main Page
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
TerrainSDK
vtlib
core
Building3d.h
1
//
2
// Building3d.h
3
//
4
// Copyright (c) 2001-2011 Virtual Terrain Project
5
// Free for all uses, see license.txt for details.
6
//
7
8
#ifndef BUILDING3DH
9
#define BUILDING3DH
10
17
18
#include "vtdata/Building.h"
19
#include "vtdata/StructArray.h"
20
#include "Structure3d.h"
21
22
class
vtHeightField
;
23
24
struct
MatMesh
25
{
26
int
m_iMatIdx;
27
vtMesh
*m_pMesh;
28
vtMesh::PrimType m_ePrimType;
29
};
30
31
36
class
vtBuilding3d
:
public
vtBuilding
,
public
vtStructure3d
37
{
38
public
:
39
vtBuilding3d
();
40
~
vtBuilding3d
();
41
42
// implement vtStructure3d methods
43
virtual
bool
CreateNode
(
vtTerrain
*pTerr);
44
virtual
bool
IsCreated();
45
virtual
vtGeode
*
GetGeom
() {
return
m_pGeode; }
46
virtual
osg::Node *GetContained() {
return
m_pGeode; }
47
virtual
void
DeleteNode();
48
// display a bounding box around to object to highlight it
49
virtual
void
ShowBounds
(
bool
bShow);
50
51
// copy
52
vtBuilding3d
&operator=(
const
vtBuilding
&v);
53
54
void
DestroyGeometry();
55
bool
CreateGeometry(
vtHeightField3d
*pHeightField);
56
void
AdjustHeight(
vtHeightField3d
*pHeightField);
57
58
// randomize building properties
59
void
Randomize(
int
iStories);
60
61
protected
:
62
bool
MakeFacade(
vtEdge
*pEdge,
FLine3
&quad,
int
stories);
63
64
protected
:
65
66
// the geometry is composed of several meshes, one for each potential material used
67
vtArray<MatMesh>
m_Mesh;
68
69
vtMesh
*FindMatMesh(
const
vtString
&Material,
const
RGBi
&color, vtMesh::PrimType ePrimType);
70
// center of the building in world coordinates (the origin of
71
// the building's local coordinate system)
72
FPoint3
m_center;
73
74
// internal methods
75
void
UpdateWorldLocation(
vtHeightField3d
*pHeightField);
76
float
GetHeightOfStories();
77
void
CreateUpperPolygon(
vtLevel
*lev,
FPolygon3
&poly,
FPolygon3
&poly2);
78
79
void
CreateEdgeGeometry(
vtLevel
*pLev,
const
FPolygon3
&polygon1,
80
const
FPolygon3
&polygon2,
int
iEdge,
bool
bShowEdge);
81
82
// create special, simple geometry for a level which is uniform
83
void
CreateUniformLevel(
int
iLevel,
float
fHeight,
int
iHighlightEdge);
84
85
// creates a wall. base_height is height from base of floor
86
// (to make siding texture match up right.)
87
void
AddWallSection
(
vtEdge
*pEdge,
bool
bUniform,
const
FLine3
&quad,
88
float
h1,
float
h2,
float
hf1 = -1.0f);
89
90
void
AddHighlightSection
(
vtEdge
*pEdge,
const
FLine3
&quad);
91
92
//adds a wall section with a door
93
void
AddDoorSection
(
vtEdge
*pWall,
vtEdgeFeature
*pFeat,
94
const
FLine3
&quad);
95
96
//adds a wall section with a window
97
void
AddWindowSection(
vtEdge
*pWall,
vtEdgeFeature
*pFeat,
98
const
FLine3
&quad);
99
100
void
AddWallNormal(
vtEdge
*pWall,
vtEdgeFeature
*pFeat,
101
const
FLine3
&quad);
102
103
void
AddFlatRoof(
const
FPolygon3
&pp,
vtLevel
*pLev);
104
FPoint3
Normal(
const
FPoint3
&p0,
const
FPoint3
&p1,
const
FPoint3
&p2);
105
106
// Felkel straight skeleton
107
float
MakeFelkelRoof(
const
FPolygon3
&pp,
vtLevel
*pLev);
108
bool
Collinear2d(
const
FPoint3
& p1,
const
FPoint3
& p2,
const
FPoint3
& p3);
109
int
FindVertex(
FPoint3
Point,
FLine3
&RoofSection3D,
vtArray<int>
&iaVertices);
110
111
vtGeode
*m_pGeode;
// The geometry node which contains the building geometry
112
vtGeode
*m_pHighlight;
// The wireframe highlight
113
};
114
// Group struct
116
117
#endif // BUILDING3DH
118
Generated on Fri Jun 7 2013 16:07:52 for Umasoft by
1.8.4