fix(daynight): fix compilation issues

This commit is contained in:
VDm 2025-07-28 00:30:40 +04:00
parent add79bdc94
commit a886fe7d63
4 changed files with 33 additions and 12 deletions

View File

@ -2165,7 +2165,7 @@ void CGxDeviceD3d::SceneClear(uint32_t mask, CImVector color) {
this->IXformSetViewport();
}
D3DCOLOR d3dColor = color.b | (color.g | (color.r << 8) << 8);
D3DCOLOR d3dColor = D3DCOLOR_RGBA(color.r, color.g, color.b, color.a);
this->m_d3dDevice->Clear(0, nullptr, flags, d3dColor, 1.0f, 0);
}

View File

@ -23,13 +23,15 @@ void DNSky::Render() {
GxRsSet(GxRs_DepthWrite, 0);
GxRsSet(GxRs_BlendingMode, GxBlend_Add);
GxRsSetAlphaRef();
GxPrimVertexPtr(
this->m_nVerts, this->m_geoVerts.Ptr(), 12,
GxPrimLockVertexPtrs(
this->m_nVerts, this->m_geoVerts.Ptr(), sizeof(C3Vector),
nullptr, 0,
this->m_clrVerts.Ptr(), sizeof(CImVector),
nullptr, 0,
this->m_clrVerts.Ptr(), 4,
nullptr, 0,
nullptr, 0);
GxDrawLockedElements(GxPrim_TriangleStrip, this->m_nIndices, this->m_indices.Ptr());
GxPrimUnlockVertexPtrs();
GxXformPop(GxXform_World);
GxRsPop();
}
@ -74,10 +76,10 @@ void DNSky::GenSphere(float sphRadius) {
for (int32_t j = 0; j < geoSize; ++j) {
auto& vertex = this->m_geoVerts[lastGeoIndex++];
float v19 = static_cast<float>(j) * 0.041666668f * 6.2831855f;
vertex.x = CMath::sinf(v19) * v16 * sphRadius;
vertex.y = v16 * CMath::cosf(v19) * sphRadius0;
vertex.z = sphRadius * v12 - CMath::cosf(0.7853981852531433f);
float v19 = static_cast<float>(j) * 0.041666668f * CMath::TWO_PI;
vertex.x = CMath::sin(v19) * v16 * sphRadius;
vertex.y = v16 * CMath::cos(v19) * sphRadius;
vertex.z = sphRadius * v12 - CMath::cos(0.7853981852531433f);
if (CMath::fequal(phi, 0.0f) || CMath::fequal(phi, CMath::PI)) {
break;
@ -98,4 +100,11 @@ void DNSky::GenSphere(float sphRadius) {
this->m_nIndices = lastIndex; // Should be always equal to 300
}
void DNSky::SetColors() {
// TODO
for (uint32_t i = 0; i < this->m_clrVerts.Count(); ++i) {
this->m_clrVerts[i] = { 0xFF, 0, 0xFF, 0xFF };
}
}
} // namespace DayNight

View File

@ -15,6 +15,7 @@ class DNSky {
void Render();
void GenSphere(float sphRadius);
void SetColors();
static float m_stripSizes[SKY_NUMBANDS];
static float m_fadeAngle[SKY_NUMBANDS];

View File

@ -61,10 +61,20 @@ void LoadMap(int32_t zoneID) {
g_stars.Initialize();
}
void SetColors() {
// TODO
g_sky.SetColors();
}
void UpdateLighting() {
// TODO
SetColors();
}
void Update() {
// TODO
UpdateLighting();
g_stars.Update();
g_sky.Render();
}
void RenderSky() {
@ -82,10 +92,11 @@ void RenderSky() {
GxXformSetViewport(minX, maxX, minY, maxY, 0.99902344f, 1.0f);
GxRsSet(GxRs_ScissorTest, 1);
CImVector color { 0xFF000000 };
GxSceneClear(3, color);
CImVector clearColor = { 124, 125, 61, 0xFF };
GxSceneClear(3, clearColor);
g_stars.Render();
//g_stars.Render();
g_sky.Render();
}
DNInfo* GetInfo() {