Bringing in some more realistic textures that are open source from https://opengameart.org/content/nekkrobox-world-textures
BIN
pics/chess.png
Normal file
After Width: | Height: | Size: 124 KiB |
BIN
pics/tile01.png
Normal file
After Width: | Height: | Size: 126 KiB |
BIN
pics/tile02.png
Normal file
After Width: | Height: | Size: 134 KiB |
BIN
pics/tile03.png
Normal file
After Width: | Height: | Size: 101 KiB |
BIN
pics/tile05.png
Normal file
After Width: | Height: | Size: 144 KiB |
BIN
pics/tile06.png
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
pics/tile07.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
pics/tile08.png
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
pics/tile09.png
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
pics/tile10.png
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
pics/tile11.png
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
pics/tile12.png
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
pics/tile13.png
Normal file
After Width: | Height: | Size: 120 KiB |
BIN
pics/tile15.png
Normal file
After Width: | Height: | Size: 115 KiB |
BIN
pics/tile16.png
Normal file
After Width: | Height: | Size: 132 KiB |
BIN
pics/tile17.png
Normal file
After Width: | Height: | Size: 140 KiB |
BIN
pics/tile30.png
Normal file
After Width: | Height: | Size: 405 KiB |
BIN
pics/tile31.png
Normal file
After Width: | Height: | Size: 97 KiB |
BIN
pics/tile32.png
Normal file
After Width: | Height: | Size: 124 KiB |
|
@ -57,8 +57,8 @@ double planeY = 0.66;
|
|||
#define gray_color(c) rgba_color(c, c, c, 255)
|
||||
|
||||
std::vector<uint32_t> 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;
|
||||
|
|