Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
physics.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "inexor/shared/geom.hpp" // for vec
4 
5 struct clipplanes;
6 struct dynent;
7 struct entity;
8 struct extentity;
9 struct physent;
10 struct vec;
11 
12 extern bool pointincube(const clipplanes &p, const vec &v);
13 extern bool overlapsdynent(const vec &o, float radius);
14 extern void rotatebb(vec &center, vec &radius, int yaw);
15 extern float shadowray(const vec &o, const vec &ray, float radius, int mode, extentity *t = nullptr);
16 struct ShadowRayCache;
17 
19 extern void freeshadowraycache(ShadowRayCache *&cache);
20 extern void resetshadowraycache(ShadowRayCache *cache);
21 extern float shadowray(ShadowRayCache *cache, const vec &o, const vec &ray, float radius, int mode, extentity *t = nullptr);
22 
23 enum { RAY_BB = 1, RAY_POLY = 3, RAY_ALPHAPOLY = 7, RAY_ENTS = 9, RAY_CLIPMAT = 16, RAY_SKIPFIRST = 32, RAY_EDITMAT = 64, RAY_SHADOW = 128, RAY_PASS = 256, RAY_SKIPSKY = 512 };
24 
25 extern float raycube (const vec &o, const vec &ray, float radius = 0, int mode = RAY_CLIPMAT, int size = 0, extentity *t = nullptr);
26 extern float raycubepos(const vec &o, const vec &ray, vec &hit, float radius = 0, int mode = RAY_CLIPMAT, int size = 0);
27 extern float rayfloor (const vec &o, vec &floor, int mode = 0, float radius = 0);
28 extern bool raycubelos(const vec &o, const vec &dest, vec &hitpos);
29 
30 
31 extern vec collidewall;
32 extern bool collideinside;
33 extern physent *collideplayer;
34 
35 extern void moveplayer(physent *pl, int moveres, bool local);
36 extern bool moveplayer(physent *pl, int moveres, bool local, int curtime);
37 extern bool ellipseboxcollide(physent *d, const vec &dir, const vec &o, const vec &center, float yaw, float xr, float yr, float hi, float lo);
38 extern bool ellipsecollide(physent *d, const vec &dir, const vec &o, const vec &center, float yaw, float xr, float yr, float hi, float lo);
39 extern bool collide(physent *d, const vec &dir = vec(0, 0, 0), float cutoff = 0.0f, bool playercol = true);
40 extern bool bounce(physent *d, float secs, float elasticity, float waterfric, float grav);
41 extern bool bounce(physent *d, float elasticity, float waterfric, float grav);
42 extern void avoidcollision(physent *d, const vec &dir, physent *obstacle, float space);
43 extern bool movecamera(physent *pl, const vec &dir, float dist, float stepdist);
44 extern void physicsframe();
45 extern void dropenttofloor(entity *e);
46 extern bool droptofloor(vec &o, float radius, float height);
47 
48 extern void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m);
49 extern void vectoyawpitch(const vec &v, float &yaw, float &pitch);
50 extern bool moveplatform(physent *p, const vec &dir);
51 extern void updatephysstate(physent *d);
52 extern void cleardynentcache();
53 extern void updatedynentcache(physent *d);
54 extern bool entinmap(dynent *d, bool avoidplayers = false);
55 extern void findplayerspawn(dynent *d, int forceent = -1, int tag = 0);
56 
Definition: physics.cpp:380
void cleardynentcache()
Definition: physics.cpp:598
Definition: physics.hpp:23
GLenum GLsizei GLsizei height
Definition: glexts.hpp:291
bool raycubelos(const vec &o, const vec &dest, vec &hitpos)
Definition: physics.cpp:459
bool ellipseboxcollide(physent *d, const vec &dir, const vec &o, const vec &center, float yaw, float xr, float yr, float hi, float lo)
Definition: physics.cpp:493
bool collide(physent *d, const vec &dir=vec(0, 0, 0), float cutoff=0.0f, bool playercol=true)
Definition: physics.cpp:1050
physent * collideplayer
Definition: physics.cpp:483
Definition: octree.hpp:173
bool bounce(physent *d, float secs, float elasticity, float waterfric, float grav)
Definition: physics.cpp:1404
bool moveplatform(physent *p, const vec &dir)
Definition: physics.cpp:1904
Definition: physics.hpp:23
bool pointincube(const clipplanes &p, const vec &v)
Definition: physics.cpp:77
void hit(int damage, dynent *d, fpsent *at, const vec &vel, int gun, float info1, int info2=1)
Definition: weapon.cpp:422
bool overlapsdynent(const vec &o, float radius)
Definition: physics.cpp:644
void vectoyawpitch(const vec &v, float &yaw, float &pitch)
Definition: physics.cpp:1574
Definition: ents.hpp:128
persistent map entity.
Definition: ents.hpp:66
float raycube(const vec &o, const vec &ray, float radius=0, int mode=RAY_CLIPMAT, int size=0, extentity *t=nullptr)
Definition: physics.cpp:302
ICOMMAND * f(float *a, float *b), floatret(*a **b)
bool movecamera(physent *pl, const vec &dir, float dist, float stepdist)
Definition: physics.cpp:1473
bool ellipsecollide(physent *d, const vec &dir, const vec &o, const vec &center, float yaw, float xr, float yr, float hi, float lo)
Definition: physics.cpp:548
bool droptofloor(vec &o, float radius, float height)
Definition: physics.cpp:1493
void updatedynentcache(physent *d)
Definition: physics.cpp:634
Definition: ents.hpp:102
vector with 3 floats and some useful methods.
Definition: geom.hpp:110
Definition: physics.hpp:23
Definition: physics.hpp:23
Definition: physics.hpp:23
float shadowray(const vec &o, const vec &ray, float radius, int mode, extentity *t=nullptr)
Definition: physics.cpp:347
void findplayerspawn(dynent *d, int forceent=-1, int tag=0)
Definition: world.cpp:1234
Definition: physics.hpp:23
Definition: physics.hpp:23
void physicsframe()
Definition: physics.cpp:1751
int curtime
Definition: legacy_time.cpp:14
int d
Definition: octaedit.cpp:1749
void t(T x, const char *cmp)
Definition: utilTest.cpp:52
Definition: physics.hpp:23
Definition: ents.hpp:258
Definition: physics.hpp:23
bool move(physent *d, vec &dir)
Definition: physics.cpp:1342
void resetshadowraycache(ShadowRayCache *cache)
Definition: physics.cpp:392
#define dir(name, v, d, s, os)
Definition: physics.cpp:2014
void freeshadowraycache(ShadowRayCache *&cache)
Definition: physics.cpp:390
GLuint GLuint GLintptr GLsizeiptr size
Definition: glexts.hpp:412
ShadowRayCache * newshadowraycache()
Definition: physics.cpp:388
vec collidewall
Definition: physics.cpp:484
void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m)
Definition: physics.cpp:1550
bool collideinside
Definition: physics.cpp:482
void rotatebb(vec &center, vec &radius, int yaw)
Definition: physics.cpp:711
float raycubepos(const vec &o, const vec &ray, vec &hit, float radius=0, int mode=RAY_CLIPMAT, int size=0)
Definition: physics.cpp:450
void updatephysstate(physent *d)
Definition: physics.cpp:1820
Definition: physics.hpp:23
mathmatics for vectors, matrices, quaterions and more
float rayfloor(const vec &o, vec &floor, int mode=0, float radius=0)
Definition: physics.cpp:469
bool entinmap(dynent *d, bool avoidplayers=false)
Definition: physics.cpp:2023
void dropenttofloor(entity *e)
Definition: physics.cpp:1536
void moveplayer(physent *pl, int moveres, bool local)
Definition: physics.cpp:1778
void avoidcollision(physent *d, const vec &dir, physent *obstacle, float space)
Definition: physics.cpp:1448