Add floor textures
This commit is contained in:
parent
6b9de75174
commit
d573101459
1 changed files with 17 additions and 1 deletions
18
demo2.cpp
18
demo2.cpp
|
@ -28,6 +28,10 @@
|
|||
//#define NO_TEXTURES
|
||||
/* ^ Turns off textures and only uses colors, which increases FPS. */
|
||||
|
||||
//#define RCL_COMPUTE_FLOOR_TEXCOORDS 1
|
||||
/* ^ Turns on computation of texture coordinates for the floor in raycastlib
|
||||
and makes this demo render the textures. */
|
||||
|
||||
//#define NO_SHADING
|
||||
/* ^ Turns off shading (fog) which increases FPS. */
|
||||
|
||||
|
@ -53,7 +57,7 @@
|
|||
#define RCL_COMPUTE_WALL_TEXCOORDS 0
|
||||
#endif
|
||||
|
||||
#define FPS 256
|
||||
#define FPS 255
|
||||
#define HEAD_BOB_HEIGHT 200
|
||||
#define HEAD_BOB_STEP 20
|
||||
#define PLAYER_SPEED (5 * RCL_UNITS_PER_SQUARE)
|
||||
|
@ -947,7 +951,13 @@ inline void pixelFunc(RCL_PixelInfo *pixel)
|
|||
|
||||
if (!pixel->isWall)
|
||||
{
|
||||
#if RCL_COMPUTE_FLOOR_TEXCOORDS == 1
|
||||
c = pixel->depth > RCL_UNITS_PER_SQUARE * 5 ?
|
||||
textureAverageColors[1] :
|
||||
sampleImage(textures[1],pixel->texCoords.x,pixel->texCoords.y);
|
||||
#else
|
||||
c = pixel->isFloor ? cFloor: cCeiling;
|
||||
#endif
|
||||
|
||||
#ifndef NO_MIRROR
|
||||
int16_t intensity = pixel->isFloor ?
|
||||
|
@ -1079,6 +1089,12 @@ int main()
|
|||
|
||||
bool strafe = pokitto.aBtn();
|
||||
|
||||
if (pokitto.aBtn())
|
||||
player.mCamera.height += 50;
|
||||
|
||||
if (pokitto.bBtn())
|
||||
player.mCamera.height -= 50;
|
||||
|
||||
if (!strafe)
|
||||
{
|
||||
if (pokitto.upBtn())
|
||||
|
|
Loading…
Reference in a new issue