Add background

This commit is contained in:
Miloslav Číž 2018-09-10 12:38:34 +02:00
parent 186f902ff9
commit 33d8b24379

223
demo3.cpp
View file

@ -26,10 +26,192 @@ char ceilingColor = 0;
#define HEIGHT_PROFILE_LENGTH 256 #define HEIGHT_PROFILE_LENGTH 256
const int8_t heightProfile[] = { 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 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,
,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 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,
,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 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,
,14,14,14,14,14,13,13,12,11,11,11,11,10,10,10,10}; 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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14,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
,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xd2,0xd2,0xd2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x14,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) Unit floorHeightAt(int16_t x, int16_t y)
{ {
@ -38,6 +220,9 @@ Unit floorHeightAt(int16_t x, int16_t y)
UNITS_PER_SQUARE; UNITS_PER_SQUARE;
} }
uint16_t previousColumn = 255;
uint16_t backgroundColumn = 0;
/** /**
Function for drawing a single pixel (like fragment shader). Function for drawing a single pixel (like fragment shader).
*/ */
@ -45,19 +230,33 @@ inline void pixelFunc(PixelInfo pixel)
{ {
uint8_t c; uint8_t c;
int16_t intensity = pixel.depth / (UNITS_PER_SQUARE * 5); int16_t intensity = 0;
if (pixel.isWall) if (pixel.isWall)
{ {
c = 50; 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 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) if (intensity != 0)
c = addRGB(c,intensity / 2,intensity / 2,intensity / 2); c = addIntensity(c,intensity);
uint8_t *buf = pokitto.display.screenbuffer; uint8_t *buf = pokitto.display.screenbuffer;
@ -75,8 +274,8 @@ void draw()
RayConstraints c; RayConstraints c;
c.maxHits = 6; c.maxHits = 6;
c.maxSteps = 15; c.maxSteps = 12;
c.computeTextureCoords = 1; c.computeTextureCoords = 0;
render(player.mCamera,floorHeightAt,0,0,pixelFunc,c); render(player.mCamera,floorHeightAt,0,0,pixelFunc,c);
/* /*