Rework shear

This commit is contained in:
Miloslav Číž 2018-09-08 07:09:46 +02:00
parent 6307d48599
commit a8b2a06aa2

View file

@ -685,6 +685,7 @@ public:
mCamera.height = UNITS_PER_SQUARE * 3; mCamera.height = UNITS_PER_SQUARE * 3;
mCamera.resolution.x = 110 / SUBSAMPLE; mCamera.resolution.x = 110 / SUBSAMPLE;
mCamera.resolution.y = 88; mCamera.resolution.y = 88;
mCamera.shear = 0;
mCamera.collisionRadius = UNITS_PER_SQUARE / 4; mCamera.collisionRadius = UNITS_PER_SQUARE / 4;
mCamera.collisionHeightBelow = UNITS_PER_SQUARE; mCamera.collisionHeightBelow = UNITS_PER_SQUARE;
@ -767,8 +768,6 @@ inline void pixelFunc(PixelInfo pixel)
unsigned short pal[256]; unsigned short pal[256];
Unit shear = 0;
void draw() void draw()
{ {
RayConstraints c; RayConstraints c;
@ -777,7 +776,7 @@ void draw()
c.maxSteps = 10; c.maxSteps = 10;
c.computeTextureCoords = 1; c.computeTextureCoords = 1;
render(player.mCamera,floorHeightAt,ceilingHeightAt,textureAt,pixelFunc,c,shear); render(player.mCamera,floorHeightAt,ceilingHeightAt,textureAt,pixelFunc,c);
Unit previousDepth; Unit previousDepth;
@ -877,7 +876,7 @@ int main()
if (strafe) if (strafe)
heightOffset = step; heightOffset = step;
else if (lookUpDown) else if (lookUpDown)
shear = min(shear + 100, 2 * UNITS_PER_SQUARE); player.mCamera.shear = min(player.mCamera.shear + 10,60);
else else
moveOffset = d; moveOffset = d;
} }
@ -886,16 +885,18 @@ int main()
if (strafe) if (strafe)
heightOffset = -step; heightOffset = -step;
else if (lookUpDown) else if (lookUpDown)
shear = max(shear - 100, -2 * UNITS_PER_SQUARE); player.mCamera.shear = max(player.mCamera.shear - 10,-60);
else else
{ {
moveOffset.x = -1 * d.x; moveOffset.x = -1 * d.x;
moveOffset.y = -1 * d.y; moveOffset.y = -1 * d.y;
} }
} }
else
if (!lookUpDown) player.mCamera.shear /= 2;
shear = shear / 2;
if (!lookUpDown)
player.mCamera.shear /= 2;
int addition = 0; int addition = 0;