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