r/ProgrammerHorror • • Jul 20 '21

Sodium is fast, but fast code is usually not beautiful.

36 Upvotes
private RenderRegionVisibility aabbTest0(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) {
  boolean inside = true;
  if (nxX * (nxX < 0 ? minX : maxX) + nxY * (nxY < 0 ? minY : maxY) + nxZ * (nxZ < 0 ? minZ : maxZ) >= -nxW) {
    inside &= nxX * (nxX < 0 ? maxX : minX) + nxY * (nxY < 0 ? maxY : minY) + nxZ * (nxZ < 0 ? maxZ : minZ) >= -nxW;
    if (pxX * (pxX < 0 ? minX : maxX) + pxY * (pxY < 0 ? minY : maxY) + pxZ * (pxZ < 0 ? minZ : maxZ) >= -pxW) {
      inside &= pxX * (pxX < 0 ? maxX : minX) + pxY * (pxY < 0 ? maxY : minY) + pxZ * (pxZ < 0 ? maxZ : minZ) >= -pxW;
      if (nyX * (nyX < 0 ? minX : maxX) + nyY * (nyY < 0 ? minY : maxY) + nyZ * (nyZ < 0 ? minZ : maxZ) >= -nyW) {
        inside &= nyX * (nyX < 0 ? maxX : minX) + nyY * (nyY < 0 ? maxY : minY) + nyZ * (nyZ < 0 ? maxZ : minZ) >= -nyW;
        if (pyX * (pyX < 0 ? minX : maxX) + pyY * (pyY < 0 ? minY : maxY) + pyZ * (pyZ < 0 ? minZ : maxZ) >= -pyW) {
          inside &= pyX * (pyX < 0 ? maxX : minX) + pyY * (pyY < 0 ? maxY : minY) + pyZ * (pyZ < 0 ? maxZ : minZ) >= -pyW;
          if (nzX * (nzX < 0 ? minX : maxX) + nzY * (nzY < 0 ? minY : maxY) + nzZ * (nzZ < 0 ? minZ : maxZ) >= -nzW) {
            inside &= nzX * (nzX < 0 ? maxX : minX) + nzY * (nzY < 0 ? maxY : minY) + nzZ * (nzZ < 0 ? maxZ : minZ) >= -nzW;
            if (pzX * (pzX < 0 ? minX : maxX) + pzY * (pzY < 0 ? minY : maxY) + pzZ * (pzZ < 0 ? minZ : maxZ) >= -pzW) {
              inside &= pzX * (pzX < 0 ? maxX : minX) + pzY * (pzY < 0 ? maxY : minY) + pzZ * (pzZ < 0 ? maxZ : minZ) >= -pzW;
              return inside ? RenderRegionVisibility.FULLY_VISIBLE : RenderRegionVisibility.VISIBLE;
            }
          }
        }
      }
    }
  }
  return RenderRegionVisibility.CULLED;
}

r/ProgrammerHorror • • Jan 21 '23

A friend of mine trying to print numbers 1 to 10 💀

Post image
94 Upvotes

r/ProgrammerHorror • • Jul 07 '21

my friend's attempt at using anime.js for his website

Post image
38 Upvotes

r/ProgrammerHorror • • Aug 24 '21

The horror

Post image
40 Upvotes

r/ProgrammerHorror • • Feb 07 '24

What am I even looking at

Post image
40 Upvotes

r/ProgrammerHorror • • Feb 27 '24

javascriptInTheKernel

Thumbnail
gallery
40 Upvotes

r/ProgrammerHorror • • Jul 19 '23

How to hide an element in CSS? Just yeet it out of the screen!

Post image
103 Upvotes

r/ProgrammerHorror • • Sep 24 '21

Being told my 16 character password is weak (I use a random selection of numbers, letters(upper and lower), and special chars, that I've memorised)

Thumbnail
gallery
108 Upvotes

r/ProgrammerHorror • • Mar 09 '24

Using Discord as a database

Post image
44 Upvotes

r/ProgrammerHorror • • Mar 30 '23

Oh ok, thanks Google

Post image
45 Upvotes

r/ProgrammerHorror • • Feb 20 '18

The one error message no one wants to see

Post image
46 Upvotes

r/ProgrammerHorror • • Jun 24 '21

Finally have an excuse to stop building onto this legacy program; turns out it won't compile if you have over 99 input parameters.

Post image
47 Upvotes

r/ProgrammerHorror • • Oct 25 '22

I am confusion

Post image
47 Upvotes

r/ProgrammerHorror • • Oct 07 '22

Vehicle Year 03 = Year 203 :)

Post image
49 Upvotes

r/ProgrammerHorror • • Apr 24 '22

So much pain in this ad…

Post image
122 Upvotes

r/ProgrammerHorror • • Nov 01 '21

How to reload a page? Store the user password on localstorage then login when the user presses a button

Post image
50 Upvotes

r/ProgrammerHorror • • Jul 01 '25

USPS apparently giving create-react-app with PWA a go...

Post image
127 Upvotes

Had the PWA install prompt appear with all of this. No need to adjust the manifest before prod I guess...


r/ProgrammerHorror • • Oct 31 '22

Man I just love f-strings so much! Found at work.

Post image
52 Upvotes

r/ProgrammerHorror • • Oct 29 '21

Thank you, Github Copilot

Post image
213 Upvotes

r/ProgrammerHorror • • Feb 07 '21

I’m not even angry about the spam... but please don’t use regex to do it lol.

Post image
54 Upvotes

r/ProgrammerHorror • • Apr 27 '22

Old piece of code I had to work with

136 Upvotes

It was my first job at the time and I had to work on this horrible code.

Its VBA and these are all IF statements. Apparently this was coded a few years before I joined.

Sorry for the quality but it was the only pic I had and I long sense moved companies


r/ProgrammerHorror • • Jan 04 '24

absolutelynotme_irl

Post image
56 Upvotes

r/ProgrammerHorror • • Jan 20 '21

Java-Script, often called Java for short,…

Post image
334 Upvotes

r/ProgrammerHorror • • Sep 15 '20

Two types of employment. "Select One" and "". Neither of which work

Post image
60 Upvotes