Skip to content

Commit

Permalink
object-light OK
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Sep 10, 2024
1 parent 0bea395 commit a1bd36d
Show file tree
Hide file tree
Showing 7 changed files with 211 additions and 58 deletions.
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ def JSystemLib(lib_name, objects, progress_category="core"):
Object(Matching, "JSystem/JStudio/JStudio_JStage/object-ambientlight.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-camera.cpp"),
Object(Matching, "JSystem/JStudio/JStudio_JStage/object-fog.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-light.cpp"),
Object(Matching, "JSystem/JStudio/JStudio_JStage/object-light.cpp"),
],
),
JSystemLib(
Expand Down
5 changes: 5 additions & 0 deletions include/JSystem/JStage/JSGLight.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

namespace JStage {
enum TELight {
TELIGHT_Unk0 = 0,
TELIGHT_Unk1 = 1,
TELIGHT_Unk2 = 2,
TELIGHT_Unk3 = 3,

kLightMax = 0xFFFFFFFF,
};

Expand Down
64 changes: 42 additions & 22 deletions include/JSystem/JStudio/JStudio/jstudio-control.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
#include "JSystem/JStudio/JStudio/stb.h"
#include "dolphin/gx/GX.h"
#include "dolphin/mtx/vec.h"
#include "dolphin/mtx/mtxvec.h"

namespace JStudio {
struct TObject;
struct TCreateObject {
TCreateObject() {}
virtual ~TCreateObject() = 0;
virtual bool create(TObject**, JStudio::stb::data::TParse_TBlock_object const&) = 0;
virtual bool create(TObject**, stb::data::TParse_TBlock_object const&) = 0;

/* 0x4 */ JGadget::TLinkListNode mNode;
}; // Size: 0xC
Expand All @@ -20,9 +21,9 @@ struct TFactory : public stb::TFactory {
TFactory() {}

virtual ~TFactory();
virtual TObject* create(JStudio::stb::data::TParse_TBlock_object const&);
virtual TObject* create(stb::data::TParse_TBlock_object const&);

void appendCreateObject(JStudio::TCreateObject*);
void appendCreateObject(TCreateObject*);

/* 0x04 */ JGadget::TLinkList<TCreateObject, -4> mList;
/* 0x10 */ fvb::TFactory fvb_Factory;
Expand All @@ -33,7 +34,10 @@ class TControl : public stb::TControl {
struct TTransform_position {
Vec mPosition;
};
struct TTransform_position_direction {};
struct TTransform_position_direction {
Vec mPosition; // _00
Vec mDirection; // _0C
};
struct TTransform_translation_rotation {};
struct TTransform_translation_rotation_scaling {};

Expand All @@ -42,7 +46,7 @@ class TControl : public stb::TControl {
void transformOnSet_setOrigin(const Vec&, f32);
void transformOnGet_setOrigin(const Vec&, f32);

void setFactory(JStudio::TFactory* factory) {
void setFactory(TFactory* factory) {
stb::TFactory* stb_factory = factory;
fvb::TFactory* fvb_factory = factory == NULL ? NULL : &factory->fvb_Factory;
stb::TControl::setFactory(stb_factory);
Expand Down Expand Up @@ -104,31 +108,47 @@ class TControl : public stb::TControl {
return obj->referFunctionValue();
}

const TTransform_position_direction* transformOnGet_transform_ifEnabled(const TTransform_position_direction& posDir, TTransform_position_direction* transformedPosDir) const {
if (!transformOnGet_isEnabled()) {
return &posDir;
} else {
transformOnGet_transform(posDir, transformedPosDir);
return transformedPosDir;
}
}
void transformOnGet_transform(const TTransform_position_direction& posDir, TTransform_position_direction* transformedPosDir) const {
transformOnGet_transformTranslation(posDir.mPosition, &transformedPosDir->mPosition);
transformOnGet_transformDirection(posDir.mDirection, &transformedPosDir->mDirection);
}
void transformOnGet_transformTranslation(const Vec& pos, Vec* transformedPos) const {
MTXMultVec(transformOnGet_getMatrix(), &pos, transformedPos);
}
void transformOnGet_transformDirection(const Vec& dir, Vec* transformedDir) const {
MTXMultVecSR(transformOnGet_getMatrix(), &dir, transformedDir);
}

// TODO
void fvb_getObjectContainer() const {}
void fvb_referControl() {}
void fvb_removeObject_all() {}
void stb_getObjectContainer() const {}
void stb_referObjectContainer() {}
void stb_removeObject(JStudio::TObject*) {}
void transformOnGet_transform(const JStudio::TControl::TTransform_position&, JStudio::TControl::TTransform_position*) const {}
void transformOnGet_transform(const JStudio::TControl::TTransform_position_direction&, JStudio::TControl::TTransform_position_direction*) const {}
void transformOnGet_transform(const JStudio::TControl::TTransform_translation_rotation&, JStudio::TControl::TTransform_translation_rotation*) const {}
void transformOnGet_transformDirection(const Vec&, Vec*) const {}
void stb_removeObject(TObject*) {}
void transformOnGet_transform(const TTransform_position&, TTransform_position*) const {}
void transformOnGet_transform(const TTransform_translation_rotation&, TTransform_translation_rotation*) const {}
void transformOnGet_transformRotation(const Vec&, Vec*) const {}
void transformOnGet_transformTranslation(const Vec&, Vec*) const {}
void transformOnGet_transform_ifEnabled(const JStudio::TControl::TTransform_position_direction&, JStudio::TControl::TTransform_position_direction*) const {}
void transformOnGet_transform_ifEnabled(const JStudio::TControl::TTransform_translation_rotation&, JStudio::TControl::TTransform_translation_rotation*) const {}
void transformOnSet_transform(const JStudio::TControl::TTransform_position&, JStudio::TControl::TTransform_position*) const {}
void transformOnSet_transform(const JStudio::TControl::TTransform_position_direction&, JStudio::TControl::TTransform_position_direction*) const {}
void transformOnSet_transform(const JStudio::TControl::TTransform_translation_rotation&, JStudio::TControl::TTransform_translation_rotation*) const {}
void transformOnGet_transform_ifEnabled(const TTransform_translation_rotation&, TTransform_translation_rotation*) const {}
void transformOnSet_transform(const TTransform_position&, TTransform_position*) const {}
void transformOnSet_transform(const TTransform_position_direction&, TTransform_position_direction*) const {}
void transformOnSet_transform(const TTransform_translation_rotation&, TTransform_translation_rotation*) const {}
void transformOnSet_transform(CMtxP, MtxP) const {}
void transformOnSet_transformDirection(const Vec&, Vec*) const {}
void transformOnSet_transformDirection_ifEnabled(const Vec&, Vec*) const {}
void transformOnSet_transformRotation(const Vec&, Vec*) const {}
void transformOnSet_transformTranslation(const Vec&, Vec*) const {}
void transformOnSet_transformTranslation_ifEnabled(const Vec&, Vec*) const {}
void transformOnSet_transform_ifEnabled(const JStudio::TControl::TTransform_position_direction&, JStudio::TControl::TTransform_position_direction*) const {}
void transformOnSet_transform_ifEnabled(const JStudio::TControl::TTransform_translation_rotation&, JStudio::TControl::TTransform_translation_rotation*) const {}
void transformOnSet_transform_ifEnabled(const TTransform_position_direction&, TTransform_position_direction*) const {}
void transformOnSet_transform_ifEnabled(const TTransform_translation_rotation&, TTransform_translation_rotation*) const {}
void transformOnSet_transform_ifEnabled(CMtxP, MtxP) const {}

/* 0x58 */ f64 mSecondPerFrame;
Expand All @@ -144,12 +164,12 @@ class TControl : public stb::TControl {
};

struct TParse : public stb::TParse {
TParse(JStudio::TControl*);
bool parseBlock_block_fvb_(JStudio::stb::data::TParse_TBlock const&, u32);
TParse(TControl*);
bool parseBlock_block_fvb_(stb::data::TParse_TBlock const&, u32);

virtual ~TParse();
virtual bool parseHeader(JStudio::stb::data::TParse_THeader const&, u32);
virtual bool parseBlock_block(JStudio::stb::data::TParse_TBlock const&, u32);
virtual bool parseHeader(stb::data::TParse_THeader const&, u32);
virtual bool parseBlock_block(stb::data::TParse_TBlock const&, u32);

TControl* getControl() { return (TControl*)stb::TParse::getControl(); }

Expand Down
20 changes: 17 additions & 3 deletions include/JSystem/JStudio/JStudio/jstudio-object.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,20 @@ struct TObject_fog : public TObject {
};

struct TAdaptor_light : public TAdaptor {
enum TEVariableValue {
TE_VALUE_NONE = -1,
TE_VALUE_7 = 7,
TE_VALUE_8 = 8,
TE_VALUE_9 = 9,
TE_VALUE_10 = 10,
TE_VALUE_11 = 11,
};
enum TEDirection_ {
DIRECTION_0,
DIRECTION_1,
DIRECTION_2,
};

TAdaptor_light()
: TAdaptor(mValue, ARRAY_SIZE(mValue))
, mValue()
Expand All @@ -356,9 +370,9 @@ struct TAdaptor_light : public TAdaptor {
/* 0x10 */ TVariableValue mValue[13];

static u8 const sauVariableValue_3_COLOR_RGB[12];
static u8 const sauVariableValue_4_COLOR_RGBA[16];
static u8 const sauVariableValue_3_POSITION_XYZ[12];
static u8 const sauVariableValue_3_TARGET_POSITION_XYZ[12];
static u32 const sauVariableValue_4_COLOR_RGBA[4];
static u32 const sauVariableValue_3_POSITION_XYZ[3];
static u32 const sauVariableValue_3_TARGET_POSITION_XYZ[3];
static u8 sauVariableValue_2_DIRECTION_THETA_PHI[8];
};

Expand Down
26 changes: 21 additions & 5 deletions include/JSystem/JStudio/JStudio_JStage/control.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,23 @@ struct TAdaptor_fog : public JStudio::TAdaptor_fog {
}; // Size: 0x8C

struct TAdaptor_light : public JStudio::TAdaptor_light {
struct TVVOutput_direction_ {
void operator()(f32, JStudio::TAdaptor*) const;
~TVVOutput_direction_();
struct TVVOutput_direction_ : public JStudio::TVariableValue::TOutput {
TVVOutput_direction_(JStudio::TAdaptor_light::TEVariableValue val, JStudio_JStage::TAdaptor_light::TEDirection_ dir)
{
mValueIndex = val;
_08 = dir;
}

virtual void operator()(f32, JStudio::TAdaptor*) const;
virtual ~TVVOutput_direction_() {}

void adaptor_setOutput_(JStudio::TAdaptor* adaptor) const {
adaptor->adaptor_referVariableValue(mValueIndex)->setOutput(this);
}
bool isEnd_() const { return mValueIndex != -1; }

/* 0x04 */ int mValueIndex;
/* 0x08 */ int _08;
};

TAdaptor_light(JStage::TSystem const*, JStage::TLight*);
Expand All @@ -190,9 +204,11 @@ struct TAdaptor_light : public JStudio::TAdaptor_light {
virtual void adaptor_do_ENABLE(JStudio::data::TEOperationData, void const*, u32);
virtual void adaptor_do_FACULTY(JStudio::data::TEOperationData, void const*, u32);

static u8 saoVVOutput_direction_[72];
static TVVOutput_direction_ saoVVOutput_direction_[6];

/* 0x110 */ u8 field_0x110[0x11C - 0x110];
/* 0x110 */ const JStage::TSystem* mSystem;
/* 0x114 */ JStage::TLight* mObject;
/* 0x118 */ int _118;
}; // Size: 0x11C

void
Expand Down
Loading

0 comments on commit a1bd36d

Please sign in to comment.