From e6a1ea9d4ff72f31e1726a344b3810b4c3e8d747 Mon Sep 17 00:00:00 2001 From: Roman Masanin <36927roma@gmail.com> Date: Mon, 12 Oct 2020 13:28:06 +0300 Subject: [PATCH] CBrightLight::render --- src/render/SpecialFX.cpp | 30 ++++++++++++++++++++++++++++-- src/render/SpecialFX.h | 3 ++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp index dcf795f5..8403e173 100644 --- a/src/render/SpecialFX.cpp +++ b/src/render/SpecialFX.cpp @@ -988,6 +988,9 @@ CBrightLights::Render(void) RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil); + TempBufferVerticesStored = 0; + TempBufferIndicesStored = 0; + for(i = 0; i < NumBrightLights; i++){ if(TempBufferIndicesStored > TEMPBUFFERINDEXSIZE-40 || TempBufferVerticesStored > TEMPBUFFERVERTSIZE-40) RenderOutGeometryBuffer(); @@ -1024,6 +1027,13 @@ CBrightLights::Render(void) g = aBrightLights[i].m_green; b = aBrightLights[i].m_blue; break; + default: +#ifdef FIX_BUGS //just to make sure that color never will be undefined + r = 0; + g = 0; + b = 0; +#endif + break; } if(aBrightLights[i].m_camDist < BRIGHTLIGHTS_FADE_DIST) @@ -1087,6 +1097,22 @@ CBrightLights::Render(void) TempBufferIndicesStored += 12*3; break; + case BRIGHTLIGHT_FRONT_BIG: + case BRIGHTLIGHT_REAR_BIG: + for (j = 0; j < 8; j++) { + pos = BigCarHeadLightsSide[j] * aBrightLights[i].m_side + + BigCarHeadLightsUp[j] * aBrightLights[i].m_up + + BigCarHeadLightsFront[j] * aBrightLights[i].m_front + + aBrightLights[i].m_pos; + RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored + j], r, g, b, a); + RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored + j], pos.x, pos.y, pos.z); + } + for (j = 0; j < 12 * 3; j++) + TempBufferRenderIndexList[TempBufferIndicesStored + j] = CubeIndices[j] + TempBufferVerticesStored; + TempBufferVerticesStored += 8; + TempBufferIndicesStored += 12 * 3; + break; + case BRIGHTLIGHT_FRONT_TALL: case BRIGHTLIGHT_REAR_TALL: for(j = 0; j < 8; j++){ @@ -1105,8 +1131,8 @@ CBrightLights::Render(void) case BRIGHTLIGHT_SIREN: for(j = 0; j < 6; j++){ - pos = SirenLightsSide[j]*aBrightLights[i].m_side + - SirenLightsUp[j]*aBrightLights[i].m_up + + pos = SirenLightsSide[j]*TheCamera.GetRight() + + SirenLightsUp[j]* TheCamera.GetUp() + aBrightLights[i].m_pos; RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+j], r, g, b, a); RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+j], pos.x, pos.y, pos.z); diff --git a/src/render/SpecialFX.h b/src/render/SpecialFX.h index 897d8b92..bf3197dc 100644 --- a/src/render/SpecialFX.h +++ b/src/render/SpecialFX.h @@ -165,6 +165,7 @@ public: uint8 m_blue; }; +//done class CBrightLights { static int NumBrightLights; @@ -173,7 +174,7 @@ public: static void Init(void); //done static void RegisterOne(CVector pos, CVector up, CVector side, CVector front, uint8 type, uint8 red = 0, uint8 green = 0, uint8 blue = 0); //done - static void Render(void); //looks similad but needs recheck !!!!!!!!!!!!!!!!! + static void Render(void); //done static void RenderOutGeometryBuffer(void); //done };