ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 02 00 00 00 02 00 08 03 00 00 00 c3 a6 24 | .PNG........IHDR...............$ |
0020 | c8 00 00 00 3f 50 4c 54 45 00 00 00 de de de ff ff ff bd bd bd ce ce ce e7 e7 e7 63 63 63 a5 a5 | ....?PLTE..................ccc.. |
0040 | a5 8c 8c 8c f7 f7 f7 c6 c6 c6 7b 7b 7b ef ef ef d6 d6 d6 ad b5 ad 94 9c 94 bd c6 bd de e7 de b5 | ..........{{{................... |
0060 | b5 b5 ef f7 ef e7 ef e7 19 07 11 e2 00 00 00 01 74 52 4e 53 00 40 e6 d8 66 00 00 71 da 49 44 41 | ................tRNS.@..f..q.IDA |
0080 | 54 78 5e ec bd 8b 72 e4 b8 ae 25 ba 00 f0 fd 3c 33 73 ff ff 5b 6f 08 84 92 a1 4c d9 59 ae 76 77 | Tx^...r...%....<3s..[o....L.Y.vw |
00a0 | f5 de c7 28 0b 5c 82 f8 26 82 69 af 82 92 f8 35 09 04 0a f8 df 25 cc 3b 7d 15 be bb 71 06 78 6b | ...(.\..&.i....5.....%.;}...q.xk |
00c0 | b6 84 f1 7d e2 19 0c f6 f8 4e d1 2a 2f 03 12 16 6b 0c 0c 17 11 9d 3e 78 95 e4 31 73 9e 3a 46 e6 | ...}.....N.*/...k.....>x..1s.:F. |
00e0 | 1c 0f 55 80 a8 b7 cc a8 9e 79 a1 c2 5c 10 8f bc f7 c2 ec 4e 48 a4 a5 07 2a 69 69 5f 57 15 bb 46 | ..U......y..\......NH...*ii_W..F |
0100 | 06 f4 16 80 de 15 3a a7 5c 84 c1 02 3e bb 95 e3 03 0d 20 66 ad c6 2a 68 29 35 2d c6 a0 18 09 24 | ......:.\...>......f..*h)5-....$ |
0120 | 10 b2 a6 60 4e cf 80 f7 30 89 e5 ce 01 ee d3 ab 37 7c 9f b0 fd 3c 37 2f bc 90 0d 62 ad dd ce c7 | ...`N...0.......7|...<7/...b.... |
0140 | fe bd 03 d4 2e 11 92 75 fc 89 cf ca 19 19 40 86 14 2e f2 32 18 17 e1 53 f2 66 ae 87 0e 0c 34 36 | .......u......@....2...S.f....46 |
0160 | 0b 45 cd 36 09 39 84 8c 5c eb 9e 4d 43 5e b3 4c 2d 57 38 47 2c 6f 42 65 f4 d5 e0 f0 78 74 07 34 | .E.6.9..\..MC^.L-W8G,oBe....xt.4 |
0180 | 9e 66 81 c1 b3 9d 4f b9 77 06 37 f0 ea 16 a3 e6 07 da 25 ec a7 8f d1 41 09 89 90 5a 4b a8 39 e5 | .f....O.w.7.......%....A...ZK.9. |
01a0 | 0a a0 77 b0 ad b6 fa 7f 74 d8 f2 77 3a 00 7f d9 01 76 39 0e 0b d7 1c 72 05 23 57 bb 27 a6 0a e2 | ..w.....t..w:....v9....r.#W.'... |
01c0 | /*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef COLLISION_HEADER
#define COLLISION_HEADER
#include "irrlichttypes_bloated.h"
#include <vector>
class Map;
class IGameDef;
class Environment;
class ActiveObject;
enum CollisionType
{
COLLISION_NODE,
COLLISION_OBJECT,
};
struct CollisionInfo
{
enum CollisionType type;
v3s16 node_p; // COLLISION_NODE
bool bouncy;
v3f old_speed;
v3f new_speed;
CollisionInfo():
type(COLLISION_NODE),
node_p(-32768,-32768,-32768),
bouncy(false),
old_speed(0,0,0),
new_speed(0,0,0)
{}
};
struct collisionMoveResult
{
bool touching_ground;
bool collides;
bool collides_xz;
bool standing_on_unloaded;
std::vector<CollisionInfo> collisions;
collisionMoveResult():
touching_ground(false),
collides(false),
collides_xz(false),
standing_on_unloaded(false)
{}
};
// Moves using a single iteration; speed should not exceed pos_max_d/dtime
collisionMoveResult collisionMoveSimple(Environment *env,IGameDef *gamedef,
f32 pos_max_d, const aabb3f &box_0,
f32 stepheight, f32 dtime,
v3f &pos_f, v3f &speed_f, v3f &accel_f,ActiveObject* self=0);
#if 0
// This doesn't seem to work and isn't used
// Moves using as many iterations as needed
collisionMoveResult collisionMovePrecise(Map *map, IGameDef *gamedef,
f32 pos_max_d, const aabb3f &box_0,
f32 stepheight, f32 dtime,
v3f &pos_f, v3f &speed_f, v3f &accel_f);
#endif
// Helper function:
// Checks for collision of a moving aabbox with a static aabbox
// Returns -1 if no collision, 0 if X collision, 1 if Y collision, 2 if Z collision
// dtime receives time until first collision, invalid if -1 is returned
int axisAlignedCollision(
const aabb3f &staticbox, const aabb3f &movingbox,
const v3f &speed, f32 d, f32 &dtime);
// Helper function:
// Checks if moving the movingbox up by the given distance would hit a ceiling.
bool wouldCollideWithCeiling(
const std::vector<aabb3f> &staticboxes,
const aabb3f &movingbox,
f32 y_increase, f32 d);
#endif
|