mirror of
https://github.com/izzy2lost/shipdev.git
synced 2026-03-26 16:50:51 -07:00
Experimental interpolation (#309)
* Experimental 60 fps * Fix compile error * Fix compile error * Fix compile error
This commit is contained in:
@@ -190,8 +190,12 @@ static int game_framebuffer_msaa_resolved;
|
||||
|
||||
uint32_t gfx_msaa_level = 1;
|
||||
|
||||
static bool has_drawn_imgui_menu;
|
||||
|
||||
static bool dropped_frame;
|
||||
|
||||
static const std::unordered_map<Mtx *, MtxF> *current_mtx_replacements;
|
||||
|
||||
static float buf_vbo[MAX_BUFFERED * (32 * 3)]; // 3 vertices in a triangle and 32 floats per vtx
|
||||
static size_t buf_vbo_len;
|
||||
static size_t buf_vbo_num_tris;
|
||||
@@ -916,20 +920,31 @@ static void gfx_matrix_mul(float res[4][4], const float a[4][4], const float b[4
|
||||
|
||||
static void gfx_sp_matrix(uint8_t parameters, const int32_t *addr) {
|
||||
float matrix[4][4];
|
||||
|
||||
if (auto it = current_mtx_replacements->find((Mtx *)addr); it != current_mtx_replacements->end()) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
float v = it->second.mf[i][j];
|
||||
int as_int = (int)(v * 65536.0f);
|
||||
matrix[i][j] = as_int * (1.0f / 65536.0f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#ifndef GBI_FLOATS
|
||||
// Original GBI where fixed point matrices are used
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j += 2) {
|
||||
int32_t int_part = addr[i * 2 + j / 2];
|
||||
uint32_t frac_part = addr[8 + i * 2 + j / 2];
|
||||
matrix[i][j] = (int32_t)((int_part & 0xffff0000) | (frac_part >> 16)) / 65536.0f;
|
||||
matrix[i][j + 1] = (int32_t)((int_part << 16) | (frac_part & 0xffff)) / 65536.0f;
|
||||
// Original GBI where fixed point matrices are used
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j += 2) {
|
||||
int32_t int_part = addr[i * 2 + j / 2];
|
||||
uint32_t frac_part = addr[8 + i * 2 + j / 2];
|
||||
matrix[i][j] = (int32_t)((int_part & 0xffff0000) | (frac_part >> 16)) / 65536.0f;
|
||||
matrix[i][j + 1] = (int32_t)((int_part << 16) | (frac_part & 0xffff)) / 65536.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
// For a modified GBI where fixed point values are replaced with floats
|
||||
memcpy(matrix, addr, sizeof(matrix));
|
||||
// For a modified GBI where fixed point values are replaced with floats
|
||||
memcpy(matrix, addr, sizeof(matrix));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (parameters & G_MTX_PROJECTION) {
|
||||
if (parameters & G_MTX_LOAD) {
|
||||
@@ -2708,6 +2723,7 @@ void gfx_start_frame(void) {
|
||||
gfx_wapi->handle_events();
|
||||
gfx_wapi->get_dimensions(&gfx_current_window_dimensions.width, &gfx_current_window_dimensions.height);
|
||||
SohImGui::DrawMainMenuAndCalculateGameSize();
|
||||
has_drawn_imgui_menu = true;
|
||||
if (gfx_current_dimensions.height == 0) {
|
||||
// Avoid division by zero
|
||||
gfx_current_dimensions.height = 1;
|
||||
@@ -2746,7 +2762,7 @@ void gfx_start_frame(void) {
|
||||
fbActive = 0;
|
||||
}
|
||||
|
||||
void gfx_run(Gfx *commands) {
|
||||
void gfx_run(Gfx *commands, const std::unordered_map<Mtx *, MtxF>& mtx_replacements) {
|
||||
gfx_sp_reset();
|
||||
|
||||
//puts("New frame");
|
||||
@@ -2755,12 +2771,21 @@ void gfx_run(Gfx *commands) {
|
||||
|
||||
if (!gfx_wapi->start_frame()) {
|
||||
dropped_frame = true;
|
||||
SohImGui::DrawFramebufferAndGameInput();
|
||||
SohImGui::CancelFrame();
|
||||
if (has_drawn_imgui_menu) {
|
||||
SohImGui::DrawFramebufferAndGameInput();
|
||||
SohImGui::CancelFrame();
|
||||
has_drawn_imgui_menu = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
dropped_frame = false;
|
||||
|
||||
if (!has_drawn_imgui_menu) {
|
||||
SohImGui::DrawMainMenuAndCalculateGameSize();
|
||||
}
|
||||
|
||||
current_mtx_replacements = &mtx_replacements;
|
||||
|
||||
double t0 = gfx_wapi->get_time();
|
||||
gfx_rapi->update_framebuffer_parameters(0, gfx_current_window_dimensions.width, gfx_current_window_dimensions.height, 1, false, true, true, !game_renders_to_framebuffer);
|
||||
gfx_rapi->start_frame();
|
||||
@@ -2792,6 +2817,7 @@ void gfx_run(Gfx *commands) {
|
||||
//printf("Process %f %f\n", t1, t1 - t0);
|
||||
gfx_rapi->end_frame();
|
||||
gfx_wapi->swap_buffers_begin();
|
||||
has_drawn_imgui_menu = false;
|
||||
}
|
||||
|
||||
void gfx_end_frame(void) {
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <unordered_map>
|
||||
#include <list>
|
||||
|
||||
#include "U64/PR/ultra64/types.h"
|
||||
|
||||
struct GfxRenderingAPI;
|
||||
struct GfxWindowManagerAPI;
|
||||
|
||||
@@ -52,26 +54,24 @@ struct TextureCacheValue {
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern struct GfxDimensions gfx_current_window_dimensions; // The dimensions of the window
|
||||
extern struct GfxDimensions gfx_current_dimensions; // The dimensions of the draw area the game draws to, before scaling (if applicable)
|
||||
extern struct XYWidthHeight gfx_current_game_window_viewport; // The area of the window the game is drawn to, (0, 0) is top-left corner
|
||||
extern uint32_t gfx_msaa_level;
|
||||
|
||||
}
|
||||
|
||||
void gfx_init(struct GfxWindowManagerAPI* wapi, struct GfxRenderingAPI* rapi, const char* game_name, bool start_in_fullscreen);
|
||||
struct GfxRenderingAPI* gfx_get_current_rendering_api(void);
|
||||
void gfx_start_frame(void);
|
||||
void gfx_run(Gfx* commands);
|
||||
void gfx_run(Gfx* commands, const std::unordered_map<Mtx*, MtxF>& mtx_replacements);
|
||||
void gfx_end_frame(void);
|
||||
void gfx_set_framedivisor(int);
|
||||
void gfx_texture_cache_clear();
|
||||
int gfx_create_framebuffer(uint32_t width, uint32_t height);
|
||||
extern "C" int gfx_create_framebuffer(uint32_t width, uint32_t height);
|
||||
void gfx_get_pixel_depth_prepare(float x, float y);
|
||||
uint16_t gfx_get_pixel_depth(float x, float y);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -681,6 +681,7 @@ namespace SohImGui {
|
||||
|
||||
EXPERIMENTAL();
|
||||
|
||||
EnhancementCheckbox("60 fps interpolation", "g60FPS");
|
||||
EnhancementCheckbox("Disable LOD", "gDisableLOD");
|
||||
|
||||
ImGui::EndMenu();
|
||||
|
||||
@@ -282,8 +282,12 @@ namespace Ship {
|
||||
gfx_start_frame();
|
||||
}
|
||||
|
||||
void Window::RunCommands(Gfx* Commands) {
|
||||
gfx_run(Commands);
|
||||
void Window::RunCommands(Gfx* Commands, const std::vector<std::unordered_map<Mtx*, MtxF>>& mtx_replacements) {
|
||||
for (const auto& m : mtx_replacements) {
|
||||
gfx_run(Commands, m);
|
||||
gfx_end_frame();
|
||||
}
|
||||
gfx_run(Commands, {});
|
||||
gfx_end_frame();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Ship {
|
||||
void MainLoop(void (*MainFunction)(void));
|
||||
void Init();
|
||||
void StartFrame();
|
||||
void RunCommands(Gfx* Commands);
|
||||
void RunCommands(Gfx* Commands, const std::vector<std::unordered_map<Mtx*, MtxF>>& mtx_replacements);
|
||||
void SetFrameDivisor(int divisor);
|
||||
void GetPixelDepthPrepare(float x, float y);
|
||||
uint16_t GetPixelDepth(float x, float y);
|
||||
|
||||
@@ -138,6 +138,8 @@ extern GraphicsContext* __gfxCtx;
|
||||
#ifndef NDEBUG
|
||||
#define OPEN_DISPS(gfxCtx, file, line) \
|
||||
{ \
|
||||
void FrameInterpolation_RecordOpenChild(const void* a, int b); \
|
||||
FrameInterpolation_RecordOpenChild(file, line); \
|
||||
GraphicsContext* __gfxCtx; \
|
||||
Gfx* dispRefs[4]; \
|
||||
__gfxCtx = gfxCtx; \
|
||||
@@ -146,6 +148,8 @@ extern GraphicsContext* __gfxCtx;
|
||||
#else
|
||||
#define OPEN_DISPS(gfxCtx, file, line) \
|
||||
{ \
|
||||
void FrameInterpolation_RecordOpenChild(const void* a, int b); \
|
||||
FrameInterpolation_RecordOpenChild(file, line); \
|
||||
GraphicsContext* __gfxCtx; \
|
||||
__gfxCtx = gfxCtx; \
|
||||
(void)__gfxCtx;
|
||||
@@ -153,11 +157,15 @@ extern GraphicsContext* __gfxCtx;
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define CLOSE_DISPS(gfxCtx, file, line) \
|
||||
{void FrameInterpolation_RecordCloseChild(void); \
|
||||
FrameInterpolation_RecordCloseChild();} \
|
||||
Graph_CloseDisps(dispRefs, gfxCtx, file, line); \
|
||||
} \
|
||||
(void)0
|
||||
#else
|
||||
#define CLOSE_DISPS(gfxCtx, file, line) \
|
||||
{void FrameInterpolation_RecordCloseChild(void); \
|
||||
FrameInterpolation_RecordCloseChild();} \
|
||||
(void)0; \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
@@ -225,6 +225,7 @@ typedef struct EffectSs {
|
||||
/* 0x5C */ s16 life; // -1 means this entry is free
|
||||
/* 0x5E */ u8 priority; // Lower value means higher priority
|
||||
/* 0x5F */ u8 type;
|
||||
u32 epoch;
|
||||
} EffectSs; // size = 0x60
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="soh\frame_interpolation.cpp" />
|
||||
<ClCompile Include="soh\Enhancements\bootcommands.c" />
|
||||
<ClCompile Include="soh\Enhancements\debugconsole.cpp" />
|
||||
<ClCompile Include="soh\Enhancements\debugger\colViewer.cpp" />
|
||||
@@ -878,6 +879,7 @@
|
||||
<ClCompile Include="src\overlays\misc\ovl_map_mark_data\z_map_mark_data.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="soh\frame_interpolation.h" />
|
||||
<ClInclude Include="include\alloca.h" />
|
||||
<ClInclude Include="include\bgm.h" />
|
||||
<ClInclude Include="include\color.h" />
|
||||
|
||||
@@ -2186,6 +2186,8 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="soh\Enhancements\debugger\ImGuiHelpers.cpp">
|
||||
<Filter>Source Files\soh\Enhancements\debugger</Filter>
|
||||
<ClCompile Include="soh\frame_interpolation.cpp">
|
||||
<Filter>Source Files\soh</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\code\z_cheap_proc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
@@ -3748,6 +3750,8 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="soh\Enhancements\debugger\ImGuiHelpers.h">
|
||||
<Filter>Header Files\soh\Enhancements\debugger</Filter>
|
||||
<ClInclude Include="soh\frame_interpolation.h">
|
||||
<Filter>Header Files\soh</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="soh\Enhancements\savestates.h">
|
||||
<Filter>Source Files\soh\Enhancements</Filter>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "colViewer.h"
|
||||
#include "../libultraship/SohImGuiImpl.h"
|
||||
#include "ImGuiHelpers.h"
|
||||
#include "../../frame_interpolation.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
+11
-2
@@ -29,6 +29,7 @@
|
||||
#include "AudioPlayer.h"
|
||||
#include "Enhancements/debugconsole.h"
|
||||
#include "Enhancements/debugger/debugger.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "variables.h"
|
||||
#include "macros.h"
|
||||
@@ -174,7 +175,7 @@ extern "C" void Graph_StartFrame() {
|
||||
|
||||
// C->C++ Bridge
|
||||
extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
|
||||
OTRGlobals::Instance->context->GetWindow()->SetFrameDivisor(R_UPDATE_RATE);
|
||||
OTRGlobals::Instance->context->GetWindow()->SetFrameDivisor(CVar_GetS32("g60FPS", 0) == 0 ? R_UPDATE_RATE : 1);
|
||||
|
||||
if (!audio.initialized) {
|
||||
audio.initialized = true;
|
||||
@@ -224,7 +225,15 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
|
||||
}
|
||||
audio.cv_to_thread.notify_one();
|
||||
|
||||
OTRGlobals::Instance->context->GetWindow()->RunCommands(commands);
|
||||
std::vector<std::unordered_map<Mtx*, MtxF>> mtx_replacements;
|
||||
if (CVar_GetS32("g60FPS", 0) != 0) {
|
||||
int to = R_UPDATE_RATE;
|
||||
for (int i = 1; i < to; i++) {
|
||||
mtx_replacements.push_back(FrameInterpolation_Interpolate(i / (float)to));
|
||||
}
|
||||
}
|
||||
|
||||
OTRGlobals::Instance->context->GetWindow()->RunCommands(commands, mtx_replacements);
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> Lock(audio.mutex);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/z64math.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
std::unordered_map<Mtx*, MtxF> FrameInterpolation_Interpolate(float step);
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
void FrameInterpolation_StartRecord(void);
|
||||
|
||||
void FrameInterpolation_StopRecord(void);
|
||||
|
||||
void FrameInterpolation_RecordOpenChild(const void* a, int b);
|
||||
|
||||
void FrameInterpolation_RecordCloseChild(void);
|
||||
|
||||
void FrameInterpolation_DontInterpolateCamera(void);
|
||||
|
||||
int FrameInterpolation_GetCameraEpoch(void);
|
||||
|
||||
void FrameInterpolation_RecordActorPosRotMatrix(void);
|
||||
|
||||
void FrameInterpolation_RecordMatrixPush(void);
|
||||
|
||||
void FrameInterpolation_RecordMatrixPop(void);
|
||||
|
||||
void FrameInterpolation_RecordMatrixPut(MtxF* src);
|
||||
|
||||
void FrameInterpolation_RecordMatrixMult(MtxF* mf, u8 mode);
|
||||
|
||||
void FrameInterpolation_RecordMatrixTranslate(f32 x, f32 y, f32 z, u8 mode);
|
||||
|
||||
void FrameInterpolation_RecordMatrixScale(f32 x, f32 y, f32 z, u8 mode);
|
||||
|
||||
void FrameInterpolation_RecordMatrixRotate1Coord(u32 coord, f32 value, u8 mode);
|
||||
|
||||
void FrameInterpolation_RecordMatrixRotateZYX(s16 x, s16 y, s16 z, u8 mode);
|
||||
|
||||
void FrameInterpolation_RecordMatrixTranslateRotateZYX(Vec3f* translation, Vec3s* rotation);
|
||||
|
||||
void FrameInterpolation_RecordMatrixSetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ, Vec3s* rot);
|
||||
|
||||
void FrameInterpolation_RecordMatrixMtxFToMtx(MtxF* src, Mtx* dest);
|
||||
|
||||
void FrameInterpolation_RecordMatrixToMtx(Mtx* dest, char* file, s32 line);
|
||||
|
||||
void FrameInterpolation_RecordMatrixReplaceRotation(MtxF* mf);
|
||||
|
||||
void FrameInterpolation_RecordMatrixRotateAxis(f32 angle, Vec3f* axis, u8 mode);
|
||||
|
||||
void FrameInterpolation_RecordSkinMatrixMtxFToMtx(MtxF* src, Mtx* dest);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "soh/frame_interpolation.h"
|
||||
|
||||
// clang-format off
|
||||
Mtx gMtxClear = {
|
||||
65536, 0, 1, 0,
|
||||
@@ -25,11 +27,13 @@ void Matrix_Init(GameState* gameState) {
|
||||
}
|
||||
|
||||
void Matrix_Push(void) {
|
||||
FrameInterpolation_RecordMatrixPush();
|
||||
Matrix_MtxFCopy(sCurrentMatrix + 1, sCurrentMatrix);
|
||||
sCurrentMatrix++;
|
||||
}
|
||||
|
||||
void Matrix_Pop(void) {
|
||||
FrameInterpolation_RecordMatrixPop();
|
||||
sCurrentMatrix--;
|
||||
ASSERT(sCurrentMatrix >= sMatrixStack, "Matrix_now >= Matrix_stack", "../sys_matrix.c", 176);
|
||||
}
|
||||
@@ -39,6 +43,7 @@ void Matrix_Get(MtxF* dest) {
|
||||
}
|
||||
|
||||
void Matrix_Put(MtxF* src) {
|
||||
FrameInterpolation_RecordMatrixPut(src);
|
||||
Matrix_MtxFCopy(sCurrentMatrix, src);
|
||||
}
|
||||
|
||||
@@ -47,6 +52,7 @@ MtxF* Matrix_GetCurrent(void) {
|
||||
}
|
||||
|
||||
void Matrix_Mult(MtxF* mf, u8 mode) {
|
||||
FrameInterpolation_RecordMatrixMult(mf, mode);
|
||||
MtxF* cmf = Matrix_GetCurrent();
|
||||
|
||||
if (mode == MTXMODE_APPLY) {
|
||||
@@ -57,6 +63,7 @@ void Matrix_Mult(MtxF* mf, u8 mode) {
|
||||
}
|
||||
|
||||
void Matrix_Translate(f32 x, f32 y, f32 z, u8 mode) {
|
||||
FrameInterpolation_RecordMatrixTranslate(x, y, z, mode);
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 tx;
|
||||
f32 ty;
|
||||
@@ -80,6 +87,7 @@ void Matrix_Translate(f32 x, f32 y, f32 z, u8 mode) {
|
||||
}
|
||||
|
||||
void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode) {
|
||||
FrameInterpolation_RecordMatrixScale(x, y, z, mode);
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
|
||||
if (mode == MTXMODE_APPLY) {
|
||||
@@ -101,6 +109,7 @@ void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode) {
|
||||
}
|
||||
|
||||
void Matrix_RotateX(f32 x, u8 mode) {
|
||||
FrameInterpolation_RecordMatrixRotate1Coord(0, x, mode);
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
@@ -165,6 +174,7 @@ void Matrix_RotateX(f32 x, u8 mode) {
|
||||
}
|
||||
|
||||
void Matrix_RotateY(f32 y, u8 mode) {
|
||||
FrameInterpolation_RecordMatrixRotate1Coord(1, y, mode);
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
@@ -229,6 +239,7 @@ void Matrix_RotateY(f32 y, u8 mode) {
|
||||
}
|
||||
|
||||
void Matrix_RotateZ(f32 z, u8 mode) {
|
||||
FrameInterpolation_RecordMatrixRotate1Coord(2, z, mode);
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
@@ -299,6 +310,7 @@ void Matrix_RotateZ(f32 z, u8 mode) {
|
||||
* Original Name: Matrix_RotateXYZ, changed to reflect rotation order.
|
||||
*/
|
||||
void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode) {
|
||||
FrameInterpolation_RecordMatrixRotateZYX(x, y, z, mode);
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 temp1;
|
||||
f32 temp2;
|
||||
@@ -389,6 +401,7 @@ void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode) {
|
||||
* transformed according to whatever the matrix was previously.
|
||||
*/
|
||||
void Matrix_TranslateRotateZYX(Vec3f* translation, Vec3s* rotation) {
|
||||
FrameInterpolation_RecordMatrixTranslateRotateZYX(translation, rotation);
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 sin = Math_SinS(rotation->z);
|
||||
f32 cos = Math_CosS(rotation->z);
|
||||
@@ -530,15 +543,20 @@ void Matrix_SetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ
|
||||
} else {
|
||||
cmf->yx = 0.0f;
|
||||
}
|
||||
FrameInterpolation_RecordMatrixSetTranslateRotateYXZ(translateX, translateY, translateZ, rot);
|
||||
}
|
||||
|
||||
Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) {
|
||||
FrameInterpolation_RecordMatrixMtxFToMtx(src, dest);
|
||||
guMtxF2L(src, dest);
|
||||
return dest;
|
||||
}
|
||||
|
||||
Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line) {
|
||||
return Matrix_MtxFToMtx(Matrix_CheckFloats(sCurrentMatrix, file, line), dest);
|
||||
FrameInterpolation_RecordMatrixToMtx(dest, file, line);
|
||||
guMtxF2L(Matrix_CheckFloats(sCurrentMatrix, file, line), dest);
|
||||
return dest;
|
||||
//return Matrix_MtxFToMtx(Matrix_CheckFloats(sCurrentMatrix, file, line), dest);
|
||||
}
|
||||
|
||||
Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line) {
|
||||
@@ -627,6 +645,7 @@ void Matrix_Transpose(MtxF* mf) {
|
||||
* seen as replacing the R rotation with `mf`, hence the function name.
|
||||
*/
|
||||
void Matrix_ReplaceRotation(MtxF* mf) {
|
||||
FrameInterpolation_RecordMatrixReplaceRotation(mf);
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 acc;
|
||||
f32 temp;
|
||||
@@ -779,6 +798,7 @@ void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
|
||||
* NB: `axis` is assumed to be a unit vector.
|
||||
*/
|
||||
void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode) {
|
||||
FrameInterpolation_RecordMatrixRotateAxis(angle, axis, mode);
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
#include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h"
|
||||
#include "objects/object_bdoor/object_bdoor.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
|
||||
#if defined(_MSC_VER) || defined(__GNUC__)
|
||||
#include <string.h>
|
||||
@@ -410,6 +411,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) {
|
||||
f32 var2;
|
||||
s32 i;
|
||||
|
||||
FrameInterpolation_RecordOpenChild(actor, 0);
|
||||
player = GET_PLAYER(globalCtx);
|
||||
|
||||
spCE = 0xFF;
|
||||
@@ -486,10 +488,12 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
actor = targetCtx->unk_94;
|
||||
if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_27)) {
|
||||
FrameInterpolation_RecordOpenChild(actor, 1);
|
||||
NaviColor* naviColor = &sNaviColorList[actor->category];
|
||||
|
||||
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x7);
|
||||
@@ -503,6 +507,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) {
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2153),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gZTargetArrowDL);
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2158);
|
||||
@@ -2490,6 +2495,7 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) {
|
||||
|
||||
Fault_AddClient(&faultClient, Actor_FaultPrint, actor, "Actor_draw");
|
||||
|
||||
FrameInterpolation_RecordOpenChild(actor, 0);
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6035);
|
||||
|
||||
lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx);
|
||||
@@ -2497,6 +2503,7 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) {
|
||||
Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos);
|
||||
Lights_Draw(lights, globalCtx->state.gfxCtx);
|
||||
|
||||
FrameInterpolation_RecordActorPosRotMatrix();
|
||||
if (actor->flags & ACTOR_FLAG_12) {
|
||||
Matrix_SetTranslateRotateYXZ(
|
||||
actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x,
|
||||
@@ -2546,6 +2553,7 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) {
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6119);
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
|
||||
Fault_RemoveClient(&faultClient);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
|
||||
|
||||
#include "soh/frame_interpolation.h"
|
||||
|
||||
s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags);
|
||||
s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags);
|
||||
s32 Camera_QRegInit(void);
|
||||
@@ -6675,6 +6677,7 @@ s32 Camera_Special9(Camera* camera) {
|
||||
case 1:
|
||||
spec9->doorParams.timer1--;
|
||||
if (spec9->doorParams.timer1 <= 0) {
|
||||
FrameInterpolation_DontInterpolateCamera();
|
||||
camera->animState++;
|
||||
if (params->interfaceFlags & 1) {
|
||||
camPosData = Camera_GetCamBGData(camera);
|
||||
@@ -7968,6 +7971,8 @@ s32 Camera_SetCSParams(Camera* camera, CutsceneCameraPoint* atPoints, CutsceneCa
|
||||
camera->speedRatio = 0.0f;
|
||||
}
|
||||
|
||||
FrameInterpolation_DontInterpolateCamera();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
#include "soh/frame_interpolation.h"
|
||||
|
||||
void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
|
||||
EffectBlureElement* elem;
|
||||
s32 numElements;
|
||||
@@ -946,6 +948,7 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
||||
s32 j;
|
||||
s32 phi_t2;
|
||||
|
||||
FrameInterpolation_RecordOpenChild(this, 0);
|
||||
OPEN_DISPS(gfxCtx, "../z_eff_blure.c", 1596);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
@@ -1059,4 +1062,5 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
||||
}
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_eff_blure.c", 1823);
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include "vt.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
#include "soh/frame_interpolation.h"
|
||||
|
||||
static Vtx sVertices[5] = {
|
||||
VTX(-32, -32, 0, 0, 1024, 0xFF, 0xFF, 0xFF, 0xFF),
|
||||
VTX(32, 32, 0, 1024, 0, 0xFF, 0xFF, 0xFF, 0xFF),
|
||||
@@ -154,6 +156,7 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
||||
Color_RGBA8 primColor;
|
||||
Color_RGBA8 envColor;
|
||||
|
||||
FrameInterpolation_RecordOpenChild(this, 0);
|
||||
OPEN_DISPS(gfxCtx, "../z_eff_shield_particle.c", 272);
|
||||
|
||||
if (this != NULL) {
|
||||
@@ -213,4 +216,5 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
||||
}
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_eff_shield_particle.c", 359);
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
#include "soh/frame_interpolation.h"
|
||||
|
||||
// original name: "spark"
|
||||
void EffectSpark_Init(void* thisx, void* initParamsx) {
|
||||
EffectSpark* this = (EffectSpark*)thisx;
|
||||
@@ -152,6 +154,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
||||
u8 sp1C4;
|
||||
f32 ratio;
|
||||
|
||||
FrameInterpolation_RecordOpenChild(this, 0);
|
||||
OPEN_DISPS(gfxCtx, "../z_eff_spark.c", 293);
|
||||
|
||||
if (this != NULL) {
|
||||
@@ -274,4 +277,5 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
||||
|
||||
end:
|
||||
CLOSE_DISPS(gfxCtx, "../z_eff_spark.c", 498);
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
|
||||
#include "soh/frame_interpolation.h"
|
||||
|
||||
EffectSsInfo sEffectSsInfo = { 0 }; // "EffectSS2Info"
|
||||
|
||||
void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) {
|
||||
@@ -233,6 +235,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init
|
||||
|
||||
sEffectSsInfo.table[index].type = type;
|
||||
sEffectSsInfo.table[index].priority = priority;
|
||||
sEffectSsInfo.table[index].epoch++;
|
||||
|
||||
if (initInfo->init(globalCtx, index, &sEffectSsInfo.table[index], initParams) == 0) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
@@ -284,7 +287,9 @@ void EffectSs_Draw(GlobalContext* globalCtx, s32 index) {
|
||||
EffectSs* effectSs = &sEffectSsInfo.table[index];
|
||||
|
||||
if (effectSs->draw != NULL) {
|
||||
FrameInterpolation_RecordOpenChild(effectSs, effectSs->epoch);
|
||||
effectSs->draw(globalCtx, index, effectSs);
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user