It seems a lot of viewport related code has it.
Maybe it's rendering at 640x352 or something and 176 is half of it?
1/ SQRT(0.0) ?
uhhhh
are you just trying to explode math?
ghidra what kind of type inference is it that you assume the return value of operator_new is an int?
WHEN HAS OPERATOR NEW EVER RETURNED AN INT?
oh nice. I'm retyping it to RenderPass*, then I click away into another function, then click back, and it's an int again.
what is going on, ghidra?
oh it's actually weirder: it's not resetting the decompilation after I switch away.
it's reshuffling the identically named functions, so that when I click on the first one, it's a different one. one I haven't typed yet
I really hope the original source of this engine used heavy use of macros.
because otherwise there are multiple places where they had to copy-paste functions like 70 times
okay it turned out to be only 22 times for this function
but all 22 functions are identical other than which type they take in and which vtable pointer they apply.
Maybe that's getting automatically generated by C++ default compilers? I hope so
4.1887903? that's a sphere!
1.0471976? a cone!
(those constants are π*4/3 and π/3)
I'm not sure what this one is.
it seems to be (pi * h * w²) - (pi*2/3 * w³)
I thought maybe torus but nope, that's not the volume for torus.
it's also got a shape_7 which is... weird.
Volume is infinity. when you try to test against if you intersect it, the answer is "yes", no matter what.
It's like... everywhere?
is this primitive shape... god?
@foone One could make a very challenging puzzle game where you're presented with a random line of legacy FORTRAN source code that contains a floating-point literal, and you have to discover what it means. Hints are subroutine/function name and the name of the application it's from.
This is either a twisted and sad puzzle game or a genius move to modernize old code by duping players into being Mechanical Turks.
Recognizing magic numbers is critical, especially when constants vary throughout a code (9.8, 9.81, 9.805). It also helps to recognize stupid unit conversion factors (459.67).