Update
This commit is contained in:
parent
d573101459
commit
67992ff2eb
1 changed files with 20 additions and 12 deletions
32
demo2.cpp
32
demo2.cpp
|
@ -23,15 +23,22 @@
|
||||||
//#define RENDER_PRECISE
|
//#define RENDER_PRECISE
|
||||||
/* ^ Turns on rendering using a more precise but slower algorithm. This can
|
/* ^ Turns on rendering using a more precise but slower algorithm. This can
|
||||||
be seen at less shaky head bobbing when moving. However the latter
|
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
|
//#define NO_TEXTURES
|
||||||
/* ^ Turns off textures and only uses colors, which increases FPS. */
|
/* ^ 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
|
/* ^ Turns on computation of texture coordinates for the floor in raycastlib
|
||||||
and makes this demo render the textures. */
|
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
|
//#define NO_SHADING
|
||||||
/* ^ Turns off shading (fog) which increases FPS. */
|
/* ^ Turns off shading (fog) which increases FPS. */
|
||||||
|
|
||||||
|
@ -952,9 +959,12 @@ inline void pixelFunc(RCL_PixelInfo *pixel)
|
||||||
if (!pixel->isWall)
|
if (!pixel->isWall)
|
||||||
{
|
{
|
||||||
#if RCL_COMPUTE_FLOOR_TEXCOORDS == 1
|
#if RCL_COMPUTE_FLOOR_TEXCOORDS == 1
|
||||||
c = pixel->depth > RCL_UNITS_PER_SQUARE * 5 ?
|
if (pixel->isFloor)
|
||||||
textureAverageColors[1] :
|
c = pixel->depth > RCL_UNITS_PER_SQUARE * 5 ?
|
||||||
sampleImage(textures[1],pixel->texCoords.x,pixel->texCoords.y);
|
textureAverageColors[1] :
|
||||||
|
sampleImage(textures[1],pixel->texCoords.x / FLOOR_TEXTURE_SCALE,pixel->texCoords.y / FLOOR_TEXTURE_SCALE);
|
||||||
|
else
|
||||||
|
c = 0; // looks better :)
|
||||||
#else
|
#else
|
||||||
c = pixel->isFloor ? cFloor: cCeiling;
|
c = pixel->isFloor ? cFloor: cCeiling;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1008,7 +1018,9 @@ void draw()
|
||||||
c.maxHits = 1;
|
c.maxHits = 1;
|
||||||
c.maxSteps = 20;
|
c.maxSteps = 20;
|
||||||
|
|
||||||
|
#ifdef HEAD_BOB
|
||||||
player.mCamera.height += player.mHeadBob;
|
player.mCamera.height += player.mHeadBob;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef RENDER_PRECISE
|
#ifdef RENDER_PRECISE
|
||||||
RCL_render(player.mCamera,floorHeightAt,0,textureAt,c);
|
RCL_render(player.mCamera,floorHeightAt,0,textureAt,c);
|
||||||
|
@ -1016,7 +1028,9 @@ void draw()
|
||||||
RCL_renderSimple(player.mCamera,floorHeightAt,textureAt,rollAt,c);
|
RCL_renderSimple(player.mCamera,floorHeightAt,textureAt,rollAt,c);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HEAD_BOB
|
||||||
player.mCamera.height -= player.mHeadBob;
|
player.mCamera.height -= player.mHeadBob;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (shotFired)
|
if (shotFired)
|
||||||
{
|
{
|
||||||
|
@ -1043,7 +1057,7 @@ int main()
|
||||||
player.setPositionSquare(6,5);
|
player.setPositionSquare(6,5);
|
||||||
player.mCamera.height = RCL_CAMERA_COLL_HEIGHT_BELOW;
|
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 previousTime = 0;
|
||||||
uint32_t dt;
|
uint32_t dt;
|
||||||
|
@ -1089,12 +1103,6 @@ int main()
|
||||||
|
|
||||||
bool strafe = pokitto.aBtn();
|
bool strafe = pokitto.aBtn();
|
||||||
|
|
||||||
if (pokitto.aBtn())
|
|
||||||
player.mCamera.height += 50;
|
|
||||||
|
|
||||||
if (pokitto.bBtn())
|
|
||||||
player.mCamera.height -= 50;
|
|
||||||
|
|
||||||
if (!strafe)
|
if (!strafe)
|
||||||
{
|
{
|
||||||
if (pokitto.upBtn())
|
if (pokitto.upBtn())
|
||||||
|
|
Loading…
Reference in a new issue