HoverRace
2.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
engine
Model
Shapes.h
Go to the documentation of this file.
1
2
// Shapes.h
3
//
4
// Copyright (c) 1995-1998 - Richard Langlois and Grokksoft Inc.
5
//
6
// Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7
// you may not use this file except in compliance with the License.
8
//
9
// A copy of the license should have been attached to the package from which
10
// you have taken this file. If you can not find the license you can not use
11
// this file.
12
//
13
//
14
// The author makes no representations about the suitability of
15
// this software for any purpose. It is provided "as is" "AS IS",
16
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17
// implied.
18
//
19
// See the License for the specific language governing permissions
20
// and limitations under the License.
21
//
22
23
//
24
// This files contains the 2.5D shapes used in the game
25
// Theses shapes are used to calculate contacts between objects
26
//
27
// Most of the members of theses class are public
28
//
29
// Serialisation will not and shound not be added to theses class
30
// Theses objects should be build at run time for collision detection only
31
//
32
33
#pragma once
34
35
#include "../Util/WorldCoordinates.h"
36
37
#if defined(_WIN32) && defined(HR_ENGINE_SHARED)
38
# ifdef MR_ENGINE
39
# define MR_DllDeclare __declspec( dllexport )
40
# else
41
# define MR_DllDeclare __declspec( dllimport )
42
# endif
43
#else
44
# define MR_DllDeclare
45
#endif
46
47
namespace
HoverRace
{
48
namespace
Model {
49
50
class
MR_DllDeclare
ShapeInterface
51
{
52
public
:
53
virtual
~ShapeInterface
() { }
54
55
enum
eShape
{ eCylinder = 0, eLineSegment = 1, ePolygon = 2 };
56
57
// Shape position
58
virtual
MR_Int32
XPos()
const
= 0;
59
virtual
MR_Int32
YPos()
const
= 0;
60
61
// Basic bonding attributes (Bonding box)
62
virtual
MR_Int32
XMin()
const
= 0;
63
virtual
MR_Int32
XMax()
const
= 0;
64
virtual
MR_Int32
YMin()
const
= 0;
65
virtual
MR_Int32
YMax()
const
= 0;
66
67
virtual
MR_Int32
ZMin()
const
= 0;
68
virtual
MR_Int32
ZMax()
const
= 0;
69
70
virtual
eShape
ShapeType()
const
= 0;
71
};
72
73
// List of availlable shapes
74
75
class
MR_DllDeclare
CylinderShape
:
public
ShapeInterface
76
{
77
public
:
78
virtual
MR_Int32
AxisX()
const
= 0;
79
virtual
MR_Int32
AxisY()
const
= 0;
80
virtual
MR_Int32
RayLen()
const
= 0;
81
82
// ShapeInterface
83
MR_Int32
XPos()
const override
;
84
MR_Int32
YPos()
const override
;
85
86
MR_Int32
XMin()
const override
;
87
MR_Int32
XMax()
const override
;
88
MR_Int32
YMin()
const override
;
89
MR_Int32
YMax()
const override
;
90
91
eShape
ShapeType()
const override
;
92
};
93
94
class
MR_DllDeclare
LineSegmentShape
:
public
ShapeInterface
95
{
96
public
:
97
virtual
MR_Int32
X0()
const
= 0;
98
virtual
MR_Int32
Y0()
const
= 0;
99
virtual
MR_Int32
Z0()
const
= 0;
100
101
virtual
MR_Int32
X1()
const
= 0;
102
virtual
MR_Int32
Y1()
const
= 0;
103
virtual
MR_Int32
Z1()
const
= 0;
104
105
virtual
MR_Int32
HorizontalLen()
const
= 0;
106
107
// ShapeInterface
108
MR_Int32
XPos()
const override
;
109
MR_Int32
YPos()
const override
;
110
111
MR_Int32
XMin()
const override
;
112
MR_Int32
XMax()
const override
;
113
MR_Int32
YMin()
const override
;
114
MR_Int32
YMax()
const override
;
115
116
eShape
ShapeType()
const override
;
117
118
};
119
120
class
MR_DllDeclare
PolygonShape
:
public
ShapeInterface
121
{
122
public
:
123
virtual
int
VertexCount()
const
= 0;
124
virtual
MR_Int32
X(
int
pIndex)
const
= 0;
125
virtual
MR_Int32
Y(
int
pIndex)
const
= 0;
126
virtual
MR_Int32
SideLen(
int
pIndex)
const
= 0;
127
128
// ShapeInterface
129
MR_Int32
XPos()
const override
;
130
MR_Int32
YPos()
const override
;
131
132
eShape
ShapeType()
const override
;
133
};
134
135
}
// namespace Model
136
}
// namespace HoverRace
137
138
#undef MR_DllDeclare
HoverRace::Model::LineSegmentShape
Definition:
Shapes.h:94
HoverRace::Model::ShapeInterface::~ShapeInterface
virtual ~ShapeInterface()
Definition:
Shapes.h:53
HoverRace::Model::ShapeInterface
Definition:
Shapes.h:50
MR_DllDeclare
#define MR_DllDeclare
Definition:
Shapes.h:44
HoverRace::Model::ShapeInterface::eShape
eShape
Definition:
Shapes.h:55
HoverRace::Model::CylinderShape
Definition:
Shapes.h:75
MR_Int32
int32_t MR_Int32
Definition:
MR_Types.h:43
HoverRace::Model::PolygonShape
Definition:
Shapes.h:120
HoverRace
Definition:
Announcement.h:24
1.8.11