Update
This commit is contained in:
parent
d573101459
commit
67992ff2eb
1 changed files with 20 additions and 12 deletions
28
demo2.cpp
28
demo2.cpp
|
@ -23,15 +23,22 @@
|
|||
//#define RENDER_PRECISE
|
||||
/* ^ 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 rolling doors (these will be turned off). */
|
||||
algorithm doesn't support some features (rooling doors, floor textures,
|
||||
...). */
|
||||
|
||||
//#define NO_TEXTURES
|
||||
/* ^ Turns off textures and only uses colors, which increases FPS. */
|
||||
|
||||
//#define RCL_COMPUTE_FLOOR_TEXCOORDS 1
|
||||
#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 FLOOR_TEXTURE_SCALE 2
|
||||
/* ^ Scales the floor texture if RCL_COMPUTE_FLOOR_TEXCOORDS is on. */
|
||||
|
||||
//#define HEAD_BOB
|
||||
/* ^ Turns on head bobbing. */
|
||||
|
||||
//#define NO_SHADING
|
||||
/* ^ Turns off shading (fog) which increases FPS. */
|
||||
|
||||
|
@ -952,9 +959,12 @@ inline void pixelFunc(RCL_PixelInfo *pixel)
|
|||
if (!pixel->isWall)
|
||||
{
|
||||
#if RCL_COMPUTE_FLOOR_TEXCOORDS == 1
|
||||
if (pixel->isFloor)
|
||||
c = pixel->depth > RCL_UNITS_PER_SQUARE * 5 ?
|
||||
textureAverageColors[1] :
|
||||
sampleImage(textures[1],pixel->texCoords.x,pixel->texCoords.y);
|
||||
sampleImage(textures[1],pixel->texCoords.x / FLOOR_TEXTURE_SCALE,pixel->texCoords.y / FLOOR_TEXTURE_SCALE);
|
||||
else
|
||||
c = 0; // looks better :)
|
||||
#else
|
||||
c = pixel->isFloor ? cFloor: cCeiling;
|
||||
#endif
|
||||
|
@ -1008,7 +1018,9 @@ void draw()
|
|||
c.maxHits = 1;
|
||||
c.maxSteps = 20;
|
||||
|
||||
#ifdef HEAD_BOB
|
||||
player.mCamera.height += player.mHeadBob;
|
||||
#endif
|
||||
|
||||
#ifdef RENDER_PRECISE
|
||||
RCL_render(player.mCamera,floorHeightAt,0,textureAt,c);
|
||||
|
@ -1016,7 +1028,9 @@ void draw()
|
|||
RCL_renderSimple(player.mCamera,floorHeightAt,textureAt,rollAt,c);
|
||||
#endif
|
||||
|
||||
#ifdef HEAD_BOB
|
||||
player.mCamera.height -= player.mHeadBob;
|
||||
#endif
|
||||
|
||||
if (shotFired)
|
||||
{
|
||||
|
@ -1043,7 +1057,7 @@ int main()
|
|||
player.setPositionSquare(6,5);
|
||||
player.mCamera.height = RCL_CAMERA_COLL_HEIGHT_BELOW;
|
||||
|
||||
player.mCamera.resolution.y = INFO_BAR_START + 1;
|
||||
player.mCamera.resolution.y = INFO_BAR_START + 2;
|
||||
|
||||
uint32_t previousTime = 0;
|
||||
uint32_t dt;
|
||||
|
@ -1089,12 +1103,6 @@ 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