Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
TerrainPatch.h
Go to the documentation of this file.
1
/* Project Starshatter 4.5
2
Destroyer Studios LLC
3
Copyright © 1997-2005. All Rights Reserved.
4
5
SUBSYSTEM: Stars.exe
6
FILE: TerrainPatch.h
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
A Single Multi-LOD Section of a Terrain Object
13
*/
14
15
#ifndef TerrainPatch_h
16
#define TerrainPatch_h
17
18
#include "
Types.h
"
19
#include "
Solid.h
"
20
#include "
Geometry.h
"
21
#include "
Polygon.h
"
22
23
// +--------------------------------------------------------------------+
24
25
class
Projector
;
26
class
Terrain
;
27
class
Water
;
28
29
// +--------------------------------------------------------------------+
30
31
class
TerrainPatch
:
public
Solid
32
{
33
public
:
34
TerrainPatch
(
Terrain
*
terrain
,
35
const
Bitmap
* patch,
const
Rect
&
rect
,
36
const
Point
& p1,
const
Point
& p2);
37
TerrainPatch
(
Terrain
* terrain,
const
Rect
& rect,
38
const
Point
& p1,
const
Point
& p2,
39
double
sea_level);
40
virtual
~TerrainPatch
();
41
42
virtual
void
SelectDetail
(
Projector
* projector);
43
virtual
void
Render
(
Video
* video, DWORD flags);
44
45
virtual
int
CollidesWith
(
Graphic
& o);
46
47
// accessors:
48
double
Scale
()
const
{
return
scale
; }
49
double
MountainScale
()
const
{
return
mtnscale
; }
50
double
SeaLevel
()
const
{
return
base
; }
51
double
MinHeight
()
const
{
return
min_height
; }
52
double
MaxHeight
()
const
{
return
max_height
; }
53
bool
IsWater
()
const
{
return
water
!= 0; }
54
55
void
UpdateSurfaceWaves
(
Vec3
& eyePos);
56
57
void
SetScales
(
double
scale
,
double
mtnscale
,
double
base
);
58
void
SetDetailLevel
(
int
nd);
59
60
virtual
int
CheckRayIntersection
(
Point
pt,
Point
vpn,
double
len,
Point
& ipt,
61
bool
treat_translucent_polys_as_solid=
true
);
62
63
double
Height
(
double
x,
double
y)
const
;
64
DWORD
BlendValue
(
double
y);
65
int
CalcLayer
(
Poly
* p);
66
void
Illuminate
(
Color
ambient,
List<Light>
& lights);
67
68
protected
:
69
virtual
bool
BuildDetailLevel
(
int
level);
70
71
enum
{
MAX_LOD
=8 };
72
73
Terrain
*
terrain
;
74
int
patch_size
;
75
int
ndetail
;
76
int
max_detail
;
77
int
terrain_width
;
78
79
Rect
rect
;
80
float
*
heights
;
81
Model
*
detail_levels
[
MAX_LOD
];
82
List<Material>
materials
;
83
Water
*
water
;
84
85
double
scale
;
86
double
mtnscale
;
87
double
base
;
88
double
size
;
89
float
min_height
;
90
float
max_height
;
91
};
92
93
#endif TerrainPatch_h
94
Stars45
TerrainPatch.h
Generated on Tue Jun 5 2012 20:47:16 for Starshatter_Open by
1.8.1