blob: ec643ccc3a148373294f06877f14ee90fb914da4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
//=============================================================================
// Copyright (C) 2002 Radical Entertainment Ltd. All rights reserved.
//
// File: spheretriggervolume.h
//
// Description: Sphere Trigger Volume class
//
// History: 03/04/2002 + Created -- Cary Brisebois
//
//=============================================================================
#ifndef SPHERETRIGGERVOLUME_H
#define SPHERETRIGGERVOLUME_H
//========================================
// Nested Includes
//========================================
#include <radmath/radmath.hpp>
#ifndef WORLD_BUILDER
#include <meta/triggervolume.h>
#else
#include "triggervolume.h"
#endif
//========================================
// Forward References
//========================================
//=============================================================================
//
// Synopsis: Blahblahblah
//
//=============================================================================
class SphereTriggerVolume : public TriggerVolume
{
public:
SphereTriggerVolume();
SphereTriggerVolume( const rmt::Vector& centre, float radius );
virtual ~SphereTriggerVolume();
// Intersection information
bool Contains( const rmt::Vector& point, float epsilon = 0.00f ) const;
// Intersection of bounding box with trigger volume.
//p1 - p4 are the four corners of the box.
bool IntersectsBox( const rmt::Vector& p1,
const rmt::Vector& p2,
const rmt::Vector& p3,
const rmt::Vector& p4 ) const;
virtual bool IntersectsBox( const rmt::Box3D& box );
bool IntersectsSphere( const rmt::Vector& position,
float radius ) const;
bool IntersectLine( const rmt::Vector& p1,
const rmt::Vector& p2 ) const;
// Bounding box
bool GetBoundingBox( rmt::Vector& p1, rmt::Vector& p2 ) const;
float GetSphereRadius() const;
void SetSphereRadius( float radius );
virtual Type GetType() const;
//////////////////////////////////////////////////////////////////////////
// tDrawable interface
//////////////////////////////////////////////////////////////////////////
void GetBoundingBox(rmt::Box3D* box);
void GetBoundingSphere(rmt::Sphere* sphere);
protected:
virtual void InitPoints();
virtual void CalcPoints();
private:
bool IntersectLineSphere( const rmt::Vector& lineOrig,
const rmt::Vector& lineDir ) const;
// For sphere type
float mRadius;
//Prevent wasteful constructor creation.
SphereTriggerVolume( const SphereTriggerVolume& spheretriggervolume );
SphereTriggerVolume& operator=( const SphereTriggerVolume& spheretriggervolume );
};
inline float SphereTriggerVolume::GetSphereRadius() const
{
return( mRadius );
}
inline void SphereTriggerVolume::SetSphereRadius( float radius )
{
mRadius = radius;
}
#endif //SPHERETRIGGERVOLUME_H
|