mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-01-23 13:35:11 +03:00
Add better cull region calculation, change gCurrentScreenWidth to 1600 to allow aspect ratios up to 6.2.
This commit is contained in:
parent
7a333a68c2
commit
354de2f364
@ -110,7 +110,7 @@ f32 sGroundPositions360z[4] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Declare global variables for screen dimensions
|
// Declare global variables for screen dimensions
|
||||||
float gCurrentScreenWidth = 320.0f * 3; // Default width
|
float gCurrentScreenWidth = 320.0f * 5; // Default width
|
||||||
float gCurrentScreenHeight = 240.0f * 3; // Default height
|
float gCurrentScreenHeight = 240.0f * 3; // Default height
|
||||||
|
|
||||||
// Custom floating-point modulo function (replaces fmodf)
|
// Custom floating-point modulo function (replaces fmodf)
|
||||||
@ -258,12 +258,15 @@ void Background_DrawStarfield(void) {
|
|||||||
vx = (zCos * bx) + (zSin * by) + currentScreenWidth / 2.0f;
|
vx = (zCos * bx) + (zSin * by) + currentScreenWidth / 2.0f;
|
||||||
vy = (-zSin * bx) + (zCos * by) + currentScreenHeight / 2.0f;
|
vy = (-zSin * bx) + (zCos * by) + currentScreenHeight / 2.0f;
|
||||||
|
|
||||||
float thirdWidth = currentScreenWidth / 3;
|
float originalWidth = currentScreenWidth / 5;
|
||||||
float thirdHeight = currentScreenHeight / 3;
|
float originalAspect = originalWidth / (currentScreenHeight / 3);
|
||||||
|
float renderMaskWidth = originalWidth * (OTRGetAspectRatio() / originalAspect);
|
||||||
|
float marginX = (currentScreenWidth - renderMaskWidth) / 2;
|
||||||
|
float renderMaskHeight = currentScreenHeight / 3;
|
||||||
|
|
||||||
// Check if the star is within the visible screen area with margin
|
// Check if the star is within the visible screen area with margin
|
||||||
if (vx >= (thirdWidth - STAR_MARGIN) && vx <= ((thirdWidth * 2) + STAR_MARGIN) &&
|
if (vx >= (marginX - STAR_MARGIN) && vx <= (marginX + renderMaskWidth + STAR_MARGIN) &&
|
||||||
vy >= (thirdHeight - STAR_MARGIN) && vy <= ((thirdHeight * 2) + STAR_MARGIN)) {
|
vy >= (renderMaskHeight - STAR_MARGIN) && vy <= ((renderMaskHeight * 2) + STAR_MARGIN)) {
|
||||||
|
|
||||||
FrameInterpolation_RecordOpenChild("Starfield", i);
|
FrameInterpolation_RecordOpenChild("Starfield", i);
|
||||||
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
|
||||||
|
@ -588,4 +588,12 @@ extern "C" void* GameEngine_Malloc(size_t size) {
|
|||||||
memset(static_cast<uint8_t*>(MemoryPool.memory) + MemoryPool.length, 0, MemoryPool.length - chunk);
|
memset(static_cast<uint8_t*>(MemoryPool.memory) + MemoryPool.length, 0, MemoryPool.length - chunk);
|
||||||
SPDLOG_INFO("Memory pool resized from {} to {}", MemoryPool.length - chunk, MemoryPool.length);
|
SPDLOG_INFO("Memory pool resized from {} to {}", MemoryPool.length - chunk, MemoryPool.length);
|
||||||
return GameEngine_Malloc(size);
|
return GameEngine_Malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" float GetWindowWidth() {
|
||||||
|
return Ship::Context::GetInstance()->GetWindow()->GetWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" float GetWindowHeight() {
|
||||||
|
return Ship::Context::GetInstance()->GetWindow()->GetHeight();
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user