mirror of
https://github.com/halpz/re3.git
synced 2025-07-21 10:09:48 +00:00
CWindModifiers
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
|
||||
#include "Antennas.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
CAntenna CAntennas::aAntennas[NUMANTENNAS];
|
||||
|
||||
void
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "General.h"
|
||||
#include "RenderBuffer.h"
|
||||
#include "TxdStore.h"
|
||||
#include "Camera.h"
|
||||
#include "Sprite.h"
|
||||
@ -12,6 +13,8 @@
|
||||
#include "Timecycle.h"
|
||||
#include "Coronas.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
struct FlareDef
|
||||
{
|
||||
float position;
|
||||
@ -130,13 +133,21 @@ void
|
||||
CCoronas::RegisterCorona(uint32 id, uint8 red, uint8 green, uint8 blue, uint8 alpha,
|
||||
const CVector &coors, float size, float drawDist, RwTexture *tex,
|
||||
int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle,
|
||||
bool longDist, float nearDist)
|
||||
bool useNearDist, float nearDist)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(sq(drawDist) < (TheCamera.GetPosition() - coors).MagnitudeSqr2D())
|
||||
return;
|
||||
|
||||
if(useNearDist){
|
||||
float dist = (TheCamera.GetPosition() - coors).Magnitude();
|
||||
if(dist < 35.0f)
|
||||
return;
|
||||
if(dist < 50.0f)
|
||||
alpha *= (dist - 35.0f)/(50.0f - 35.0f);
|
||||
}
|
||||
|
||||
for(i = 0; i < NUMCORONAS; i++)
|
||||
if(aCoronas[i].id == id)
|
||||
break;
|
||||
@ -189,17 +200,19 @@ CCoronas::RegisterCorona(uint32 id, uint8 red, uint8 green, uint8 blue, uint8 al
|
||||
aCoronas[i].reflection = reflection;
|
||||
aCoronas[i].LOScheck = LOScheck;
|
||||
aCoronas[i].drawStreak = drawStreak;
|
||||
aCoronas[i].useNearDist = useNearDist;
|
||||
aCoronas[i].nearDist = nearDist;
|
||||
}
|
||||
|
||||
void
|
||||
CCoronas::RegisterCorona(uint32 id, uint8 red, uint8 green, uint8 blue, uint8 alpha,
|
||||
const CVector &coors, float size, float drawDist, uint8 type,
|
||||
int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle,
|
||||
bool longDist, float nearDist)
|
||||
bool useNearDist, float nearDist)
|
||||
{
|
||||
RegisterCorona(id, red, green, blue, alpha, coors, size, drawDist,
|
||||
gpCoronaTexture[type], flareType, reflection, LOScheck, drawStreak, someAngle,
|
||||
longDist, nearDist);
|
||||
useNearDist, nearDist);
|
||||
}
|
||||
|
||||
void
|
||||
@ -258,7 +271,10 @@ CCoronas::Render(void)
|
||||
|
||||
CVector spriteCoors;
|
||||
float spritew, spriteh;
|
||||
if(CSprite::CalcScreenCoors(aCoronas[i].coors, spriteCoors, &spritew, &spriteh, true)){
|
||||
if(!CSprite::CalcScreenCoors(aCoronas[i].coors, spriteCoors, &spritew, &spriteh, true)){
|
||||
aCoronas[i].offScreen = true;
|
||||
aCoronas[i].sightClear = false;
|
||||
}else{
|
||||
aCoronas[i].offScreen = false;
|
||||
|
||||
if(spriteCoors.x < 0.0f || spriteCoors.y < 0.0f ||
|
||||
@ -292,10 +308,7 @@ CCoronas::Render(void)
|
||||
}
|
||||
|
||||
|
||||
if(aCoronas[i].fadeAlpha == 0)
|
||||
continue;
|
||||
|
||||
if(spriteCoors.z < aCoronas[i].drawDist){
|
||||
if(aCoronas[i].fadeAlpha && spriteCoors.z < aCoronas[i].drawDist){
|
||||
float recipz = 1.0f/spriteCoors.z;
|
||||
float fadeDistance = aCoronas[i].drawDist / 2.0f;
|
||||
float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance;
|
||||
@ -312,7 +325,7 @@ CCoronas::Render(void)
|
||||
if(CCoronas::aCoronas[i].id == SUN_CORE)
|
||||
spriteCoors.z = 0.95f * RwCameraGetFarClipPlane(Scene.camera);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(aCoronas[i].texture));
|
||||
spriteCoors.z -= 1.5f;
|
||||
spriteCoors.z -= aCoronas[i].nearDist;
|
||||
|
||||
if(aCoronas[i].texture == gpCoronaTexture[8]){
|
||||
// what's this?
|
||||
@ -370,14 +383,11 @@ CCoronas::Render(void)
|
||||
recipz, 255);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
aCoronas[i].offScreen = true;
|
||||
aCoronas[i].sightClear = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
|
||||
@ -393,23 +403,24 @@ CCoronas::Render(void)
|
||||
if(!aCoronas[i].hasValue[j] || !aCoronas[i].hasValue[j+1])
|
||||
continue;
|
||||
|
||||
int mod1 = (float)(6 - j) / 6 * 128;
|
||||
int mod2 = (float)(6 - (j+1)) / 6 * 128;
|
||||
int alpha1 = (float)(6 - j) / 6 * 128;
|
||||
int alpha2 = (float)(6 - (j+1)) / 6 * 128;
|
||||
|
||||
RwIm2DVertexSetScreenX(&vertexbufferX[0], aCoronas[i].prevX[j]);
|
||||
RwIm2DVertexSetScreenY(&vertexbufferX[0], aCoronas[i].prevY[j]);
|
||||
RwIm2DVertexSetIntRGBA(&vertexbufferX[0], aCoronas[i].prevRed[j] * mod1 / 256, aCoronas[i].prevGreen[j] * mod1 / 256, aCoronas[i].prevBlue[j] * mod1 / 256, 255);
|
||||
RwIm2DVertexSetIntRGBA(&vertexbufferX[0], aCoronas[i].prevRed[j] * alpha1 / 256, aCoronas[i].prevGreen[j] * alpha1 / 256, aCoronas[i].prevBlue[j] * alpha1 / 256, 255);
|
||||
RwIm2DVertexSetScreenX(&vertexbufferX[1], aCoronas[i].prevX[j+1]);
|
||||
RwIm2DVertexSetScreenY(&vertexbufferX[1], aCoronas[i].prevY[j+1]);
|
||||
RwIm2DVertexSetIntRGBA(&vertexbufferX[1], aCoronas[i].prevRed[j+1] * mod2 / 256, aCoronas[i].prevGreen[j+1] * mod2 / 256, aCoronas[i].prevBlue[j+1] * mod2 / 256, 255);
|
||||
RwIm2DVertexSetIntRGBA(&vertexbufferX[1], aCoronas[i].prevRed[j+1] * alpha2 / 256, aCoronas[i].prevGreen[j+1] * alpha2 / 256, aCoronas[i].prevBlue[j+1] * alpha2 / 256, 255);
|
||||
|
||||
// BUG: game doesn't do this
|
||||
#ifdef FIX_BUGS
|
||||
RwIm2DVertexSetScreenZ(&vertexbufferX[0], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetCameraZ(&vertexbufferX[0], RwCameraGetNearClipPlane(Scene.camera));
|
||||
RwIm2DVertexSetRecipCameraZ(&vertexbufferX[0], 1.0f/RwCameraGetNearClipPlane(Scene.camera));
|
||||
RwIm2DVertexSetScreenZ(&vertexbufferX[1], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetCameraZ(&vertexbufferX[1], RwCameraGetNearClipPlane(Scene.camera));
|
||||
RwIm2DVertexSetRecipCameraZ(&vertexbufferX[1], 1.0f/RwCameraGetNearClipPlane(Scene.camera));
|
||||
#endif
|
||||
|
||||
RwIm2DRenderLine(vertexbufferX, 2, 0, 1);
|
||||
}
|
||||
@ -428,6 +439,8 @@ CCoronas::RenderReflections(void)
|
||||
CEntity *entity;
|
||||
|
||||
if(CWeather::WetRoads > 0.0f){
|
||||
CSprite::InitSpriteBuffer();
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
|
||||
@ -438,7 +451,8 @@ CCoronas::RenderReflections(void)
|
||||
|
||||
for(i = 0; i < NUMCORONAS; i++){
|
||||
if(aCoronas[i].id == 0 ||
|
||||
aCoronas[i].fadeAlpha == 0 && aCoronas[i].alpha == 0)
|
||||
aCoronas[i].fadeAlpha == 0 && aCoronas[i].alpha == 0 ||
|
||||
aCoronas[i].reflection == 0)
|
||||
continue;
|
||||
|
||||
// check if we want a reflection on this corona
|
||||
@ -453,11 +467,8 @@ CCoronas::RenderReflections(void)
|
||||
}
|
||||
}
|
||||
|
||||
if(!aCoronas[i].renderReflection)
|
||||
continue;
|
||||
|
||||
// Don't draw if reflection is too high
|
||||
if(aCoronas[i].heightAboveRoad < 20.0f){
|
||||
if(aCoronas[i].renderReflection && aCoronas[i].heightAboveRoad < 20.0f){
|
||||
// don't draw if camera is below road
|
||||
if(CCoronas::aCoronas[i].coors.z - aCoronas[i].heightAboveRoad > TheCamera.GetPosition().z)
|
||||
continue;
|
||||
@ -469,13 +480,14 @@ CCoronas::RenderReflections(void)
|
||||
float spritew, spriteh;
|
||||
if(CSprite::CalcScreenCoors(coors, spriteCoors, &spritew, &spriteh, true)){
|
||||
float drawDist = 0.75f * aCoronas[i].drawDist;
|
||||
drawDist = Min(drawDist, 50.0f);
|
||||
drawDist = Min(drawDist, 55.0f);
|
||||
if(spriteCoors.z < drawDist){
|
||||
float fadeDistance = drawDist / 2.0f;
|
||||
float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance;
|
||||
distanceFade = clamp(distanceFade, 0.0f, 1.0f);
|
||||
float recipz = 1.0f/RwCameraGetNearClipPlane(Scene.camera);
|
||||
int intensity = (20.0f - aCoronas[i].heightAboveRoad) * 230.0 * distanceFade*CWeather::WetRoads * 0.05f;
|
||||
float heightFade = (20.0f - aCoronas[i].heightAboveRoad)/20.0f;
|
||||
int intensity = distanceFade*heightFade * 230.0 * CWeather::WetRoads;
|
||||
|
||||
CSprite::RenderBufferedOneXLUSprite(
|
||||
spriteCoors.x, spriteCoors.y, RwIm2DGetNearScreenZ(),
|
||||
@ -504,6 +516,130 @@ CCoronas::RenderReflections(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CCoronas::RenderSunReflection(void)
|
||||
{
|
||||
float sunZDir = CTimeCycle::GetSunDirection().z;
|
||||
if(sunZDir > -0.05f){
|
||||
float intensity = (0.3f - Abs(sunZDir - 0.25f))/0.3f *
|
||||
(1.0f - CWeather::CloudCoverage) *
|
||||
(1.0f - CWeather::Foggyness) *
|
||||
(1.0f - CWeather::Wind);
|
||||
if(intensity > 0.0f){
|
||||
int r = (CTimeCycle::GetSunCoreRed() + CTimeCycle::GetSunCoronaRed())*intensity*0.25f;
|
||||
int g = (CTimeCycle::GetSunCoreGreen() + CTimeCycle::GetSunCoronaGreen())*intensity*0.25f;
|
||||
int b = (CTimeCycle::GetSunCoreBlue() + CTimeCycle::GetSunCoronaBlue())*intensity*0.25f;
|
||||
|
||||
CVector sunPos = 40.0f*CTimeCycle::GetSunDirection() + TheCamera.GetPosition();
|
||||
sunPos.z = 0.5f*CWeather::Wind + 6.1f;
|
||||
CVector sunDir = CTimeCycle::GetSunDirection();
|
||||
sunDir.z = 0.0;
|
||||
sunDir.Normalise();
|
||||
|
||||
TempBufferIndicesStored = 6;
|
||||
TempBufferRenderIndexList[0] = 2;
|
||||
TempBufferRenderIndexList[1] = 1;
|
||||
TempBufferRenderIndexList[2] = 0;
|
||||
TempBufferRenderIndexList[3] = 2;
|
||||
TempBufferRenderIndexList[4] = 3;
|
||||
TempBufferRenderIndexList[5] = 1;
|
||||
|
||||
// 60 unit square in sun direction
|
||||
TempBufferVerticesStored = 4;
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[0], r, g, b, 255);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[0],
|
||||
sunPos.x + 30.0f*sunDir.y,
|
||||
sunPos.y - 30.0f*sunDir.x,
|
||||
sunPos.z);
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[1], r, g, b, 255);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[1],
|
||||
sunPos.x - 30.0f*sunDir.y,
|
||||
sunPos.y + 30.0f*sunDir.x,
|
||||
sunPos.z);
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[2], r, g, b, 255);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[2],
|
||||
sunPos.x + 60.0f*sunDir.x + 30.0f*sunDir.y,
|
||||
sunPos.y + 60.0f*sunDir.y - 30.0f*sunDir.x,
|
||||
sunPos.z);
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[3], r, g, b, 255);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[3],
|
||||
sunPos.x + 60.0f*sunDir.x - 30.0f*sunDir.y,
|
||||
sunPos.y + 60.0f*sunDir.y + 30.0f*sunDir.x,
|
||||
sunPos.z);
|
||||
|
||||
RwIm3DVertexSetU(&TempBufferRenderVertices[0], 0.0f);
|
||||
RwIm3DVertexSetV(&TempBufferRenderVertices[0], 1.0f);
|
||||
RwIm3DVertexSetU(&TempBufferRenderVertices[1], 1.0f);
|
||||
RwIm3DVertexSetV(&TempBufferRenderVertices[1], 1.0f);
|
||||
RwIm3DVertexSetU(&TempBufferRenderVertices[2], 0.0f);
|
||||
RwIm3DVertexSetV(&TempBufferRenderVertices[2], 0.5f);
|
||||
RwIm3DVertexSetU(&TempBufferRenderVertices[3], 1.0f);
|
||||
RwIm3DVertexSetV(&TempBufferRenderVertices[3], 0.5f);
|
||||
|
||||
int timeInc = 0;
|
||||
int sideInc = 0;
|
||||
int fwdInc = 0;
|
||||
for(int i = 0; i < 20; i++){
|
||||
TempBufferRenderIndexList[TempBufferIndicesStored + 0] = TempBufferVerticesStored;
|
||||
TempBufferRenderIndexList[TempBufferIndicesStored + 1] = TempBufferVerticesStored-1;
|
||||
TempBufferRenderIndexList[TempBufferIndicesStored + 2] = TempBufferVerticesStored-2;
|
||||
TempBufferRenderIndexList[TempBufferIndicesStored + 3] = TempBufferVerticesStored;
|
||||
TempBufferRenderIndexList[TempBufferIndicesStored + 4] = TempBufferVerticesStored+1;
|
||||
TempBufferRenderIndexList[TempBufferIndicesStored + 5] = TempBufferVerticesStored-1;
|
||||
TempBufferIndicesStored += 6;
|
||||
|
||||
// What a weird way to do it...
|
||||
float fwdLen = fwdInc/20 + 60;
|
||||
float sideLen = sideInc/20 + 30;
|
||||
sideLen += 10.0f*Sin((float)(CTimer::GetTimeInMilliseconds()+timeInc & 0x7FF)/0x800*TWOPI);
|
||||
timeInc += 900;
|
||||
sideInc += 970;
|
||||
fwdInc += 1440;
|
||||
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+0], r, g, b, 255);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+0],
|
||||
sunPos.x + fwdLen*sunDir.x + sideLen*sunDir.y,
|
||||
sunPos.y + fwdLen*sunDir.y - sideLen*sunDir.x,
|
||||
sunPos.z);
|
||||
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+1], r, g, b, 255);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+1],
|
||||
sunPos.x + fwdLen*sunDir.x - sideLen*sunDir.x,
|
||||
sunPos.y + fwdLen*sunDir.y + sideLen*sunDir.y,
|
||||
sunPos.z);
|
||||
|
||||
RwIm3DVertexSetU(&TempBufferRenderVertices[TempBufferVerticesStored+0], 0.0f);
|
||||
RwIm3DVertexSetV(&TempBufferRenderVertices[TempBufferVerticesStored+0], 0.5f);
|
||||
RwIm3DVertexSetU(&TempBufferRenderVertices[TempBufferVerticesStored+1], 1.0f);
|
||||
RwIm3DVertexSetV(&TempBufferRenderVertices[TempBufferVerticesStored+1], 0.5f);
|
||||
TempBufferVerticesStored += 2;
|
||||
}
|
||||
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEFOGTYPE, (void*)rwFOGTYPELINEAR);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[4]));
|
||||
if(RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, rwIM3D_VERTEXUV)){
|
||||
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempBufferRenderIndexList, TempBufferIndicesStored);
|
||||
RwIm3DEnd();
|
||||
}
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
|
||||
TempBufferVerticesStored = 0;
|
||||
TempBufferIndicesStored = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CCoronas::DoSunAndMoon(void)
|
||||
{
|
||||
@ -520,7 +656,7 @@ CCoronas::DoSunAndMoon(void)
|
||||
255, sunCoors, size,
|
||||
999999.88f, TYPE_STAR, FLARE_NONE, REFLECTION_OFF, LOSCHECK_OFF, STREAK_OFF, 0.0f);
|
||||
|
||||
if(CTimeCycle::GetSunDirection().z > 0.0f)
|
||||
if(CTimeCycle::GetSunDirection().z > 0.0f && !CGame::IsInInterior())
|
||||
RegisterCorona(SUN_CORONA,
|
||||
CTimeCycle::GetSunCoronaRed(), CTimeCycle::GetSunCoronaGreen(), CTimeCycle::GetSunCoronaBlue(),
|
||||
255, sunCoors, 25.0f * CTimeCycle::GetSunSize(),
|
||||
|
@ -4,19 +4,21 @@ extern RwTexture *gpCoronaTexture[9];
|
||||
|
||||
struct CRegisteredCorona
|
||||
{
|
||||
CVector coors;
|
||||
uint32 id;
|
||||
uint32 lastLOScheck;
|
||||
RwTexture *texture;
|
||||
float size;
|
||||
float someAngle;
|
||||
float drawDist;
|
||||
float nearDist;
|
||||
float heightAboveRoad;
|
||||
uint8 red;
|
||||
uint8 green;
|
||||
uint8 blue;
|
||||
uint8 alpha; // alpha when fully visible
|
||||
uint8 fadeAlpha; // actual value used for rendering, faded
|
||||
CVector coors;
|
||||
float size;
|
||||
float someAngle;
|
||||
bool registeredThisFrame;
|
||||
float drawDist;
|
||||
int8 flareType;
|
||||
int8 reflection;
|
||||
|
||||
@ -25,12 +27,11 @@ struct CRegisteredCorona
|
||||
uint8 firstUpdate : 1;
|
||||
uint8 drawStreak : 1;
|
||||
uint8 sightClear : 1;
|
||||
uint8 useNearDist : 1;
|
||||
uint8 renderReflection : 1;
|
||||
|
||||
bool renderReflection;
|
||||
float heightAboveRoad;
|
||||
|
||||
float prevX[6];
|
||||
float prevY[6];
|
||||
int16 prevX[6];
|
||||
int16 prevY[6];
|
||||
uint8 prevRed[6];
|
||||
uint8 prevGreen[6];
|
||||
uint8 prevBlue[6];
|
||||
@ -39,7 +40,7 @@ struct CRegisteredCorona
|
||||
void Update(void);
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(CRegisteredCorona, 0x80);
|
||||
VALIDATE_SIZE(CRegisteredCorona, 0x68);
|
||||
|
||||
class CCoronas
|
||||
{
|
||||
@ -91,13 +92,14 @@ public:
|
||||
static void RegisterCorona(uint32 id, uint8 red, uint8 green, uint8 blue, uint8 alpha,
|
||||
const CVector &coors, float size, float drawDist, RwTexture *tex,
|
||||
int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle,
|
||||
bool longDist = false, float nearClip = 1.5f);
|
||||
bool useNearDist = false, float nearDist = 1.5f);
|
||||
static void RegisterCorona(uint32 id, uint8 red, uint8 green, uint8 blue, uint8 alpha,
|
||||
const CVector &coors, float size, float drawDist, uint8 type,
|
||||
int8 flareType, uint8 reflection, uint8 LOScheck, uint8 drawStreak, float someAngle,
|
||||
bool longDist = false, float nearClip = 1.5f);
|
||||
bool useNearDist = false, float nearDist = 1.5f);
|
||||
static void UpdateCoronaCoors(uint32 id, const CVector &coors, float drawDist, float someAngle);
|
||||
static void Render(void);
|
||||
static void RenderReflections(void);
|
||||
static void RenderSunReflection(void);
|
||||
static void DoSunAndMoon(void);
|
||||
};
|
||||
|
269
src/render/CutsceneShadow.cpp
Normal file
269
src/render/CutsceneShadow.cpp
Normal file
@ -0,0 +1,269 @@
|
||||
#include "common.h"
|
||||
#include "main.h"
|
||||
#include "rwcore.h"
|
||||
#include "rwplcore.h"
|
||||
#include "CutsceneShadow.h"
|
||||
#include "RwHelper.h"
|
||||
|
||||
#define DLIGHT_VALUE 0.8f /* Directional light intensity */
|
||||
|
||||
|
||||
CCutsceneShadow::CCutsceneShadow()
|
||||
{
|
||||
m_pAtomic = nil;
|
||||
m_nRwObjectType = -1;
|
||||
m_pLight = nil;
|
||||
m_nBlurPasses = 0;
|
||||
m_bResample = false;
|
||||
m_bGradient = false;
|
||||
}
|
||||
|
||||
CCutsceneShadow::~CCutsceneShadow()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
bool
|
||||
CCutsceneShadow::Create(RwObject *object, int32 rasterSize, bool resample, int32 blurPasses, bool gradient)
|
||||
{
|
||||
ASSERT(object != nil);
|
||||
|
||||
RwRGBAReal color;
|
||||
RwFrame *frame;
|
||||
|
||||
if (!object)
|
||||
return false;
|
||||
|
||||
m_pLight = RpLightCreate(rpLIGHTDIRECTIONAL);
|
||||
ASSERT(m_pLight != nil);
|
||||
|
||||
if (!m_pLight)
|
||||
return false;
|
||||
|
||||
color.red = color.green = color.blue = DLIGHT_VALUE;
|
||||
color.alpha = 0.0f;
|
||||
|
||||
RpLightSetColor(m_pLight, &color);
|
||||
|
||||
frame = RwFrameCreate();
|
||||
ASSERT(frame != nil);
|
||||
|
||||
RpLightSetFrame(m_pLight, frame);
|
||||
|
||||
SetLightProperties(180.0f, 90.0f, false);
|
||||
|
||||
m_pObject = object;
|
||||
m_nRwObjectType = RwObjectGetType(m_pObject);
|
||||
|
||||
switch ( m_nRwObjectType )
|
||||
{
|
||||
case rpCLUMP:
|
||||
{
|
||||
RpClumpGetBoundingSphere(m_pClump, &m_BoundingSphere, 1);
|
||||
m_BaseSphere.radius = m_BoundingSphere.radius;
|
||||
RwV3dTransformPoints(&m_BaseSphere.center, &m_BoundingSphere.center, 1, RwFrameGetMatrix(RpClumpGetFrame(m_pClump)));
|
||||
break;
|
||||
}
|
||||
|
||||
case rpATOMIC:
|
||||
{
|
||||
m_BoundingSphere = *RpAtomicGetBoundingSphere(m_pAtomic);
|
||||
m_BaseSphere.radius = m_BoundingSphere.radius;
|
||||
RwV3dTransformPoints(&m_BaseSphere.center, &m_BoundingSphere.center, 1, RwFrameGetMatrix(RpAtomicGetFrame(m_pAtomic)));
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
Destroy();
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !m_Camera.Create(rasterSize) )
|
||||
{
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_nBlurPasses = blurPasses;
|
||||
m_bResample = resample;
|
||||
m_bGradient = gradient;
|
||||
|
||||
if ( m_bResample && !m_ResampleCamera.Create(rasterSize - 1) )
|
||||
{
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_nBlurPasses != 0 )
|
||||
{
|
||||
if ( !m_BlurCamera.Create(resample ? rasterSize - 1 : rasterSize) )
|
||||
{
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_bGradient )
|
||||
{
|
||||
if ( !m_GradientCamera.Create(resample ? rasterSize - 1 : rasterSize) )
|
||||
{
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_GradientCamera.MakeGradientRaster();
|
||||
}
|
||||
|
||||
m_Camera.SetLight(m_pLight);
|
||||
|
||||
switch ( m_nRwObjectType )
|
||||
{
|
||||
case rpATOMIC:
|
||||
m_Camera.SetFrustum(1.1f * m_BoundingSphere.radius);
|
||||
break;
|
||||
|
||||
case rpCLUMP:
|
||||
m_Camera.SetFrustum(1.1f * m_BoundingSphere.radius);
|
||||
break;
|
||||
}
|
||||
|
||||
m_Camera.SetCenter(&m_BaseSphere.center);
|
||||
return true;
|
||||
}
|
||||
|
||||
RwFrame *
|
||||
CCutsceneShadow::SetLightProperties(float angleY, float angleX, bool setLight)
|
||||
{
|
||||
ASSERT(m_pLight != nil);
|
||||
|
||||
RwFrame *frame;
|
||||
static RwV3d Xaxis = { 1.0f, 0.0f, 0.0f };
|
||||
static RwV3d Yaxis = { 0.0f, 1.0f, 0.0f };
|
||||
|
||||
frame = RpLightGetFrame(m_pLight);
|
||||
ASSERT(frame != nil);
|
||||
|
||||
if ( !frame )
|
||||
return nil;
|
||||
|
||||
RwFrameRotate(frame, &Yaxis, angleY, rwCOMBINEREPLACE);
|
||||
RwFrameRotate(frame, &Xaxis, angleX, rwCOMBINEPOSTCONCAT);
|
||||
|
||||
if ( setLight )
|
||||
m_Camera.SetLight(m_pLight);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
bool
|
||||
CCutsceneShadow::IsInitialized()
|
||||
{
|
||||
return m_pObject != nil;
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneShadow::Destroy()
|
||||
{
|
||||
m_Camera.Destroy();
|
||||
m_ResampleCamera.Destroy();
|
||||
m_BlurCamera.Destroy();
|
||||
m_GradientCamera.Destroy();
|
||||
|
||||
m_pAtomic = nil;
|
||||
|
||||
m_nRwObjectType = -1;
|
||||
|
||||
if (m_pLight)
|
||||
{
|
||||
RwFrame *frame = RpLightGetFrame(m_pLight);
|
||||
RpLightSetFrame(m_pLight, nil);
|
||||
RwFrameDestroy(frame);
|
||||
RpLightDestroy(m_pLight);
|
||||
m_pLight = nil;
|
||||
}
|
||||
}
|
||||
|
||||
RwRaster *
|
||||
CCutsceneShadow::Update()
|
||||
{
|
||||
switch ( m_nRwObjectType )
|
||||
{
|
||||
case rpCLUMP:
|
||||
ASSERT(m_pClump != nil);
|
||||
RwV3dTransformPoints(&m_BaseSphere.center, &m_BoundingSphere.center, 1, RwFrameGetMatrix(RpClumpGetFrame(m_pClump)));
|
||||
break;
|
||||
|
||||
case rpATOMIC:
|
||||
ASSERT(m_pAtomic != nil);
|
||||
RwV3dTransformPoints(&m_BaseSphere.center, &m_BoundingSphere.center, 1, RwFrameGetMatrix(RpAtomicGetFrame(m_pAtomic)));
|
||||
break;
|
||||
}
|
||||
|
||||
m_Camera.SetCenter(&m_BaseSphere.center);
|
||||
|
||||
switch ( m_nRwObjectType )
|
||||
{
|
||||
case rpCLUMP:
|
||||
m_Camera.Update(m_pClump);
|
||||
break;
|
||||
|
||||
case rpATOMIC:
|
||||
m_Camera.Update(m_pAtomic);
|
||||
break;
|
||||
}
|
||||
|
||||
RwRaster *raster = m_Camera.GetRwRenderRaster();
|
||||
ASSERT(raster != nil);
|
||||
|
||||
if ( m_bResample )
|
||||
return m_ResampleCamera.RasterResample(raster);
|
||||
|
||||
if ( m_nBlurPasses )
|
||||
return m_BlurCamera.RasterBlur(raster, m_nBlurPasses);
|
||||
|
||||
if ( m_bGradient )
|
||||
return m_GradientCamera.RasterGradient(raster);
|
||||
|
||||
return raster;
|
||||
}
|
||||
|
||||
RwTexture *
|
||||
CCutsceneShadow::UpdateForCutscene()
|
||||
{
|
||||
Update();
|
||||
return GetShadowRwTexture();
|
||||
}
|
||||
|
||||
CShadowCamera *
|
||||
CCutsceneShadow::GetShadowCamera(int32 camType)
|
||||
{
|
||||
switch ( camType )
|
||||
{
|
||||
case RESAMPLE: return &m_ResampleCamera;
|
||||
case BLUR: return &m_BlurCamera;
|
||||
case GRADIENT: return &m_GradientCamera;
|
||||
}
|
||||
|
||||
return &m_Camera;
|
||||
}
|
||||
|
||||
RwTexture *
|
||||
CCutsceneShadow::GetShadowRwTexture()
|
||||
{
|
||||
if ( m_bResample )
|
||||
return m_ResampleCamera.GetRwRenderTexture();
|
||||
else
|
||||
return m_Camera.GetRwRenderTexture();
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneShadow::DrawBorderAroundTexture(RwRGBA const& color)
|
||||
{
|
||||
if ( m_bResample )
|
||||
m_ResampleCamera.DrawOutlineBorder(color);
|
||||
else
|
||||
m_Camera.DrawOutlineBorder(color);
|
||||
}
|
52
src/render/CutsceneShadow.h
Normal file
52
src/render/CutsceneShadow.h
Normal file
@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
#include "ShadowCamera.h"
|
||||
|
||||
class CCutsceneShadow
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
RASTER = 0,
|
||||
RESAMPLE,
|
||||
BLUR,
|
||||
GRADIENT,
|
||||
};
|
||||
|
||||
CShadowCamera m_Camera;
|
||||
bool m_bResample;
|
||||
CShadowCamera m_ResampleCamera;
|
||||
int32 m_nBlurPasses;
|
||||
CShadowCamera m_BlurCamera;
|
||||
bool m_bGradient;
|
||||
CShadowCamera m_GradientCamera;
|
||||
|
||||
union
|
||||
{
|
||||
RwObject *m_pObject;
|
||||
RpAtomic *m_pAtomic;
|
||||
RpClump *m_pClump;
|
||||
};
|
||||
|
||||
int32 m_nRwObjectType;
|
||||
RpLight *m_pLight;
|
||||
RwSphere m_BoundingSphere;
|
||||
RwSphere m_BaseSphere;
|
||||
|
||||
CCutsceneShadow();
|
||||
~CCutsceneShadow();
|
||||
|
||||
RwSphere GetBaseSphere()
|
||||
{
|
||||
return m_BaseSphere;
|
||||
}
|
||||
|
||||
bool Create(RwObject *object, int32 rasterSize, bool resample, int32 blurPasses, bool gradient);
|
||||
RwFrame *SetLightProperties(float angleY, float angleX, bool setLight);
|
||||
bool IsInitialized();
|
||||
void Destroy();
|
||||
RwRaster *Update();
|
||||
RwTexture *UpdateForCutscene();
|
||||
CShadowCamera *GetShadowCamera(int32 camType = RASTER);
|
||||
RwTexture *GetShadowRwTexture();
|
||||
void DrawBorderAroundTexture(RwRGBA const& color);
|
||||
};
|
@ -7,6 +7,7 @@
|
||||
#include "Camera.h"
|
||||
#include "Sprite.h"
|
||||
#include "Coronas.h"
|
||||
#include "PointLights.h"
|
||||
#include "Rubbish.h"
|
||||
#include "Timecycle.h"
|
||||
#include "General.h"
|
||||
@ -391,7 +392,7 @@ void CMovingThings::Init()
|
||||
CPlaneTrails::Init();
|
||||
CSmokeTrails::Init();
|
||||
CPlaneBanners::Init();
|
||||
CEscalators::Init();
|
||||
CPointLights::Init();
|
||||
|
||||
StartCloseList.m_pNext = &CMovingThings::EndCloseList;
|
||||
StartCloseList.m_pPrev = nil;
|
||||
@ -399,6 +400,8 @@ void CMovingThings::Init()
|
||||
EndCloseList.m_pPrev = &CMovingThings::StartCloseList;
|
||||
Num = 0;
|
||||
|
||||
CEscalators::Init();
|
||||
|
||||
#ifndef MIAMI // something is still used here actually
|
||||
// Initialize scroll bars
|
||||
aScrollBars[0].Init(CVector( 228.3f, -669.0f, 39.0f ), SCROLL_BUSINESS, 0.0f, 0.5f, 0.5f, 255, 128, 0, 0.3f);
|
||||
|
@ -255,6 +255,11 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint8 DrunkBlurRed = 128;
|
||||
static uint8 DrunkBlurGreen = 128;
|
||||
static uint8 DrunkBlurBlue = 128;
|
||||
static int32 DrunkBlurIncrement = 1;
|
||||
|
||||
void
|
||||
CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, int32 bluralpha)
|
||||
{
|
||||
@ -367,7 +372,36 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(MIAMI): drunkness
|
||||
int DrunkBlurAlpha = 175.0f * Drunkness;
|
||||
if(DrunkBlurAlpha != 0){
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||
if(BlurOn){
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[0], 255, 255, 255, DrunkBlurAlpha);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[1], 255, 255, 255, DrunkBlurAlpha);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[2], 255, 255, 255, DrunkBlurAlpha);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[3], 255, 255, 255, DrunkBlurAlpha);
|
||||
}else{
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[0], DrunkBlurRed, DrunkBlurGreen, DrunkBlurBlue, DrunkBlurAlpha);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[1], DrunkBlurRed, DrunkBlurGreen, DrunkBlurBlue, DrunkBlurAlpha);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[2], DrunkBlurRed, DrunkBlurGreen, DrunkBlurBlue, DrunkBlurAlpha);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[3], DrunkBlurRed, DrunkBlurGreen, DrunkBlurBlue, DrunkBlurAlpha);
|
||||
if(DrunkBlurIncrement){
|
||||
if(DrunkBlurRed < 255) DrunkBlurRed++;
|
||||
if(DrunkBlurGreen < 255) DrunkBlurGreen++;
|
||||
if(DrunkBlurBlue < 255) DrunkBlurBlue++;
|
||||
if(DrunkBlurRed == 255)
|
||||
DrunkBlurIncrement = 0;
|
||||
}else{
|
||||
if(DrunkBlurRed > 128) DrunkBlurRed--;
|
||||
if(DrunkBlurGreen > 128) DrunkBlurGreen--;
|
||||
if(DrunkBlurBlue > 128) DrunkBlurBlue--;
|
||||
if(DrunkBlurRed == 128)
|
||||
DrunkBlurIncrement = 1;
|
||||
}
|
||||
}
|
||||
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
|
||||
}
|
||||
|
||||
// TODO(MIAMI): OverlayRenderFx
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "CutsceneMgr.h"
|
||||
#include "Lights.h"
|
||||
#include "Camera.h"
|
||||
#include "Weather.h"
|
||||
@ -10,8 +11,23 @@
|
||||
#include "Timer.h"
|
||||
#include "PointLights.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
int16 CPointLights::NumLights;
|
||||
CRegisteredPointLight CPointLights::aLights[NUMPOINTLIGHTS];
|
||||
CVector CPointLights::aCachedMapReads[32];
|
||||
float CPointLights::aCachedMapReadResults[32];
|
||||
int32 CPointLights::NextCachedValue;
|
||||
|
||||
void
|
||||
CPointLights::Init(void)
|
||||
{
|
||||
for(int i = 0; i < ARRAY_SIZE(aCachedMapReads); i++){
|
||||
aCachedMapReads[i] = CVector(0.0f, 0.0f, 0.0f);
|
||||
aCachedMapReadResults[i] = 0.0f;
|
||||
}
|
||||
NextCachedValue = 0;
|
||||
}
|
||||
|
||||
void
|
||||
CPointLights::InitPerFrame(void)
|
||||
@ -86,12 +102,11 @@ CPointLights::GenerateLightsAffectingObject(Const CVector *objCoors)
|
||||
ret *= distNorm;
|
||||
}else{
|
||||
float intensity;
|
||||
// distance fade
|
||||
if(distNorm < 0.5f)
|
||||
// near enough
|
||||
intensity = 1.0f;
|
||||
else
|
||||
// attenuate
|
||||
intensity = 1.0f - (distNorm - 0.5f)*2.0f;
|
||||
intensity = 1.0f - (distNorm - 0.5f)/(1.0f - 0.5f);
|
||||
|
||||
if(distance != 0.0f){
|
||||
CVector dir = dist / distance;
|
||||
@ -143,17 +158,22 @@ CPointLights::RenderFogEffect(void)
|
||||
CVector spriteCoors;
|
||||
float spritew, spriteh;
|
||||
|
||||
if(CCutsceneMgr::IsRunning())
|
||||
return;
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpPointlightRaster);
|
||||
|
||||
CSprite::InitSpriteBuffer();
|
||||
|
||||
for(i = 0; i < NumLights; i++){
|
||||
if(aLights[i].fogType != FOG_NORMAL && aLights[i].fogType != FOG_ALWAYS)
|
||||
continue;
|
||||
|
||||
fogginess = aLights[i].fogType == FOG_ALWAYS ? 1.0f : CWeather::Foggyness;
|
||||
fogginess = aLights[i].fogType == FOG_NORMAL ? CWeather::Foggyness : 1.0f;
|
||||
if(fogginess == 0.0f)
|
||||
continue;
|
||||
|
||||
@ -198,7 +218,7 @@ CPointLights::RenderFogEffect(void)
|
||||
float distsq = sq(dx) + sq(dy);
|
||||
float linedistsq = distsq - sq(dot);
|
||||
if(dot > 0.0f && dot < FOG_AREA_LENGTH && linedistsq < sq(FOG_AREA_WIDTH)){
|
||||
CVector fogcoors(xi, yi, aLights[i].coors.z + 1.0f);
|
||||
CVector fogcoors(xi, yi, aLights[i].coors.z + 10.0f);
|
||||
if(CWorld::ProcessVerticalLine(fogcoors, fogcoors.z - 20.0f,
|
||||
point, entity, true, false, false, false, true, false, nil)){
|
||||
// Now same check again in xyz
|
||||
@ -220,9 +240,9 @@ CPointLights::RenderFogEffect(void)
|
||||
intensity *= 1.0f - sq(Sqrt(linedistsq) / FOG_AREA_WIDTH);
|
||||
|
||||
if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){
|
||||
float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x1FFF;
|
||||
float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x2000;
|
||||
float size = FogSizes[r>>1];
|
||||
CSprite::RenderOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
||||
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
||||
spritew * size, spriteh * size,
|
||||
aLights[i].red * intensity, aLights[i].green * intensity, aLights[i].blue * intensity,
|
||||
intensity, 1/spriteCoors.z, rotation, 255);
|
||||
@ -234,9 +254,8 @@ CPointLights::RenderFogEffect(void)
|
||||
}
|
||||
|
||||
}else if(aLights[i].type == LIGHT_POINT || aLights[i].type == LIGHT_FOGONLY || aLights[i].type == LIGHT_FOGONLY_ALWAYS){
|
||||
if(CWorld::ProcessVerticalLine(aLights[i].coors, aLights[i].coors.z - 20.0f,
|
||||
point, entity, true, false, false, false, true, false, nil)){
|
||||
|
||||
float groundZ;
|
||||
if(ProcessVerticalLineUsingCache(aLights[i].coors, &groundZ)){
|
||||
xmin = aLights[i].coors.x - FOG_AREA_RADIUS;
|
||||
ymin = aLights[i].coors.y - FOG_AREA_RADIUS;
|
||||
xmax = aLights[i].coors.x + FOG_AREA_RADIUS;
|
||||
@ -267,11 +286,11 @@ CPointLights::RenderFogEffect(void)
|
||||
// more intensity the closer to light source
|
||||
intensity *= 1.0f - sq(lightdist / FOG_AREA_RADIUS);
|
||||
|
||||
CVector fogcoors(xi, yi, point.point.z + 1.6f);
|
||||
CVector fogcoors(xi, yi, groundZ + 1.6f);
|
||||
if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){
|
||||
float rotation = (CTimer::GetTimeInMilliseconds()&0x3FFF) * 2*3.14f / 0x3FFF;
|
||||
float rotation = (CTimer::GetTimeInMilliseconds()&0x3FFF) * 2*3.14f / 0x4000;
|
||||
float size = FogSizes[r>>1];
|
||||
CSprite::RenderOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
||||
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
||||
spritew * size, spriteh * size,
|
||||
aLights[i].red * intensity, aLights[i].green * intensity, aLights[i].blue * intensity,
|
||||
intensity, 1/spriteCoors.z, rotation, 255);
|
||||
@ -283,4 +302,27 @@ CPointLights::RenderFogEffect(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CSprite::FlushSpriteBuffer();
|
||||
}
|
||||
|
||||
bool
|
||||
CPointLights::ProcessVerticalLineUsingCache(CVector coors, float *groundZ)
|
||||
{
|
||||
for(int i = 0; i < ARRAY_SIZE(aCachedMapReads); i++)
|
||||
if(aCachedMapReads[i] == coors){
|
||||
*groundZ = aCachedMapReadResults[i];
|
||||
return true;
|
||||
}
|
||||
|
||||
CColPoint point;
|
||||
CEntity *entity;
|
||||
if(CWorld::ProcessVerticalLine(coors, coors.z - 20.0f, point, entity, true, false, false, false, true, false, nil)){
|
||||
aCachedMapReads[NextCachedValue] = coors;
|
||||
aCachedMapReadResults[NextCachedValue] = point.point.z;
|
||||
NextCachedValue = (NextCachedValue+1) % ARRAY_SIZE(aCachedMapReads);
|
||||
*groundZ = point.point.z;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,6 +20,9 @@ class CPointLights
|
||||
public:
|
||||
static int16 NumLights;
|
||||
static CRegisteredPointLight aLights[NUMPOINTLIGHTS];
|
||||
static CVector aCachedMapReads[32];
|
||||
static float aCachedMapReadResults[32];
|
||||
static int32 NextCachedValue;
|
||||
|
||||
enum {
|
||||
LIGHT_POINT,
|
||||
@ -37,9 +40,11 @@ public:
|
||||
FOG_ALWAYS
|
||||
};
|
||||
|
||||
static void Init(void);
|
||||
static void InitPerFrame(void);
|
||||
static void AddLight(uint8 type, CVector coors, CVector dir, float radius, float red, float green, float blue, uint8 fogType, bool castExtraShadows);
|
||||
static float GenerateLightsAffectingObject(Const CVector *objCoors);
|
||||
static void RemoveLightsAffectingObject(void);
|
||||
static void RenderFogEffect(void);
|
||||
static bool ProcessVerticalLineUsingCache(CVector coors, float *groundZ);
|
||||
};
|
||||
|
@ -74,8 +74,12 @@ CRenderer::PreRender(void)
|
||||
for(i = 0; i < ms_nNoOfVisibleEntities; i++)
|
||||
ms_aVisibleEntityPtrs[i]->PreRender();
|
||||
|
||||
for(i = 0; i < ms_nNoOfInVisibleEntities; i++)
|
||||
for (i = 0; i < ms_nNoOfInVisibleEntities; i++) {
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
if (ms_aInVisibleEntityPtrs[i]->IsVehicle() && ((CVehicle*)ms_aInVisibleEntityPtrs[i])->IsHeli())
|
||||
#endif
|
||||
ms_aInVisibleEntityPtrs[i]->PreRender();
|
||||
}
|
||||
|
||||
for(node = CVisibilityPlugins::m_alphaEntityList.head.next;
|
||||
node != &CVisibilityPlugins::m_alphaEntityList.tail;
|
||||
|
@ -8,17 +8,18 @@
|
||||
#include "World.h"
|
||||
#include "Vehicle.h"
|
||||
#include "ZoneCull.h"
|
||||
#include "Stats.h"
|
||||
#include "TxdStore.h"
|
||||
#include "RenderBuffer.h"
|
||||
#include "Rubbish.h"
|
||||
|
||||
#define RUBBISH_MAX_DIST (18.0f)
|
||||
#define RUBBISH_FADE_DIST (16.5f)
|
||||
//--MIAMI: file done
|
||||
|
||||
#define RUBBISH_MAX_DIST (23.0f)
|
||||
#define RUBBISH_FADE_DIST (20.0f)
|
||||
|
||||
RwTexture *gpRubbishTexture[4];
|
||||
RwImVertexIndex RubbishIndexList[6];
|
||||
RwImVertexIndex RubbishIndexList2[6]; // unused
|
||||
RwIm3DVertex RubbishVertices[4];
|
||||
bool CRubbish::bRubbishInvisible;
|
||||
int CRubbish::RubbishVisibility;
|
||||
COneSheet CRubbish::aSheets[NUM_RUBBISH_SHEETS];
|
||||
@ -52,12 +53,16 @@ CRubbish::Render(void)
|
||||
{
|
||||
int type;
|
||||
|
||||
if(RubbishVisibility == 0)
|
||||
return;
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
|
||||
|
||||
for(type = 0; type < 4; type++){
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpRubbishTexture[type]));
|
||||
if(type < 3 || CStats::PamphletMissionPassed)
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpRubbishTexture[type]));
|
||||
|
||||
TempBufferIndicesStored = 0;
|
||||
TempBufferVerticesStored = 0;
|
||||
@ -69,7 +74,7 @@ CRubbish::Render(void)
|
||||
if(sheet->m_state == 0)
|
||||
continue;
|
||||
|
||||
uint32 alpha = 128;
|
||||
uint32 alpha = 100;
|
||||
CVector pos;
|
||||
if(sheet->m_state == 1){
|
||||
pos = sheet->m_basePos;
|
||||
@ -82,7 +87,7 @@ CRubbish::Render(void)
|
||||
float t = (float)(CTimer::GetTimeInMilliseconds() - sheet->m_moveStart)/sheet->m_moveDuration;
|
||||
float f1 = sheet->m_isVisible ? 1.0f-t : 0.0f;
|
||||
float f2 = sheet->m_targetIsVisible ? t : 0.0f;
|
||||
alpha = 128 * (f1+f2);
|
||||
alpha = 100 * (f1+f2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,17 +97,27 @@ CRubbish::Render(void)
|
||||
alpha -= alpha*(camDist-RUBBISH_FADE_DIST)/(RUBBISH_MAX_DIST-RUBBISH_FADE_DIST);
|
||||
alpha = (RubbishVisibility*alpha)/256;
|
||||
|
||||
float vx = Sin(sheet->m_angle) * 0.4f;
|
||||
float vy = Cos(sheet->m_angle) * 0.4f;
|
||||
float vx1, vy1, vx2, vy2;
|
||||
if(type == 0 || type == 1){
|
||||
vx1 = 0.9f*Sin(sheet->m_angle);
|
||||
vy1 = 0.9f*Cos(sheet->m_angle);
|
||||
vx2 = 0.3f*Cos(sheet->m_angle);
|
||||
vy2 = -0.3f*Sin(sheet->m_angle);
|
||||
}else{
|
||||
vx1 = 0.3f*Sin(sheet->m_angle);
|
||||
vy1 = 0.3f*Cos(sheet->m_angle);
|
||||
vx2 = 0.3f*Cos(sheet->m_angle);
|
||||
vy2 = -0.3f*Sin(sheet->m_angle);
|
||||
}
|
||||
|
||||
int v = TempBufferVerticesStored;
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+0], pos.x + vx, pos.y + vy, pos.z);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+0], pos.x + vx1 + vx2, pos.y + vy1 + vy2, pos.z);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+1], pos.x + vx1 - vx2, pos.y + vy1 - vy2, pos.z);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+2], pos.x - vx1 + vx2, pos.y - vy1 + vy2, pos.z);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+3], pos.x - vx1 - vx2, pos.y - vy1 - vy2, pos.z);
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[v+0], 255, 255, 255, alpha);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+1], pos.x - vy, pos.y + vx, pos.z);
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[v+1], 255, 255, 255, alpha);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+2], pos.x + vy, pos.y - vx, pos.z);
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[v+2], 255, 255, 255, alpha);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+3], pos.x - vx, pos.y - vy, pos.z);
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[v+3], 255, 255, 255, alpha);
|
||||
RwIm3DVertexSetU(&TempBufferRenderVertices[v+0], 0.0f);
|
||||
RwIm3DVertexSetV(&TempBufferRenderVertices[v+0], 0.0f);
|
||||
@ -373,24 +388,6 @@ CRubbish::Init(void)
|
||||
EndMoversList.m_next = nil;
|
||||
EndMoversList.m_prev = &StartMoversList;
|
||||
|
||||
// unused
|
||||
RwIm3DVertexSetU(&RubbishVertices[0], 0.0f);
|
||||
RwIm3DVertexSetV(&RubbishVertices[0], 0.0f);
|
||||
RwIm3DVertexSetU(&RubbishVertices[1], 1.0f);
|
||||
RwIm3DVertexSetV(&RubbishVertices[1], 0.0f);
|
||||
RwIm3DVertexSetU(&RubbishVertices[2], 0.0f);
|
||||
RwIm3DVertexSetV(&RubbishVertices[2], 1.0f);
|
||||
RwIm3DVertexSetU(&RubbishVertices[3], 1.0f);
|
||||
RwIm3DVertexSetV(&RubbishVertices[3], 1.0f);
|
||||
|
||||
// unused
|
||||
RubbishIndexList2[0] = 0;
|
||||
RubbishIndexList2[1] = 2;
|
||||
RubbishIndexList2[2] = 1;
|
||||
RubbishIndexList2[3] = 1;
|
||||
RubbishIndexList2[4] = 2;
|
||||
RubbishIndexList2[5] = 3;
|
||||
|
||||
RubbishIndexList[0] = 0;
|
||||
RubbishIndexList[1] = 1;
|
||||
RubbishIndexList[2] = 2;
|
||||
@ -414,19 +411,11 @@ void
|
||||
CRubbish::Shutdown(void)
|
||||
{
|
||||
RwTextureDestroy(gpRubbishTexture[0]);
|
||||
#ifdef GTA3_1_1_PATCH
|
||||
gpRubbishTexture[0] = nil;
|
||||
#endif
|
||||
RwTextureDestroy(gpRubbishTexture[1]);
|
||||
#ifdef GTA3_1_1_PATCH
|
||||
gpRubbishTexture[1] = nil;
|
||||
#endif
|
||||
RwTextureDestroy(gpRubbishTexture[2]);
|
||||
#ifdef GTA3_1_1_PATCH
|
||||
gpRubbishTexture[2] = nil;
|
||||
#endif
|
||||
RwTextureDestroy(gpRubbishTexture[3]);
|
||||
#ifdef GTA3_1_1_PATCH
|
||||
gpRubbishTexture[3] = nil;
|
||||
#endif
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ class CVehicle;
|
||||
|
||||
enum {
|
||||
// NB: not all values are allowed, check the code
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
NUM_RUBBISH_SHEETS = 32
|
||||
#else
|
||||
NUM_RUBBISH_SHEETS = 64
|
||||
#endif
|
||||
};
|
||||
|
||||
class COneSheet
|
||||
|
549
src/render/ShadowCamera.cpp
Normal file
549
src/render/ShadowCamera.cpp
Normal file
@ -0,0 +1,549 @@
|
||||
#include "common.h"
|
||||
#include "rwcore.h"
|
||||
#include "ShadowCamera.h"
|
||||
#include "RwHelper.h"
|
||||
|
||||
#define TEXELOFFSET 0.5f
|
||||
|
||||
RpAtomic *ShadowRenderCallBack(RpAtomic *atomic, void *data)
|
||||
{
|
||||
RpAtomicCallBackRender savedCB = RpAtomicGetRenderCallBack(atomic);
|
||||
RpAtomicSetRenderCallBack(atomic, AtomicDefaultRenderCallBack);
|
||||
RpAtomicRender(atomic);
|
||||
RpAtomicSetRenderCallBack(atomic, savedCB);
|
||||
return atomic;
|
||||
}
|
||||
|
||||
CShadowCamera::CShadowCamera()
|
||||
{
|
||||
m_pCamera = nil;
|
||||
m_pTexture = nil;
|
||||
}
|
||||
|
||||
CShadowCamera::~CShadowCamera()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void
|
||||
CShadowCamera::Destroy()
|
||||
{
|
||||
if ( m_pCamera )
|
||||
{
|
||||
RwRaster *raster;
|
||||
RwFrame *frame;
|
||||
|
||||
frame = RwCameraGetFrame(m_pCamera);
|
||||
|
||||
if ( frame )
|
||||
{
|
||||
RwCameraSetFrame(m_pCamera, nil);
|
||||
RwFrameDestroy(frame);
|
||||
}
|
||||
|
||||
raster = RwCameraGetZRaster(m_pCamera);
|
||||
if ( raster )
|
||||
{
|
||||
RwCameraSetZRaster(m_pCamera, nil);
|
||||
RwRasterDestroy(raster);
|
||||
}
|
||||
|
||||
raster = RwCameraGetRaster(m_pCamera);
|
||||
if ( raster )
|
||||
{
|
||||
RwCameraSetRaster(m_pCamera, nil);
|
||||
RwRasterDestroy(raster);
|
||||
}
|
||||
|
||||
if ( m_pTexture )
|
||||
{
|
||||
RwTextureSetRaster(m_pTexture, nil);
|
||||
RwTextureDestroy(m_pTexture);
|
||||
m_pTexture = nil;
|
||||
}
|
||||
|
||||
RwCameraDestroy(m_pCamera);
|
||||
m_pCamera = nil;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
RwCamera *
|
||||
CShadowCamera::Create(int32 rasterSize)
|
||||
{
|
||||
int32 size = 1 << rasterSize;
|
||||
|
||||
m_pCamera = RwCameraCreate();
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
if ( m_pCamera )
|
||||
{
|
||||
RwCameraSetFrame(m_pCamera, RwFrameCreate());
|
||||
|
||||
if( RwCameraGetFrame(m_pCamera) )
|
||||
{
|
||||
RwRaster *zRaster = RwRasterCreate(size, size, 0, rwRASTERTYPEZBUFFER);
|
||||
ASSERT(zRaster != nil);
|
||||
|
||||
if ( zRaster )
|
||||
{
|
||||
RwCameraSetZRaster(m_pCamera, zRaster);
|
||||
|
||||
RwRaster *raster = RwRasterCreate(size, size, 0, rwRASTERTYPECAMERATEXTURE);
|
||||
ASSERT(raster != nil);
|
||||
|
||||
if ( raster )
|
||||
{
|
||||
RwCameraSetRaster(m_pCamera, raster);
|
||||
m_pTexture = RwTextureCreate(raster);
|
||||
ASSERT(m_pTexture != nil);
|
||||
|
||||
if ( m_pTexture )
|
||||
{
|
||||
RwTextureSetAddressing(m_pTexture, rwTEXTUREADDRESSCLAMP);
|
||||
RwTextureSetFilterMode(m_pTexture, rwFILTERLINEAR);
|
||||
RwCameraSetProjection(m_pCamera, rwPARALLEL);
|
||||
return (m_pCamera);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Destroy();
|
||||
|
||||
return (nil);
|
||||
}
|
||||
|
||||
RwCamera *
|
||||
CShadowCamera::SetFrustum(float objectRadius)
|
||||
{
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
RwV2d vw;
|
||||
|
||||
RwCameraSetFarClipPlane (m_pCamera, 2.0f * objectRadius);
|
||||
RwCameraSetNearClipPlane(m_pCamera, 0.001f * objectRadius);
|
||||
|
||||
vw.x = objectRadius;
|
||||
vw.y = objectRadius;
|
||||
RwCameraSetViewWindow(m_pCamera, &vw);
|
||||
|
||||
return m_pCamera;
|
||||
}
|
||||
|
||||
RwCamera *
|
||||
CShadowCamera::SetLight(RpLight *light)
|
||||
{
|
||||
ASSERT(light != nil);
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
RwFrame *camFrame = RwCameraGetFrame(m_pCamera);
|
||||
RwMatrix *camMatrix = RwFrameGetMatrix(camFrame);
|
||||
RwFrame *lightFrame = RpLightGetFrame(light);
|
||||
RwMatrix *lightMatrix = RwFrameGetMatrix(lightFrame);
|
||||
|
||||
*RwMatrixGetRight(camMatrix) = *RwMatrixGetRight(lightMatrix);
|
||||
*RwMatrixGetUp(camMatrix) = *RwMatrixGetUp(lightMatrix);
|
||||
*RwMatrixGetAt(camMatrix) = *RwMatrixGetAt(lightMatrix);
|
||||
|
||||
RwMatrixUpdate(camMatrix);
|
||||
RwFrameUpdateObjects(camFrame);
|
||||
|
||||
return m_pCamera;
|
||||
}
|
||||
|
||||
RwCamera *
|
||||
CShadowCamera::SetCenter(RwV3d *center)
|
||||
{
|
||||
ASSERT(center != nil);
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
RwFrame *camFrame = RwCameraGetFrame(m_pCamera);
|
||||
RwMatrix *camMatrix = RwFrameGetMatrix(camFrame);
|
||||
|
||||
*RwMatrixGetPos(camMatrix) = *center;
|
||||
|
||||
RwV3dIncrementScaled(RwMatrixGetPos(camMatrix), RwMatrixGetAt(camMatrix), -0.5f * RwCameraGetFarClipPlane(m_pCamera));
|
||||
|
||||
RwMatrixUpdate(camMatrix);
|
||||
RwFrameUpdateObjects(camFrame);
|
||||
RwFrameOrthoNormalize(camFrame);
|
||||
|
||||
return m_pCamera;
|
||||
}
|
||||
|
||||
RwCamera *
|
||||
CShadowCamera::Update(RpClump *clump)
|
||||
{
|
||||
ASSERT(clump != nil);
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
RwUInt32 flags;
|
||||
RpGeometry *geometry;
|
||||
|
||||
RwRGBA bgColor = { 255, 255, 255, 0 };
|
||||
|
||||
RwCameraClear(m_pCamera, &bgColor, rwCAMERACLEARZ | rwCAMERACLEARIMAGE);
|
||||
|
||||
if ( RwCameraBeginUpdate(m_pCamera) )
|
||||
{
|
||||
geometry = GetFirstAtomic(clump)->geometry;
|
||||
ASSERT(geometry != nil);
|
||||
|
||||
flags = RpGeometryGetFlags(geometry);
|
||||
|
||||
RpGeometrySetFlags(geometry, flags & ~(rpGEOMETRYPRELIT|rpGEOMETRYLIGHT
|
||||
|rpGEOMETRYTEXTURED|rpGEOMETRYTEXTURED2|rpGEOMETRYMODULATEMATERIALCOLOR));
|
||||
|
||||
RpClumpForAllAtomics(clump, ShadowRenderCallBack, nil);
|
||||
|
||||
RpGeometrySetFlags(geometry, flags);
|
||||
|
||||
InvertRaster();
|
||||
RwCameraEndUpdate(m_pCamera);
|
||||
}
|
||||
|
||||
return m_pCamera;
|
||||
}
|
||||
|
||||
RwCamera *
|
||||
CShadowCamera::Update(RpAtomic *atomic)
|
||||
{
|
||||
ASSERT(atomic != nil);
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
RwUInt32 flags;
|
||||
RpGeometry *geometry;
|
||||
|
||||
RwRGBA bgColor = { 255, 255, 255, 0 };
|
||||
|
||||
RwCameraClear(m_pCamera, &bgColor, rwCAMERACLEARZ | rwCAMERACLEARIMAGE);
|
||||
|
||||
if ( RwCameraBeginUpdate(m_pCamera) )
|
||||
{
|
||||
geometry = RpAtomicGetGeometry(atomic);
|
||||
ASSERT(geometry != nil);
|
||||
flags = RpGeometryGetFlags(geometry);
|
||||
|
||||
RpGeometrySetFlags(geometry, flags & ~(rpGEOMETRYPRELIT|rpGEOMETRYLIGHT
|
||||
|rpGEOMETRYTEXTURED|rpGEOMETRYTEXTURED2|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYNORMALS));
|
||||
|
||||
ShadowRenderCallBack(atomic, nil);
|
||||
|
||||
RpGeometrySetFlags(geometry, flags);
|
||||
|
||||
InvertRaster();
|
||||
RwCameraEndUpdate(m_pCamera);
|
||||
}
|
||||
|
||||
return m_pCamera;
|
||||
}
|
||||
|
||||
void
|
||||
CShadowCamera::InvertRaster()
|
||||
{
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
RwIm2DVertex vx[4];
|
||||
float crw, crh;
|
||||
RwRaster *raster;
|
||||
float recipZ;
|
||||
|
||||
raster = RwCameraGetRaster(m_pCamera);
|
||||
ASSERT(raster != nil);
|
||||
|
||||
crw = (float)RwRasterGetWidth(raster);
|
||||
crh = (float)RwRasterGetHeight(raster);
|
||||
|
||||
recipZ = 1.0f / RwCameraGetNearClipPlane(m_pCamera);
|
||||
|
||||
RwIm2DVertexSetScreenX (&vx[0], 0.0f);
|
||||
RwIm2DVertexSetScreenY (&vx[0], 0.0f);
|
||||
RwIm2DVertexSetScreenZ (&vx[0], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetRecipCameraZ(&vx[0], recipZ);
|
||||
RwIm2DVertexSetIntRGBA (&vx[0], 255, 255, 255, 255);
|
||||
|
||||
RwIm2DVertexSetScreenX (&vx[1], 0.0f);
|
||||
RwIm2DVertexSetScreenY (&vx[1], crh);
|
||||
RwIm2DVertexSetScreenZ (&vx[1], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetRecipCameraZ(&vx[1], recipZ);
|
||||
RwIm2DVertexSetIntRGBA (&vx[1], 255, 255, 255, 255);
|
||||
|
||||
RwIm2DVertexSetScreenX (&vx[2], crw);
|
||||
RwIm2DVertexSetScreenY (&vx[2], 0.0f);
|
||||
RwIm2DVertexSetScreenZ (&vx[2], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetRecipCameraZ(&vx[2], recipZ);
|
||||
RwIm2DVertexSetIntRGBA (&vx[2], 255, 255, 255, 255);
|
||||
|
||||
RwIm2DVertexSetScreenX (&vx[3], crw);
|
||||
RwIm2DVertexSetScreenY (&vx[3], crh);
|
||||
RwIm2DVertexSetScreenZ (&vx[3], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetRecipCameraZ(&vx[3], recipZ);
|
||||
RwIm2DVertexSetIntRGBA (&vx[3], 255, 255, 255, 255);
|
||||
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)nil);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDINVDESTCOLOR);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDZERO);
|
||||
|
||||
RwIm2DRenderPrimitive(rwPRIMTYPETRISTRIP, vx, 4);
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA);
|
||||
}
|
||||
|
||||
RwRaster *
|
||||
CShadowCamera::MakeGradientRaster()
|
||||
{
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
RwIm2DVertex vx[2];
|
||||
|
||||
if ( !m_pCamera )
|
||||
return nil;
|
||||
|
||||
float recipCamZ = 1.0f / RwCameraGetNearClipPlane(m_pCamera);
|
||||
|
||||
RwRaster *raster = RwCameraGetRaster(m_pCamera);
|
||||
ASSERT(raster != nil);
|
||||
|
||||
float width = (float)RwRasterGetWidth(raster);
|
||||
float height = (float)RwRasterGetHeight(raster);
|
||||
|
||||
if ( height < 1 )
|
||||
return nil;
|
||||
|
||||
if ( RwCameraBeginUpdate(m_pCamera) )
|
||||
{
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)rwFILTERNAFILTERMODE);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDZERO);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDINVDESTCOLOR);
|
||||
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void *)rwSHADEMODEFLAT);
|
||||
|
||||
float color = 255.0f;
|
||||
float step = (-191.0f / height);
|
||||
|
||||
for ( int32 i = 0; i < height; i++ )
|
||||
{
|
||||
RwIm2DVertexSetScreenX (&vx[0], 0.0f);
|
||||
RwIm2DVertexSetScreenY (&vx[0], i);
|
||||
RwIm2DVertexSetScreenZ (&vx[0], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetRecipCameraZ(&vx[0], recipCamZ);
|
||||
RwIm2DVertexSetIntRGBA (&vx[0], (uint32)color, (uint32)color, (uint32)color, (uint32)color);
|
||||
|
||||
RwIm2DVertexSetScreenX (&vx[1], width - 1);
|
||||
RwIm2DVertexSetScreenY (&vx[1], i);
|
||||
RwIm2DVertexSetScreenZ (&vx[1], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetRecipCameraZ(&vx[1], recipCamZ);
|
||||
RwIm2DVertexSetIntRGBA (&vx[1], (uint32)color, (uint32)color, (uint32)color, (uint32)color);
|
||||
|
||||
RwIm2DRenderLine(vx, 2, 0, 1);
|
||||
|
||||
color += step;
|
||||
}
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void *)rwSHADEMODEGOURAUD);
|
||||
|
||||
RwCameraEndUpdate(m_pCamera);
|
||||
}
|
||||
|
||||
return raster;
|
||||
}
|
||||
|
||||
RwRaster *
|
||||
CShadowCamera::RasterResample(RwRaster *dstRaster)
|
||||
{
|
||||
ASSERT(dstRaster != nil);
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
if ( !m_pCamera )
|
||||
return nil;
|
||||
|
||||
RwRaster *raster = RwCameraGetRaster(m_pCamera);
|
||||
ASSERT(raster != nil);
|
||||
|
||||
float size = (float) RwRasterGetWidth(raster);
|
||||
float uvOffset = TEXELOFFSET / size;
|
||||
float recipCamZ = 1.0f / RwCameraGetNearClipPlane(m_pCamera);
|
||||
|
||||
if ( RwCameraBeginUpdate(m_pCamera) )
|
||||
{
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDZERO);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)dstRaster);
|
||||
|
||||
Im2DRenderQuad(0.0f, 0.0f, size, size, RwIm2DGetNearScreenZ(), recipCamZ, uvOffset);
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA);
|
||||
|
||||
RwCameraEndUpdate(m_pCamera);
|
||||
}
|
||||
|
||||
return raster;
|
||||
}
|
||||
|
||||
RwRaster *
|
||||
CShadowCamera::RasterBlur(RwRaster *dstRaster, int32 numPasses)
|
||||
{
|
||||
ASSERT(dstRaster != nil);
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
if ( !m_pCamera )
|
||||
return nil;
|
||||
|
||||
RwRaster *raster = RwCameraGetRaster(m_pCamera);
|
||||
ASSERT(raster != nil);
|
||||
|
||||
float size = (float) RwRasterGetWidth(dstRaster);
|
||||
float recipCamZ = 1.0f / RwCameraGetNearClipPlane(m_pCamera);
|
||||
|
||||
for (int i = 0; i < numPasses; i++ )
|
||||
{
|
||||
RwCameraSetRaster(m_pCamera, raster);
|
||||
|
||||
if ( RwCameraBeginUpdate(m_pCamera) )
|
||||
{
|
||||
if ( i == 0 )
|
||||
{
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDZERO);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
|
||||
}
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)dstRaster);
|
||||
Im2DRenderQuad(0.0f, 0.0f, size, size, RwIm2DGetNearScreenZ(), recipCamZ, 1.0f / size);
|
||||
RwCameraEndUpdate(m_pCamera);
|
||||
}
|
||||
|
||||
RwCameraSetRaster(m_pCamera, dstRaster);
|
||||
|
||||
if ( RwCameraBeginUpdate(m_pCamera) )
|
||||
{
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)raster);
|
||||
Im2DRenderQuad(0.0f, 0.0f, size, size, RwIm2DGetNearScreenZ(), recipCamZ, 0);
|
||||
|
||||
if ( i == numPasses - 1 )
|
||||
{
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA);
|
||||
}
|
||||
|
||||
RwCameraEndUpdate(m_pCamera);
|
||||
}
|
||||
}
|
||||
|
||||
RwCameraSetRaster(m_pCamera, raster);
|
||||
|
||||
return dstRaster;
|
||||
}
|
||||
|
||||
RwRaster *
|
||||
CShadowCamera::RasterGradient(RwRaster *dstRaster)
|
||||
{
|
||||
ASSERT(dstRaster != nil);
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
RwRaster *raster = RwCameraGetRaster(m_pCamera);
|
||||
ASSERT(raster != nil);
|
||||
|
||||
float size = (float)RwRasterGetWidth(dstRaster);
|
||||
float recipCamZ = 1.0f / RwCameraGetNearClipPlane(m_pCamera);
|
||||
|
||||
RwCameraSetRaster(m_pCamera, dstRaster);
|
||||
|
||||
if ( RwCameraBeginUpdate(m_pCamera) )
|
||||
{
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDZERO);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDSRCCOLOR);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)raster);
|
||||
|
||||
Im2DRenderQuad(0, 0, size, size, RwIm2DGetNearScreenZ(), recipCamZ, 0);
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA);
|
||||
|
||||
RwCameraEndUpdate(m_pCamera);
|
||||
}
|
||||
|
||||
RwCameraSetRaster(m_pCamera, raster);
|
||||
|
||||
return dstRaster;
|
||||
}
|
||||
|
||||
RwRaster *CShadowCamera::DrawOutlineBorder(RwRGBA const& color)
|
||||
{
|
||||
ASSERT(m_pCamera != nil);
|
||||
|
||||
RwIm2DVertex vx[4];
|
||||
RwImVertexIndex ix[5];
|
||||
|
||||
RwRaster *raster = RwCameraGetRaster(m_pCamera);
|
||||
ASSERT(raster != nil);
|
||||
|
||||
float size = (float)RwRasterGetWidth(raster) - 1.0f;
|
||||
float recipCamZ = 1.0f / RwCameraGetNearClipPlane(m_pCamera);
|
||||
|
||||
RwIm2DVertexSetScreenX (&vx[0], 0.0f);
|
||||
RwIm2DVertexSetScreenY (&vx[0], 0.0f);
|
||||
RwIm2DVertexSetScreenZ (&vx[0], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetIntRGBA (&vx[0], color.red, color.green, color.blue, color.alpha);
|
||||
RwIm2DVertexSetRecipCameraZ(&vx[0], recipCamZ);
|
||||
|
||||
RwIm2DVertexSetScreenX (&vx[1], size);
|
||||
RwIm2DVertexSetScreenY (&vx[1], 0.0f);
|
||||
RwIm2DVertexSetScreenZ (&vx[1], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetIntRGBA (&vx[1], color.red, color.green, color.blue, color.alpha);
|
||||
RwIm2DVertexSetRecipCameraZ(&vx[1], recipCamZ);
|
||||
|
||||
RwIm2DVertexSetScreenX (&vx[2], size);
|
||||
RwIm2DVertexSetScreenY (&vx[2], size);
|
||||
RwIm2DVertexSetScreenZ (&vx[2], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetIntRGBA (&vx[2], color.red, color.green, color.blue, color.alpha);
|
||||
RwIm2DVertexSetRecipCameraZ(&vx[2], recipCamZ);
|
||||
|
||||
RwIm2DVertexSetScreenX (&vx[3], 0.0f);
|
||||
RwIm2DVertexSetScreenY (&vx[3], size);
|
||||
RwIm2DVertexSetScreenZ (&vx[3], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetIntRGBA (&vx[3], color.red, color.green, color.blue, color.alpha);
|
||||
RwIm2DVertexSetRecipCameraZ(&vx[3], recipCamZ);
|
||||
|
||||
ix[0] = 0;
|
||||
ix[4] = 0;
|
||||
ix[1] = 1;
|
||||
ix[2] = 2;
|
||||
ix[3] = 3;
|
||||
|
||||
if ( RwCameraBeginUpdate(m_pCamera) )
|
||||
{
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)nil);
|
||||
|
||||
RwIm2DRenderIndexedPrimitive(rwPRIMTYPEPOLYLINE, vx, 4, ix, 5);
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
|
||||
|
||||
RwCameraEndUpdate(m_pCamera);
|
||||
}
|
||||
|
||||
return raster;
|
||||
}
|
54
src/render/ShadowCamera.h
Normal file
54
src/render/ShadowCamera.h
Normal file
@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class CShadowCamera
|
||||
{
|
||||
public:
|
||||
RwCamera *m_pCamera;
|
||||
RwTexture *m_pTexture;
|
||||
|
||||
CShadowCamera();
|
||||
~CShadowCamera();
|
||||
|
||||
RwCamera *Create(int32 rasterSize);
|
||||
void Destroy();
|
||||
|
||||
RwCamera *SetFrustum(float objectRadius);
|
||||
RwCamera *SetLight(RpLight *light);
|
||||
RwCamera *SetCenter(RwV3d *center);
|
||||
|
||||
RwCamera *Update(RpClump *clump);
|
||||
RwCamera *Update(RpAtomic *atomic);
|
||||
|
||||
void InvertRaster();
|
||||
|
||||
RwRaster* GetRwRenderRaster()
|
||||
{
|
||||
return RwCameraGetRaster(m_pCamera);
|
||||
}
|
||||
|
||||
// ShadowRasterRender(RwV2d *)
|
||||
// ApplyAlphaMapToRaster(void)
|
||||
|
||||
RwRaster *MakeGradientRaster();
|
||||
|
||||
RwTexture *GetRwRenderTexture()
|
||||
{
|
||||
return m_pTexture;
|
||||
}
|
||||
|
||||
RwRaster* GetRwZRaster()
|
||||
{
|
||||
return RwCameraGetZRaster(m_pCamera);
|
||||
}
|
||||
|
||||
RwRaster *RasterResample(RwRaster *dstRaster);
|
||||
RwRaster *RasterBlur(RwRaster *dstRaster, int32 numPasses);
|
||||
RwRaster *RasterGradient(RwRaster *dstRaster);
|
||||
RwRaster *DrawOutlineBorder(RwRGBA const& color);
|
||||
|
||||
RwCamera *GetRwCamera()
|
||||
{
|
||||
return m_pCamera;
|
||||
}
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#define MAX_STOREDSHADOWS 48
|
||||
#define MAX_POLYBUNCHES 300
|
||||
#define MAX_STATICSHADOWS 64
|
||||
#define MAX_POLYBUNCHES 380
|
||||
#define MAX_STATICSHADOWS 48
|
||||
#define MAX_PERMAMENTSHADOWS 48
|
||||
|
||||
|
||||
|
||||
class CEntity;
|
||||
class CPtrList;
|
||||
class CAutomobile;
|
||||
class CVehicle;
|
||||
class CPed;
|
||||
class CCutsceneShadow;
|
||||
class CCutsceneObject;
|
||||
|
||||
enum eShadowType
|
||||
{
|
||||
@ -27,6 +34,16 @@ enum eShadowTextureType
|
||||
SHADOWTEX_BLOOD
|
||||
};
|
||||
|
||||
enum VEH_SHD_TYPE
|
||||
{
|
||||
VEH_SHD_TYPE_CAR = 0,
|
||||
VEH_SHD_TYPE_BIKE,
|
||||
VEH_SHD_TYPE_HELI,
|
||||
VEH_SHD_TYPE_SEAPLANE,
|
||||
VEH_SHD_TYPE_RCPLANE,
|
||||
};
|
||||
|
||||
|
||||
class CStoredShadow
|
||||
{
|
||||
public:
|
||||
@ -35,6 +52,8 @@ public:
|
||||
CVector2D m_vecSide;
|
||||
float m_fZDistance;
|
||||
float m_fScale;
|
||||
RwTexture *m_pTexture;
|
||||
CCutsceneShadow *m_pCutsceneShadow;
|
||||
int16 m_nIntensity;
|
||||
uint8 m_ShadowType;
|
||||
uint8 m_nRed;
|
||||
@ -44,9 +63,9 @@ public:
|
||||
{
|
||||
uint8 bDrawOnWater : 1;
|
||||
uint8 bRendered : 1;
|
||||
//uint8 bDrawOnBuildings : 1;
|
||||
uint8 bDrawOnBuildings : 1;
|
||||
} m_nFlags;
|
||||
RwTexture *m_pTexture;
|
||||
|
||||
|
||||
CStoredShadow()
|
||||
{ }
|
||||
@ -57,11 +76,11 @@ VALIDATE_SIZE(CStoredShadow, 0x30);
|
||||
class CPolyBunch
|
||||
{
|
||||
public:
|
||||
int16 m_nNumVerts;
|
||||
CVector m_aVerts[7];
|
||||
CPolyBunch *m_pNext;
|
||||
int16 m_nNumVerts;
|
||||
uint8 m_aU[7];
|
||||
uint8 m_aV[7];
|
||||
CPolyBunch *m_pNext;
|
||||
|
||||
CPolyBunch()
|
||||
{ }
|
||||
@ -80,15 +99,16 @@ public:
|
||||
CVector2D m_vecSide;
|
||||
float m_fZDistance;
|
||||
float m_fScale;
|
||||
uint8 m_nType;
|
||||
RwTexture *m_pTexture;
|
||||
int16 m_nIntensity; // unsigned ?
|
||||
uint8 m_nType;
|
||||
uint8 m_nRed;
|
||||
uint8 m_nGreen;
|
||||
uint8 m_nBlue;
|
||||
bool m_bJustCreated;
|
||||
bool m_bRendered;
|
||||
bool m_bTemp;
|
||||
RwTexture *m_pTexture;
|
||||
|
||||
|
||||
CStaticShadow()
|
||||
{ }
|
||||
@ -106,14 +126,14 @@ public:
|
||||
CVector2D m_vecSide;
|
||||
float m_fZDistance;
|
||||
float m_fScale;
|
||||
uint32 m_nTimeCreated;
|
||||
uint32 m_nLifeTime;
|
||||
RwTexture *m_pTexture;
|
||||
int16 m_nIntensity;
|
||||
uint8 m_nType; // eShadowType
|
||||
uint8 m_nRed;
|
||||
uint8 m_nGreen;
|
||||
uint8 m_nBlue;
|
||||
uint32 m_nTimeCreated;
|
||||
uint32 m_nLifeTime;
|
||||
RwTexture *m_pTexture;
|
||||
|
||||
CPermanentShadow()
|
||||
{ }
|
||||
@ -121,60 +141,62 @@ public:
|
||||
|
||||
VALIDATE_SIZE(CPermanentShadow, 0x38);
|
||||
|
||||
class CPtrList;
|
||||
class CAutomobile;
|
||||
class CPed;
|
||||
|
||||
class CShadows
|
||||
{
|
||||
public:
|
||||
#if 1
|
||||
static int16 ShadowsStoredToBeRendered;
|
||||
static CStoredShadow asShadowsStored [MAX_STOREDSHADOWS];
|
||||
static CPolyBunch aPolyBunches [MAX_POLYBUNCHES];
|
||||
static CStaticShadow aStaticShadows [MAX_STATICSHADOWS];
|
||||
static CPolyBunch *pEmptyBunchList;
|
||||
static CPermanentShadow aPermanentShadows[MAX_PERMAMENTSHADOWS];
|
||||
#else
|
||||
static int16 &ShadowsStoredToBeRendered;
|
||||
static CStoredShadow (&asShadowsStored) [MAX_STOREDSHADOWS];
|
||||
static CPolyBunch (&aPolyBunches) [MAX_POLYBUNCHES];
|
||||
static CStaticShadow (&aStaticShadows) [MAX_STATICSHADOWS];
|
||||
static CPolyBunch *&pEmptyBunchList;
|
||||
static CPermanentShadow (&aPermanentShadows)[MAX_PERMAMENTSHADOWS];
|
||||
#endif
|
||||
|
||||
static void Init (void);
|
||||
static void Shutdown (void);
|
||||
static void AddPermanentShadow ( uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, uint32 nTime, float fScale);
|
||||
static void StoreStaticShadow (uint32 nID, uint8 ShadowType, RwTexture *pTexture, Const CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, float fScale, float fDrawDistance, bool bTempShadow, float fUpDistance);
|
||||
static void StoreShadowToBeRendered ( uint8 ShadowType, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue);
|
||||
static void StoreShadowToBeRendered ( uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, bool bDrawOnWater, float fScale);
|
||||
static void StoreShadowForCar (CAutomobile *pCar);
|
||||
static void StoreCarLightShadow (CAutomobile *pCar, int32 nID, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, uint8 nRed, uint8 nGreen, uint8 nBlue, float fMaxViewAngle);
|
||||
static void StoreShadowForPed (CPed *pPed, float fDisplacementX, float fDisplacementY, float fFrontX, float fFrontY, float fSideX, float fSideY);
|
||||
static void StoreShadowForPedObject (CEntity *pPedObject, float fDisplacementX, float fDisplacementY, float fFrontX, float fFrontY, float fSideX, float fSideY);
|
||||
static void StoreShadowForTree (CEntity *pTree);
|
||||
static void StoreShadowForPole (CEntity *pPole, float fOffsetX, float fOffsetY, float fOffsetZ, float fPoleHeight, float fPoleWidth, uint32 nID);
|
||||
static void SetRenderModeForShadowType (uint8 ShadowType);
|
||||
static void RenderStoredShadows (void);
|
||||
static void RenderStaticShadows (void);
|
||||
static void GeneratePolysForStaticShadow (int16 nStaticShadowID);
|
||||
static void CastShadowSectorList (CPtrList &PtrList, float fStartX, float fStartY, float fEndX, float fEndY,
|
||||
static void Init (void);
|
||||
static void Shutdown (void);
|
||||
static void AddPermanentShadow ( uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, uint32 nTime, float fScale);
|
||||
|
||||
static bool StoreStaticShadow (uint32 nID, uint8 ShadowType, RwTexture *pTexture, Const CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, float fScale, float fDrawDistance, bool bTempShadow, float fUpDistance);
|
||||
static void StoreShadowToBeRendered ( uint8 ShadowType, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue);
|
||||
static void StoreShadowToBeRendered ( uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, bool bDrawOnWater, float fScale, CCutsceneShadow *pShadow, bool bDrawOnBuildings);
|
||||
static void StoreShadowForVehicle (CVehicle *pCar, VEH_SHD_TYPE type);
|
||||
static void StoreCarLightShadow (CAutomobile *pCar, int32 nID, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, uint8 nRed, uint8 nGreen, uint8 nBlue, float fMaxViewAngle);
|
||||
static void StoreShadowForPed (CPed *pPed, float fDisplacementX, float fDisplacementY, float fFrontX, float fFrontY, float fSideX, float fSideY);
|
||||
static void StoreShadowForPedObject (CEntity *pPedObject, float fDisplacementX, float fDisplacementY, float fFrontX, float fFrontY, float fSideX, float fSideY);
|
||||
static void StoreShadowForCutscenePedObject(CCutsceneObject *pObject, float fDisplacementX, float fDisplacementY, float fFrontX, float fFrontY, float fSideX, float fSideY);
|
||||
static void StoreShadowForTree (CEntity *pTree);
|
||||
static void StoreShadowForPole (CEntity *pPole, float fOffsetX, float fOffsetY, float fOffsetZ, float fPoleHeight, float fPoleWidth, uint32 nID);
|
||||
static void SetRenderModeForShadowType (uint8 ShadowType);
|
||||
static void RenderStoredShadows (void);
|
||||
static void RenderStaticShadows (void);
|
||||
|
||||
static void GeneratePolysForStaticShadow (int16 nStaticShadowID);
|
||||
static void CastShadowSectorList (CPtrList &PtrList, float fStartX, float fStartY, float fEndX, float fEndY,
|
||||
CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, float fScale, CPolyBunch **ppPolyBunch);
|
||||
static void CastShadowEntity (CEntity *pEntity, float fStartX, float fStartY, float fEndX, float fEndY,
|
||||
|
||||
static void CastPlayerShadowSectorList (CPtrList &PtrList, float fStartX, float fStartY, float fEndX, float fEndY,
|
||||
CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, float fScale, CPolyBunch **ppPolyBunch);
|
||||
|
||||
static void CastCutsceneShadowSectorList (CPtrList &PtrList, float fStartX, float fStartY, float fEndX, float fEndY,
|
||||
CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, float fScale, CPolyBunch **ppPolyBunch, CCutsceneShadow *pShadow);
|
||||
|
||||
static void CastShadowEntityXY (CEntity *pEntity, float fStartX, float fStartY, float fEndX, float fEndY,
|
||||
CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, float fScale, CPolyBunch **ppPolyBunch);
|
||||
static void UpdateStaticShadows (void);
|
||||
static void UpdatePermanentShadows (void);
|
||||
static void CalcPedShadowValues (CVector vecLightDir, float *pfDisplacementX, float *pfDisplacementY, float *pfFrontX, float *pfFrontY, float *pfSideX, float *pfSideY);
|
||||
static void RenderExtraPlayerShadows (void);
|
||||
static void TidyUpShadows (void);
|
||||
static void RenderIndicatorShadow (uint32 nID, uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity);
|
||||
|
||||
static void CastShadowEntityXYZ (CEntity *pEntity, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, float fScale, CPolyBunch **ppPolyBunch, CCutsceneShadow *pShadow);
|
||||
|
||||
static void UpdateStaticShadows (void);
|
||||
static void UpdatePermanentShadows (void);
|
||||
static void CalcPedShadowValues (CVector vecLightDir, float *pfFrontX, float *pfFrontY, float *pfSideX, float *pfSideY, float *pfDisplacementX, float *pfDisplacementY);
|
||||
static void RenderExtraPlayerShadows (void);
|
||||
static void TidyUpShadows (void);
|
||||
static void RenderIndicatorShadow (uint32 nID, uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity);
|
||||
};
|
||||
|
||||
extern RwTexture *gpShadowCarTex;
|
||||
extern RwTexture *gpShadowPedTex;
|
||||
extern RwTexture *gpShadowHeliTex;
|
||||
extern RwTexture *gpShadowBikeTex;
|
||||
extern RwTexture *gpShadowBaronTex;
|
||||
extern RwTexture *gpShadowExplosionTex;
|
||||
extern RwTexture *gpShadowHeadLightsTex;
|
||||
extern RwTexture *gpOutline1Tex;
|
||||
@ -182,7 +204,6 @@ extern RwTexture *gpOutline2Tex;
|
||||
extern RwTexture *gpOutline3Tex;
|
||||
extern RwTexture *gpBloodPoolTex;
|
||||
extern RwTexture *gpReflectionTex;
|
||||
extern RwTexture *gpGoalMarkerTex;
|
||||
extern RwTexture *gpWalkDontTex;
|
||||
extern RwTexture *gpCrackedGlassTex;
|
||||
extern RwTexture *gpPostShadowTex;
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "Replay.h"
|
||||
#include "Skidmarks.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
CSkidmark CSkidmarks::aSkidmarks[NUMSKIDMARKS];
|
||||
|
||||
RwImVertexIndex SkidmarkIndexList[SKIDMARK_LENGTH * 6];
|
||||
@ -37,13 +39,6 @@ CSkidmarks::Init(void)
|
||||
SkidmarkIndexList[i*6+5] = ix+3;
|
||||
ix += 2;
|
||||
}
|
||||
|
||||
for(i = 0; i < SKIDMARK_LENGTH; i++){
|
||||
RwIm3DVertexSetU(&SkidmarkVertices[i*2 + 0], 0.0f);
|
||||
RwIm3DVertexSetV(&SkidmarkVertices[i*2 + 0], i*5.01f);
|
||||
RwIm3DVertexSetU(&SkidmarkVertices[i*2 + 1], 1.0f);
|
||||
RwIm3DVertexSetV(&SkidmarkVertices[i*2 + 1], i*5.01f);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -141,8 +136,12 @@ CSkidmarks::Render(void)
|
||||
p2.y -= aSkidmarks[i].m_sideY[j];
|
||||
RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+0], color.red, color.green, color.blue, alpha);
|
||||
RwIm3DVertexSetPos(&SkidmarkVertices[j*2+0], p1.x, p1.y, p1.z+0.1f);
|
||||
RwIm3DVertexSetU(&SkidmarkVertices[j*2+0], 0.0f);
|
||||
RwIm3DVertexSetV(&SkidmarkVertices[j*2+0], j*5.01f);
|
||||
RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+1], color.red, color.green, color.blue, alpha);
|
||||
RwIm3DVertexSetPos(&SkidmarkVertices[j*2+1], p2.x, p2.y, p2.z+0.1f);
|
||||
RwIm3DVertexSetU(&SkidmarkVertices[j*2+1], 1.0f);
|
||||
RwIm3DVertexSetV(&SkidmarkVertices[j*2+1], j*5.01f);
|
||||
}
|
||||
|
||||
LittleTest();
|
||||
|
@ -10,60 +10,60 @@
|
||||
#include "FileMgr.h"
|
||||
#include "Timecycle.h"
|
||||
|
||||
// TODO(MIAMI): change some of the types here
|
||||
//--MIAMI: done
|
||||
|
||||
int CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nAmbientRed_Obj[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nAmbientGreen_Obj[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nAmbientBlue_Obj[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nAmbientRed_Bl[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nAmbientGreen_Bl[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nAmbientBlue_Bl[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nAmbientRed_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nAmbientGreen_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nAmbientBlue_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fSunSize[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fSpriteSize[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
|
||||
short CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
short CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
short CTimeCycle::m_nPoleShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fFogStart[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fFarClip[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
|
||||
int CTimeCycle::m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fBlurRed[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fBlurGreen[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fBlurBlue[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fWaterRed[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fWaterGreen[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fWaterBlue[NUMHOURS][NUMWEATHERS];
|
||||
float CTimeCycle::m_fWaterAlpha[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientRed_Obj[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientGreen_Obj[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientBlue_Obj[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientRed_Bl[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientGreen_Bl[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientBlue_Bl[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientRed_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientGreen_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nAmbientBlue_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
|
||||
int8 CTimeCycle::m_fSunSize[NUMHOURS][NUMWEATHERS];
|
||||
int8 CTimeCycle::m_fSpriteSize[NUMHOURS][NUMWEATHERS];
|
||||
int8 CTimeCycle::m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nPoleShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
int16 CTimeCycle::m_fFogStart[NUMHOURS][NUMWEATHERS];
|
||||
int16 CTimeCycle::m_fFarClip[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_fBlurRed[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_fBlurGreen[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_fBlurBlue[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_fWaterRed[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_fWaterGreen[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_fWaterBlue[NUMHOURS][NUMWEATHERS];
|
||||
uint8 CTimeCycle::m_fWaterAlpha[NUMHOURS][NUMWEATHERS];
|
||||
|
||||
|
||||
float CTimeCycle::m_fCurrentAmbientRed;
|
||||
@ -81,36 +81,36 @@ float CTimeCycle::m_fCurrentAmbientBlue_Obj_Bl;
|
||||
float CTimeCycle::m_fCurrentDirectionalRed;
|
||||
float CTimeCycle::m_fCurrentDirectionalGreen;
|
||||
float CTimeCycle::m_fCurrentDirectionalBlue;
|
||||
int CTimeCycle::m_nCurrentSkyTopRed;
|
||||
int CTimeCycle::m_nCurrentSkyTopGreen;
|
||||
int CTimeCycle::m_nCurrentSkyTopBlue;
|
||||
int CTimeCycle::m_nCurrentSkyBottomRed;
|
||||
int CTimeCycle::m_nCurrentSkyBottomGreen;
|
||||
int CTimeCycle::m_nCurrentSkyBottomBlue;
|
||||
int CTimeCycle::m_nCurrentSunCoreRed;
|
||||
int CTimeCycle::m_nCurrentSunCoreGreen;
|
||||
int CTimeCycle::m_nCurrentSunCoreBlue;
|
||||
int CTimeCycle::m_nCurrentSunCoronaRed;
|
||||
int CTimeCycle::m_nCurrentSunCoronaGreen;
|
||||
int CTimeCycle::m_nCurrentSunCoronaBlue;
|
||||
int32 CTimeCycle::m_nCurrentSkyTopRed;
|
||||
int32 CTimeCycle::m_nCurrentSkyTopGreen;
|
||||
int32 CTimeCycle::m_nCurrentSkyTopBlue;
|
||||
int32 CTimeCycle::m_nCurrentSkyBottomRed;
|
||||
int32 CTimeCycle::m_nCurrentSkyBottomGreen;
|
||||
int32 CTimeCycle::m_nCurrentSkyBottomBlue;
|
||||
int32 CTimeCycle::m_nCurrentSunCoreRed;
|
||||
int32 CTimeCycle::m_nCurrentSunCoreGreen;
|
||||
int32 CTimeCycle::m_nCurrentSunCoreBlue;
|
||||
int32 CTimeCycle::m_nCurrentSunCoronaRed;
|
||||
int32 CTimeCycle::m_nCurrentSunCoronaGreen;
|
||||
int32 CTimeCycle::m_nCurrentSunCoronaBlue;
|
||||
float CTimeCycle::m_fCurrentSunSize;
|
||||
float CTimeCycle::m_fCurrentSpriteSize;
|
||||
float CTimeCycle::m_fCurrentSpriteBrightness;
|
||||
int CTimeCycle::m_nCurrentShadowStrength;
|
||||
int CTimeCycle::m_nCurrentLightShadowStrength;
|
||||
int CTimeCycle::m_nCurrentPoleShadowStrength;
|
||||
int32 CTimeCycle::m_nCurrentShadowStrength;
|
||||
int32 CTimeCycle::m_nCurrentLightShadowStrength;
|
||||
int32 CTimeCycle::m_nCurrentPoleShadowStrength;
|
||||
float CTimeCycle::m_fCurrentFogStart;
|
||||
float CTimeCycle::m_fCurrentFarClip;
|
||||
float CTimeCycle::m_fCurrentLightsOnGroundBrightness;
|
||||
int CTimeCycle::m_nCurrentLowCloudsRed;
|
||||
int CTimeCycle::m_nCurrentLowCloudsGreen;
|
||||
int CTimeCycle::m_nCurrentLowCloudsBlue;
|
||||
int CTimeCycle::m_nCurrentFluffyCloudsTopRed;
|
||||
int CTimeCycle::m_nCurrentFluffyCloudsTopGreen;
|
||||
int CTimeCycle::m_nCurrentFluffyCloudsTopBlue;
|
||||
int CTimeCycle::m_nCurrentFluffyCloudsBottomRed;
|
||||
int CTimeCycle::m_nCurrentFluffyCloudsBottomGreen;
|
||||
int CTimeCycle::m_nCurrentFluffyCloudsBottomBlue;
|
||||
int32 CTimeCycle::m_nCurrentLowCloudsRed;
|
||||
int32 CTimeCycle::m_nCurrentLowCloudsGreen;
|
||||
int32 CTimeCycle::m_nCurrentLowCloudsBlue;
|
||||
int32 CTimeCycle::m_nCurrentFluffyCloudsTopRed;
|
||||
int32 CTimeCycle::m_nCurrentFluffyCloudsTopGreen;
|
||||
int32 CTimeCycle::m_nCurrentFluffyCloudsTopBlue;
|
||||
int32 CTimeCycle::m_nCurrentFluffyCloudsBottomRed;
|
||||
int32 CTimeCycle::m_nCurrentFluffyCloudsBottomGreen;
|
||||
int32 CTimeCycle::m_nCurrentFluffyCloudsBottomBlue;
|
||||
float CTimeCycle::m_fCurrentBlurRed;
|
||||
float CTimeCycle::m_fCurrentBlurGreen;
|
||||
float CTimeCycle::m_fCurrentBlurBlue;
|
||||
@ -118,13 +118,16 @@ float CTimeCycle::m_fCurrentWaterRed;
|
||||
float CTimeCycle::m_fCurrentWaterGreen;
|
||||
float CTimeCycle::m_fCurrentWaterBlue;
|
||||
float CTimeCycle::m_fCurrentWaterAlpha;
|
||||
int CTimeCycle::m_nCurrentFogColourRed;
|
||||
int CTimeCycle::m_nCurrentFogColourGreen;
|
||||
int CTimeCycle::m_nCurrentFogColourBlue;
|
||||
int32 CTimeCycle::m_nCurrentFogColourRed;
|
||||
int32 CTimeCycle::m_nCurrentFogColourGreen;
|
||||
int32 CTimeCycle::m_nCurrentFogColourBlue;
|
||||
|
||||
int CTimeCycle::m_FogReduction;
|
||||
int32 CTimeCycle::m_FogReduction;
|
||||
bool CTimeCycle::m_bExtraColourOn;
|
||||
int32 CTimeCycle::m_ExtraColour;
|
||||
float CTimeCycle::m_ExtraColourInter;
|
||||
|
||||
int CTimeCycle::m_CurrentStoredValue;
|
||||
int32 CTimeCycle::m_CurrentStoredValue;
|
||||
CVector CTimeCycle::m_VectorToSun[16];
|
||||
float CTimeCycle::m_fShadowFrontX[16];
|
||||
float CTimeCycle::m_fShadowFrontY[16];
|
||||
@ -133,7 +136,6 @@ float CTimeCycle::m_fShadowSideY[16];
|
||||
float CTimeCycle::m_fShadowDisplacementX[16];
|
||||
float CTimeCycle::m_fShadowDisplacementY[16];
|
||||
|
||||
|
||||
void
|
||||
CTimeCycle::Initialise(void)
|
||||
{
|
||||
@ -233,15 +235,15 @@ CTimeCycle::Initialise(void)
|
||||
m_nSunCoronaRed[h][w] = sunCoronaR;
|
||||
m_nSunCoronaGreen[h][w] = sunCoronaG;
|
||||
m_nSunCoronaBlue[h][w] = sunCoronaB;
|
||||
m_fSunSize[h][w] = sunSz;
|
||||
m_fSpriteSize[h][w] = sprSz;
|
||||
m_fSpriteBrightness[h][w] = sprBght;
|
||||
m_fSunSize[h][w] = sunSz * 10.0f;
|
||||
m_fSpriteSize[h][w] = sprSz * 10.0f;
|
||||
m_fSpriteBrightness[h][w] = sprBght * 10.0f;
|
||||
m_nShadowStrength[h][w] = shad;
|
||||
m_nLightShadowStrength[h][w] = lightShad;
|
||||
m_nPoleShadowStrength[h][w] = poleShad;
|
||||
m_fFarClip[h][w] = farClp;
|
||||
m_fFogStart[h][w] = fogSt;
|
||||
m_fLightsOnGroundBrightness[h][w] = lightGnd;
|
||||
m_fLightsOnGroundBrightness[h][w] = lightGnd * 10.0f;
|
||||
m_nLowCloudsRed[h][w] = cloudR;
|
||||
m_nLowCloudsGreen[h][w] = cloudG;
|
||||
m_nLowCloudsBlue[h][w] = cloudB;
|
||||
@ -265,6 +267,51 @@ CTimeCycle::Initialise(void)
|
||||
debug("CTimeCycle ready\n");
|
||||
}
|
||||
|
||||
static float interp_c0, interp_c1, interp_c2, interp_c3;
|
||||
|
||||
float CTimeCycle::Interpolate(int8 *a, int8 *b)
|
||||
{
|
||||
return a[CWeather::OldWeatherType] * interp_c0 +
|
||||
b[CWeather::OldWeatherType] * interp_c1 +
|
||||
a[CWeather::NewWeatherType] * interp_c2 +
|
||||
b[CWeather::NewWeatherType] * interp_c3;
|
||||
}
|
||||
|
||||
float CTimeCycle::Interpolate(uint8 *a, uint8 *b)
|
||||
{
|
||||
return a[CWeather::OldWeatherType] * interp_c0 +
|
||||
b[CWeather::OldWeatherType] * interp_c1 +
|
||||
a[CWeather::NewWeatherType] * interp_c2 +
|
||||
b[CWeather::NewWeatherType] * interp_c3;
|
||||
}
|
||||
|
||||
float CTimeCycle::Interpolate(int16 *a, int16 *b)
|
||||
{
|
||||
return a[CWeather::OldWeatherType] * interp_c0 +
|
||||
b[CWeather::OldWeatherType] * interp_c1 +
|
||||
a[CWeather::NewWeatherType] * interp_c2 +
|
||||
b[CWeather::NewWeatherType] * interp_c3;
|
||||
}
|
||||
|
||||
void
|
||||
CTimeCycle::StartExtraColour(int32 c, bool fade)
|
||||
{
|
||||
m_bExtraColourOn = true;
|
||||
m_ExtraColour = c;
|
||||
if(fade)
|
||||
m_ExtraColourInter = 0.0f;
|
||||
else
|
||||
m_ExtraColourInter = 1.0f;
|
||||
}
|
||||
|
||||
void
|
||||
CTimeCycle::StopExtraColour(bool fade)
|
||||
{
|
||||
m_bExtraColourOn = false;
|
||||
if(!fade)
|
||||
m_ExtraColourInter = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
CTimeCycle::Update(void)
|
||||
{
|
||||
@ -274,12 +321,12 @@ CTimeCycle::Update(void)
|
||||
int w2 = CWeather::NewWeatherType;
|
||||
float timeInterp = (CClock::GetMinutes() + CClock::GetSeconds()/60.0f)/60.0f;
|
||||
// coefficients for a bilinear interpolation
|
||||
float c0 = (1.0f-timeInterp) * (1.0f-CWeather::InterpolationValue);
|
||||
float c1 = timeInterp * (1.0f-CWeather::InterpolationValue);
|
||||
float c2 = (1.0f-timeInterp) * CWeather::InterpolationValue;
|
||||
float c3 = timeInterp * CWeather::InterpolationValue;
|
||||
interp_c0 = (1.0f-timeInterp) * (1.0f-CWeather::InterpolationValue);
|
||||
interp_c1 = timeInterp * (1.0f-CWeather::InterpolationValue);
|
||||
interp_c2 = (1.0f-timeInterp) * CWeather::InterpolationValue;
|
||||
interp_c3 = timeInterp * CWeather::InterpolationValue;
|
||||
|
||||
#define INTERP(v) v[h1][w1]*c0 + v[h2][w1]*c1 + v[h1][w2]*c2 + v[h2][w2]*c3;
|
||||
#define INTERP(v) Interpolate(v[h1], v[h2])
|
||||
|
||||
m_nCurrentSkyTopRed = INTERP(m_nSkyTopRed);
|
||||
m_nCurrentSkyTopGreen = INTERP(m_nSkyTopGreen);
|
||||
@ -317,15 +364,15 @@ CTimeCycle::Update(void)
|
||||
m_nCurrentSunCoronaGreen = INTERP(m_nSunCoronaGreen);
|
||||
m_nCurrentSunCoronaBlue = INTERP(m_nSunCoronaBlue);
|
||||
|
||||
m_fCurrentSunSize = INTERP(m_fSunSize);
|
||||
m_fCurrentSpriteSize = INTERP(m_fSpriteSize);
|
||||
m_fCurrentSpriteBrightness = INTERP(m_fSpriteBrightness);
|
||||
m_fCurrentSunSize = INTERP(m_fSunSize)/10.0f;
|
||||
m_fCurrentSpriteSize = INTERP(m_fSpriteSize)/10.0f;
|
||||
m_fCurrentSpriteBrightness = INTERP(m_fSpriteBrightness)/10.0f;
|
||||
m_nCurrentShadowStrength = INTERP(m_nShadowStrength);
|
||||
m_nCurrentLightShadowStrength = INTERP(m_nLightShadowStrength);
|
||||
m_nCurrentPoleShadowStrength = INTERP(m_nPoleShadowStrength);
|
||||
m_fCurrentFarClip = INTERP(m_fFarClip);
|
||||
m_fCurrentFogStart = INTERP(m_fFogStart);
|
||||
m_fCurrentLightsOnGroundBrightness = INTERP(m_fLightsOnGroundBrightness);
|
||||
m_fCurrentLightsOnGroundBrightness = INTERP(m_fLightsOnGroundBrightness)/10.0f;
|
||||
|
||||
m_nCurrentLowCloudsRed = INTERP(m_nLowCloudsRed);
|
||||
m_nCurrentLowCloudsGreen = INTERP(m_nLowCloudsGreen);
|
||||
@ -347,6 +394,7 @@ CTimeCycle::Update(void)
|
||||
m_fCurrentWaterGreen = INTERP(m_fWaterGreen);
|
||||
m_fCurrentWaterBlue = INTERP(m_fWaterBlue);
|
||||
m_fCurrentWaterAlpha = INTERP(m_fWaterAlpha);
|
||||
#undef INTERP
|
||||
|
||||
if(m_FogReduction != 0)
|
||||
m_fCurrentFarClip = Max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f);
|
||||
@ -360,7 +408,88 @@ CTimeCycle::Update(void)
|
||||
sunPos.z = 0.2f - Cos(sunAngle);
|
||||
sunPos.Normalise();
|
||||
|
||||
// TODO(MIAMI): extra colours
|
||||
if(m_bExtraColourOn)
|
||||
m_ExtraColourInter = Min(1.0f, m_ExtraColourInter + CTimer::GetTimeStep()/120.0f);
|
||||
else
|
||||
m_ExtraColourInter = Max(-.0f, m_ExtraColourInter - CTimer::GetTimeStep()/120.0f);
|
||||
if(m_ExtraColourInter > 0.0f){
|
||||
#define INTERP(extra,cur) (m_ExtraColourInter*extra[m_ExtraColour][WEATHER_EXTRACOLOURS] + (1.0f-m_ExtraColourInter)*cur)
|
||||
#define INTERPscl(extra,scl,cur) (m_ExtraColourInter*extra[m_ExtraColour][WEATHER_EXTRACOLOURS]/scl + (1.0f-m_ExtraColourInter)*cur)
|
||||
if(m_nSkyTopRed[m_ExtraColour][WEATHER_EXTRACOLOURS] != 0 ||
|
||||
m_nSkyTopGreen[m_ExtraColour][WEATHER_EXTRACOLOURS] != 0 ||
|
||||
m_nSkyTopBlue[m_ExtraColour][WEATHER_EXTRACOLOURS] != 0){
|
||||
m_nCurrentSkyTopRed = INTERP(m_nSkyTopRed,m_nCurrentSkyTopRed);
|
||||
m_nCurrentSkyTopGreen = INTERP(m_nSkyTopGreen,m_nCurrentSkyTopGreen);
|
||||
m_nCurrentSkyTopBlue = INTERP(m_nSkyTopBlue,m_nCurrentSkyTopBlue);
|
||||
|
||||
m_nCurrentSkyBottomRed = INTERP(m_nSkyBottomRed,m_nCurrentSkyBottomRed);
|
||||
m_nCurrentSkyBottomGreen = INTERP(m_nSkyBottomGreen,m_nCurrentSkyBottomGreen);
|
||||
m_nCurrentSkyBottomBlue = INTERP(m_nSkyBottomBlue,m_nCurrentSkyBottomBlue);
|
||||
|
||||
m_nCurrentSunCoreRed = INTERP(m_nSunCoreRed,m_nCurrentSunCoreRed);
|
||||
m_nCurrentSunCoreGreen = INTERP(m_nSunCoreGreen,m_nCurrentSunCoreGreen);
|
||||
m_nCurrentSunCoreBlue = INTERP(m_nSunCoreBlue,m_nCurrentSunCoreBlue);
|
||||
|
||||
m_nCurrentSunCoronaRed = INTERP(m_nSunCoronaRed,m_nCurrentSunCoronaRed);
|
||||
m_nCurrentSunCoronaGreen = INTERP(m_nSunCoronaGreen,m_nCurrentSunCoronaGreen);
|
||||
m_nCurrentSunCoronaBlue = INTERP(m_nSunCoronaBlue,m_nCurrentSunCoronaBlue);
|
||||
|
||||
m_fCurrentSunSize = INTERPscl(m_fSunSize,10.0f,m_fCurrentSunSize);
|
||||
|
||||
m_nCurrentLowCloudsRed = INTERP(m_nLowCloudsRed,m_nCurrentLowCloudsRed);
|
||||
m_nCurrentLowCloudsGreen = INTERP(m_nLowCloudsGreen,m_nCurrentLowCloudsGreen);
|
||||
m_nCurrentLowCloudsBlue = INTERP(m_nLowCloudsBlue,m_nCurrentLowCloudsBlue);
|
||||
|
||||
m_nCurrentFluffyCloudsTopRed = INTERP(m_nFluffyCloudsTopRed,m_nCurrentFluffyCloudsTopRed);
|
||||
m_nCurrentFluffyCloudsTopGreen = INTERP(m_nFluffyCloudsTopGreen,m_nCurrentFluffyCloudsTopGreen);
|
||||
m_nCurrentFluffyCloudsTopBlue = INTERP(m_nFluffyCloudsTopBlue,m_nCurrentFluffyCloudsTopBlue);
|
||||
|
||||
m_nCurrentFluffyCloudsBottomRed = INTERP(m_nFluffyCloudsBottomRed,m_nCurrentFluffyCloudsBottomRed);
|
||||
m_nCurrentFluffyCloudsBottomGreen = INTERP(m_nFluffyCloudsBottomGreen,m_nCurrentFluffyCloudsBottomGreen);
|
||||
m_nCurrentFluffyCloudsBottomBlue = INTERP(m_nFluffyCloudsBottomBlue,m_nCurrentFluffyCloudsBottomBlue);
|
||||
|
||||
m_fCurrentWaterRed = INTERP(m_fWaterRed,m_fCurrentWaterRed);
|
||||
m_fCurrentWaterGreen = INTERP(m_fWaterGreen,m_fCurrentWaterGreen);
|
||||
m_fCurrentWaterBlue = INTERP(m_fWaterBlue,m_fCurrentWaterBlue);
|
||||
m_fCurrentWaterAlpha = INTERP(m_fWaterAlpha,m_fCurrentWaterAlpha);
|
||||
}
|
||||
|
||||
m_fCurrentAmbientRed = INTERP(m_nAmbientRed,m_fCurrentAmbientRed);
|
||||
m_fCurrentAmbientGreen = INTERP(m_nAmbientGreen,m_fCurrentAmbientGreen);
|
||||
m_fCurrentAmbientBlue = INTERP(m_nAmbientBlue,m_fCurrentAmbientBlue);
|
||||
|
||||
m_fCurrentAmbientRed_Obj = INTERP(m_nAmbientRed_Obj,m_fCurrentAmbientRed_Obj);
|
||||
m_fCurrentAmbientGreen_Obj = INTERP(m_nAmbientGreen_Obj,m_fCurrentAmbientGreen_Obj);
|
||||
m_fCurrentAmbientBlue_Obj = INTERP(m_nAmbientBlue_Obj,m_fCurrentAmbientBlue_Obj);
|
||||
|
||||
m_fCurrentAmbientRed_Bl = INTERP(m_nAmbientRed_Bl,m_fCurrentAmbientRed_Bl);
|
||||
m_fCurrentAmbientGreen_Bl = INTERP(m_nAmbientGreen_Bl,m_fCurrentAmbientGreen_Bl);
|
||||
m_fCurrentAmbientBlue_Bl = INTERP(m_nAmbientBlue_Bl,m_fCurrentAmbientBlue_Bl);
|
||||
|
||||
m_fCurrentAmbientRed_Obj_Bl = INTERP(m_nAmbientRed_Obj_Bl,m_fCurrentAmbientRed_Obj_Bl);
|
||||
m_fCurrentAmbientGreen_Obj_Bl = INTERP(m_nAmbientGreen_Obj_Bl,m_fCurrentAmbientGreen_Obj_Bl);
|
||||
m_fCurrentAmbientBlue_Obj_Bl = INTERP(m_nAmbientBlue_Obj_Bl,m_fCurrentAmbientBlue_Obj_Bl);
|
||||
|
||||
m_fCurrentDirectionalRed = INTERP(m_nDirectionalRed,m_fCurrentDirectionalRed);
|
||||
m_fCurrentDirectionalGreen = INTERP(m_nDirectionalGreen,m_fCurrentDirectionalGreen);
|
||||
m_fCurrentDirectionalBlue = INTERP(m_nDirectionalBlue,m_fCurrentDirectionalBlue);
|
||||
|
||||
m_fCurrentSpriteSize = INTERPscl(m_fSpriteSize,10.0f,m_fCurrentSpriteSize);
|
||||
m_fCurrentSpriteBrightness = INTERPscl(m_fSpriteBrightness,10.0f,m_fCurrentSpriteBrightness);
|
||||
m_nCurrentShadowStrength = INTERP(m_nShadowStrength,m_nCurrentShadowStrength);
|
||||
m_nCurrentLightShadowStrength = INTERP(m_nLightShadowStrength,m_nCurrentLightShadowStrength);
|
||||
m_nCurrentPoleShadowStrength = INTERP(m_nPoleShadowStrength,m_nCurrentPoleShadowStrength);
|
||||
m_fCurrentFarClip = INTERP(m_fFarClip,m_fCurrentFarClip);
|
||||
m_fCurrentFogStart = INTERP(m_fFogStart,m_fCurrentFogStart);
|
||||
m_fCurrentLightsOnGroundBrightness = INTERPscl(m_fLightsOnGroundBrightness,10.0f,m_fCurrentLightsOnGroundBrightness);
|
||||
|
||||
m_fCurrentBlurRed = INTERP(m_fBlurRed,m_fCurrentBlurRed);
|
||||
m_fCurrentBlurGreen = INTERP(m_fBlurGreen,m_fCurrentBlurGreen);
|
||||
m_fCurrentBlurBlue = INTERP(m_fBlurBlue,m_fCurrentBlurBlue);
|
||||
|
||||
#undef INTERP
|
||||
#undef INTERPscl
|
||||
}
|
||||
|
||||
if(TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE)
|
||||
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, 5, MOTION_BLUR_LIGHT_SCENE);
|
||||
|
@ -2,58 +2,58 @@
|
||||
|
||||
class CTimeCycle
|
||||
{
|
||||
static int m_nAmbientRed[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nAmbientRed_Obj[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nAmbientGreen_Obj[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nAmbientBlue_Obj[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nAmbientRed_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nAmbientGreen_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nAmbientBlue_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nAmbientRed_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nAmbientGreen_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nAmbientBlue_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fSunSize[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fSpriteSize[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
|
||||
static short m_nShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
static short m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
static short m_nPoleShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fFogStart[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fFarClip[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
|
||||
static int m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fBlurRed[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fBlurGreen[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fBlurBlue[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fWaterRed[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fWaterGreen[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fWaterBlue[NUMHOURS][NUMWEATHERS];
|
||||
static float m_fWaterAlpha[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientRed[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientRed_Obj[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientGreen_Obj[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientBlue_Obj[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientRed_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientGreen_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientBlue_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientRed_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientGreen_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nAmbientBlue_Obj_Bl[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
|
||||
static int8 m_fSunSize[NUMHOURS][NUMWEATHERS];
|
||||
static int8 m_fSpriteSize[NUMHOURS][NUMWEATHERS];
|
||||
static int8 m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nPoleShadowStrength[NUMHOURS][NUMWEATHERS];
|
||||
static int16 m_fFogStart[NUMHOURS][NUMWEATHERS];
|
||||
static int16 m_fFarClip[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_fBlurRed[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_fBlurGreen[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_fBlurBlue[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_fWaterRed[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_fWaterGreen[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_fWaterBlue[NUMHOURS][NUMWEATHERS];
|
||||
static uint8 m_fWaterAlpha[NUMHOURS][NUMWEATHERS];
|
||||
|
||||
static float m_fCurrentAmbientRed;
|
||||
static float m_fCurrentAmbientGreen;
|
||||
@ -70,36 +70,36 @@ class CTimeCycle
|
||||
static float m_fCurrentDirectionalRed;
|
||||
static float m_fCurrentDirectionalGreen;
|
||||
static float m_fCurrentDirectionalBlue;
|
||||
static int m_nCurrentSkyTopRed;
|
||||
static int m_nCurrentSkyTopGreen;
|
||||
static int m_nCurrentSkyTopBlue;
|
||||
static int m_nCurrentSkyBottomRed;
|
||||
static int m_nCurrentSkyBottomGreen;
|
||||
static int m_nCurrentSkyBottomBlue;
|
||||
static int m_nCurrentSunCoreRed;
|
||||
static int m_nCurrentSunCoreGreen;
|
||||
static int m_nCurrentSunCoreBlue;
|
||||
static int m_nCurrentSunCoronaRed;
|
||||
static int m_nCurrentSunCoronaGreen;
|
||||
static int m_nCurrentSunCoronaBlue;
|
||||
static int32 m_nCurrentSkyTopRed;
|
||||
static int32 m_nCurrentSkyTopGreen;
|
||||
static int32 m_nCurrentSkyTopBlue;
|
||||
static int32 m_nCurrentSkyBottomRed;
|
||||
static int32 m_nCurrentSkyBottomGreen;
|
||||
static int32 m_nCurrentSkyBottomBlue;
|
||||
static int32 m_nCurrentSunCoreRed;
|
||||
static int32 m_nCurrentSunCoreGreen;
|
||||
static int32 m_nCurrentSunCoreBlue;
|
||||
static int32 m_nCurrentSunCoronaRed;
|
||||
static int32 m_nCurrentSunCoronaGreen;
|
||||
static int32 m_nCurrentSunCoronaBlue;
|
||||
static float m_fCurrentSunSize;
|
||||
static float m_fCurrentSpriteSize;
|
||||
static float m_fCurrentSpriteBrightness;
|
||||
static int m_nCurrentShadowStrength;
|
||||
static int m_nCurrentLightShadowStrength;
|
||||
static int m_nCurrentPoleShadowStrength;
|
||||
static int32 m_nCurrentShadowStrength;
|
||||
static int32 m_nCurrentLightShadowStrength;
|
||||
static int32 m_nCurrentPoleShadowStrength;
|
||||
static float m_fCurrentFogStart;
|
||||
static float m_fCurrentFarClip;
|
||||
static float m_fCurrentLightsOnGroundBrightness;
|
||||
static int m_nCurrentLowCloudsRed;
|
||||
static int m_nCurrentLowCloudsGreen;
|
||||
static int m_nCurrentLowCloudsBlue;
|
||||
static int m_nCurrentFluffyCloudsTopRed;
|
||||
static int m_nCurrentFluffyCloudsTopGreen;
|
||||
static int m_nCurrentFluffyCloudsTopBlue;
|
||||
static int m_nCurrentFluffyCloudsBottomRed;
|
||||
static int m_nCurrentFluffyCloudsBottomGreen;
|
||||
static int m_nCurrentFluffyCloudsBottomBlue;
|
||||
static int32 m_nCurrentLowCloudsRed;
|
||||
static int32 m_nCurrentLowCloudsGreen;
|
||||
static int32 m_nCurrentLowCloudsBlue;
|
||||
static int32 m_nCurrentFluffyCloudsTopRed;
|
||||
static int32 m_nCurrentFluffyCloudsTopGreen;
|
||||
static int32 m_nCurrentFluffyCloudsTopBlue;
|
||||
static int32 m_nCurrentFluffyCloudsBottomRed;
|
||||
static int32 m_nCurrentFluffyCloudsBottomGreen;
|
||||
static int32 m_nCurrentFluffyCloudsBottomBlue;
|
||||
static float m_fCurrentBlurRed;
|
||||
static float m_fCurrentBlurGreen;
|
||||
static float m_fCurrentBlurBlue;
|
||||
@ -107,14 +107,17 @@ class CTimeCycle
|
||||
static float m_fCurrentWaterGreen;
|
||||
static float m_fCurrentWaterBlue;
|
||||
static float m_fCurrentWaterAlpha;
|
||||
static int m_nCurrentFogColourRed;
|
||||
static int m_nCurrentFogColourGreen;
|
||||
static int m_nCurrentFogColourBlue;
|
||||
static int32 m_nCurrentFogColourRed;
|
||||
static int32 m_nCurrentFogColourGreen;
|
||||
static int32 m_nCurrentFogColourBlue;
|
||||
|
||||
static int m_FogReduction;
|
||||
static int32 m_FogReduction;
|
||||
|
||||
public:
|
||||
static int m_CurrentStoredValue;
|
||||
static bool m_bExtraColourOn;
|
||||
static int32 m_ExtraColour;
|
||||
static float m_ExtraColourInter;
|
||||
static int32 m_CurrentStoredValue;
|
||||
static CVector m_VectorToSun[16];
|
||||
static float m_fShadowFrontX[16];
|
||||
static float m_fShadowFrontY[16];
|
||||
@ -138,51 +141,56 @@ public:
|
||||
static float GetDirectionalRed(void) { return m_fCurrentDirectionalRed; }
|
||||
static float GetDirectionalGreen(void) { return m_fCurrentDirectionalGreen; }
|
||||
static float GetDirectionalBlue(void) { return m_fCurrentDirectionalBlue; }
|
||||
static int GetSkyTopRed(void) { return m_nCurrentSkyTopRed; }
|
||||
static int GetSkyTopGreen(void) { return m_nCurrentSkyTopGreen; }
|
||||
static int GetSkyTopBlue(void) { return m_nCurrentSkyTopBlue; }
|
||||
static int GetSkyBottomRed(void) { return m_nCurrentSkyBottomRed; }
|
||||
static int GetSkyBottomGreen(void) { return m_nCurrentSkyBottomGreen; }
|
||||
static int GetSkyBottomBlue(void) { return m_nCurrentSkyBottomBlue; }
|
||||
static int GetSunCoreRed(void) { return m_nCurrentSunCoreRed; }
|
||||
static int GetSunCoreGreen(void) { return m_nCurrentSunCoreGreen; }
|
||||
static int GetSunCoreBlue(void) { return m_nCurrentSunCoreBlue; }
|
||||
static int GetSunCoronaRed(void) { return m_nCurrentSunCoronaRed; }
|
||||
static int GetSunCoronaGreen(void) { return m_nCurrentSunCoronaGreen; }
|
||||
static int GetSunCoronaBlue(void) { return m_nCurrentSunCoronaBlue; }
|
||||
static int32 GetSkyTopRed(void) { return m_nCurrentSkyTopRed; }
|
||||
static int32 GetSkyTopGreen(void) { return m_nCurrentSkyTopGreen; }
|
||||
static int32 GetSkyTopBlue(void) { return m_nCurrentSkyTopBlue; }
|
||||
static int32 GetSkyBottomRed(void) { return m_nCurrentSkyBottomRed; }
|
||||
static int32 GetSkyBottomGreen(void) { return m_nCurrentSkyBottomGreen; }
|
||||
static int32 GetSkyBottomBlue(void) { return m_nCurrentSkyBottomBlue; }
|
||||
static int32 GetSunCoreRed(void) { return m_nCurrentSunCoreRed; }
|
||||
static int32 GetSunCoreGreen(void) { return m_nCurrentSunCoreGreen; }
|
||||
static int32 GetSunCoreBlue(void) { return m_nCurrentSunCoreBlue; }
|
||||
static int32 GetSunCoronaRed(void) { return m_nCurrentSunCoronaRed; }
|
||||
static int32 GetSunCoronaGreen(void) { return m_nCurrentSunCoronaGreen; }
|
||||
static int32 GetSunCoronaBlue(void) { return m_nCurrentSunCoronaBlue; }
|
||||
static float GetSunSize(void) { return m_fCurrentSunSize; }
|
||||
static float GetSpriteBrightness(void) { return m_fCurrentSpriteBrightness; }
|
||||
static float GetSpriteSize(void) { return m_fCurrentSpriteSize; }
|
||||
static int GetShadowStrength(void) { return m_nCurrentShadowStrength; }
|
||||
static int GetLightShadowStrength(void) { return m_nCurrentLightShadowStrength; }
|
||||
static int32 GetShadowStrength(void) { return m_nCurrentShadowStrength; }
|
||||
static int32 GetLightShadowStrength(void) { return m_nCurrentLightShadowStrength; }
|
||||
static float GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; }
|
||||
static float GetFarClip(void) { return m_fCurrentFarClip; }
|
||||
static float GetFogStart(void) { return m_fCurrentFogStart; }
|
||||
|
||||
static int GetLowCloudsRed(void) { return m_nCurrentLowCloudsRed; }
|
||||
static int GetLowCloudsGreen(void) { return m_nCurrentLowCloudsGreen; }
|
||||
static int GetLowCloudsBlue(void) { return m_nCurrentLowCloudsBlue; }
|
||||
static int GetFluffyCloudsTopRed(void) { return m_nCurrentFluffyCloudsTopRed; }
|
||||
static int GetFluffyCloudsTopGreen(void) { return m_nCurrentFluffyCloudsTopGreen; }
|
||||
static int GetFluffyCloudsTopBlue(void) { return m_nCurrentFluffyCloudsTopBlue; }
|
||||
static int GetFluffyCloudsBottomRed(void) { return m_nCurrentFluffyCloudsBottomRed; }
|
||||
static int GetFluffyCloudsBottomGreen(void) { return m_nCurrentFluffyCloudsBottomGreen; }
|
||||
static int GetFluffyCloudsBottomBlue(void) { return m_nCurrentFluffyCloudsBottomBlue; }
|
||||
static int GetFogRed(void) { return m_nCurrentFogColourRed; }
|
||||
static int GetFogGreen(void) { return m_nCurrentFogColourGreen; }
|
||||
static int GetFogBlue(void) { return m_nCurrentFogColourBlue; }
|
||||
static int GetFogReduction(void) { return m_FogReduction; }
|
||||
static int32 GetLowCloudsRed(void) { return m_nCurrentLowCloudsRed; }
|
||||
static int32 GetLowCloudsGreen(void) { return m_nCurrentLowCloudsGreen; }
|
||||
static int32 GetLowCloudsBlue(void) { return m_nCurrentLowCloudsBlue; }
|
||||
static int32 GetFluffyCloudsTopRed(void) { return m_nCurrentFluffyCloudsTopRed; }
|
||||
static int32 GetFluffyCloudsTopGreen(void) { return m_nCurrentFluffyCloudsTopGreen; }
|
||||
static int32 GetFluffyCloudsTopBlue(void) { return m_nCurrentFluffyCloudsTopBlue; }
|
||||
static int32 GetFluffyCloudsBottomRed(void) { return m_nCurrentFluffyCloudsBottomRed; }
|
||||
static int32 GetFluffyCloudsBottomGreen(void) { return m_nCurrentFluffyCloudsBottomGreen; }
|
||||
static int32 GetFluffyCloudsBottomBlue(void) { return m_nCurrentFluffyCloudsBottomBlue; }
|
||||
static int32 GetFogRed(void) { return m_nCurrentFogColourRed; }
|
||||
static int32 GetFogGreen(void) { return m_nCurrentFogColourGreen; }
|
||||
static int32 GetFogBlue(void) { return m_nCurrentFogColourBlue; }
|
||||
static int32 GetFogReduction(void) { return m_FogReduction; }
|
||||
|
||||
static int GetBlurRed(void) { return m_fCurrentBlurRed; }
|
||||
static int GetBlurGreen(void) { return m_fCurrentBlurGreen; }
|
||||
static int GetBlurBlue(void) { return m_fCurrentBlurBlue; }
|
||||
static int GetWaterRed(void) { return m_fCurrentWaterRed; }
|
||||
static int GetWaterGreen(void) { return m_fCurrentWaterGreen; }
|
||||
static int GetWaterBlue(void) { return m_fCurrentWaterBlue; }
|
||||
static int GetWaterAlpha(void) { return m_fCurrentWaterAlpha; }
|
||||
static int32 GetBlurRed(void) { return m_fCurrentBlurRed; }
|
||||
static int32 GetBlurGreen(void) { return m_fCurrentBlurGreen; }
|
||||
static int32 GetBlurBlue(void) { return m_fCurrentBlurBlue; }
|
||||
static int32 GetWaterRed(void) { return m_fCurrentWaterRed; }
|
||||
static int32 GetWaterGreen(void) { return m_fCurrentWaterGreen; }
|
||||
static int32 GetWaterBlue(void) { return m_fCurrentWaterBlue; }
|
||||
static int32 GetWaterAlpha(void) { return m_fCurrentWaterAlpha; }
|
||||
|
||||
static void Initialise(void);
|
||||
static void Update(void);
|
||||
static float Interpolate(int8 *a, int8 *b);
|
||||
static float Interpolate(uint8 *a, uint8 *b);
|
||||
static float Interpolate(int16 *a, int16 *b);
|
||||
static void StartExtraColour(int32 c, bool fade);
|
||||
static void StopExtraColour(bool fade);
|
||||
static CVector &GetSunDirection(void) { return m_VectorToSun[m_CurrentStoredValue]; }
|
||||
static float GetShadowFrontX(void) { return m_fShadowFrontX[m_CurrentStoredValue]; }
|
||||
static float GetShadowFrontY(void) { return m_fShadowFrontY[m_CurrentStoredValue]; }
|
||||
|
@ -6,7 +6,9 @@ enum {
|
||||
WEATHER_FOGGY,
|
||||
WEATHER_EXTRA_SUNNY,
|
||||
WEATHER_HURRICANE,
|
||||
WEATHER_TOTAL
|
||||
WEATHER_TOTAL,
|
||||
|
||||
WEATHER_EXTRACOLOURS = 6
|
||||
};
|
||||
|
||||
class CWeather
|
||||
|
Reference in New Issue
Block a user