Pyrogenesis
13997
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
source
simulation2
components
ICmpFootprint.h
Go to the documentation of this file.
1
/* Copyright (C) 2010 Wildfire Games.
2
* This file is part of 0 A.D.
3
*
4
* 0 A.D. is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* 0 A.D. is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef INCLUDED_ICMPFOOTPRINT
19
#define INCLUDED_ICMPFOOTPRINT
20
21
#include "
simulation2/system/Interface.h
"
22
23
#include "
simulation2/helpers/Position.h
"
24
25
class
CFixedVector3D
;
26
27
/**
28
* Footprints - an approximation of the entity's shape, used for collision detection and for
29
* rendering selection outlines.
30
* A footprint is either a circle (of some radius) or square (of some width and depth (actually
31
* it's a rectangle)), horizontally aligned, extruded to a given height.
32
*/
33
class
ICmpFootprint
:
public
IComponent
34
{
35
public
:
36
enum
EShape
37
{
38
CIRCLE
,
39
SQUARE
40
};
41
42
/**
43
* Return the shape of this footprint.
44
* Shapes are horizontal circles or squares, extended vertically upwards to make cylinders or boxes.
45
* @param[out] shape either CIRCLE or SQUARE
46
* @param[out] size0 if CIRCLE then radius, else width (size in X axis)
47
* @param[out] size1 if CIRCLE then radius, else depth (size in Z axis)
48
* @param[out] height size in Y axis
49
*/
50
virtual
void
GetShape
(
EShape
& shape,
entity_pos_t
& size0,
entity_pos_t
& size1,
entity_pos_t
& height) = 0;
51
52
/**
53
* GetShape wrapper for script calls.
54
* Returns { "type": "circle", "radius": 5.0, "height": 1.0 }
55
* or { "type": "square", "width": 5.0, "depth": 5.0, "height": 1.0 }
56
*/
57
CScriptVal
GetShape_wrapper
();
58
59
/**
60
* Pick a sensible position to place a newly-spawned entity near this footprint,
61
* such that it won't be in an invalid (obstructed) location regardless of the spawned unit's
62
* orientation.
63
* @return the X and Z coordinates of the spawn point, with Y = 0; or the special value (-1, -1, -1) if there's no space
64
*/
65
virtual
CFixedVector3D
PickSpawnPoint
(
entity_id_t
spawned) = 0;
66
67
DECLARE_INTERFACE_TYPE
(Footprint)
68
};
69
70
#endif // INCLUDED_ICMPFOOTPRINT
IComponent
Definition:
IComponent.h:33
CFixed
A simple fixed-point number class.
Definition:
Fixed.h:115
CScriptVal
A trivial wrapper around a jsval.
Definition:
ScriptVal.h:29
ICmpFootprint::GetShape_wrapper
CScriptVal GetShape_wrapper()
GetShape wrapper for script calls.
Definition:
ICmpFootprint.cpp:27
ICmpFootprint::EShape
EShape
Definition:
ICmpFootprint.h:36
ICmpFootprint::SQUARE
Definition:
ICmpFootprint.h:39
CFixedVector3D
Definition:
FixedVector3D.h:24
DECLARE_INTERFACE_TYPE
#define DECLARE_INTERFACE_TYPE(iname)
Definition:
Interface.h:23
ICmpFootprint::CIRCLE
Definition:
ICmpFootprint.h:38
ICmpFootprint
Footprints - an approximation of the entity's shape, used for collision detection and for rendering s...
Definition:
ICmpFootprint.h:33
ICmpFootprint::PickSpawnPoint
virtual CFixedVector3D PickSpawnPoint(entity_id_t spawned)=0
Pick a sensible position to place a newly-spawned entity near this footprint, such that it won't be i...
ICmpFootprint::GetShape
virtual void GetShape(EShape &shape, entity_pos_t &size0, entity_pos_t &size1, entity_pos_t &height)=0
Return the shape of this footprint.
Interface.h
Position.h
Entity coordinate types.
entity_id_t
u32 entity_id_t
Entity ID type.
Definition:
Entity.h:24
Generated on Mon Oct 14 2013 00:58:09 for Pyrogenesis by
1.8.5