SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
MercatorTransformCube.cpp
1#include "Game/AreaObj/MercatorTransformCube.hpp"
2#include "JSystem/JMath/JMath.hpp"
3
4MercatorTransformCube::MercatorTransformCube(int type, const char *pName) : AreaObj(type, pName) {
5 _3C.identity();
6}
7
8MercatorTransformCube::~MercatorTransformCube() {
9
10}
11
13 AreaObj::init(rIter);
14
15 TMtx34f *matrix = MR::getZonePlacementMtx(rIter);
16 _3C.setInline(*matrix);
17}
18
19f32 MercatorTransformCube::getSphereRadius() const {
20 if (mObjArg0 == -1) {
21 return 3000.0f;
22 }
23
24 return static_cast<f32>(mObjArg0);
25}
26
27void MercatorTransformCube::calcUV(TVec2f *uv, const TVec3f &a2) const {
28 TVec3f boxSize;
29 calcLocalBoxSize(&boxSize);
30 boxSize *= 0.5f;
31
32 TVec3f localPos;
33 MR::calcCubeLocalPos(&localPos, this, a2);
34
35 uv->x = 3.1415927f * localPos.x / boxSize.x;
36 uv->y = 1.5707964f * -localPos.z / boxSize.z;
37}
38
39void MercatorTransformCube::calcLocalBoxSize(TVec3f *pPos) const {
40 TBox3f *box = MR::getCubeLocalBox(this);
41
42 TVec3f max;
43 TVec3f min;
44
45 min.set(box->mMin);
46 max.set(box->mMax);
47
48 JMathInlineVEC::PSVECSubtract(reinterpret_cast<Vec *>(&max), reinterpret_cast<Vec *>(&min), reinterpret_cast<Vec *>(pPos));
49}
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
Definition AreaObj.cpp:41
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.