diff --git a/src/gx/d3d/CGxDeviceD3d.cpp b/src/gx/d3d/CGxDeviceD3d.cpp index ff5fb57..a0bf63b 100644 --- a/src/gx/d3d/CGxDeviceD3d.cpp +++ b/src/gx/d3d/CGxDeviceD3d.cpp @@ -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); } diff --git a/src/world/daynight/DNSky.cpp b/src/world/daynight/DNSky.cpp index 7202988..a6246d8 100644 --- a/src/world/daynight/DNSky.cpp +++ b/src/world/daynight/DNSky.cpp @@ -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(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(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 diff --git a/src/world/daynight/DNSky.hpp b/src/world/daynight/DNSky.hpp index fee85a9..b1937ef 100644 --- a/src/world/daynight/DNSky.hpp +++ b/src/world/daynight/DNSky.hpp @@ -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]; diff --git a/src/world/daynight/DayNight.cpp b/src/world/daynight/DayNight.cpp index 8cfa967..50e2164 100644 --- a/src/world/daynight/DayNight.cpp +++ b/src/world/daynight/DayNight.cpp @@ -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() {