Files
@ r27569:6a9aa0750697
Branch filter:
Location: cpp/openttd-patchpack/source/src/tests/landscape_partial_pixel_z.cpp
r27569:6a9aa0750697
30.1 KiB
text/x-c
Codechange: remove need for GetDParamX
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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | /*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD 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 General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file landscape_partial_pixel_z.cpp Tests for consistency/validity of the results of GetPartialPixelZ. */
#include "../stdafx.h"
#include "../3rdparty/catch2/catch.hpp"
#include "../landscape.h"
#include "../slope_func.h"
/**
* Check whether the addition of two slope's GetPartialPixelZ values results in
* the GetPartialPixelZ values of the expected slope.
* This iterates over all sub-pixel locations within a single tile.
* @param slope_expected The slope that is expected.
* @param slope_a The first slope of the addition.
* @param slope_b The second slope of the addition.
* @return True iff at all GetPartialPixelZ results are the same for each sub-tile position.
*/
bool CheckPartialPixelZSlopeAddition(Slope slope_expected, Slope slope_a, Slope slope_b)
{
for (uint x = 0; x < TILE_SIZE; x++) {
for (uint y = 0; y < TILE_SIZE; y++) {
int z_a = GetPartialPixelZ(x, y, slope_a);
int z_b = GetPartialPixelZ(x, y, slope_b);
int z_result = GetPartialPixelZ(x, y, slope_expected);
if (z_result != z_a + z_b) return false;
}
}
return true;
}
TEST_CASE("PartialPixelSlopeAdditionTest - A one corner slope, plus the opposite three corner slope results in a flat but elevated slope")
{
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_ELEVATED, SLOPE_N, SLOPE_WSE));
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_ELEVATED, SLOPE_E, SLOPE_NWS));
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_ELEVATED, SLOPE_S, SLOPE_ENW));
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_ELEVATED, SLOPE_W, SLOPE_SEN));
}
TEST_CASE("PartialPixelSlopeAdditionTest - Diagonal slopes with their opposite slope result in a flat but elevated slope")
{
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_ELEVATED, SLOPE_NW, SLOPE_SE));
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_ELEVATED, SLOPE_SW, SLOPE_NE));
}
TEST_CASE("PartialPixelSlopeAdditionTest - Half tile slopes with their opposite half tile slope result in a flat but elevated slope")
{
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_ELEVATED, HalftileSlope(SLOPE_N, CORNER_N), HalftileSlope(SLOPE_S, CORNER_S)));
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_ELEVATED, HalftileSlope(SLOPE_E, CORNER_E), HalftileSlope(SLOPE_W, CORNER_W)));
}
TEST_CASE("PartialPixelSlopeAdditionTest - Two opposite one corner slopes result in the two corner slope with opposite corners")
{
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_NS, SLOPE_N, SLOPE_S));
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_EW, SLOPE_E, SLOPE_W));
}
TEST_CASE("PartialPixelSlopeAdditionTest - A steep slope is a one corner slope on top of a three corner slope")
{
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_STEEP_N, SLOPE_N, SLOPE_ENW));
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_STEEP_E, SLOPE_E, SLOPE_SEN));
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_STEEP_S, SLOPE_S, SLOPE_WSE));
CHECK(CheckPartialPixelZSlopeAddition(SLOPE_STEEP_W, SLOPE_W, SLOPE_NWS));
}
TEST_CASE("PartialPixelSlopeAdditionTest - A half tile steep slope is a one corner half tile on top of a three corner slope")
{
CHECK(CheckPartialPixelZSlopeAddition(HalftileSlope(SLOPE_STEEP_N, CORNER_N), HalftileSlope(SLOPE_N, CORNER_N), SLOPE_ENW));
CHECK(CheckPartialPixelZSlopeAddition(HalftileSlope(SLOPE_STEEP_E, CORNER_E), HalftileSlope(SLOPE_E, CORNER_E), SLOPE_SEN));
CHECK(CheckPartialPixelZSlopeAddition(HalftileSlope(SLOPE_STEEP_S, CORNER_S), HalftileSlope(SLOPE_S, CORNER_S), SLOPE_WSE));
CHECK(CheckPartialPixelZSlopeAddition(HalftileSlope(SLOPE_STEEP_W, CORNER_W), HalftileSlope(SLOPE_W, CORNER_W), SLOPE_NWS));
}
/**
* Check whether the partial pixel Z values are the expected values. The arrays
* are as if the map is rotated 45 degrees counterclockwise.
* @param slope The slope that is to be checked.
* @param expected The expect partial pixels Z values.
* @return True iff at all GetPartialPixelZ results are the same as the expected Z-coordinates.
*/
bool CheckPartialPixelZ(Slope slope, std::array<int, TILE_SIZE * TILE_SIZE> expected)
{
for (uint i = 0; i < expected.size(); i++) {
int actual = GetPartialPixelZ(GB(i, 4, 4), GB(i, 0, 4), slope);
if (actual != expected[i]) return false;
}
return true;
}
TEST_CASE("PartialPixelTest - One corner up slopes - SLOPE_N")
{
CHECK(CheckPartialPixelZ(SLOPE_N, {
8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0,
7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0,
7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0,
6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0,
6, 5, 5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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}));
}
TEST_CASE("PartialPixelTest - Normal half tile slopes - SLOPE/CORNER_E")
{
CHECK(CheckPartialPixelZ(HalftileSlope(SLOPE_E, CORNER_E), {
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8,
0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}));
}
TEST_CASE("PartialPixelTest - Normal half tile slopes - SLOPE/CORNER_S")
{
CHECK(CheckPartialPixelZ(HalftileSlope(SLOPE_S, CORNER_S), {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0,
8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0}));
}
TEST_CASE("PartialPixelTest - Steep slopes - SLOPE_STEEP_N")
{
CHECK(CheckPartialPixelZ(SLOPE_STEEP_N, {
16, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8,
15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8,
15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7,
14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7,
14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6,
13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6,
13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5,
12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5,
12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4,
11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4,
11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3,
10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3,
10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2,
9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2,
9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1,
8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1}));
}
TEST_CASE("PartialPixelTest - Steep slopes - SLOPE_STEEP_E")
{
CHECK(CheckPartialPixelZ(SLOPE_STEEP_E, {
8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16,
8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15,
7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15,
7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14,
6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14,
6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13,
5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13,
5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12,
4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12,
4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11,
3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10,
2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10,
2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9,
1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8}));
}
TEST_CASE("PartialPixelTest - Steep slopes - SLOPE_STEEP_S")
{
CHECK(CheckPartialPixelZ(SLOPE_STEEP_S, {
0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8,
1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8,
1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9,
2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10,
3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10,
3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11,
4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12,
5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12,
5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13,
6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13,
6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14,
7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14,
7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15,
8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15}));
}
TEST_CASE("PartialPixelTest - Steep slopes - SLOPE_STEEP_W")
{
CHECK(CheckPartialPixelZ(SLOPE_STEEP_W, {
8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0,
8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1,
9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1,
9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2,
10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2,
10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3,
11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3,
11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4,
12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4,
12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5,
13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5,
13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6,
14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6,
14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7,
15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7,
15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8}));
}
TEST_CASE("PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_N")
{
CHECK(CheckPartialPixelZ(HalftileSlope(SLOPE_STEEP_N, CORNER_N), {
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5,
16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5,
16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4,
16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4,
16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3,
16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3,
16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2,
16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2,
16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1,
16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1}));
}
TEST_CASE("PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_E")
{
CHECK(CheckPartialPixelZ(HalftileSlope(SLOPE_STEEP_E, CORNER_E), {
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16,
4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16,
4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16,
3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16,
3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16,
2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16,
2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16,
1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16,
1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16}));
}
TEST_CASE("PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_S")
{
CHECK(CheckPartialPixelZ(HalftileSlope(SLOPE_STEEP_S, CORNER_S), {
0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8,
1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16,
1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16,
2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16,
2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16,
3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16,
3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16,
4, 4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16,
4, 5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16,
5, 5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16,
5, 6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
6, 6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
6, 7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
7, 7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
7, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}));
}
TEST_CASE("PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_W")
{
CHECK(CheckPartialPixelZ(HalftileSlope(SLOPE_STEEP_W, CORNER_W), {
8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0,
16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1,
16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1,
16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2,
16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2,
16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3,
16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3,
16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4, 4,
16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5, 4,
16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5, 5,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6, 5,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6, 6,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7, 6,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 7,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8}));
}
|