mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-11-23 20:49:57 +01:00
Fix floor texturing
This commit is contained in:
parent
c903d801f8
commit
e2fbbd36e8
2 changed files with 11 additions and 13 deletions
|
@ -1249,7 +1249,7 @@ void _RCL_columnFunctionComplex(RCL_HitResult *hits, uint16_t hitCount, uint16_t
|
|||
RCL_Unit fPosY = _RCL_camera.resolution.y;
|
||||
RCL_Unit cPosY = -1;
|
||||
|
||||
// world coordinates
|
||||
// world coordinates (relative to camera height though)
|
||||
RCL_Unit fZ1World = _RCL_startFloorHeight;
|
||||
RCL_Unit cZ1World = _RCL_startCeil_Height;
|
||||
|
||||
|
@ -1320,6 +1320,8 @@ void _RCL_columnFunctionComplex(RCL_HitResult *hits, uint16_t hitCount, uint16_t
|
|||
p.depth = 0;
|
||||
#endif
|
||||
|
||||
p.hit = hit;
|
||||
|
||||
limit = _RCL_drawHorizontal(fPosY,fZ1Screen,cPosY + 1,
|
||||
_RCL_camera.resolution.y,fZ1World,-1,RCL_COMPUTE_FLOOR_DEPTH,
|
||||
// ^ purposfully allow outside screen bounds
|
||||
|
@ -1352,7 +1354,6 @@ void _RCL_columnFunctionComplex(RCL_HitResult *hits, uint16_t hitCount, uint16_t
|
|||
p.isWall = 1;
|
||||
p.depth = distance;
|
||||
p.isFloor = 1;
|
||||
p.hit = hit;
|
||||
p.texCoords.x = hit.textureCoord;
|
||||
p.height = 0; // don't compute this, no use
|
||||
|
||||
|
|
17
testSDL.c
17
testSDL.c
|
@ -12,11 +12,7 @@
|
|||
|
||||
//#define RCL_USE_DIST_APPROX 2
|
||||
|
||||
// redefine some parameters
|
||||
#define FPS 40
|
||||
#define GRAVITY_ACCELERATION (RCL_UNITS_PER_SQUARE * 3)
|
||||
#define PLAYER_JUMP_SPEED 700
|
||||
#define RCL_CAMERA_COLL_HEIGHT_BELOW ((3 * RCL_UNITS_PER_SQUARE) / 2)
|
||||
#define RCL_COMPUTE_FLOOR_TEXCOORDS 1
|
||||
#define RCL_HORIZONTAL_FOV (RCL_UNITS_PER_SQUARE / 5)
|
||||
#define RCL_VERTICAL_FOV RCL_UNITS_PER_SQUARE // redefine camera vertical FOV
|
||||
|
||||
|
@ -878,7 +874,7 @@ void pixelFunc(RCL_PixelInfo *pixel)
|
|||
if (pixel->isWall)
|
||||
c = sampleImage(textures[pixel->hit.type],pixel->texCoords.x,pixel->texCoords.y);
|
||||
else
|
||||
c = pixel->isFloor ? 0b00010001 : 0b00001010;
|
||||
c = sampleImage(textures[0],pixel->texCoords.x,pixel->texCoords.y); //pixel->isFloor ? 0b00010001 : 0b00001010;
|
||||
|
||||
// int intensity = pixel->depth - 8 * RCL_UNITS_PER_SQUARE;
|
||||
int intensity = pixel->depth - 8 * RCL_UNITS_PER_SQUARE;
|
||||
|
@ -913,6 +909,7 @@ if (pixel->isWall)
|
|||
else
|
||||
c = pixel->isFloor ? 0x00FF0000 : 0x00F00000;
|
||||
*/
|
||||
|
||||
pixels[index] = r | g | b;
|
||||
pixelCounter[index]++;
|
||||
}
|
||||
|
@ -983,11 +980,11 @@ int main()
|
|||
placeSprite(6,sprite3,16,12,1,3000);
|
||||
|
||||
#undef placeSprite
|
||||
camera.position.x = RCL_UNITS_PER_SQUARE * 5;
|
||||
camera.position.y = RCL_UNITS_PER_SQUARE * 4;
|
||||
camera.position.x = 25699;
|
||||
camera.position.y = 10717;
|
||||
camera.shear = 0;
|
||||
camera.direction = 0;
|
||||
camera.height = RCL_UNITS_PER_SQUARE * 2;
|
||||
camera.direction = -205;
|
||||
camera.height = 2048;
|
||||
camera.resolution.x = SCREEN_WIDTH;
|
||||
camera.resolution.y = SCREEN_HEIGHT;
|
||||
|
||||
|
|
Loading…
Reference in a new issue