some small AstroDomeOrbit attempts

This commit is contained in:
shibbo 2024-07-19 20:56:04 -04:00
parent bc65d7e7a5
commit b348284dfc
4 changed files with 96 additions and 2 deletions

View File

@ -0,0 +1,24 @@
#pragma once
#include "Game/LiveActor/LiveActor.hpp"
class AstroDomeOrbit : public LiveActor {
public:
AstroDomeOrbit();
virtual ~AstroDomeOrbit();
virtual void init(const JMapInfoIter &);
virtual void draw() const;
void drawBloom() const;
void setup(s32);
void moveCoord();
void calcGalaxyPos(TVec3f *) const;
void initDraw(const Color8 &) const;
void drewCelling(f32, bool, f32) const;
void drawSide(f32, bool, f32) const;
f32 calcRepeatedRotateCoord(f32) const;
f32 _8C;
f32 _90;
};

View File

@ -0,0 +1,8 @@
#pragma once
#include <revolution.h>
class MiniatureGalaxyFunction {
public:
static s32 getMiniatureGalaxyNum();
};

View File

@ -191,6 +191,13 @@ namespace JGeometry {
};
}
inline void scaleAdd(f32 val, const TVec3<f32> &a1, const TVec3<f32> &a2) {
JMAVECScaleAdd(a1.toCVec(), a2.toCVec(), this->toVec(), val);
}
inline void cross(const TVec3<f32> &a1, const TVec3<f32> &a2) {
PSVECCrossProduct(a1.toCVec(), a2.toCVec(), this->toVec());
}
inline T squaredInline() const
{
@ -285,8 +292,16 @@ namespace JGeometry {
return ret;
}
TVec3<T>& operator=(const TVec3<T> &);
TVec3<T> operator*=(T);
TVec3<T>& operator=(const TVec3<T> &rhs) {
TVec3<T> f = *this;
JGeometry::setTVec3f((const f32*)rhs, (f32*)f);
return f;
}
TVec3<f32>& operator*=(f32 scalar) {
scale(scalar);
return *this;
}
TVec3<T> operator*(T scalar) const NO_INLINE
{
TVec3<T> f = *this;
@ -901,6 +916,16 @@ namespace JGeometry {
T x, y, z, h;
};
void setTVec3f(register const f32 *src, register f32 *dst) {
__asm {
psq_l f0, 0(src), 0, 0
lfs f1, 8(src)
psq_st f0, 0(dst), 0, 0
stfs f1, 8(dst)
};
}
}; // namespace JGeometry
typedef JGeometry::TVec2<f32> TVec2f;

View File

@ -0,0 +1,37 @@
#include "Game/MapObj/AstroDomeOrbit.hpp"
#include "Game/MapObj/MiniatureGalaxyHolder.hpp"
namespace {
static f32 cRotateOutermost[3] = {
20.0f, 45.0f, 0.0f
};
static f32 cRadius[5] = {
4000.0f, 6200.0f, 8100.0f, 10300.0f, 12000.0f
};
static f32 cRadiusLastDome[4] = {
4000.0f, 6700.0f, 9100.0f, 11800.0f
};
};
void AstroDomeOrbit::setup(s32 radiusIdx) {
s32 miniNum = MiniatureGalaxyFunction::getMiniatureGalaxyNum();
f32* domes = cRadiusLastDome;
if (radiusIdx == 5) {
domes = cRadius;
}
f32 radiusFlt = radiusIdx;
_8C = domes[radiusIdx];
_90 = 230.0f * (radiusFlt - 4.503601774854144e15);
if (radiusIdx >= 4) {
f32 z = cRotateOutermost[0];
f32 y = cRotateOutermost[1];
f32 x = cRotateOutermost[2];
mRotation.setInline(z, y, x);
}
}