Simulant
21.12-574
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
simulant
interfaces
boundable.h
1
#pragma once
2
3
#include "../types.h"
4
5
namespace
smlt
{
6
12
class
Boundable
{
13
public
:
14
virtual
const
AABB
& aabb()
const
= 0;
15
16
virtual
float
width()
const
{
17
AABB
box = aabb();
18
return
box.width();
19
}
20
21
virtual
float
height()
const
{
22
AABB
box = aabb();
23
return
box.height();
24
}
25
26
virtual
float
depth()
const
{
27
AABB
box = aabb();
28
return
box.depth();
29
}
30
31
virtual
float
half_width()
const
{
return
width() * 0.5f; }
32
virtual
float
half_height()
const
{
return
height() * 0.5f; }
33
virtual
float
half_depth()
const
{
return
depth() * 0.5f; }
34
35
virtual
float
diameter()
const
{
return
std::max(width(), std::max(height(), depth())); }
36
virtual
float
radius()
const
{
return
diameter() * 0.5f; }
37
};
38
48
class
BoundableEntity
:
49
public
virtual
Boundable
{
50
51
public
:
52
virtual
const
AABB
transformed_aabb()
const
= 0;
53
virtual
const
Vec3
centre()
const
{
54
AABB
box = transformed_aabb();
55
return
box.centre();
56
}
57
};
58
59
}
60
smlt::Vec3
Definition:
vec3.h:23
smlt
Definition:
animation.cpp:25
smlt::AABB
Definition:
aabb.h:22
smlt::BoundableEntity
The BoundableEntity class.
Definition:
boundable.h:49
smlt::Boundable
The Boundable class.
Definition:
boundable.h:12
Generated by
1.8.20