Test collisions with a ridge smaller than the box.

Whee, found a failing test case :)
This commit is contained in:
Bill Currie 2011-12-04 09:02:12 +09:00
parent 55eb88b52c
commit 487a6b20ab
4 changed files with 38 additions and 0 deletions

View file

@ -275,3 +275,32 @@ hull_t hull_hole = {
{0, 0, 0},
{0, 0, 0},
};
// 2 3
// eee|eee|eee
// 0,32+---+--- 1
// eee|sss|eee
// ---+---+--- 0
// ss0,0s8,0ss
static mclipnode_t clipnodes_ridge[] = {
{ 0, { 1, CONTENTS_SOLID}},
{ 1, {CONTENTS_EMPTY, 2}},
{ 2, { 3, CONTENTS_EMPTY}},
{ 3, {CONTENTS_EMPTY, CONTENTS_SOLID}},
};
static plane_t planes_ridge[] = {
{{0, 0, 1}, 0, 2, 0},
{{0, 0, 1}, 32, 2, 0},
{{1, 0, 0}, 0, 0, 0},
{{1, 0, 0}, 8, 0, 0},
};
hull_t hull_ridge = {
clipnodes_ridge,
planes_ridge,
0,
3,
{0, 0, 0},
{0, 0, 0},
};

View file

@ -10,3 +10,4 @@ extern hull_t hull_step3;
extern hull_t hull_covered_step;
extern hull_t hull_ramp;
extern hull_t hull_hole;
extern hull_t hull_ridge;

View file

@ -171,6 +171,9 @@ test_t tests[] = {
{ 1, -16, 0}, { 1, 16, 0}, { 0.25, 0, 0, 1, 0, 13}},
{"Box, Hole. edge", &box, &hull_hole,
{-1, -16, 0}, { -1, 16, 0}, { 0.25, 0, 0, 1, 0, 13}},
{"Box, ridge", &box, &hull_ridge,
{4, 41, 0}, { 4, 39, 0}, { 0.5, 0, 0, 1, 0, 8}},
};
#define num_tests (sizeof (tests) / sizeof (tests[0]))

View file

@ -95,6 +95,11 @@ test_t tests[] = {
{ 0, 0, 8}, { CONTENTS_EMPTY, 1}},
{"Box, ramp", &box, &hull_ramp,
{ 0, 0, 7}, { CONTENTS_SOLID, 3}},
{"Box, ridge", &box, &hull_ridge,
{ 4, 0, 40}, { CONTENTS_EMPTY, 1}},
{"Box, ridge", &box, &hull_ridge,
{ 4, 0, 39}, { CONTENTS_SOLID, 3}},
};
#define num_tests (sizeof (tests) / sizeof (tests[0]))