Tune the parameters

This commit is contained in:
Miloslav Číž 2018-09-25 10:04:16 +02:00
parent 98efa53671
commit 6b0f5e86fb
2 changed files with 18 additions and 7 deletions

View file

@ -22,9 +22,8 @@
//#define RENDER_COMPLEX
/* ^ Turns on rendering using a more precise but slower algorithm. This can
be seen at less shaky head bobbing when moving. However the latter
algorithm doesn't support some features (rooling doors, floor textures,
...). */
be seen at less shaky head bobbing when moving. However it doesn't
support many other features, so the result actually looks worse. */
//#define NO_TEXTURES
/* ^ Turns off textures and only uses colors, which increases FPS. */
@ -927,7 +926,7 @@ int16_t intensity = 0;
if (pixel->isFloor)
{
if (pixel->texCoords.y > 3 * RCL_UNITS_PER_SQUARE) // leave astrip of untextured floor
color = pixel->depth > RCL_UNITS_PER_SQUARE * 5 ?
color = pixel->depth > (RCL_UNITS_PER_SQUARE * 6 + RCL_UNITS_PER_SQUARE / 2) ?
textureAverageColors[1] :
sampleImage(textures[1],pixel->texCoords.x / FLOOR_TEXTURE_SCALE,pixel->texCoords.y / FLOOR_TEXTURE_SCALE);
else
@ -953,9 +952,9 @@ int16_t intensity = 0;
#ifndef NO_MIRROR
intensity = pixel->isFloor ?
-1 * (pixel->depth - mirror * 128) / RCL_UNITS_PER_SQUARE : 0;
2 - (pixel->depth - mirror * 128) / RCL_UNITS_PER_SQUARE : 0;
#else
intensity = -1 * pixel->depth / (RCL_UNITS_PER_SQUARE * 2);
intensity = 2 - pixel->depth / (RCL_UNITS_PER_SQUARE * 2);
#endif
color = addIntensity(color,intensity);
@ -1065,7 +1064,9 @@ int main()
cFloor = rgbToIndex(3,3,2);
cCeiling = rgbToIndex(3,2,0);
player.setPositionSquare(6,5);
player.setPositionSquare(9,1);
//player.mCamera.position.y -= RCL_UNITS_PER_SQUARE / 2;
//player.mCamera.direction = -50;
player.mCamera.height = RCL_CAMERA_COLL_HEIGHT_BELOW;
player.mCamera.resolution.y = RESOLUTION_Y;

View file

@ -174,6 +174,16 @@ inline uint8_t addRGB(uint8_t color, int16_t red, int16_t green, int16_t blue)
return rgbToIndex(r,g,b);
}
/**
Inits a color gradient from darkest (0, -7 intensity) to brightest
(14, +7 intensity). Index 7 will have the base color.
*/
void initGradient(unsigned char dest[15], unsigned char baseColor)
{
for (int8_t i = 0; i < 15; ++i)
dest[i] = addIntensity(baseColor, i - 7);
}
/**
Samples an image by normalized coordinates - each coordinate is in range
0 to RCL_UNITS_PER_SQUARE (from raycastlib).