aboutsummaryrefslogtreecommitdiff
path: root/src/client/camera.cpp
Commit message (Collapse)AuthorAge
* Add nametag background setting and object property (#10937)rubenwardy2021-02-17
|
* Semi-transparent background for nametags (#10152)Zughy2020-12-14
|
* Darwin platform build fix (#10376)David CARLIER2020-09-09
| | | | the event header seemingly being generic with libevent thus renaming it. openal and opengl are deprecated on newer mac os releases thus suppressing the build warnings.
* Apply camera smoothing to 'air stepheight' (#10025)Paramat2020-07-05
| | | | | | | | Recent changes to collision code have changed the behaviour of the 'touching_ground' bool in movement code. This had the effect of disabling camera smoothing when 'air stepheight' occurred when jumping onto a node while pressing forwards against the node, causing an unpleasant sharp camera movement. Rewrite the conditions for camera smoothing such that it is applied when jumping.
* CSM: Bugfixes to camera:get_pos() and camera:get_fov()sfan52020-05-14
| | | closes #9857
* set_fov: Add support for time-based transitions (#9705)ANAND2020-05-02
|
* Reuse object_shader for "wielditem" and "item" entity drawtypes (#9537)Danila Shutov2020-04-19
|
* Camera: Fix shooting line offsets (#9681)SmallJoker2020-04-16
| | | | Removes duplicated offset calculations from Game and use whatever the Camera class returns. This keeps the eye position nicely in sync, and gets rid of duplicated code.
* Ignore near_plane setting on non-Android platforms (#8749)ANAND2020-03-28
| | | Camera's near-plane will be hard-coded to 0.1 on all non-Android platforms. The upper-bound of this setting has been reduced to 0.25, as 0.5 is just way too high.
* Improve arm physics (#9485)Jean-Patrick Guerrero2020-03-08
|
* Attachments: Fix interpolation from (0,0,0) after detachSmallJoker2019-12-07
| | | | | | GenericCAO::getPosition() did not take the camera offset into account LocalPlayer attachment cleanup: Use sane getParent() function Make that getPosition() (GenericCAO and LocalPlayer) always return the absolute position
* Add support for per-player FOV overrides and multipliersAnand S2019-09-19
|
* Load CSM environment after the restrictions are knownSmallJoker2019-09-14
| | | | | | | Safety-guards for CSM callbacks to abort on a bad implementation Only run callbacks when the mods are loaded (and with it: builtin) Duplication checks inside constructors
* Merge pull request #8776 from osjc/FixGetNodeJozef Behran2019-08-10
| | | Finish getNode cleanup
* Move client-specific files to 'src/client' (#7902)Quentin Bazin2018-11-28
Update Android.mk Remove 'src/client' from include_directories
l opt">) continue; // Sample size and total weighted r, g, b values. u32 ss = 0, sr = 0, sg = 0, sb = 0; // Walk each neighbor pixel (clipped to image bounds). for (u32 sy = (ctry < 1) ? 0 : (ctry - 1); sy <= (ctry + 1) && sy < dim.Height; sy++) for (u32 sx = (ctrx < 1) ? 0 : (ctrx - 1); sx <= (ctrx + 1) && sx < dim.Width; sx++) { // Ignore transparent pixels. irr::video::SColor d = src->getPixel(sx, sy); if (d.getAlpha() <= threshold) continue; // Add RGB values weighted by alpha. u32 a = d.getAlpha(); ss += a; sr += a * d.getRed(); sg += a * d.getGreen(); sb += a * d.getBlue(); } // If we found any neighbor RGB data, set pixel to average // weighted by alpha. if (ss > 0) { c.setRed(sr / ss); c.setGreen(sg / ss); c.setBlue(sb / ss); src->setPixel(ctrx, ctry, c); } } } /* Scale a region of an image into another image, using nearest-neighbor with * anti-aliasing; treat pixels as crisp rectangles, but blend them at boundaries * to prevent non-integer scaling ratio artifacts. Note that this may cause * some blending at the edges where pixels don't line up perfectly, but this * filter is designed to produce the most accurate results for both upscaling * and downscaling. */ void imageScaleNNAA(video::IImage *src, const core::rect<s32> &srcrect, video::IImage *dest) { double sx, sy, minsx, maxsx, minsy, maxsy, area, ra, ga, ba, aa, pw, ph, pa; u32 dy, dx; video::SColor pxl; // Cache rectsngle boundaries. double sox = srcrect.UpperLeftCorner.X * 1.0; double soy = srcrect.UpperLeftCorner.Y * 1.0; double sw = srcrect.getWidth() * 1.0; double sh = srcrect.getHeight() * 1.0; // Walk each destination image pixel. // Note: loop y around x for better cache locality. core::dimension2d<u32> dim = dest->getDimension(); for (dy = 0; dy < dim.Height; dy++) for (dx = 0; dx < dim.Width; dx++) { // Calculate floating-point source rectangle bounds. // Do some basic clipping, and for mirrored/flipped rects, // make sure min/max are in the right order. minsx = sox + (dx * sw / dim.Width); minsx = rangelim(minsx, 0, sw); maxsx = minsx + sw / dim.Width; maxsx = rangelim(maxsx, 0, sw); if (minsx > maxsx) SWAP(double, minsx, maxsx); minsy = soy + (dy * sh / dim.Height); minsy = rangelim(minsy, 0, sh); maxsy = minsy + sh / dim.Height; maxsy = rangelim(maxsy, 0, sh); if (minsy > maxsy) SWAP(double, minsy, maxsy); // Total area, and integral of r, g, b values over that area, // initialized to zero, to be summed up in next loops. area = 0; ra = 0; ga = 0; ba = 0; aa = 0; // Loop over the integral pixel positions described by those bounds. for (sy = floor(minsy); sy < maxsy; sy++) for (sx = floor(minsx); sx < maxsx; sx++) { // Calculate width, height, then area of dest pixel // that's covered by this source pixel. pw = 1; if (minsx > sx) pw += sx - minsx; if (maxsx < (sx + 1)) pw += maxsx - sx - 1; ph = 1; if (minsy > sy) ph += sy - minsy; if (maxsy < (sy + 1)) ph += maxsy - sy - 1; pa = pw * ph; // Get source pixel and add it to totals, weighted // by covered area and alpha. pxl = src->getPixel((u32)sx, (u32)sy); area += pa; ra += pa * pxl.getRed(); ga += pa * pxl.getGreen(); ba += pa * pxl.getBlue(); aa += pa * pxl.getAlpha(); } // Set the destination image pixel to the average color. if (area > 0) { pxl.setRed(ra / area + 0.5); pxl.setGreen(ga / area + 0.5); pxl.setBlue(ba / area + 0.5); pxl.setAlpha(aa / area + 0.5); } else { pxl.setRed(0); pxl.setGreen(0); pxl.setBlue(0); pxl.setAlpha(0); } dest->setPixel(dx, dy, pxl); } }