diff --git a/pics/chess.png b/pics/chess.png new file mode 100644 index 0000000..c9da7b5 Binary files /dev/null and b/pics/chess.png differ diff --git a/pics/tile01.png b/pics/tile01.png new file mode 100644 index 0000000..74fa8b6 Binary files /dev/null and b/pics/tile01.png differ diff --git a/pics/tile02.png b/pics/tile02.png new file mode 100644 index 0000000..af7a2aa Binary files /dev/null and b/pics/tile02.png differ diff --git a/pics/tile03.png b/pics/tile03.png new file mode 100644 index 0000000..5d95c4d Binary files /dev/null and b/pics/tile03.png differ diff --git a/pics/tile05.png b/pics/tile05.png new file mode 100644 index 0000000..5d4c2f9 Binary files /dev/null and b/pics/tile05.png differ diff --git a/pics/tile06.png b/pics/tile06.png new file mode 100644 index 0000000..2d6e09b Binary files /dev/null and b/pics/tile06.png differ diff --git a/pics/tile07.png b/pics/tile07.png new file mode 100644 index 0000000..c25c2c8 Binary files /dev/null and b/pics/tile07.png differ diff --git a/pics/tile08.png b/pics/tile08.png new file mode 100644 index 0000000..a3fca51 Binary files /dev/null and b/pics/tile08.png differ diff --git a/pics/tile09.png b/pics/tile09.png new file mode 100644 index 0000000..d6ce855 Binary files /dev/null and b/pics/tile09.png differ diff --git a/pics/tile10.png b/pics/tile10.png new file mode 100644 index 0000000..7b729e1 Binary files /dev/null and b/pics/tile10.png differ diff --git a/pics/tile11.png b/pics/tile11.png new file mode 100644 index 0000000..cc426e8 Binary files /dev/null and b/pics/tile11.png differ diff --git a/pics/tile12.png b/pics/tile12.png new file mode 100644 index 0000000..e4b478c Binary files /dev/null and b/pics/tile12.png differ diff --git a/pics/tile13.png b/pics/tile13.png new file mode 100644 index 0000000..997a1b0 Binary files /dev/null and b/pics/tile13.png differ diff --git a/pics/tile15.png b/pics/tile15.png new file mode 100644 index 0000000..8263a7d Binary files /dev/null and b/pics/tile15.png differ diff --git a/pics/tile16.png b/pics/tile16.png new file mode 100644 index 0000000..d343c2a Binary files /dev/null and b/pics/tile16.png differ diff --git a/pics/tile17.png b/pics/tile17.png new file mode 100644 index 0000000..9199b16 Binary files /dev/null and b/pics/tile17.png differ diff --git a/pics/tile30.png b/pics/tile30.png new file mode 100644 index 0000000..891a37d Binary files /dev/null and b/pics/tile30.png differ diff --git a/pics/tile31.png b/pics/tile31.png new file mode 100644 index 0000000..c702c42 Binary files /dev/null and b/pics/tile31.png differ diff --git a/pics/tile32.png b/pics/tile32.png new file mode 100644 index 0000000..a41c174 Binary files /dev/null and b/pics/tile32.png differ diff --git a/sfmlcaster.cpp b/sfmlcaster.cpp index e6a4ede..bf64b2e 100644 --- a/sfmlcaster.cpp +++ b/sfmlcaster.cpp @@ -57,8 +57,8 @@ double planeY = 0.66; #define gray_color(c) rgba_color(c, c, c, 255) std::vector texture[8]; -#define texWidth 64 // must be power of two -#define texHeight 64 // must be power of two +#define texWidth 256 // must be power of two +#define texHeight 256 // must be power of two #define pixcoord(X, Y) ((Y) * SCREEN_HEIGHT) + (X) @@ -80,14 +80,14 @@ void load_textures() { texture[i].resize(texWidth * texHeight); } - loadImage(texture[0], "pics/eagle.png"); - loadImage(texture[1], "pics/redbrick.png"); - loadImage(texture[2], "pics/purplestone.png"); - loadImage(texture[3], "pics/greystone.png"); - loadImage(texture[4], "pics/bluestone.png"); - loadImage(texture[5], "pics/mossy.png"); - loadImage(texture[6], "pics/wood.png"); - loadImage(texture[7], "pics/colorstone.png"); + loadImage(texture[0], "pics/tile16.png"); + loadImage(texture[1], "pics/tile02.png"); + loadImage(texture[2], "pics/tile03.png"); + loadImage(texture[3], "pics/tile32.png"); + loadImage(texture[4], "pics/tile05.png"); + loadImage(texture[5], "pics/tile17.png"); + loadImage(texture[6], "pics/tile10.png"); + loadImage(texture[7], "pics/tile01.png"); } void draw_sfml_rect(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, uint8_t color) { @@ -274,7 +274,6 @@ void ray_casting(sf::RenderWindow &window, Matrix& map) { double texPos = (drawStart - PITCH - h / 2 + lineHeight / 2) * step; for(int y = drawStart; y < drawEnd; y++) { - // BUG? Why bitwise and here? int texY = (int)texPos & (texHeight - 1); texPos += step; uint32_t color = texture[texNum][texHeight * texY + texX]; @@ -315,9 +314,7 @@ void draw_ceiling_floor(sf::RenderWindow &window) { floorX += floorStepX; floorY += floorStepY; - int checkerBoardPattern = int(cellX + cellY) & 1; - int floorTexture = checkerBoardPattern == 0 ? 3 : 4; - + int floorTexture = 3; int ceilingTexture = 6; uint32_t color;