diff --git a/demo3.cpp b/demo3.cpp index 1191be2..fa57895 100644 --- a/demo3.cpp +++ b/demo3.cpp @@ -26,10 +26,192 @@ char ceilingColor = 0; #define HEIGHT_PROFILE_LENGTH 256 const int8_t heightProfile[] = { -9,9,9,10,10,10,11,11,12,13,13,14,14,14,15,15,15,16,16,16,16,16,15,15,15,14,14,13,13,12,11,10,10,9,9,9,8,8,8,8,8,8,7,7,7,6,5,4,4,3,3,3,3,3,3,4,5,7,8,10,11,12,12,13,13,13,14,16,19,20,21,21,22,22,22,23,23,23,23,22 -,22,21,20,19,18,18,17,17,17,17,16,16,16,16,16,16,16,15,15,15,14,14,13,12,11,10,8,7,6,5,5,5,4,4,4,4,4,5,5,5,6,6,7,7,7,8,8,8,8,8,8,8,7,7,7,7,6,6,5,4,4,3,2,2,2,1,1,1,1,2,3,5,6,7,9,13,13,13,18,18 -,22,22,22,22,22,22,21,21,20,20,19,16,16,16,14,14,14,15,15,15,15,15,16,17,17,18,18,18,16,16,16,16,15,15,15,14,14,13,12,8,7,7,7,8,9,11,12,12,13,13,13,12,11,10,10,10,10,11,11,12,13,13,12,12,11,11,10,10,9,9,9,9,9,9,10,10,11,12,13,13 -,14,14,14,14,14,13,13,12,11,11,11,11,10,10,10,10}; +9,9,9,10,10,10,11,11,12,13,13,14,14,14,15,15,15,16,16,16,16,16,15,15,15,14,14, +13,13,12,11,10,10,9,9,9,8,8,8,8,8,8,7,7,7,6,5,4,4,3,3,3,3,3,3,4,5,7,8,10,11,12, +12,13,13,13,14,16,19,20,21,21,22,22,22,23,23,23,23,22,22,21,20,19,18,18,17,17, +17,17,16,16,16,16,16,16,16,15,15,15,14,14,13,12,11,10,8,7,6,5,5,5,4,4,4,4,4,5, +5,5,6,6,7,7,7,8,8,8,8,8,8,8,7,7,7,7,6,6,5,4,4,3,2,2,2,1,1,1,1,2,3,5,6,7,9,13, +13,13,18,18,22,22,22,22,22,22,21,21,20,20,19,16,16,16,14,14,14,15,15,15,15,15, +16,17,17,18,18,18,16,16,16,16,15,15,15,14,14,13,12,8,7,7,7,8,9,11,12,12,13,13, +13,12,11,10,10,10,10,11,11,12,13,13,12,12,11,11,10,10,9,9,9,9,9,9,10,10,11,12, +13,13,14,14,14,14,14,13,13,12,11,11,11,11,10,10,10,10}; + +const unsigned char imageBackground[] = +{ 55, 44 // width, height + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xff,0xff + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2,0xd2,0xd2,0xff,0xff,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xd2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0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2,0xd2,0xd2,0xff,0xff,0xff,0xff,0xff + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2,0xd2,0xd2,0xff,0xff,0xff + ,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2,0xd2,0xd2,0xff + ,0xff,0xff,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2,0xd2 + ,0xff,0xff,0xff,0xff,0xff,0xff,0xd2,0xd2,0xff,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xd2,0xd2 + ,0xd2,0xd2,0xff,0xff,0xff,0xff,0xff,0xff,0xd2,0xd2,0xff,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0xd2,0xd2,0xd2,0xd2,0xd2,0xff,0xff,0xff,0xff,0xff,0xff,0xff + ,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xff,0xd2,0xff,0xff + ,0xff,0xff,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xff,0xff,0xff,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0xd2,0xff,0xff,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14 + ,0x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,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0xff,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0xff,0xff,0xff,0xd2,0xff,0xff,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0xff,0xff,0xff,0xd2,0xff,0xff,0xd2,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xff,0xff,0xff,0xd2,0xff,0xff + ,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xff,0xff,0xff,0xd2 + ,0xff,0xff,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xff,0xff + ,0xff,0xff,0xff,0xff,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0xff,0xd2,0xff,0xff,0xff,0xff,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0xff,0xd2,0xff,0xff,0xff,0xff,0xff,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0xff,0xd2,0xff,0xff,0xd2,0xff,0xff,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0xff,0xd2,0xff,0xff,0xd2,0xff,0xff,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2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,0x14,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xff,0xff,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2 + ,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xff,0xff,0xd2,0xd2,0xd2,0xd2 + ,0xd2,0xd2,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x14,0x14,0x14 + ,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 +}; Unit floorHeightAt(int16_t x, int16_t y) { @@ -38,6 +220,9 @@ Unit floorHeightAt(int16_t x, int16_t y) UNITS_PER_SQUARE; } +uint16_t previousColumn = 255; +uint16_t backgroundColumn = 0; + /** Function for drawing a single pixel (like fragment shader). */ @@ -45,19 +230,33 @@ inline void pixelFunc(PixelInfo pixel) { uint8_t c; - int16_t intensity = pixel.depth / (UNITS_PER_SQUARE * 5); + int16_t intensity = 0; if (pixel.isWall) { c = 50; - intensity += (pixel.hit.direction % 2 == 0 ? 2 : 0); + intensity = pixel.hit.direction % 2 == 0 ? 2 : 0; + } + else if (pixel.isFloor && !pixel.isHorizon) + { + c = floorColor; + intensity = pixel.depth / (UNITS_PER_SQUARE * 3); } else - c = pixel.isFloor && pixel.depth < UNITS_PER_SQUARE * 16 ? - floorColor : ceilingColor; + { + if (previousColumn == pixel.position.x) + { + c = imageBackground[2 + backgroundColumn * 44 + pixel.position.y / 2]; + } + else + { + backgroundColumn = absVal(pixel.position.x / 2 + (110 * player.mCamera.direction) / UNITS_PER_SQUARE) % 55; + previousColumn = pixel.position.x; + } + } - if (c != ceilingColor) - c = addRGB(c,intensity / 2,intensity / 2,intensity / 2); + if (intensity != 0) + c = addIntensity(c,intensity); uint8_t *buf = pokitto.display.screenbuffer; @@ -75,8 +274,8 @@ void draw() RayConstraints c; c.maxHits = 6; - c.maxSteps = 15; - c.computeTextureCoords = 1; + c.maxSteps = 12; + c.computeTextureCoords = 0; render(player.mCamera,floorHeightAt,0,0,pixelFunc,c); /*