I don't know why this code has the value 176.0 all over it.
It seems a lot of viewport related code has it.
Maybe it's rendering at 640x352 or something and 176 is half of it?
but let me know if you know some secret Wii-176 connection

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

and it's not templated, I'd be able to tell from the function names.
currently figuring out which 3D primitives are which by looking at the volume(Primitive*) method and matching up the formulas

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.

the first half is the formula for a cylinder, but it's minus... half a sphere? what?

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 Does the game have global sound or auto-run script volumes? Reading this, if I make a level editor in the future, I'd probably implement them this way so they can still be placed as objects in the scene and won't require a separate GUI.