mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-09-12 11:35:09 -04:00
Merge main
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
#if TARGET_PC
|
||||
#include "helpers/endian.h"
|
||||
#endif
|
||||
|
||||
class JSUInputStream;
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,7 +79,9 @@ public:
|
||||
virtual ~J3DModel() {}
|
||||
|
||||
#if TARGET_PC
|
||||
static void interp_callback(bool isSimFrame, void* pUserWork);
|
||||
static void interp_callback(void* pUserWork);
|
||||
void calc_presentation_base_mtx();
|
||||
void prepare_presentation_view();
|
||||
#endif
|
||||
|
||||
J3DModelData* getModelData() { return mModelData; }
|
||||
@@ -133,6 +135,9 @@ public:
|
||||
/* 0xD0 */ J3DVtxColorCalc* mVtxColorCalc;
|
||||
/* 0xD4 */ J3DUnkCalc1* mUnkCalc1;
|
||||
/* 0xD8 */ J3DUnkCalc2* mUnkCalc2;
|
||||
#if TARGET_PC
|
||||
Mtx mPresentationBase;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* J3DMODEL_H */
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/interp/frame_interpolation.h"
|
||||
#endif
|
||||
|
||||
#define J3D_ASSERTMSG(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG)
|
||||
@@ -29,6 +29,7 @@ void J3DModel::initialize() {
|
||||
|
||||
MTXIdentity(mBaseTransformMtx);
|
||||
MTXIdentity(mInternalView);
|
||||
IF_DUSK(MTXIdentity(mPresentationBase));
|
||||
|
||||
mMtxBuffer = NULL;
|
||||
mMatPacket = NULL;
|
||||
@@ -101,17 +102,32 @@ s32 J3DModel::entryModelData(J3DModelData* pModelData, u32 mdlFlags, u32 mtxNum)
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
void J3DModel::interp_callback(bool isSimFrame, void* pUserWork) {
|
||||
void J3DModel::interp_callback(void* pUserWork) {
|
||||
J3DModel* i_this = static_cast<J3DModel*>(pUserWork);
|
||||
if (!isSimFrame) {
|
||||
i_this->calcMaterial();
|
||||
i_this->diff();
|
||||
}
|
||||
i_this->calcMaterial();
|
||||
i_this->diff();
|
||||
}
|
||||
|
||||
void J3DModel::setAnmMtx(int jointNo, Mtx m) {
|
||||
mMtxBuffer->setAnmMtx(jointNo, m);
|
||||
dusk::frame_interp::record_final_mtx(mMtxBuffer->getAnmMtx(jointNo));
|
||||
dusk::interp::record_final_mtx(mMtxBuffer->getAnmMtx(jointNo));
|
||||
}
|
||||
|
||||
void J3DModel::calc_presentation_base_mtx() {
|
||||
Mtx identity;
|
||||
MTXIdentity(identity);
|
||||
J3DCalcViewBaseMtx(identity, mBaseScale, mBaseTransformMtx, mPresentationBase);
|
||||
dusk::interp::record_final_mtx(mPresentationBase);
|
||||
prepare_presentation_view();
|
||||
}
|
||||
|
||||
void J3DModel::prepare_presentation_view() {
|
||||
Mtx replacement;
|
||||
MtxP presentationBase = mPresentationBase;
|
||||
if (dusk::interp::lookup_replacement(mPresentationBase, replacement)) {
|
||||
presentationBase = replacement;
|
||||
}
|
||||
MTXConcat(j3dSys.getViewMtx(), presentationBase, mInternalView);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -470,11 +486,11 @@ void J3DModel::calc() {
|
||||
|
||||
#ifdef TARGET_PC
|
||||
for (u16 i = 0; i < mModelData->getJointNum(); ++i) {
|
||||
dusk::frame_interp::record_final_mtx(getAnmMtx(i));
|
||||
dusk::interp::record_final_mtx(getAnmMtx(i));
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < mModelData->getWEvlpMtxNum(); ++i) {
|
||||
dusk::frame_interp::record_final_mtx(getWeightAnmMtx(i));
|
||||
dusk::interp::record_final_mtx(getWeightAnmMtx(i));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -505,8 +521,9 @@ void J3DModel::entry() {
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
if (mModelData->needsInterpCallBack())
|
||||
dusk::frame_interp::add_interpolation_callback(&J3DModel::interp_callback, this);
|
||||
if (mModelData->needsInterpCallBack()) {
|
||||
dusk::interp::add_interpolation_callback(&J3DModel::interp_callback, this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -516,18 +533,20 @@ void J3DModel::viewCalc() {
|
||||
|
||||
if (getModelData()->checkFlag(0x10)) {
|
||||
if (getMtxCalcMode() == 2) {
|
||||
#if TARGET_PC
|
||||
calc_presentation_base_mtx();
|
||||
#else
|
||||
J3DCalcViewBaseMtx(j3dSys.getViewMtx(), mBaseScale, mBaseTransformMtx,
|
||||
(MtxP)&mInternalView);
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::record_final_mtx(mInternalView);
|
||||
#endif
|
||||
}
|
||||
} else if (isCpuSkinningOn()) {
|
||||
if (getMtxCalcMode() == 2) {
|
||||
#if TARGET_PC
|
||||
calc_presentation_base_mtx();
|
||||
#else
|
||||
J3DCalcViewBaseMtx(j3dSys.getViewMtx(), mBaseScale, mBaseTransformMtx,
|
||||
(MtxP)&mInternalView);
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::record_final_mtx(mInternalView);
|
||||
#endif
|
||||
}
|
||||
} else if (checkFlag(J3DMdlFlag_SkinPosCpu)) {
|
||||
@@ -549,15 +568,6 @@ void J3DModel::viewCalc() {
|
||||
DCStoreRange(getNrmMtxPtr(), mModelData->getDrawMtxNum() * sizeof(Mtx33));
|
||||
}
|
||||
|
||||
#ifdef TARGET_PC
|
||||
Mtx* drawMtx = getDrawMtxPtr();
|
||||
if (drawMtx != J3DMtxBuffer::sNoUseDrawMtxPtr) {
|
||||
for (u16 i = 0; i < mModelData->getDrawMtxNum(); ++i) {
|
||||
dusk::frame_interp::record_final_mtx(drawMtx[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
prepareShapePackets();
|
||||
}
|
||||
|
||||
|
||||
@@ -342,6 +342,11 @@ int J3DShapePacket::newDifferedDisplayList(u32 diffFlags) {
|
||||
void J3DShapePacket::prepareDraw() const {
|
||||
mpModel->getVertexBuffer()->setArray();
|
||||
j3dSys.setModel(mpModel);
|
||||
#if TARGET_PC
|
||||
if (mpModel->getMtxCalcMode() == 2) {
|
||||
mpModel->prepare_presentation_view();
|
||||
}
|
||||
#endif
|
||||
j3dSys.setShapePacket((J3DShapePacket*)this);
|
||||
|
||||
J3DShapeMtx::setLODFlag(mpModel->checkFlag(J3DMdlFlag_EnableLOD) != 0);
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/interp/frame_interpolation.h"
|
||||
#endif
|
||||
|
||||
DUSK_GAME_DATA u16 J3DShapeMtx::sMtxLoadCache[10];
|
||||
|
||||
#if TARGET_PC
|
||||
static void J3DFrameInterpConcat(MtxP lhs, MtxP rhs, Mtx out) {
|
||||
if (!dusk::frame_interp::lookup_concat_replacement(lhs, rhs, out)) {
|
||||
if (!dusk::interp::lookup_concat_replacement(lhs, rhs, out)) {
|
||||
MTXConcat(lhs, rhs, out);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/interp/frame_interpolation.h"
|
||||
#include "helpers/gx_helper.h"
|
||||
|
||||
#include <tracy/Tracy.hpp>
|
||||
@@ -379,7 +379,7 @@ void J3DSys::reinitPixelProc() {
|
||||
#if TARGET_PC
|
||||
void J3DSys::setViewMtx(const Mtx m) {
|
||||
Mtx patched;
|
||||
if (dusk::frame_interp::lookup_replacement(m, patched)) {
|
||||
if (dusk::interp::lookup_replacement(m, patched)) {
|
||||
m = patched;
|
||||
}
|
||||
MTXCopy(m, mViewMtx);
|
||||
|
||||
@@ -176,11 +176,7 @@ void JASChannel::updateEffectorParam(JASDsp::TChannel* i_channel, u16* i_mixerVo
|
||||
|
||||
f32 pan = 0.5f;
|
||||
f32 dolby = 0.0f;
|
||||
#if TARGET_PC
|
||||
u32 effectiveOutputMode = dusk::audio::EnableHrtf ? JAS_OUTPUT_SURROUND : JASDriver::getOutputMode();
|
||||
#else
|
||||
u32 effectiveOutputMode = JASDriver::getOutputMode();
|
||||
#endif
|
||||
switch (effectiveOutputMode) {
|
||||
case JAS_OUTPUT_MONO:
|
||||
break;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "JSystem/JAudio2/JASDriverIF.h"
|
||||
#include "JSystem/JAudio2/JASAiCtrl.h"
|
||||
#include "JSystem/JAudio2/JASDSPInterface.h"
|
||||
#include "dusk/settings.h"
|
||||
#include <os.h>
|
||||
|
||||
void JASDriver::setDSPLevel(f32 param_0) {
|
||||
@@ -30,7 +31,18 @@ void JASDriver::setOutputMode(u32 mode) {
|
||||
}
|
||||
|
||||
u32 JASDriver::getOutputMode() {
|
||||
#ifdef TARGET_PC
|
||||
switch (dusk::getSettings().audio.outputMode) {
|
||||
case dusk::AudioOutputMode::StereoSpeakers:
|
||||
return JAS_OUTPUT_STEREO;
|
||||
case dusk::AudioOutputMode::StereoHeadphones:
|
||||
case dusk::AudioOutputMode::Surround6ch:
|
||||
case dusk::AudioOutputMode::Surround8ch:
|
||||
return JAS_OUTPUT_SURROUND;
|
||||
}
|
||||
#else
|
||||
return JASDriver::JAS_SYSTEM_OUTPUT_MODE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void JASDriver::waitSubFrame() {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/dusk.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/interp/frame_interpolation.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "dusk/settings.h"
|
||||
#include "dusk/time.h"
|
||||
@@ -218,8 +218,8 @@ void JFWDisplay::endGX() {
|
||||
|
||||
if (mFader != NULL) {
|
||||
ortho.setPort();
|
||||
#ifdef TARGET_PC
|
||||
if (dusk::frame_interp::get_ui_tick_pending()) {
|
||||
#if TARGET_PC
|
||||
if (dusk::interp::get_ui_tick_pending()) {
|
||||
mFader->advance();
|
||||
}
|
||||
if (mFader->getStatus() != JUTFader::Wait) {
|
||||
@@ -382,7 +382,7 @@ static void waitForTick(u32 p1, u16 p2) {
|
||||
#if TARGET_PC
|
||||
static Limiter limiter;
|
||||
|
||||
if (dusk::frame_interp::is_enabled() || dusk::getTransientSettings().turboMode) {
|
||||
if (dusk::interp::is_enabled() || dusk::getTransientSettings().turboMode) {
|
||||
limiter.Reset();
|
||||
dusk::frameUsagePct = 0.f;
|
||||
return;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <gx.h>
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/interp/frame_interpolation.h"
|
||||
|
||||
#include <tracy/Tracy.hpp>
|
||||
#endif
|
||||
@@ -552,7 +552,7 @@ static void submit_particle_quad(
|
||||
void JPAInterpBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
Mtx ptclPosMtx;
|
||||
MTXTrans(ptclPosMtx, ptcl->mPosition.x, ptcl->mPosition.y, ptcl->mPosition.z);
|
||||
dusk::frame_interp::record_final_mtx(ptclPosMtx, ptcl);
|
||||
dusk::interp::record_final_mtx(ptclPosMtx, ptcl);
|
||||
}
|
||||
|
||||
void JPAInterpRotBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
@@ -564,7 +564,7 @@ void JPAInterpRotBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
ptclPosMtx[0][1] = -sinRot;
|
||||
ptclPosMtx[1][0] = sinRot;
|
||||
ptclPosMtx[1][1] = cosRot;
|
||||
dusk::frame_interp::record_final_mtx(ptclPosMtx, ptcl);
|
||||
dusk::interp::record_final_mtx(ptclPosMtx, ptcl);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -577,7 +577,7 @@ void JPADrawBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_C
|
||||
JGeometry::TVec3<f32> pos;
|
||||
#if TARGET_PC
|
||||
Mtx ptclPosMtx;
|
||||
if (dusk::frame_interp::lookup_replacement(ptcl, ptclPosMtx)) {
|
||||
if (dusk::interp::lookup_replacement(ptcl, ptclPosMtx)) {
|
||||
pos.set(ptclPosMtx[0][3], ptclPosMtx[1][3], ptclPosMtx[2][3]);
|
||||
MTXMultVec(work->mPosCamMtx, &pos, &pos);
|
||||
} else
|
||||
@@ -617,7 +617,7 @@ void JPADrawRotBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRA
|
||||
#if TARGET_PC
|
||||
Mtx ptclPosMtx;
|
||||
MTXTrans(ptclPosMtx, ptcl->mPosition.x, ptcl->mPosition.y, ptcl->mPosition.z);
|
||||
if (dusk::frame_interp::lookup_replacement(ptcl, ptclPosMtx)) {
|
||||
if (dusk::interp::lookup_replacement(ptcl, ptclPosMtx)) {
|
||||
pos.set(ptclPosMtx[0][3], ptclPosMtx[1][3], ptclPosMtx[2][3]);
|
||||
sinRot = ptclPosMtx[1][0];
|
||||
cosRot = ptclPosMtx[0][0];
|
||||
@@ -994,7 +994,7 @@ void JPAInterpDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
posMtx[2][2] = axisZ.z;
|
||||
posMtx[2][3] = ptcl->mPosition.z;
|
||||
p_plane[work->mPlaneType](posMtx, scaleX, scaleY);
|
||||
dusk::frame_interp::record_final_mtx(posMtx, ptcl);
|
||||
dusk::interp::record_final_mtx(posMtx, ptcl);
|
||||
}
|
||||
|
||||
void JPAInterpRotDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
@@ -1037,7 +1037,7 @@ void JPAInterpRotDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
mtx2[2][2] = axisZ.z;
|
||||
mtx2[2][3] = ptcl->mPosition.z;
|
||||
MTXConcat(mtx2, mtx1, mtx1);
|
||||
dusk::frame_interp::record_final_mtx(mtx1, ptcl);
|
||||
dusk::interp::record_final_mtx(mtx1, ptcl);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1050,7 +1050,7 @@ void JPADrawDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRAW_C
|
||||
|
||||
Mtx posMtx;
|
||||
#if TARGET_PC
|
||||
if (!dusk::frame_interp::lookup_replacement(ptcl, posMtx) &&
|
||||
if (!dusk::interp::lookup_replacement(ptcl, posMtx) &&
|
||||
!make_direction_mtx(work, ptcl, posMtx))
|
||||
{
|
||||
return;
|
||||
@@ -1113,7 +1113,7 @@ void JPADrawRotDirection(JPAEmitterWorkData* work, JPABaseParticle* ptcl JPA_DRA
|
||||
Mtx mtx1;
|
||||
Mtx mtx2;
|
||||
#if TARGET_PC
|
||||
if (!dusk::frame_interp::lookup_replacement(ptcl, mtx1) &&
|
||||
if (!dusk::interp::lookup_replacement(ptcl, mtx1) &&
|
||||
!make_rot_direction_mtx(work, ptcl, mtx1))
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "JSystem/JParticle/JPAExtraShape.h"
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/interp/frame_interpolation.h"
|
||||
#endif
|
||||
|
||||
JPAParticleCallBack::~JPAParticleCallBack() {
|
||||
@@ -210,7 +210,7 @@ void JPABaseParticle::init_c(JPAEmitterWorkData* work, JPABaseParticle* parent)
|
||||
|
||||
#if TARGET_PC
|
||||
void JPABaseParticle::interp(JPAEmitterWorkData* work, void const* drawFunc) {
|
||||
if (!dusk::frame_interp::is_enabled())
|
||||
if (!dusk::interp::is_enabled())
|
||||
return;
|
||||
|
||||
// don't interpolate the first frame
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/interp/frame_interpolation.h"
|
||||
|
||||
#include <tracy/Tracy.hpp>
|
||||
|
||||
@@ -839,7 +839,7 @@ bool JPAResource::calc(JPAEmitterWorkData* work, JPABaseEmitter* emtr) {
|
||||
|
||||
#ifdef TARGET_PC
|
||||
if (((pBsp && pBsp->getDirType() == 3) || (pCsp && pCsp->getDirType() == 3)) &&
|
||||
dusk::frame_interp::is_enabled())
|
||||
dusk::interp::is_enabled())
|
||||
{
|
||||
// ensure mGlobalEmtrDir is valid
|
||||
calcWorkData_d(work);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/audio.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#include "dusk/interp/frame_interpolation.h"
|
||||
#include "dusk/settings.h"
|
||||
#endif
|
||||
|
||||
@@ -655,10 +655,10 @@ value_or_fun:
|
||||
|
||||
value:
|
||||
#if TARGET_PC
|
||||
if (dusk::frame_interp::is_enabled() && u <= 5 &&
|
||||
if (dusk::interp::is_enabled() && u <= 5 &&
|
||||
(operation == data::UNK_0x2 || operation == data::UNK_0x3 || operation == data::UNK_0x12))
|
||||
{
|
||||
dusk::frame_interp::request_presentation_sync();
|
||||
dusk::interp::request_presentation_sync();
|
||||
}
|
||||
#endif
|
||||
adaptor->adaptor_setVariableValue(control, u, operation, param_2, param_3);
|
||||
@@ -666,11 +666,11 @@ value:
|
||||
|
||||
value_n:
|
||||
#if TARGET_PC
|
||||
if (dusk::frame_interp::is_enabled() &&
|
||||
if (dusk::interp::is_enabled() &&
|
||||
(pN == TAdaptor_camera::sauVariableValue_3_POSITION_XYZ || pN == TAdaptor_camera::sauVariableValue_3_TARGET_POSITION_XYZ) &&
|
||||
(operation == data::UNK_0x2 || operation == data::UNK_0x3 || operation == data::UNK_0x12))
|
||||
{
|
||||
dusk::frame_interp::request_presentation_sync();
|
||||
dusk::interp::request_presentation_sync();
|
||||
}
|
||||
#endif
|
||||
adaptor->adaptor_setVariableValue_n(control, pN, u, operation, param_2, param_3);
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
|
||||
#ifdef TARGET_PC
|
||||
#include "dusk/interp/frame_interpolation.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "dusk/frame_interpolation.h"
|
||||
#endif
|
||||
|
||||
JUTFader::JUTFader(int x, int y, int width, int height, JUtility::TColor pColor)
|
||||
@@ -74,8 +75,8 @@ void JUTFader::control() {
|
||||
void JUTFader::draw() {
|
||||
if (mColor.a != 0) {
|
||||
#ifdef TARGET_PC
|
||||
if (dusk::frame_interp::is_enabled() && mDuration != 0) {
|
||||
const auto step = dusk::frame_interp::get_interpolation_step();
|
||||
if (dusk::interp::is_enabled() && mDuration != 0) {
|
||||
const auto step = dusk::interp::get_interpolation_step();
|
||||
const auto progress = static_cast<f32>(mTimer) / static_cast<f32>(mDuration);
|
||||
const auto timer = mTimer - 1 + step + progress;
|
||||
auto alpha = timer / mDuration;
|
||||
|
||||
Reference in New Issue
Block a user