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 104 105 106
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef _TRACE_RAY_H
#define _TRACE_RAY_H
#include <vector>
class float3;
class CUnit;
class CFeature;
class CWeapon;
class CPlasmaRepulser;
class CSolidObject;
struct CollisionQuery;
namespace Collision {
enum {
NOENEMIES = 1 << 0,
NOFRIENDLIES = 1 << 1,
NOFEATURES = 1 << 2,
NONEUTRALS = 1 << 3,
NOFIREBASES = 1 << 4, // ignored by rays
NOGROUND = 1 << 5,
NOCLOAKED = 1 << 6,
NOUNITS = NOENEMIES | NOFRIENDLIES | NONEUTRALS
};
}
namespace TraceRay {
struct SShieldDist {
CPlasmaRepulser* rep;
float dist;
};
float TraceRay(
const float3& pos,
const float3& dir,
float traceLength,
int traceFlags,
const CUnit* owner,
CUnit*& hitUnit,
CFeature*& hitFeature,
CollisionQuery* hitColQuery = nullptr
);
float TraceRay(
const float3& pos,
const float3& dir,
float traceLength,
int traceFlags,
int allyTeam,
const CUnit* owner,
CUnit*& hitUnit,
CFeature*& hitFeature,
CollisionQuery* hitColQuery
);
void TraceRayShields(
const CWeapon* emitter,
const float3& start,
const float3& dir,
float length,
std::vector<SShieldDist>& hitShields
);
float GuiTraceRay(
const float3& start,
const float3& dir,
const float length,
const CUnit* exclude,
const CUnit*& hitUnit,
const CFeature*& hitFeature,
bool useRadar,
bool groundOnly = false,
bool ignoreWater = true
);
/**
* @return true if there is an object (allied/neutral unit, feature)
* within the firing cone of \<owner\> (that might be hit)
*/
bool TestCone(
const float3& from,
const float3& dir,
float length,
float spread,
int allyteam,
int traceFlags,
CUnit* owner);
/**
* @return true if there is an object (allied/neutral unit, feature)
* within the firing trajectory of \<owner\> (that might be hit)
*/
bool TestTrajectoryCone(
const float3& from,
const float3& dir,
float length,
float linear,
float quadratic,
float spread,
int allyteam,
int traceFlags,
CUnit* owner);
}
#endif // _TRACE_RAY_H
|