CBrightLight::render

This commit is contained in:
Roman Masanin 2020-10-12 13:28:06 +03:00
parent ca1d899413
commit e6a1ea9d4f
2 changed files with 30 additions and 3 deletions

View File

@ -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);

View File

@ -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
};