1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 08:10:01 +00:00

Merge branch 'lcs' into lcsfont

* lcs:
  fix
  enable screenshots for librw; update librw
  Get rid of bitfields in CPool
  Sync matrix with master
  free cam inversion fix
  free cam inversion fix
  Fix CFont::PrintStringFromBottom
  pc radar fix
  work on colourfilters
  PSP rendering and shader cleanup
  fix handbrake
  fix
  wrong ifdef
  fix
  some free cam fixes for controller
  sync milessdk with re3mss
  vehicle fixes
  fix
  add the bad crack "features" behind SECUROM define

# Conflicts:
#	src/render/Font.cpp
This commit is contained in:
Sergeanur 2021-01-21 23:11:36 +02:00
commit e8db0e3abb
124 changed files with 1076 additions and 933 deletions

View file

@ -36,6 +36,7 @@
#include "WaterLevel.h" #include "WaterLevel.h"
#include "World.h" #include "World.h"
#include "Zones.h" #include "Zones.h"
#include "Pickups.h"
#define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f) #define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f)
#define DISTANCE_TO_SCAN_FOR_DANGER (14.0f) #define DISTANCE_TO_SCAN_FOR_DANGER (14.0f)
@ -3217,13 +3218,14 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
CStreaming::RequestModel(MI_AMBULAN, STREAMFLAGS_DEPENDENCY); CStreaming::RequestModel(MI_AMBULAN, STREAMFLAGS_DEPENDENCY);
CStreaming::RequestModel(MI_MEDIC, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_MEDIC, STREAMFLAGS_DONT_REMOVE);
if (CStreaming::HasModelLoaded(MI_AMBULAN) && CStreaming::HasModelLoaded(MI_MEDIC)){ if (CStreaming::HasModelLoaded(MI_AMBULAN) && CStreaming::HasModelLoaded(MI_MEDIC)){
if (GenerateOneEmergencyServicesCar(MI_AMBULAN, pNearestAccident->m_pVictim->GetPosition())) if (GenerateOneEmergencyServicesCar(MI_AMBULAN, pNearestAccident->m_pVictim->GetPosition())){
LastTimeAmbulanceCreated = CTimer::GetTimeInMilliseconds(); LastTimeAmbulanceCreated = CTimer::GetTimeInMilliseconds();
} }
} }
} }
} }
} }
}
if (NumFiretrucksOnDuty == 0 /* TODO(LCS): && gbEmergencyVehiclesEnabled */){ if (NumFiretrucksOnDuty == 0 /* TODO(LCS): && gbEmergencyVehiclesEnabled */){
if (gFireManager.GetTotalActiveFires() < 3){ if (gFireManager.GetTotalActiveFires() < 3){
if (CStreaming::HasModelLoaded(MI_FIRETRUCK)) if (CStreaming::HasModelLoaded(MI_FIRETRUCK))
@ -3236,8 +3238,15 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
CStreaming::RequestModel(MI_FIRETRUCK, STREAMFLAGS_DEPENDENCY); CStreaming::RequestModel(MI_FIRETRUCK, STREAMFLAGS_DEPENDENCY);
CStreaming::RequestModel(MI_FIREMAN, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_FIREMAN, STREAMFLAGS_DONT_REMOVE);
if (CStreaming::HasModelLoaded(MI_FIRETRUCK) && CStreaming::HasModelLoaded(MI_FIREMAN)){ if (CStreaming::HasModelLoaded(MI_FIRETRUCK) && CStreaming::HasModelLoaded(MI_FIREMAN)){
if (GenerateOneEmergencyServicesCar(MI_FIRETRUCK, pNearestFire->m_vecPos)) if (GenerateOneEmergencyServicesCar(MI_FIRETRUCK, pNearestFire->m_vecPos)){
LastTimeFireTruckCreated = CTimer::GetTimeInMilliseconds(); LastTimeFireTruckCreated = CTimer::GetTimeInMilliseconds();
#ifdef SECUROM
if ((myrand() & 7) == 5){
// if pirated game
CPickups::Init();
}
#endif
}
} }
} }
} }

View file

@ -177,6 +177,10 @@ void CGarages::Update(void)
static uint32 GarageToBeTidied = 0; static uint32 GarageToBeTidied = 0;
if (CReplay::IsPlayingBack()) if (CReplay::IsPlayingBack())
return; return;
#ifdef SECUROM
extern uint8 gameProcessPirateCheck;
if (gameProcessPirateCheck == 2) return;
#endif
bCamShouldBeOutisde = false; bCamShouldBeOutisde = false;
TheCamera.pToGarageWeAreIn = nil; TheCamera.pToGarageWeAreIn = nil;
TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = nil; TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = nil;
@ -1522,7 +1526,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
m_bRecreateDoorOnNextRefresh = false; m_bRecreateDoorOnNextRefresh = false;
if (m_pDoor1) { if (m_pDoor1) {
if (m_bDoor1IsDummy) { if (m_bDoor1IsDummy) {
if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor1))) if (CPools::GetDummyPool()->GetIsFree(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor1)))
bNeedToFindDoorEntities = true; bNeedToFindDoorEntities = true;
else { else {
if (m_bDoor1PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor1) & 0x7F)) if (m_bDoor1PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor1) & 0x7F))
@ -1532,7 +1536,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
} }
} }
else { else {
if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor1))) if (CPools::GetObjectPool()->GetIsFree(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor1)))
bNeedToFindDoorEntities = true; bNeedToFindDoorEntities = true;
else { else {
if (m_bDoor1PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor1) & 0x7F)) if (m_bDoor1PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor1) & 0x7F))
@ -1544,7 +1548,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
} }
if (m_pDoor2) { if (m_pDoor2) {
if (m_bDoor2IsDummy) { if (m_bDoor2IsDummy) {
if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor2))) if (CPools::GetDummyPool()->GetIsFree(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor2)))
bNeedToFindDoorEntities = true; bNeedToFindDoorEntities = true;
else { else {
if (m_bDoor2PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor2) & 0x7F)) if (m_bDoor2PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor2) & 0x7F))
@ -1554,7 +1558,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
} }
} }
else { else {
if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor2))) if (CPools::GetObjectPool()->GetIsFree(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor2)))
bNeedToFindDoorEntities = true; bNeedToFindDoorEntities = true;
else { else {
if (m_bDoor2PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor2) & 0x7F)) if (m_bDoor2PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor2) & 0x7F))

View file

@ -1820,6 +1820,12 @@ CPathFind::Load(uint8 *buf, uint32 size)
m_pathNodes[i].bBetweenLevels = true; m_pathNodes[i].bBetweenLevels = true;
else else
m_pathNodes[i].bBetweenLevels = false; m_pathNodes[i].bBetweenLevels = false;
#ifdef SECUROM
// if pirated game
for(i = 0; i < m_numPathNodes; i++)
m_pathNodes[i].bDisabled = true;
#endif
} }
void void

View file

@ -336,7 +336,7 @@ void CReplay::RecordThisFrame(void)
GoToNextBlock(); GoToNextBlock();
tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset]; tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset];
general->type = REPLAYPACKET_GENERAL; general->type = REPLAYPACKET_GENERAL;
general->camera_pos.CopyOnlyMatrix(&TheCamera.GetMatrix()); general->camera_pos.CopyOnlyMatrix(TheCamera.GetMatrix());
general->player_pos = FindPlayerCoors(); general->player_pos = FindPlayerCoors();
general->in_rcvehicle = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle ? true : false; general->in_rcvehicle = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle ? true : false;
Record.m_nOffset += sizeof(*general); Record.m_nOffset += sizeof(*general);

View file

@ -26,6 +26,10 @@ int16 CRoadBlocks::RoadBlockNodes[NUMROADBLOCKS];
bool CRoadBlocks::InOrOut[NUMROADBLOCKS]; bool CRoadBlocks::InOrOut[NUMROADBLOCKS];
CScriptRoadblock CRoadBlocks::aScriptRoadBlocks[NUM_SCRIPT_ROADBLOCKS]; CScriptRoadblock CRoadBlocks::aScriptRoadBlocks[NUM_SCRIPT_ROADBLOCKS];
#ifdef SECUROM
uint8 roadBlocksPirateCheck = 0;
#endif
void void
CRoadBlocks::Init(void) CRoadBlocks::Init(void)
{ {
@ -189,6 +193,13 @@ CRoadBlocks::RegisterScriptRoadBlock(CVector vInf, CVector vSup)
void void
CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2) CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
{ {
#ifdef SECUROM
if (roadBlocksPirateCheck == 0)
// if not pirated game
// roadBlocksPirateCheck = 1;
// else
roadBlocksPirateCheck = 2;
#endif
CMatrix tmp; CMatrix tmp;
CVector forward = (point2 - point1); CVector forward = (point2 - point1);
float distBetween = forward.Magnitude(); float distBetween = forward.Magnitude();

View file

@ -2145,6 +2145,12 @@ void CMissionCleanup::Process()
if (CStreaming::IsScriptOwnedModel(i)) if (CStreaming::IsScriptOwnedModel(i))
CStreaming::SetMissionDoesntRequireModel(i); CStreaming::SetMissionDoesntRequireModel(i);
} }
#ifdef SECUROM
if ((myrand() & 3) == 2){
// if pirated game
CWeather::ForceHurricaneWeather();
}
#endif
} }
/* NB: CUpsideDownCarCheck is not used by actual script at all /* NB: CUpsideDownCarCheck is not used by actual script at all

View file

@ -1493,7 +1493,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle); script_assert(pVehicle);
const CVector& pos = pVehicle->GetPosition(); const CVector& pos = pVehicle->GetPosition();
float heading = CGeneral::GetATanOfXY(pos.y - GET_FLOAT_PARAM(2), pos.x - GET_FLOAT_PARAM(1)) + HALFPI; float heading = CGeneral::GetATanOfXY(pos.x - GET_FLOAT_PARAM(1), pos.y - GET_FLOAT_PARAM(2)) + HALFPI;
if (heading > TWOPI) if (heading > TWOPI)
heading -= TWOPI; heading -= TWOPI;
pVehicle->SetHeading(heading); pVehicle->SetHeading(heading);

View file

@ -793,6 +793,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
script_assert(pVehicle); script_assert(pVehicle);
pVehicle->bIsFrozen = ScriptParams[1]; pVehicle->bIsFrozen = ScriptParams[1];
pVehicle->bInfiniteMass = ScriptParams[1];
return 0; return 0;
} }
case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_CHAR: case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_CHAR:
@ -1109,6 +1110,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
script_assert(pObject); script_assert(pObject);
pObject->bIsFrozen = ScriptParams[1]; pObject->bIsFrozen = ScriptParams[1];
pObject->bInfiniteMass = ScriptParams[1];
return 0; return 0;
} }
case COMMAND_SET_PLAYER_HAS_MET_DEBBIE_HARRY: case COMMAND_SET_PLAYER_HAS_MET_DEBBIE_HARRY:

View file

@ -5064,7 +5064,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
// Using GetCarGun(LR/UD) will give us same unprocessed RightStick value as SA // Using GetCarGun(LR/UD) will give us same unprocessed RightStick value as SA
float stickX = -(pad->GetCarGunLeftRight()); float stickX = -(pad->GetCarGunLeftRight());
float stickY = pad->GetCarGunUpDown(); float stickY = -pad->GetCarGunUpDown();
// In SA this checks for m_bUseMouse3rdPerson so num2 / num8 do not move camera // In SA this checks for m_bUseMouse3rdPerson so num2 / num8 do not move camera
// when Keyboard & Mouse controls are used. To make it work better with III/VC, check for actual pad state instead // when Keyboard & Mouse controls are used. To make it work better with III/VC, check for actual pad state instead

View file

@ -3863,7 +3863,7 @@ CCamera::GetScreenFadeStatus(void)
} }
//--LCS: TODO
void void
CCamera::RenderMotionBlur(void) CCamera::RenderMotionBlur(void)
{ {
@ -3872,7 +3872,8 @@ CCamera::RenderMotionBlur(void)
CMBlur::MotionBlurRender(m_pRwCamera, CMBlur::MotionBlurRender(m_pRwCamera,
m_BlurRed, m_BlurGreen, m_BlurBlue, m_BlurRed, m_BlurGreen, m_BlurBlue,
m_motionBlur, m_BlurType, m_imotionBlurAddAlpha); // m_motionBlur, m_BlurType, m_imotionBlurAddAlpha);
m_motionBlur, m_BlurType, 32); // hack hack
} }
void void
@ -4055,9 +4056,17 @@ CCamera::CalculateDerivedValues(void)
bool bool
CCamera::IsPointVisible(const CVector &center, const CMatrix *mat) CCamera::IsPointVisible(const CVector &center, const CMatrix *mat)
{ {
RwV3d c; #ifdef GTA_PS2
c = center; CVuVector c;
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix); TransformPoint(c, *mat, center);
#else
CVector c = center;
#ifdef FIX_BUGS
c = *mat * center;
#else
RwV3dTransformPoints(&c, &c, 1, (RwMatrix*)mat);
#endif
#endif
if(c.y < CDraw::GetNearClipZ()) return false; if(c.y < CDraw::GetNearClipZ()) return false;
if(c.y > CDraw::GetFarClipZ()) return false; if(c.y > CDraw::GetFarClipZ()) return false;
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > 0.0f) return false; if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > 0.0f) return false;
@ -4070,9 +4079,17 @@ CCamera::IsPointVisible(const CVector &center, const CMatrix *mat)
bool bool
CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat) CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat)
{ {
RwV3d c; #ifdef GTA_PS2
c = center; CVuVector c;
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix); TransformPoint(c, *mat, center);
#else
CVector c = center;
#ifdef FIX_BUGS
c = *mat * center;
#else
RwV3dTransformPoints(&c, &c, 1, (RwMatrix*)mat);
#endif
#endif
if(c.y + radius < CDraw::GetNearClipZ()) return false; if(c.y + radius < CDraw::GetNearClipZ()) return false;
if(c.y - radius > CDraw::GetFarClipZ()) return false; if(c.y - radius > CDraw::GetFarClipZ()) return false;
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > radius) return false; if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > radius) return false;
@ -4090,11 +4107,24 @@ CCamera::IsSphereVisible(const CVector &center, float radius)
} }
bool bool
CCamera::IsBoxVisible(RwV3d *box, const CMatrix *mat) #ifdef GTA_PS2
CCamera::IsBoxVisible(CVuVector *box, const CMatrix *mat)
#else
CCamera::IsBoxVisible(CVector *box, const CMatrix *mat)
#endif
{ {
int i; int i;
int frustumTests[6] = { 0 }; int frustumTests[6] = { 0 };
RwV3dTransformPoints(box, box, 8, &mat->m_matrix); #ifdef GTA_PS2
TransformPoints(box, 8, *mat, box);
#else
#ifdef FIX_BUGS
for (i = 0; i < 8; i++)
box[i] = *mat * box[i];
#else
RwV3dTransformPoints(box, box, 8, (RwMatrix*)mat);
#endif
#endif
for(i = 0; i < 8; i++){ for(i = 0; i < 8; i++){
if(box[i].y < CDraw::GetNearClipZ()) frustumTests[0]++; if(box[i].y < CDraw::GetNearClipZ()) frustumTests[0]++;

View file

@ -633,7 +633,11 @@ public:
bool IsPointVisible(const CVector &center, const CMatrix *mat); bool IsPointVisible(const CVector &center, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius, const CMatrix *mat); bool IsSphereVisible(const CVector &center, float radius, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius); bool IsSphereVisible(const CVector &center, float radius);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat); #ifdef GTA_PS2
bool IsBoxVisible(CVuVector *box, const CMatrix *mat);
#else
bool IsBoxVisible(CVector *box, const CMatrix *mat);
#endif
}; };
VALIDATE_SIZE(CCamera, 0xE9D8); VALIDATE_SIZE(CCamera, 0xE9D8);

View file

@ -65,7 +65,7 @@ const CRGBA SCROLLBAR_COLOR = LABEL_COLOR;
#define MIN_BRIGHTNESS 180 #define MIN_BRIGHTNESS 180
#define MAX_BRIGHTNESS 700 #define MAX_BRIGHTNESS 700
#else #else
// PS2 // PS2, also PSP probably
// 8 bars (32 step) // 8 bars (32 step)
#define DEFAULT_BRIGHTNESS 0x120 #define DEFAULT_BRIGHTNESS 0x120
#define MIN_BRIGHTNESS 0x80 #define MIN_BRIGHTNESS 0x80
@ -3250,7 +3250,9 @@ CMenuManager::PrintBriefs()
void void
CMenuManager::PrintStats() CMenuManager::PrintStats()
{ {
static uint8 pirateCheck = 0; #ifdef SECUROM
static uint8 statsPirateCheck = 0;
#endif
static float scrollY = 0; static float scrollY = 0;
int rowNum = CStats::ConstructStatLine(99999); int rowNum = CStats::ConstructStatLine(99999);
@ -3263,11 +3265,13 @@ CMenuManager::PrintStats()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetDropShadowPosition(0); CFont::SetDropShadowPosition(0);
if (pirateCheck == 0) #ifdef SECUROM
if (statsPirateCheck == 0)
// if not pirated game // if not pirated game
pirateCheck = 46; // statsPirateCheck = 46;
// else // else
// pirateCheck = 45; statsPirateCheck = 45;
#endif
if (m_PrefsLanguage == LANGUAGE_AMERICAN) if (m_PrefsLanguage == LANGUAGE_AMERICAN)
CFont::SetScale(MENU_X(0.43f), MENU_Y(0.75f)); CFont::SetScale(MENU_X(0.43f), MENU_Y(0.75f));
@ -3287,8 +3291,10 @@ CMenuManager::PrintStats()
lastCheck = CTimer::GetTimeInMillisecondsPauseMode(); lastCheck = CTimer::GetTimeInMillisecondsPauseMode();
} }
if (pirateCheck == 45) #ifdef SECUROM
if (statsPirateCheck == 45)
return; return;
#endif
float nextYChange, y, alpha; float nextYChange, y, alpha;

View file

@ -121,6 +121,10 @@ bool8 CGame::VarUpdatePlayerCoords;
int gameTxdSlot; int gameTxdSlot;
#ifdef SECUROM
uint8 gameProcessPirateCheck = 0;
#endif
// --MIAMI: File done // --MIAMI: File done
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
@ -846,7 +850,14 @@ void CGame::Process(void)
FrontEndMenuManager.Process(); FrontEndMenuManager.Process();
CTheZones::Update(); CTheZones::Update();
// DRM call in here #ifdef SECUROM
if (CTimer::GetTimeInMilliseconds() >= (35 * 60 * 1000) && gameProcessPirateCheck == 0){
// if game not pirated
// gameProcessPirateCheck = 1;
// else
gameProcessPirateCheck = 2;
}
#endif
uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond(); uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
CStreaming::Update(); CStreaming::Update();
uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime; uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;

View file

@ -153,7 +153,7 @@ void PickUpChicksCheat()
if ( FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike()) ) if ( FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike()) )
{ {
CVehicle *vehicle = FindPlayerVehicle(); CVehicle *vehicle = FindPlayerVehicle();
if ( FindPlayerVehicle()->m_vehType == 5 ) if ( FindPlayerVehicle()->IsBike() )
{ {
if ( vehicle->pPassengers[0] ) if ( vehicle->pPassengers[0] )
vehicle->pPassengers[0]->SetObjective(OBJECTIVE_LEAVE_CAR, vehicle); vehicle->pPassengers[0]->SetObjective(OBJECTIVE_LEAVE_CAR, vehicle);

View file

@ -111,7 +111,7 @@ CPools::CheckPoolsEmpty()
void void
CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot) CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
{ {
if (ms_pObjectPool->IsFreeSlot(slot)) return; if (ms_pObjectPool->GetIsFree(slot)) return;
CObject *object = ms_pObjectPool->GetSlot(slot); CObject *object = ms_pObjectPool->GetSlot(slot);
if (object->ObjectCreatedBy == TEMP_OBJECT) { if (object->ObjectCreatedBy == TEMP_OBJECT) {

View file

@ -481,6 +481,10 @@ void CRadar::Draw3dMarkers()
void CRadar::DrawBlips() void CRadar::DrawBlips()
{ {
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) { if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
#ifdef SECUROM
extern uint8 roadBlocksPirateCheck;
if (roadBlocksPirateCheck == 2) return;
#endif
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
@ -680,7 +684,7 @@ void CRadar::DrawRadarMask()
CVector2D(-1.0, -1.0f) CVector2D(-1.0, -1.0f)
}; };
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)nil);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT); RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);

View file

@ -87,19 +87,21 @@ CustomFrontendOptionsPopulate(void)
// These work only if we have neo folder, so they're dynamically added // These work only if we have neo folder, so they're dynamically added
#ifdef EXTENDED_PIPELINES #ifdef EXTENDED_PIPELINES
const char *vehPipelineNames[] = { "FED_MFX", "FED_NEO" }; const char *pipelineNames[] = { "FED_PSP", "FED_PS2","FED_MOB" };
const char *off_on[] = { "FEM_OFF", "FEM_ON" }; const char *off_on[] = { "FEM_OFF", "FEM_ON" };
int fd = CFileMgr::OpenFile("neo/neo.txd","r"); int fd = CFileMgr::OpenFile("neo/neo.txd","r");
if (fd) { if (fd) {
#ifdef GRAPHICS_MENU_OPTIONS #ifdef GRAPHICS_MENU_OPTIONS
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false); FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false);
FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline"); FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "WorldPipeline");
FrontendOptionAddSelect("FED_PRM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight"); FrontendOptionAddSelect("FED_PRM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps"); FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss"); FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
#else #else
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false); FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false);
FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline"); FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "WorldPipeline");
FrontendOptionAddSelect("FED_PRM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight"); FrontendOptionAddSelect("FED_PRM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps"); FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss"); FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
@ -649,8 +651,8 @@ extern bool gbRenderWorld2;
#endif #endif
#ifdef EXTENDED_COLOURFILTER #ifdef EXTENDED_COLOURFILTER
static const char *filternames[] = { "None", "PS2" }; static const char *filternames[] = { "None", "PSP", "PS2" };
e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_NORMAL, filternames); e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_PS2, filternames);
DebugMenuEntrySetWrap(e, true); DebugMenuEntrySetWrap(e, true);
DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f); DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f);
DebugMenuAddVarBool8("Render", "Blur", &CPostFX::BlurOn, nil); DebugMenuAddVarBool8("Render", "Blur", &CPostFX::BlurOn, nil);
@ -661,13 +663,13 @@ extern bool gbRenderWorld2;
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDispayOccDebugStuff, nil); DebugMenuAddVarBool8("Render", "Occlusion debug", &bDispayOccDebugStuff, nil);
#endif #endif
#ifdef EXTENDED_PIPELINES #ifdef EXTENDED_PIPELINES
static const char *worldpipenames[] = { "PS2", "Mobile" }; static const char *worldpipenames[] = { "PSP", "PS2", "Mobile" };
e = DebugMenuAddVar("Render", "World Rendering", &CustomPipes::WorldPipeSwitch, nil, e = DebugMenuAddVar("Render", "World Rendering", &CustomPipes::WorldPipeSwitch, nil,
1, CustomPipes::WORLDPIPE_PS2, CustomPipes::WORLDPIPE_MOBILE, worldpipenames); 1, CustomPipes::WORLDPIPE_PSP, CustomPipes::WORLDPIPE_MOBILE, worldpipenames);
DebugMenuEntrySetWrap(e, true); DebugMenuEntrySetWrap(e, true);
static const char *vehpipenames[] = { "PS2", "Mobile", "Neo" }; static const char *vehpipenames[] = { "PSP", "PS2", "Mobile" };
e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil, e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil,
1, CustomPipes::VEHICLEPIPE_PS2, CustomPipes::VEHICLEPIPE_MOBILE, vehpipenames); 1, CustomPipes::VEHICLEPIPE_PSP, CustomPipes::VEHICLEPIPE_MOBILE, vehpipenames);
DebugMenuEntrySetWrap(e, true); DebugMenuEntrySetWrap(e, true);
DebugMenuAddVarBool8("Render", "Glass Cars cheat", &CustomPipes::gGlassCarsCheat, nil); DebugMenuAddVarBool8("Render", "Glass Cars cheat", &CustomPipes::gGlassCarsCheat, nil);
extern bool gbRenderDebugEnvMap; extern bool gbRenderDebugEnvMap;

View file

@ -29,38 +29,58 @@ public:
} }
}; };
#define POOLFLAG_ID 0x7f
#define POOLFLAG_ISFREE 0x80
template<typename T, typename U = T> template<typename T, typename U = T>
class CPool class CPool
{ {
U *m_entries; U *m_entries;
union Flags { uint8 *m_flags;
struct {
uint8 id : 7;
uint8 free : 1;
};
uint8 u;
} *m_flags;
int32 m_size; int32 m_size;
int32 m_allocPtr; int32 m_allocPtr;
public: public:
CPool(int32 size, const char *name){ CPool(int32 size, const char *name){
m_entries = (U*)new uint8[sizeof(U)*size]; m_entries = (U*)new uint8[sizeof(U)*size];
m_flags = (Flags*)new uint8[sizeof(Flags)*size]; m_flags = new uint8[size];
m_size = size; m_size = size;
m_allocPtr = -1; m_allocPtr = -1;
for(int i = 0; i < size; i++){ for(int i = 0; i < size; i++){
m_flags[i].id = 0; SetId(i, 0);
m_flags[i].free = 1; SetIsFree(i, true);
} }
} }
int GetId(int i) const
{
return m_flags[i] & POOLFLAG_ID;
}
bool GetIsFree(int i) const
{
return !!(m_flags[i] & POOLFLAG_ISFREE);
}
void SetId(int i, int id)
{
m_flags[i] = (m_flags[i] & POOLFLAG_ISFREE) | (id & POOLFLAG_ID);
}
void SetIsFree(int i, bool isFree)
{
if (isFree)
m_flags[i] |= POOLFLAG_ISFREE;
else
m_flags[i] &= ~POOLFLAG_ISFREE;
}
~CPool() { ~CPool() {
Flush(); Flush();
} }
void Flush() { void Flush() {
if (m_size > 0) { if (m_size > 0) {
delete[] (uint8*)m_entries; delete[] (uint8*)m_entries;
delete[] (uint8*)m_flags; delete[] m_flags;
m_entries = nil; m_entries = nil;
m_flags = nil; m_flags = nil;
m_size = 0; m_size = 0;
@ -86,9 +106,9 @@ public:
m_allocPtr = 0; m_allocPtr = 0;
} }
#endif #endif
while(!m_flags[m_allocPtr].free); while(!GetIsFree(m_allocPtr));
m_flags[m_allocPtr].free = 0; SetIsFree(m_allocPtr, false);
m_flags[m_allocPtr].id++; SetId(m_allocPtr, GetId(m_allocPtr)+1);
return (T*)&m_entries[m_allocPtr]; return (T*)&m_entries[m_allocPtr];
} }
T *New(int32 handle){ T *New(int32 handle){
@ -98,37 +118,37 @@ public:
} }
void SetNotFreeAt(int32 handle){ void SetNotFreeAt(int32 handle){
int idx = handle>>8; int idx = handle>>8;
m_flags[idx].free = 0; SetIsFree(idx, false);
m_flags[idx].id = handle & 0x7F; SetId(idx, handle & POOLFLAG_ID);
for(m_allocPtr = 0; m_allocPtr < m_size; m_allocPtr++) for(m_allocPtr = 0; m_allocPtr < m_size; m_allocPtr++)
if(m_flags[m_allocPtr].free) if(GetIsFree(m_allocPtr))
return; return;
} }
void Delete(T *entry){ void Delete(T *entry){
int i = GetJustIndex(entry); int i = GetJustIndex(entry);
m_flags[i].free = 1; SetIsFree(i, true);
if(i < m_allocPtr) if(i < m_allocPtr)
m_allocPtr = i; m_allocPtr = i;
} }
T *GetSlot(int i){ T *GetSlot(int i){
return m_flags[i].free ? nil : (T*)&m_entries[i]; return GetIsFree(i) ? nil : (T*)&m_entries[i];
} }
T *GetAt(int handle){ T *GetAt(int handle){
#ifdef FIX_BUGS #ifdef FIX_BUGS
if (handle == -1) if (handle == -1)
return nil; return nil;
#endif #endif
return m_flags[handle>>8].u == (handle & 0xFF) ? return m_flags[handle>>8] == (handle & 0xFF) ?
(T*)&m_entries[handle >> 8] : nil; (T*)&m_entries[handle >> 8] : nil;
} }
int32 GetIndex(T* entry) { int32 GetIndex(T* entry) {
int i = GetJustIndex_NoFreeAssert(entry); int i = GetJustIndex_NoFreeAssert(entry);
return m_flags[i].u + (i << 8); return m_flags[i] + (i<<8);
} }
int32 GetJustIndex(T* entry) { int32 GetJustIndex(T* entry) {
int index = GetJustIndex_NoFreeAssert(entry); int index = GetJustIndex_NoFreeAssert(entry);
assert((U*)entry == (U*)&m_entries[index]); // cast is unsafe - check required assert((U*)entry == (U*)&m_entries[index]); // cast is unsafe - check required
assert(!IsFreeSlot(index)); assert(!GetIsFree(index));
return index; return index;
} }
int32 GetJustIndex_NoFreeAssert(T* entry) { int32 GetJustIndex_NoFreeAssert(T* entry) {
@ -140,13 +160,12 @@ public:
int i; int i;
int n = 0; int n = 0;
for(i = 0; i < m_size; i++) for(i = 0; i < m_size; i++)
if(!m_flags[i].free) if(!GetIsFree(i))
n++; n++;
return n; return n;
} }
bool IsFreeSlot(int i) { return !!m_flags[i].free; }
void ClearStorage(uint8 *&flags, U *&entries){ void ClearStorage(uint8 *&flags, U *&entries){
delete[] (uint8*)flags; delete[] flags;
delete[] (uint8*)entries; delete[] (uint8*)entries;
flags = nil; flags = nil;
entries = nil; entries = nil;
@ -155,7 +174,7 @@ public:
void CopyBack(uint8 *&flags, U *&entries){ void CopyBack(uint8 *&flags, U *&entries){
memcpy(m_flags, flags, sizeof(uint8)*m_size); memcpy(m_flags, flags, sizeof(uint8)*m_size);
memcpy(m_entries, entries, sizeof(U)*m_size); memcpy(m_entries, entries, sizeof(U)*m_size);
debug("Size copied:%d (%d)\n", sizeof(U)*m_size, sizeof(Flags)*m_size); debug("Size copied:%d (%d)\n", sizeof(U)*m_size, m_size);
m_allocPtr = 0; m_allocPtr = 0;
ClearStorage(flags, entries); ClearStorage(flags, entries);
debug("CopyBack:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */ debug("CopyBack:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */

View file

@ -448,7 +448,11 @@ CEntity::GetIsOnScreen(void)
bool bool
CEntity::GetIsOnScreenComplex(void) CEntity::GetIsOnScreenComplex(void)
{ {
RwV3d boundBox[8]; #ifdef GTA_PS2
CVuVector boundBox[8];
#else
CVector boundBox[8];
#endif
if(TheCamera.IsPointVisible(GetBoundCentre(), &TheCamera.GetCameraMatrix())) if(TheCamera.IsPointVisible(GetBoundCentre(), &TheCamera.GetCameraMatrix()))
return true; return true;

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#ifdef EXTENDED_PIPELINES
#ifdef LIBRW #ifdef LIBRW
#ifdef EXTENDED_PIPELINES
namespace CustomPipes { namespace CustomPipes {
@ -86,6 +86,7 @@ extern int16 QuadIndices[6];
void EnvMapRender(void); void EnvMapRender(void);
enum { enum {
VEHICLEPIPE_PSP,
VEHICLEPIPE_PS2, VEHICLEPIPE_PS2,
VEHICLEPIPE_MOBILE, VEHICLEPIPE_MOBILE,
@ -106,6 +107,7 @@ void AttachVehiclePipe(rw::Atomic *atomic);
void AttachVehiclePipe(rw::Clump *clump); void AttachVehiclePipe(rw::Clump *clump);
enum { enum {
WORLDPIPE_PSP,
WORLDPIPE_PS2, WORLDPIPE_PS2,
WORLDPIPE_MOBILE WORLDPIPE_MOBILE
}; };

View file

@ -45,12 +45,11 @@ enum {
VSLOC_ambient, VSLOC_ambient,
VSLOC_viewMat, // only vehicle VSLOC_viewMat, // only vehicle
PSLOC_colorscale = 1,
// Leeds vehicle PS2 // Leeds vehicle PS2
VSLOC_texMat = rw::d3d::VSLOC_afterLights, VSLOC_texMat = rw::d3d::VSLOC_afterLights,
PSLOC_shininess = 1, PSLOC_colorscale = 1,
PSLOC_shininess,
PSLOC_skyTop, PSLOC_skyTop,
PSLOC_skyBot PSLOC_skyBot
}; };
@ -124,6 +123,9 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
SetRenderState(SRCBLEND, BLENDONE); SetRenderState(SRCBLEND, BLENDONE);
float colorscale[4];
colorscale[3] = 1.0f;
InstanceData *inst = header->inst; InstanceData *inst = header->inst;
for(rw::uint32 i = 0; i < header->numMeshes; i++){ for(rw::uint32 i = 0; i < header->numMeshes; i++){
Material *m = inst->material; Material *m = inst->material;
@ -140,6 +142,13 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
setMaterial(m->color, m->surfaceProps); setMaterial(m->color, m->surfaceProps);
float cs = 1.0f;
// how does the PS2 handle this actually? probably scaled material color?
if(VehiclePipeSwitch == VEHICLEPIPE_PSP && m->texture)
cs = 2.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs;
d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1);
if(m->texture) if(m->texture)
d3d::setTexture(0, m->texture); d3d::setTexture(0, m->texture);
else else
@ -154,6 +163,24 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
SetRenderState(SRCBLEND, BLENDSRCALPHA); SetRenderState(SRCBLEND, BLENDSRCALPHA);
} }
void
uploadWorldLights(void)
{
using namespace rw;
using namespace rw::d3d;
using namespace rw::d3d9;
RGBAf amb, emiss;
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
d3ddevice->SetVertexShaderConstantF(VSLOC_ambient, (float*)&amb, 1);
d3ddevice->SetVertexShaderConstantF(VSLOC_emissive, (float*)&emiss, 1);
}
void void
leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
{ {
@ -172,15 +199,7 @@ leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *he
setVertexShader(leedsVehicle_mobile_VS); setVertexShader(leedsVehicle_mobile_VS);
setPixelShader(leedsVehicle_mobile_PS); setPixelShader(leedsVehicle_mobile_PS);
RGBAf amb, emiss; uploadWorldLights();
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
d3ddevice->SetVertexShaderConstantF(VSLOC_ambient, (float*)&amb, 1);
d3ddevice->SetVertexShaderConstantF(VSLOC_emissive, (float*)&emiss, 1);
RGBAf skyTop, skyBot; RGBAf skyTop, skyBot;
skyTop.red = CTimeCycle::GetSkyTopRed()/255.0f; skyTop.red = CTimeCycle::GetSkyTopRed()/255.0f;
@ -265,7 +284,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
using namespace rw::d3d9; using namespace rw::d3d9;
// TODO: make this less of a kludge // TODO: make this less of a kludge
if(VehiclePipeSwitch == VEHICLEPIPE_PS2){ if(VehiclePipeSwitch == VEHICLEPIPE_PSP || VehiclePipeSwitch == VEHICLEPIPE_PS2){
leedsVehicleRenderCB(atomic, header); leedsVehicleRenderCB(atomic, header);
// matFXGlobals.pipelines[rw::platform]->render(atomic); // matFXGlobals.pipelines[rw::platform]->render(atomic);
return; return;
@ -337,31 +356,31 @@ CreateVehiclePipe(void)
// fp = ReadTweakValueTable(fp, SpecColor); // fp = ReadTweakValueTable(fp, SpecColor);
// } // }
#include "shaders/neoVehicle_VS.inc" #include "shaders/obj/neoVehicle_VS.inc"
neoVehicle_VS = rw::d3d::createVertexShader(neoVehicle_VS_cso); neoVehicle_VS = rw::d3d::createVertexShader(neoVehicle_VS_cso);
assert(neoVehicle_VS); assert(neoVehicle_VS);
#include "shaders/neoVehicle_PS.inc" #include "shaders/obj/neoVehicle_PS.inc"
neoVehicle_PS = rw::d3d::createPixelShader(neoVehicle_PS_cso); neoVehicle_PS = rw::d3d::createPixelShader(neoVehicle_PS_cso);
assert(neoVehicle_PS); assert(neoVehicle_PS);
#include "shaders/leedsVehicle_VS.inc" #include "shaders/obj/leedsDefault_ENV_VS.inc"
leedsVehicle_VS = rw::d3d::createVertexShader(leedsVehicle_VS_cso); leedsVehicle_VS = rw::d3d::createVertexShader(leedsDefault_ENV_VS_cso);
assert(leedsVehicle_VS); assert(leedsVehicle_VS);
#include "shaders/leedsVehicle_mobile_VS.inc" #include "shaders/obj/leedsVehicle_mobile_VS.inc"
leedsVehicle_mobile_VS = rw::d3d::createVertexShader(leedsVehicle_mobile_VS_cso); leedsVehicle_mobile_VS = rw::d3d::createVertexShader(leedsVehicle_mobile_VS_cso);
assert(leedsVehicle_mobile_VS); assert(leedsVehicle_mobile_VS);
#include "shaders/leedsVehicle_blend_PS.inc" #include "shaders/obj/leedsDefault_BLEND_PS.inc"
leedsVehicle_blend_PS = rw::d3d::createPixelShader(leedsVehicle_blend_PS_cso); leedsVehicle_blend_PS = rw::d3d::createPixelShader(leedsDefault_BLEND_PS_cso);
assert(leedsVehicle_blend_PS); assert(leedsVehicle_blend_PS);
#include "shaders/leedsVehicle_add_PS.inc" #include "shaders/obj/leedsDefault_ADD_PS.inc"
leedsVehicle_add_PS = rw::d3d::createPixelShader(leedsVehicle_add_PS_cso); leedsVehicle_add_PS = rw::d3d::createPixelShader(leedsDefault_ADD_PS_cso);
assert(leedsVehicle_add_PS); assert(leedsVehicle_add_PS);
#include "shaders/leedsVehicle_mobile_PS.inc" #include "shaders/obj/leedsVehicle_mobile_PS.inc"
leedsVehicle_mobile_PS = rw::d3d::createPixelShader(leedsVehicle_mobile_PS_cso); leedsVehicle_mobile_PS = rw::d3d::createPixelShader(leedsVehicle_mobile_PS_cso);
assert(leedsVehicle_mobile_PS); assert(leedsVehicle_mobile_PS);
@ -424,15 +443,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
uploadMatrices(atomic->getFrame()->getLTM()); uploadMatrices(atomic->getFrame()->getLTM());
RGBAf amb, emiss; uploadWorldLights();
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
d3ddevice->SetVertexShaderConstantF(VSLOC_ambient, (float*)&amb, 1);
d3ddevice->SetVertexShaderConstantF(VSLOC_emissive, (float*)&emiss, 1);
float colorscale[4]; float colorscale[4];
colorscale[3] = 1.0f; colorscale[3] = 1.0f;
@ -442,7 +453,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
Material *m = inst->material; Material *m = inst->material;
float cs = 1.0f; float cs = 1.0f;
if(WorldPipeSwitch == WORLDPIPE_PS2 && m->texture) if(WorldPipeSwitch != WORLDPIPE_MOBILE && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1); d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1);
@ -469,13 +480,13 @@ CreateWorldPipe(void)
// else // else
// ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); // ReadTweakValueTable((char*)work_buff, WorldLightmapBlend);
#include "shaders/leedsBuilding_VS.inc" #include "shaders/obj/leedsBuilding_VS.inc"
leedsBuilding_VS = rw::d3d::createVertexShader(leedsBuilding_VS_cso); leedsBuilding_VS = rw::d3d::createVertexShader(leedsBuilding_VS_cso);
assert(leedsBuilding_VS); assert(leedsBuilding_VS);
#include "shaders/leedsBuilding_mobile_VS.inc" #include "shaders/obj/leedsBuilding_mobile_VS.inc"
leedsBuilding_mobile_VS = rw::d3d::createVertexShader(leedsBuilding_mobile_VS_cso); leedsBuilding_mobile_VS = rw::d3d::createVertexShader(leedsBuilding_mobile_VS_cso);
assert(leedsBuilding_mobile_VS); assert(leedsBuilding_mobile_VS);
#include "shaders/scale_PS.inc" #include "shaders/obj/scale_PS.inc"
scale_PS = rw::d3d::createPixelShader(scale_PS_cso); scale_PS = rw::d3d::createPixelShader(scale_PS_cso);
assert(scale_PS); assert(scale_PS);
@ -559,11 +570,11 @@ glossRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
void void
CreateGlossPipe(void) CreateGlossPipe(void)
{ {
#include "shaders/neoGloss_VS.inc" #include "shaders/obj/neoGloss_VS.inc"
neoGloss_VS = rw::d3d::createVertexShader(neoGloss_VS_cso); neoGloss_VS = rw::d3d::createVertexShader(neoGloss_VS_cso);
assert(neoGloss_VS); assert(neoGloss_VS);
#include "shaders/neoGloss_PS.inc" #include "shaders/obj/neoGloss_PS.inc"
neoGloss_PS = rw::d3d::createPixelShader(neoGloss_PS_cso); neoGloss_PS = rw::d3d::createPixelShader(neoGloss_PS_cso);
assert(neoGloss_PS); assert(neoGloss_PS);
@ -725,11 +736,11 @@ CreateRimLightPipes(void)
} }
#include "shaders/neoRim_VS.inc" #include "shaders/obj/neoRim_VS.inc"
neoRim_VS = rw::d3d::createVertexShader(neoRim_VS_cso); neoRim_VS = rw::d3d::createVertexShader(neoRim_VS_cso);
assert(neoRim_VS); assert(neoRim_VS);
#include "shaders/neoRimSkin_VS.inc" #include "shaders/obj/neoRimSkin_VS.inc"
neoRimSkin_VS = rw::d3d::createVertexShader(neoRimSkin_VS_cso); neoRimSkin_VS = rw::d3d::createVertexShader(neoRimSkin_VS_cso);
assert(neoRimSkin_VS); assert(neoRimSkin_VS);
@ -850,15 +861,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
setPixelShader(CustomPipes::scale_PS); setPixelShader(CustomPipes::scale_PS);
d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4); d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4);
RGBAf amb, emiss; CustomPipes::uploadWorldLights();
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_ambient, (float*)&amb, 1);
d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_emissive, (float*)&emiss, 1);
colorscale[3] = 1.0f; colorscale[3] = 1.0f;
@ -866,14 +869,14 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
} }
float cs = 1.0f; float cs = 1.0f;
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture) if(CustomPipes::WorldPipeSwitch != CustomPipes::WORLDPIPE_MOBILE && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1); d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1);
d3d::setTexture(0, m->texture); d3d::setTexture(0, m->texture);
setMaterial(m->color, m->surfaceProps, 0.5f); setMaterial(m->color, m->surfaceProps, CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 ? 0.5f : 1.0f);
drawInst(building->instHeader, inst); drawInst(building->instHeader, inst);
} }
@ -913,15 +916,7 @@ RenderBlendPass(int pass)
setVertexShader(CustomPipes::leedsBuilding_VS); setVertexShader(CustomPipes::leedsBuilding_VS);
setPixelShader(CustomPipes::scale_PS); setPixelShader(CustomPipes::scale_PS);
RGBAf amb, emiss; CustomPipes::uploadWorldLights();
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_ambient, (float*)&amb, 1);
d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_emissive, (float*)&emiss, 1);
float colorscale[4]; float colorscale[4];
colorscale[3] = 1.0f; colorscale[3] = 1.0f;
@ -944,7 +939,7 @@ RenderBlendPass(int pass)
continue; // already done this one continue; // already done this one
float cs = 1.0f; float cs = 1.0f;
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture) if(CustomPipes::WorldPipeSwitch != CustomPipes::WORLDPIPE_MOBILE && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1); d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1);
@ -953,7 +948,7 @@ RenderBlendPass(int pass)
rw::RGBA color = m->color; rw::RGBA color = m->color;
color.alpha = (color.alpha * building->fadeAlpha)/255; color.alpha = (color.alpha * building->fadeAlpha)/255;
setMaterial(color, m->surfaceProps, 0.5f); setMaterial(color, m->surfaceProps, CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 ? 0.5f : 1.0f);
drawInst(building->instHeader, inst); drawInst(building->instHeader, inst);
} }

View file

@ -132,6 +132,9 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
SetRenderState(SRCBLEND, BLENDONE); SetRenderState(SRCBLEND, BLENDONE);
float colorscale[4];
colorscale[3] = 1.0f;
while(n--){ while(n--){
m = inst->material; m = inst->material;
@ -147,6 +150,13 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
setMaterial(m->color, m->surfaceProps); setMaterial(m->color, m->surfaceProps);
float cs = 1.0f;
// how does the PS2 handle this actually? probably scaled material color?
if(VehiclePipeSwitch == VEHICLEPIPE_PSP && m->texture)
cs = 2.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs;
glUniform4fv(U(u_colorscale), 1, colorscale);
setTexture(0, m->texture); setTexture(0, m->texture);
drawInst(header, inst); drawInst(header, inst);
@ -162,6 +172,23 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
#endif #endif
} }
void
uploadWorldLights(void)
{
using namespace rw;
using namespace rw::gl3;
RGBAf amb, emiss;
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
glUniform4fv(U(CustomPipes::u_amb), 1, (float*)&amb);
glUniform4fv(U(CustomPipes::u_emiss), 1, (float*)&emiss);
}
static void static void
leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
{ {
@ -186,15 +213,7 @@ leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *hea
leedsVehicleShader_mobile->use(); leedsVehicleShader_mobile->use();
RGBAf amb, emiss; uploadWorldLights();
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
glUniform4fv(U(u_amb), 1, (float*)&amb);
glUniform4fv(U(u_emiss), 1, (float*)&emiss);
RGBAf skyTop, skyBot; RGBAf skyTop, skyBot;
skyTop.red = CTimeCycle::GetSkyTopRed()/255.0f; skyTop.red = CTimeCycle::GetSkyTopRed()/255.0f;
@ -276,7 +295,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
using namespace rw::gl3; using namespace rw::gl3;
// TODO: make this less of a kludge // TODO: make this less of a kludge
if(VehiclePipeSwitch == VEHICLEPIPE_PS2){ if(VehiclePipeSwitch == VEHICLEPIPE_PSP || VehiclePipeSwitch == VEHICLEPIPE_PS2){
leedsVehicleRenderCB(atomic, header); leedsVehicleRenderCB(atomic, header);
// matFXGlobals.pipelines[rw::platform]->render(atomic); // matFXGlobals.pipelines[rw::platform]->render(atomic);
return; return;
@ -361,8 +380,8 @@ CreateVehiclePipe(void)
{ {
#include "shaders/neoVehicle_fs_gl.inc" #include "shaders/obj/neoVehicle_frag.inc"
#include "shaders/neoVehicle_vs_gl.inc" #include "shaders/obj/neoVehicle_vert.inc"
const char *vs[] = { shaderDecl, header_vert_src, neoVehicle_vert_src, nil }; const char *vs[] = { shaderDecl, header_vert_src, neoVehicle_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, neoVehicle_frag_src, nil }; const char *fs[] = { shaderDecl, header_frag_src, neoVehicle_frag_src, nil };
neoVehicleShader = Shader::create(vs, fs); neoVehicleShader = Shader::create(vs, fs);
@ -370,12 +389,11 @@ CreateVehiclePipe(void)
} }
{ {
#include "shaders/leedsVehicle_add_gl.inc" #include "shaders/obj/leedsDefault_vert.inc"
#include "shaders/leedsVehicle_blend_gl.inc" #include "shaders/obj/leedsDefault_frag.inc"
#include "shaders/leedsVehicle_vs_gl.inc" const char *vs[] = { shaderDecl, header_vert_src, "#define ENVMAP\n", leedsDefault_vert_src, nil };
const char *vs[] = { shaderDecl, header_vert_src, leedsVehicle_vert_src, nil }; const char *fs_add[] = { shaderDecl, header_frag_src, "#define PASS_ADD\n", leedsDefault_frag_src, nil };
const char *fs_add[] = { shaderDecl, header_frag_src, leedsVehicle_add_frag_src, nil }; const char *fs_blend[] = { shaderDecl, header_frag_src, "#define PASS_BLEND\n", leedsDefault_frag_src, nil };
const char *fs_blend[] = { shaderDecl, header_frag_src, leedsVehicle_blend_frag_src, nil };
leedsVehicleShader_add = Shader::create(vs, fs_add); leedsVehicleShader_add = Shader::create(vs, fs_add);
assert(leedsVehicleShader_add); assert(leedsVehicleShader_add);
leedsVehicleShader_blend = Shader::create(vs, fs_blend); leedsVehicleShader_blend = Shader::create(vs, fs_blend);
@ -383,8 +401,8 @@ CreateVehiclePipe(void)
} }
{ {
#include "shaders/leedsVehicle_mobile_fs_gl.inc" #include "shaders/obj/leedsVehicle_mobile_frag.inc"
#include "shaders/leedsVehicle_mobile_vs_gl.inc" #include "shaders/obj/leedsVehicle_mobile_vert.inc"
const char *vs[] = { shaderDecl, header_vert_src, leedsVehicle_mobile_vert_src, nil }; const char *vs[] = { shaderDecl, header_vert_src, leedsVehicle_mobile_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, leedsVehicle_mobile_frag_src, nil }; const char *fs[] = { shaderDecl, header_frag_src, leedsVehicle_mobile_frag_src, nil };
leedsVehicleShader_mobile = Shader::create(vs, fs); leedsVehicleShader_mobile = Shader::create(vs, fs);
@ -453,15 +471,7 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
else else
CustomPipes::leedsWorldShader->use(); CustomPipes::leedsWorldShader->use();
RGBAf amb, emiss; uploadWorldLights();
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
glUniform4fv(U(u_amb), 1, (float*)&amb);
glUniform4fv(U(u_emiss), 1, (float*)&emiss);
float colorscale[4]; float colorscale[4];
colorscale[3] = 1.0f; colorscale[3] = 1.0f;
@ -470,14 +480,14 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
m = inst->material; m = inst->material;
float cs = 1.0f; float cs = 1.0f;
if(WorldPipeSwitch == WORLDPIPE_PS2 && m->texture) if(WorldPipeSwitch != WORLDPIPE_MOBILE && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
glUniform4fv(U(u_colorscale), 1, colorscale); glUniform4fv(U(u_colorscale), 1, colorscale);
setTexture(0, m->texture); setTexture(0, m->texture);
setMaterial(m->color, m->surfaceProps, 0.5f); setMaterial(m->color, m->surfaceProps, CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 ? 0.5f : 1.0f);
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF); rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
@ -501,9 +511,9 @@ CreateWorldPipe(void)
// ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); // ReadTweakValueTable((char*)work_buff, WorldLightmapBlend);
{ {
#include "shaders/scale_fs_gl.inc" #include "shaders/obj/scale_frag.inc"
#include "shaders/leedsBuilding_vs_gl.inc" #include "shaders/obj/leedsBuilding_vert.inc"
#include "shaders/leedsBuilding_mobile_vs_gl.inc" #include "shaders/obj/leedsBuilding_mobile_vert.inc"
const char *vs[] = { shaderDecl, header_vert_src, leedsBuilding_vert_src, nil }; const char *vs[] = { shaderDecl, header_vert_src, leedsBuilding_vert_src, nil };
const char *vs_mobile[] = { shaderDecl, header_vert_src, leedsBuilding_mobile_vert_src, nil }; const char *vs_mobile[] = { shaderDecl, header_vert_src, leedsBuilding_mobile_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, scale_frag_src, nil }; const char *fs[] = { shaderDecl, header_frag_src, scale_frag_src, nil };
@ -610,8 +620,8 @@ CreateGlossPipe(void)
using namespace rw::gl3; using namespace rw::gl3;
{ {
#include "shaders/neoGloss_fs_gl.inc" #include "shaders/obj/neoGloss_frag.inc"
#include "shaders/neoGloss_vs_gl.inc" #include "shaders/obj/neoGloss_vert.inc"
const char *vs[] = { shaderDecl, header_vert_src, neoGloss_vert_src, nil }; const char *vs[] = { shaderDecl, header_vert_src, neoGloss_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, neoGloss_frag_src, nil }; const char *fs[] = { shaderDecl, header_frag_src, neoGloss_frag_src, nil };
neoGlossShader = Shader::create(vs, fs); neoGlossShader = Shader::create(vs, fs);
@ -782,8 +792,8 @@ CreateRimLightPipes(void)
} }
{ {
#include "shaders/simple_fs_gl.inc" #include "shaders/obj/simple_frag.inc"
#include "shaders/neoRimSkin_gl.inc" #include "shaders/obj/neoRimSkin_vert.inc"
const char *vs[] = { shaderDecl, header_vert_src, neoRimSkin_vert_src, nil }; const char *vs[] = { shaderDecl, header_vert_src, neoRimSkin_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, simple_frag_src, nil }; const char *fs[] = { shaderDecl, header_frag_src, simple_frag_src, nil };
neoRimSkinShader = Shader::create(vs, fs); neoRimSkinShader = Shader::create(vs, fs);
@ -791,8 +801,8 @@ CreateRimLightPipes(void)
} }
{ {
#include "shaders/simple_fs_gl.inc" #include "shaders/obj/simple_frag.inc"
#include "shaders/neoRim_gl.inc" #include "shaders/obj/neoRim_vert.inc"
const char *vs[] = { shaderDecl, header_vert_src, neoRim_vert_src, nil }; const char *vs[] = { shaderDecl, header_vert_src, neoRim_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, simple_frag_src, nil }; const char *fs[] = { shaderDecl, header_frag_src, simple_frag_src, nil };
neoRimShader = Shader::create(vs, fs); neoRimShader = Shader::create(vs, fs);
@ -936,25 +946,17 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
#endif #endif
RGBAf amb, emiss; CustomPipes::uploadWorldLights();
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
glUniform4fv(U(CustomPipes::u_amb), 1, (float*)&amb);
glUniform4fv(U(CustomPipes::u_emiss), 1, (float*)&emiss);
colorscale[3] = 1.0f; colorscale[3] = 1.0f;
setupDone = true; setupDone = true;
} }
setMaterial(m->color, m->surfaceProps, 0.5f); setMaterial(m->color, m->surfaceProps, CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 ? 0.5f : 1.0f);
float cs = 1.0f; float cs = 1.0f;
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture) if(CustomPipes::WorldPipeSwitch != CustomPipes::WORLDPIPE_MOBILE && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale); glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale);
@ -999,15 +1001,7 @@ RenderBlendPass(int pass)
else else
CustomPipes::leedsWorldShader->use(); CustomPipes::leedsWorldShader->use();
RGBAf amb, emiss; CustomPipes::uploadWorldLights();
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
glUniform4fv(U(CustomPipes::u_amb), 1, (float*)&amb);
glUniform4fv(U(CustomPipes::u_emiss), 1, (float*)&emiss);
float colorscale[4]; float colorscale[4];
colorscale[3] = 1.0f; colorscale[3] = 1.0f;
@ -1035,10 +1029,10 @@ RenderBlendPass(int pass)
rw::RGBA color = m->color; rw::RGBA color = m->color;
color.alpha = (color.alpha * building->fadeAlpha)/255; color.alpha = (color.alpha * building->fadeAlpha)/255;
setMaterial(color, m->surfaceProps, 0.5f); setMaterial(color, m->surfaceProps, CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 ? 0.5f : 1.0f);
float cs = 1.0f; float cs = 1.0f;
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture) if(CustomPipes::WorldPipeSwitch != CustomPipes::WORLDPIPE_MOBILE && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale); glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale);

View file

@ -16,13 +16,15 @@
RwRaster *CPostFX::pFrontBuffer; RwRaster *CPostFX::pFrontBuffer;
RwRaster *CPostFX::pBackBuffer; RwRaster *CPostFX::pBackBuffer;
bool CPostFX::bJustInitialised; bool CPostFX::bJustInitialised;
int CPostFX::EffectSwitch = POSTFX_NORMAL; int CPostFX::EffectSwitch = POSTFX_PS2;
bool CPostFX::BlurOn = false; bool CPostFX::BlurOn = false;
bool CPostFX::MotionBlurOn = false; bool CPostFX::MotionBlurOn = false;
static RwIm2DVertex Vertex[4]; static RwIm2DVertex Vertex[4];
static RwIm2DVertex Vertex2[4]; static RwIm2DVertex Vertex2[4];
static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 }; static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 };
static RwIm2DVertex BlurVertex[12];
static RwImVertexIndex BlurIndex[18] = { 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11 };
#ifdef RW_D3D9 #ifdef RW_D3D9
void *colourfilterLCS_PS; void *colourfilterLCS_PS;
@ -143,17 +145,17 @@ CPostFX::Open(RwCamera *cam)
#ifdef RW_D3D9 #ifdef RW_D3D9
#include "shaders/colourfilterLCS_PS.inc" #include "shaders/obj/colourfilterLCS_PS.inc"
colourfilterLCS_PS = rw::d3d::createPixelShader(colourfilterLCS_PS_cso); colourfilterLCS_PS = rw::d3d::createPixelShader(colourfilterLCS_PS_cso);
#include "shaders/contrastPS.inc" #include "shaders/obj/contrastPS.inc"
contrast_PS = rw::d3d::createPixelShader(contrastPS_cso); contrast_PS = rw::d3d::createPixelShader(contrastPS_cso);
#endif #endif
#ifdef RW_OPENGL #ifdef RW_OPENGL
using namespace rw::gl3; using namespace rw::gl3;
{ {
#include "shaders/im2d_gl.inc" #include "shaders/obj/im2d_vert.inc"
#include "shaders/colourfilterLCS_fs_gl.inc" #include "shaders/obj/colourfilterLCS_frag.inc"
const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil }; const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, colourfilterLCS_frag_src, nil }; const char *fs[] = { shaderDecl, header_frag_src, colourfilterLCS_frag_src, nil };
colourFilterLCS = Shader::create(vs, fs); colourFilterLCS = Shader::create(vs, fs);
@ -161,8 +163,8 @@ CPostFX::Open(RwCamera *cam)
} }
{ {
#include "shaders/im2d_gl.inc" #include "shaders/obj/im2d_vert.inc"
#include "shaders/contrast_fs_gl.inc" #include "shaders/obj/contrast_frag.inc"
const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil }; const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, contrast_frag_src, nil }; const char *fs[] = { shaderDecl, header_frag_src, contrast_frag_src, nil };
contrast = Shader::create(vs, fs); contrast = Shader::create(vs, fs);
@ -205,9 +207,44 @@ CPostFX::Close(void)
#endif #endif
} }
static float blurOffset = 0.6f;//3.0f/16.0f; // not quite sure sure about this
static float blurIntensity = 0.25f;
void void
CPostFX::RenderOverlayBlur(RwCamera *cam, int32 r, int32 g, int32 b, int32 a) CPostFX::RenderOverlayBlur(RwCamera *cam, int32 r, int32 g, int32 b, int32 a)
{ {
memcpy(BlurVertex, Vertex, sizeof(Vertex));
memcpy(BlurVertex+4, Vertex, sizeof(Vertex));
memcpy(BlurVertex+8, Vertex, sizeof(Vertex));
int intensity = 255*blurIntensity;
int i;
for(i = 0; i < 4; i++){
RwIm2DVertexSetScreenX(&BlurVertex[i], RwIm2DVertexGetScreenX(&BlurVertex[i]) + blurOffset);
RwIm2DVertexSetIntRGBA(&BlurVertex[i], 255, 255, 255, intensity);
}
for(i = 4; i < 8; i++){
RwIm2DVertexSetScreenX(&BlurVertex[i], RwIm2DVertexGetScreenX(&BlurVertex[i]) + blurOffset);
RwIm2DVertexSetScreenY(&BlurVertex[i], RwIm2DVertexGetScreenY(&BlurVertex[i]) + blurOffset);
RwIm2DVertexSetIntRGBA(&BlurVertex[i], 255, 255, 255, intensity);
}
for(i = 8; i < 12; i++){
RwIm2DVertexSetScreenY(&BlurVertex[i], RwIm2DVertexGetScreenY(&BlurVertex[i]) + blurOffset);
RwIm2DVertexSetIntRGBA(&BlurVertex[i], 255, 255, 255, intensity);
}
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pBackBuffer);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, BlurVertex, 12, BlurIndex, 18);
// this sucks: should render colourfilter with blending instead
// but can't change equation to subtraction for PSP here
GetBackBuffer(cam);
/* the old way
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pFrontBuffer); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pFrontBuffer);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
@ -240,6 +277,7 @@ CPostFX::RenderOverlayBlur(RwCamera *cam, int32 r, int32 g, int32 b, int32 a)
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6); RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, BlurOn ? Vertex2 : Vertex, 4, Index, 6); RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, BlurOn ? Vertex2 : Vertex, 4, Index, 6);
*/
} }
void void
@ -291,7 +329,7 @@ CPostFX::RenderOverlayShader(RwCamera *cam, int32 r, int32 g, int32 b, int32 a)
blurcolors[0] = r*f/255.0f; blurcolors[0] = r*f/255.0f;
blurcolors[1] = g*f/255.0f; blurcolors[1] = g*f/255.0f;
blurcolors[2] = b*f/255.0f; blurcolors[2] = b*f/255.0f;
blurcolors[3] = 30/255.0f; blurcolors[3] = EffectSwitch == POSTFX_PSP ? -1.0f : 1.0f;
#ifdef RW_D3D9 #ifdef RW_D3D9
rw::d3d::d3ddevice->SetPixelShaderConstantF(10, blurcolors, 1); rw::d3d::d3ddevice->SetPixelShaderConstantF(10, blurcolors, 1);
rw::d3d::im2dOverridePS = colourfilterLCS_PS; rw::d3d::im2dOverridePS = colourfilterLCS_PS;
@ -339,11 +377,8 @@ CPostFX::NeedBackBuffer(void)
case POSTFX_SIMPLE: case POSTFX_SIMPLE:
// no actual rendering here // no actual rendering here
return false; return false;
case POSTFX_NORMAL: case POSTFX_PSP:
if(MotionBlurOn) case POSTFX_PS2:
return false;
else
return true;
case POSTFX_MOBILE: case POSTFX_MOBILE:
return true; return true;
} }
@ -354,24 +389,11 @@ bool
CPostFX::NeedFrontBuffer(int32 type) CPostFX::NeedFrontBuffer(int32 type)
{ {
// Last frame -- needed for motion blur // Last frame -- needed for motion blur
if(CMBlur::Drunkness > 0.0f) if(MotionBlurOn)
return true; return true;
if(type == MOTION_BLUR_SNIPER) if(type == MOTION_BLUR_SNIPER)
return true; return true;
switch(EffectSwitch){
case POSTFX_OFF:
case POSTFX_SIMPLE:
// no actual rendering here
return false;
case POSTFX_NORMAL:
if(MotionBlurOn)
return true;
else
return false;
case POSTFX_MOBILE:
return false;
}
return false; return false;
} }
@ -386,11 +408,17 @@ CPostFX::GetBackBuffer(RwCamera *cam)
void void
CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha) CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha)
{ {
// LCS PS2 blur is drawn in three passes:
// blend frame with current frame 3 times to blur a bit
// blend one more time with colour filter
// motion blur like normal
if(pFrontBuffer == nil) if(pFrontBuffer == nil)
Open(cam); Open(cam);
assert(pFrontBuffer); assert(pFrontBuffer);
assert(pBackBuffer); assert(pBackBuffer);
/* // LCS: don't need that anymore
if(type == MOTION_BLUR_LIGHT_SCENE){ if(type == MOTION_BLUR_LIGHT_SCENE){
SmoothColor(red, green, blue, blur); SmoothColor(red, green, blue, blur);
red = AvgRed; red = AvgRed;
@ -398,6 +426,7 @@ CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blu
blue = AvgBlue; blue = AvgBlue;
blur = AvgAlpha; blur = AvgAlpha;
} }
*/
if(NeedBackBuffer()) if(NeedBackBuffer())
GetBackBuffer(cam); GetBackBuffer(cam);
@ -405,10 +434,15 @@ CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blu
DefinedState(); DefinedState();
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
if(BlurOn)
RenderOverlayBlur(cam, 0, 0, 0, 0);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
// TODO(LCS): check this out
if(type == MOTION_BLUR_SNIPER){ if(type == MOTION_BLUR_SNIPER){
if(!bJustInitialised) if(!bJustInitialised)
RenderOverlaySniper(cam, red, green, blue, blur); RenderOverlaySniper(cam, red, green, blue, blur);
@ -417,21 +451,16 @@ CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blu
case POSTFX_SIMPLE: case POSTFX_SIMPLE:
// no actual rendering here // no actual rendering here
break; break;
case POSTFX_NORMAL: case POSTFX_PSP:
if(MotionBlurOn){ case POSTFX_PS2:
if(!bJustInitialised)
RenderOverlayBlur(cam, red, green, blue, blur);
}else{
RenderOverlayShader(cam, red, green, blue, blur);
}
break;
case POSTFX_MOBILE: case POSTFX_MOBILE:
RenderOverlayShader(cam, red, green, blue, blur); RenderOverlayShader(cam, red, green, blue, blur);
break; break;
} }
if(MotionBlurOn)
if(!bJustInitialised) if(!bJustInitialised)
RenderMotionBlur(cam, 175.0f * CMBlur::Drunkness); RenderMotionBlur(cam, bluralpha);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);

View file

@ -7,9 +7,8 @@ class CPostFX
public: public:
enum { enum {
POSTFX_OFF, POSTFX_OFF,
// POSTFX_SIMPLE, POSTFX_PSP,
POSTFX_NORMAL, POSTFX_PS2,
// POSTFX_MOBILE
// not so sensible for the moment // not so sensible for the moment
POSTFX_SIMPLE = -1, POSTFX_SIMPLE = -1,

View file

@ -112,14 +112,14 @@ ScreenDroplets::InitDraw(void)
openim2d_uv2(); openim2d_uv2();
#ifdef RW_D3D9 #ifdef RW_D3D9
#include "shaders/screenDroplet_PS.inc" #include "shaders/obj/screenDroplet_PS.inc"
screenDroplet_PS = rw::d3d::createPixelShader(screenDroplet_PS_cso); screenDroplet_PS = rw::d3d::createPixelShader(screenDroplet_PS_cso);
#endif #endif
#ifdef RW_GL3 #ifdef RW_GL3
using namespace rw::gl3; using namespace rw::gl3;
{ {
#include "shaders/im2d_UV2_gl.inc" #include "shaders/obj/im2d_UV2_vert.inc"
#include "shaders/screenDroplet_fs_gl.inc" #include "shaders/obj/screenDroplet_frag.inc"
const char *vs[] = { shaderDecl, header_vert_src, im2d_UV2_vert_src, nil }; const char *vs[] = { shaderDecl, header_vert_src, im2d_UV2_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, screenDroplet_frag_src, nil }; const char *fs[] = { shaderDecl, header_frag_src, screenDroplet_frag_src, nil };
screenDroplet = Shader::create(vs, fs); screenDroplet = Shader::create(vs, fs);

View file

@ -1,121 +0,0 @@
all: im2d_gl.inc simple_fs_gl.inc default_UV2_gl.inc \
colourfilterLCS_fs_gl.inc contrast_fs_gl.inc \
neoRim_gl.inc neoRimSkin_gl.inc \
neoWorldVC_fs_gl.inc neoGloss_vs_gl.inc neoGloss_fs_gl.inc \
neoVehicle_vs_gl.inc neoVehicle_fs_gl.inc \
im2d_UV2_gl.inc screenDroplet_fs_gl.inc \
leedsBuilding_vs_gl.inc leedsBuilding_mobile_vs_gl.inc scale_fs_gl.inc \
leedsVehicle_vs_gl.inc leedsVehicle_add_gl.inc leedsVehicle_blend_gl.inc \
leedsVehicle_mobile_vs_gl.inc leedsVehicle_mobile_fs_gl.inc
im2d_gl.inc: im2d.vert
(echo 'const char *im2d_vert_src =';\
sed 's/..*/"&\\n"/' im2d.vert;\
echo ';') >im2d_gl.inc
colourfilterLCS_fs_gl.inc: colourfilterLCS.frag
(echo 'const char *colourfilterLCS_frag_src =';\
sed 's/..*/"&\\n"/' colourfilterLCS.frag;\
echo ';') >colourfilterLCS_fs_gl.inc
simple_fs_gl.inc: simple.frag
(echo 'const char *simple_frag_src =';\
sed 's/..*/"&\\n"/' simple.frag;\
echo ';') >simple_fs_gl.inc
default_UV2_gl.inc: default_UV2.vert
(echo 'const char *default_UV2_vert_src =';\
sed 's/..*/"&\\n"/' default_UV2.vert;\
echo ';') >default_UV2_gl.inc
contrast_fs_gl.inc: contrast.frag
(echo 'const char *contrast_frag_src =';\
sed 's/..*/"&\\n"/' contrast.frag;\
echo ';') >contrast_fs_gl.inc
neoRim_gl.inc: neoRim.vert
(echo 'const char *neoRim_vert_src =';\
sed 's/..*/"&\\n"/' neoRim.vert;\
echo ';') >neoRim_gl.inc
neoRimSkin_gl.inc: neoRimSkin.vert
(echo 'const char *neoRimSkin_vert_src =';\
sed 's/..*/"&\\n"/' neoRimSkin.vert;\
echo ';') >neoRimSkin_gl.inc
neoWorldVC_fs_gl.inc: neoWorldVC.frag
(echo 'const char *neoWorldVC_frag_src =';\
sed 's/..*/"&\\n"/' neoWorldVC.frag;\
echo ';') >neoWorldVC_fs_gl.inc
neoGloss_fs_gl.inc: neoGloss.frag
(echo 'const char *neoGloss_frag_src =';\
sed 's/..*/"&\\n"/' neoGloss.frag;\
echo ';') >neoGloss_fs_gl.inc
neoGloss_vs_gl.inc: neoGloss.vert
(echo 'const char *neoGloss_vert_src =';\
sed 's/..*/"&\\n"/' neoGloss.vert;\
echo ';') >neoGloss_vs_gl.inc
neoVehicle_vs_gl.inc: neoVehicle.vert
(echo 'const char *neoVehicle_vert_src =';\
sed 's/..*/"&\\n"/' neoVehicle.vert;\
echo ';') >neoVehicle_vs_gl.inc
neoVehicle_fs_gl.inc: neoVehicle.frag
(echo 'const char *neoVehicle_frag_src =';\
sed 's/..*/"&\\n"/' neoVehicle.frag;\
echo ';') >neoVehicle_fs_gl.inc
im2d_UV2_gl.inc: im2d_UV2.vert
(echo 'const char *im2d_UV2_vert_src =';\
sed 's/..*/"&\\n"/' im2d_UV2.vert;\
echo ';') >im2d_UV2_gl.inc
screenDroplet_fs_gl.inc: screenDroplet.frag
(echo 'const char *screenDroplet_frag_src =';\
sed 's/..*/"&\\n"/' screenDroplet.frag;\
echo ';') >screenDroplet_fs_gl.inc
leedsBuilding_vs_gl.inc: leedsBuilding.vert
(echo 'const char *leedsBuilding_vert_src =';\
sed 's/..*/"&\\n"/' leedsBuilding.vert;\
echo ';') >leedsBuilding_vs_gl.inc
leedsBuilding_mobile_vs_gl.inc: leedsBuilding_mobile.vert
(echo 'const char *leedsBuilding_mobile_vert_src =';\
sed 's/..*/"&\\n"/' leedsBuilding_mobile.vert;\
echo ';') >leedsBuilding_mobile_vs_gl.inc
scale_fs_gl.inc: scale.frag
(echo 'const char *scale_frag_src =';\
sed 's/..*/"&\\n"/' scale.frag;\
echo ';') >scale_fs_gl.inc
leedsVehicle_vs_gl.inc: leedsVehicle.vert
(echo 'const char *leedsVehicle_vert_src =';\
sed 's/..*/"&\\n"/' leedsVehicle.vert;\
echo ';') >leedsVehicle_vs_gl.inc
leedsVehicle_add_gl.inc: leedsVehicle_add.frag
(echo 'const char *leedsVehicle_add_frag_src =';\
sed 's/..*/"&\\n"/' leedsVehicle_add.frag;\
echo ';') >leedsVehicle_add_gl.inc
leedsVehicle_blend_gl.inc: leedsVehicle_blend.frag
(echo 'const char *leedsVehicle_blend_frag_src =';\
sed 's/..*/"&\\n"/' leedsVehicle_blend.frag;\
echo ';') >leedsVehicle_blend_gl.inc
leedsVehicle_mobile_vs_gl.inc: leedsVehicle_mobile.vert
(echo 'const char *leedsVehicle_mobile_vert_src =';\
sed 's/..*/"&\\n"/' leedsVehicle_mobile.vert;\
echo ';') >leedsVehicle_mobile_vs_gl.inc
leedsVehicle_mobile_fs_gl.inc: leedsVehicle_mobile.frag
(echo 'const char *leedsVehicle_mobile_frag_src =';\
sed 's/..*/"&\\n"/' leedsVehicle_mobile.frag;\
echo ';') >leedsVehicle_mobile_fs_gl.inc

View file

@ -1,13 +1,10 @@
sampler2D tex : register(s0); sampler2D tex : register(s0);
float4 blurcol : register(c10); float4 blurcol : register(c10);
//float4 blurcols[10] : register(c15);
float4 main(in float2 texcoord : TEXCOORD0) : COLOR0 float4 main(in float2 texcoord : TEXCOORD0) : COLOR0
{ {
float4 dst = tex2D(tex, texcoord.xy); float4 dst = tex2D(tex, texcoord.xy);
dst += dst*blurcol; dst += dst*blurcol*blurcol.a;
dst.a = 1.0; dst.a = 1.0;
return dst; return dst;
} }

View file

@ -2,29 +2,45 @@ uniform sampler2D tex0;
uniform sampler2D tex1; uniform sampler2D tex1;
uniform float u_fxparams; uniform float u_fxparams;
uniform vec4 u_colorscale;
#define shininess (u_fxparams) #define shininess (u_fxparams)
FSIN vec4 v_color; FSIN vec4 v_color;
FSIN vec2 v_tex0; FSIN vec2 v_tex0;
#if defined(PASS_BLEND) || defined(PASS_ADD)
FSIN vec2 v_tex1; FSIN vec2 v_tex1;
#endif
FSIN float v_fog; FSIN float v_fog;
void void
main(void) main(void)
{ {
vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y))*u_colorscale;
pass1.rgb = clamp(pass1.rgb, 0.0, 1.0);
pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);
vec4 color;
#if defined(PASS_BLEND) || defined(PASS_ADD)
vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y)); vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));
pass2.a *= shininess; pass2.a *= shininess;
pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);
pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog); pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);
// We simulate drawing this in two passes. // We simulate drawing this in two passes.
#if defined(PASS_ADD)
// First pass with standard blending, second with addition
// We premultiply alpha so render state should be one.
color.rgb = pass1.rgb*pass1.a + pass2.rgb*pass2.a;
color.a = pass1.a;
#elif defined(PASS_BLEND)
// We premultiply alpha so render state should be one. // We premultiply alpha so render state should be one.
vec4 color;
color.rgb = pass1.rgb*pass1.a*(1.0-pass2.a) + pass2.rgb*pass2.a; color.rgb = pass1.rgb*pass1.a*(1.0-pass2.a) + pass2.rgb*pass2.a;
color.a = pass1.a*(1.0-pass2.a) + pass2.a; color.a = pass1.a*(1.0-pass2.a) + pass2.a;
#endif
#else
color = pass1;
#endif
DoAlphaTest(color.a); DoAlphaTest(color.a);

View file

@ -0,0 +1,51 @@
#ifdef ENVMAP
uniform mat4 u_texMatrix;
#endif
#ifdef SKIN
uniform mat4 u_boneMatrices[64];
#endif
VSIN(ATTRIB_POS) vec3 in_pos;
VSOUT vec4 v_color;
VSOUT vec2 v_tex0;
#ifdef ENVMAP
VSOUT vec2 v_tex1;
#endif
VSOUT float v_fog;
void
main(void)
{
#ifdef SKIN
vec3 SkinVertex = vec3(0.0, 0.0, 0.0);
vec3 SkinNormal = vec3(0.0, 0.0, 0.0);
for(int i = 0; i < 4; i++){
SkinVertex += (u_boneMatrices[int(in_indices[i])] * vec4(in_pos, 1.0)).xyz * in_weights[i];
SkinNormal += (mat3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];
}
vec4 Vertex = u_world * vec4(SkinVertex, 1.0);
gl_Position = u_proj * u_view * Vertex;
vec3 Normal = mat3(u_world) * SkinNormal;
#else
vec4 Vertex = u_world * vec4(in_pos, 1.0);
gl_Position = u_proj * u_view * Vertex;
vec3 Normal = mat3(u_world) * in_normal;
#endif
v_tex0 = in_tex0;
#ifdef ENVMAP
v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy;
#endif
v_color = in_color;
v_color.rgb += u_ambLight.rgb*surfAmbient;
v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;
// PS2 clamps before material color
// PSP clamps after...maybe another constant for this?
v_color = clamp(v_color, 0.0, 1.0);
v_color *= u_matColor;
v_fog = DoFog(gl_Position.w);
}

View file

@ -1,7 +1,9 @@
struct VS_out { struct VS_out {
float4 Position : POSITION; float4 Position : POSITION;
float3 TexCoord0 : TEXCOORD0; float3 TexCoord0 : TEXCOORD0;
#if defined(PASS_BLEND) || defined(PASS_ADD)
float2 TexCoord1 : TEXCOORD1; float2 TexCoord1 : TEXCOORD1;
#endif
float4 Color : COLOR0; float4 Color : COLOR0;
}; };
@ -10,25 +12,38 @@ sampler2D envTex : register(s1);
float4 fogColor : register(c0); float4 fogColor : register(c0);
float4 fxparams : register(c1); float4 colorscale : register(c1);
float4 fxparams : register(c2);
#define shininess (fxparams.x) #define shininess (fxparams.x)
float4 main(VS_out input) : COLOR float4 main(VS_out input) : COLOR
{ {
float4 pass1 = input.Color*tex2D(diffTex, input.TexCoord0.xy); float4 pass1 = input.Color*tex2D(diffTex, input.TexCoord0.xy)*colorscale;
pass1.rgb = clamp(pass1.rgb, 0.0, 1.0);
pass1.rgb = lerp(fogColor.rgb, pass1.rgb, input.TexCoord0.z);
float4 color;
#if defined(PASS_BLEND) || defined(PASS_ADD)
float4 pass2 = tex2D(envTex, input.TexCoord1.xy); float4 pass2 = tex2D(envTex, input.TexCoord1.xy);
pass2.a *= shininess; pass2.a *= shininess;
pass1.rgb = lerp(fogColor.rgb, pass1.rgb, input.TexCoord0.z);
pass2.rgb = lerp(float3(0.0, 0.0, 0.0), pass2.rgb, input.TexCoord0.z); pass2.rgb = lerp(float3(0.0, 0.0, 0.0), pass2.rgb, input.TexCoord0.z);
// We simulate drawing this in two passes. // We simulate drawing this in two passes.
#if defined(PASS_ADD)
// First pass with standard blending, second with addition // First pass with standard blending, second with addition
// We premultiply alpha so render state should be one. // We premultiply alpha so render state should be one.
float4 color;
color.rgb = pass1.rgb*pass1.a + pass2.rgb*pass2.a; color.rgb = pass1.rgb*pass1.a + pass2.rgb*pass2.a;
color.a = pass1.a; color.a = pass1.a;
#elif defined(PASS_BLEND)
// We premultiply alpha so render state should be one.
color.rgb = pass1.rgb*pass1.a*(1.0-pass2.a) + pass2.rgb*pass2.a;
color.a = pass1.a*(1.0-pass2.a) + pass2.a;
#endif
#else
color = pass1;
#endif
return color; return color;
} }

View file

@ -1,6 +1,11 @@
#include "standardConstants.h" #include "standardConstants.h"
#ifdef ENVMAP
float4x4 texMat : register(c41); float4x4 texMat : register(c41);
#endif
#ifdef SKIN
float4x3 boneMatrices[64] : register(c41);
#endif
struct VS_in struct VS_in
{ {
@ -8,12 +13,18 @@ struct VS_in
float3 Normal : NORMAL; float3 Normal : NORMAL;
float2 TexCoord : TEXCOORD0; float2 TexCoord : TEXCOORD0;
float4 Prelight : COLOR0; float4 Prelight : COLOR0;
#ifdef SKIN
float4 Weights : BLENDWEIGHT;
int4 Indices : BLENDINDICES;
#endif
}; };
struct VS_out { struct VS_out {
float4 Position : POSITION; float4 Position : POSITION;
float3 TexCoord0 : TEXCOORD0; // also fog float3 TexCoord0 : TEXCOORD0; // also fog
#ifdef ENVMAP
float2 TexCoord1 : TEXCOORD1; float2 TexCoord1 : TEXCOORD1;
#endif
float4 Color : COLOR0; float4 Color : COLOR0;
}; };
@ -22,12 +33,27 @@ VS_out main(in VS_in input)
{ {
VS_out output; VS_out output;
#ifdef SKIN
int j;
float3 SkinVertex = float3(0.0, 0.0, 0.0);
float3 SkinNormal = float3(0.0, 0.0, 0.0);
for(j = 0; j < 4; j++){
SkinVertex += mul(input.Position, boneMatrices[input.Indices[j]]).xyz * input.Weights[j];
SkinNormal += mul(input.Normal, (float3x3)boneMatrices[input.Indices[j]]).xyz * input.Weights[j];
}
output.Position = mul(combinedMat, SkinVertex);
// float3 V = mul(worldMat, SkinVertex).xyz;
float3 N = mul(normalMat, SkinNormal);
#else
output.Position = mul(combinedMat, input.Position); output.Position = mul(combinedMat, input.Position);
float3 V = mul(worldMat, input.Position).xyz; // float3 V = mul(worldMat, input.Position).xyz;
float3 N = mul(normalMat, input.Normal); float3 N = mul(normalMat, input.Normal);
#endif
output.TexCoord0.xy = input.TexCoord; output.TexCoord0.xy = input.TexCoord;
#ifdef ENVMAP
output.TexCoord1 = mul(texMat, float4(N, 1.0)).xy; output.TexCoord1 = mul(texMat, float4(N, 1.0)).xy;
#endif
output.Color = input.Prelight; output.Color = input.Prelight;
output.Color.rgb += ambientLight.rgb * surfAmbient; output.Color.rgb += ambientLight.rgb * surfAmbient;
@ -36,6 +62,7 @@ VS_out main(in VS_in input)
for(i = 0; i < numDirLights; i++) for(i = 0; i < numDirLights; i++)
output.Color.xyz += DoDirLight(lights[i+firstDirLight], N)*surfDiffuse; output.Color.xyz += DoDirLight(lights[i+firstDirLight], N)*surfDiffuse;
// PS2 clamps before material color // PS2 clamps before material color
// PSP clamps after...maybe another constant for this?
output.Color = clamp(output.Color, 0.0, 1.0); output.Color = clamp(output.Color, 0.0, 1.0);
output.Color *= matCol; output.Color *= matCol;

View file

@ -1,27 +0,0 @@
uniform mat4 u_texMatrix;
VSIN(ATTRIB_POS) vec3 in_pos;
VSOUT vec4 v_color;
VSOUT vec2 v_tex0;
VSOUT vec2 v_tex1;
VSOUT float v_fog;
void
main(void)
{
vec4 Vertex = u_world * vec4(in_pos, 1.0);
gl_Position = u_proj * u_view * Vertex;
vec3 Normal = mat3(u_world) * in_normal;
v_tex0 = in_tex0;
v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy;
v_color = in_color;
v_color.rgb += u_ambLight.rgb*surfAmbient;
v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;
v_color = clamp(v_color, 0.0, 1.0);
v_color *= u_matColor;
v_fog = DoFog(gl_Position.w);
}

View file

@ -1,32 +0,0 @@
uniform sampler2D tex0;
uniform sampler2D tex1;
uniform float u_fxparams;
#define shininess (u_fxparams)
FSIN vec4 v_color;
FSIN vec2 v_tex0;
FSIN vec2 v_tex1;
FSIN float v_fog;
void
main(void)
{
vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));
pass2.a *= shininess;
pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);
pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);
// We simulate drawing this in two passes.
// We premultiply alpha so render state should be one.
vec4 color;
color.rgb = pass1.rgb*pass1.a + pass2.rgb*pass2.a;
color.a = pass1.a;
DoAlphaTest(color.a);
FRAGCOLOR(color);
}

View file

@ -1,44 +0,0 @@
static unsigned char leedsVehicle_add_PS_cso[] = {
0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x40, 0x00, 0x43, 0x54, 0x41, 0x42,
0x1c, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff,
0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0xc1, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x02, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x84, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x00,
0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xa8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
0x01, 0x00, 0x06, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x64, 0x69, 0x66, 0x66, 0x54, 0x65, 0x78, 0x00, 0x04, 0x00, 0x0c, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x65, 0x6e, 0x76, 0x54, 0x65, 0x78, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x66, 0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0xab, 0xab,
0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x66, 0x78, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72,
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c,
0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f,
0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e,
0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0xb0,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xb0,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x01, 0x08, 0x0f, 0xa0,
0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xb0,
0x01, 0x08, 0xe4, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80,
0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03,
0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0x00, 0xa0,
0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xaa, 0xb0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80,
0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04,
0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xe4, 0xa1, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x08, 0x80,
0x01, 0x00, 0xff, 0x80, 0x00, 0x00, 0xff, 0x90, 0x04, 0x00, 0x00, 0x04,
0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x01, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, 0x80,
0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80,
0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80,
0xff, 0xff, 0x00, 0x00
};

View file

@ -1,34 +0,0 @@
const char *leedsVehicle_add_frag_src =
"uniform sampler2D tex0;\n"
"uniform sampler2D tex1;\n"
"uniform float u_fxparams;\n"
"#define shininess (u_fxparams)\n"
"FSIN vec4 v_color;\n"
"FSIN vec2 v_tex0;\n"
"FSIN vec2 v_tex1;\n"
"FSIN float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
" vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n"
" pass2.a *= shininess;\n"
" pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);\n"
" pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);\n"
" // We simulate drawing this in two passes.\n"
" // We premultiply alpha so render state should be one.\n"
" vec4 color;\n"
" color.rgb = pass1.rgb*pass1.a + pass2.rgb*pass2.a;\n"
" color.a = pass1.a;\n"
" DoAlphaTest(color.a);\n"
" FRAGCOLOR(color);\n"
"}\n"
;

View file

@ -1,33 +0,0 @@
struct VS_out {
float4 Position : POSITION;
float3 TexCoord0 : TEXCOORD0;
float2 TexCoord1 : TEXCOORD1;
float4 Color : COLOR0;
};
sampler2D diffTex : register(s0);
sampler2D envTex : register(s1);
float4 fogColor : register(c0);
float4 fxparams : register(c1);
#define shininess (fxparams.x)
float4 main(VS_out input) : COLOR
{
float4 pass1 = input.Color*tex2D(diffTex, input.TexCoord0.xy);
float4 pass2 = tex2D(envTex, input.TexCoord1.xy);
pass2.a *= shininess;
pass1.rgb = lerp(fogColor.rgb, pass1.rgb, input.TexCoord0.z);
pass2.rgb = lerp(float3(0.0, 0.0, 0.0), pass2.rgb, input.TexCoord0.z);
// We simulate drawing this in two passes.
// We premultiply alpha so render state should be one.
float4 color;
color.rgb = pass1.rgb*pass1.a*(1.0-pass2.a) + pass2.rgb*pass2.a;
color.a = pass1.a*(1.0-pass2.a) + pass2.a;
return color;
}

View file

@ -1,50 +0,0 @@
static unsigned char leedsVehicle_blend_PS_cso[] = {
0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x40, 0x00, 0x43, 0x54, 0x41, 0x42,
0x1c, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff,
0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0xc1, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x02, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x84, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x00,
0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xa8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
0x01, 0x00, 0x06, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x64, 0x69, 0x66, 0x66, 0x54, 0x65, 0x78, 0x00, 0x04, 0x00, 0x0c, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x65, 0x6e, 0x76, 0x54, 0x65, 0x78, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x66, 0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0xab, 0xab,
0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x66, 0x78, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72,
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c,
0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f,
0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e,
0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab,
0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0xb0,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xb0,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x01, 0x08, 0x0f, 0xa0,
0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0,
0x00, 0x08, 0xe4, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80,
0x01, 0x00, 0xe4, 0xb0, 0x01, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04,
0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x00, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xe4, 0xa1, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x80,
0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xff, 0x90, 0x04, 0x00, 0x00, 0x04,
0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x00, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80,
0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xaa, 0xb0,
0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x08, 0x80, 0x01, 0x00, 0xff, 0x80,
0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80,
0x01, 0x00, 0x00, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x08, 0x80,
0x01, 0x00, 0xff, 0x80, 0x02, 0x00, 0x00, 0x81, 0x02, 0x00, 0x00, 0xa0,
0x04, 0x00, 0x00, 0x04, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80,
0x01, 0x00, 0xff, 0x80, 0x02, 0x00, 0xff, 0x80, 0x12, 0x00, 0x00, 0x04,
0x03, 0x00, 0x07, 0x80, 0x02, 0x00, 0xff, 0x80, 0x01, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80,
0x03, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00
};

View file

@ -14,9 +14,9 @@ sampler2D envTex : register(s1);
float4 fogColor : register(c0); float4 fogColor : register(c0);
float4 fxparams : register(c1); float4 fxparams : register(c2);
float3 skyTop : register(c2); float3 skyTop : register(c3);
float3 skyBot : register(c3); float3 skyBot : register(c4);
#define shininess (fxparams.x) #define shininess (fxparams.x)

View file

@ -1,29 +0,0 @@
const char *leedsVehicle_vert_src =
"uniform mat4 u_texMatrix;\n"
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
"VSOUT vec4 v_color;\n"
"VSOUT vec2 v_tex0;\n"
"VSOUT vec2 v_tex1;\n"
"VSOUT float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * in_normal;\n"
" v_tex0 = in_tex0;\n"
" v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy;\n"
" v_color = in_color;\n"
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
" v_color = clamp(v_color, 0.0, 1.0);\n"
" v_color *= u_matColor;\n"
" v_fog = DoFog(gl_Position.w);\n"
"}\n"
;

View file

@ -1,3 +0,0 @@
@echo off
for %%f in (*PS.hlsl) do "%DXSDK_DIR%\Utilities\bin\x86\fxc.exe" /T ps_2_0 /nologo /E main /Fo %%~nf.cso %%f
for %%f in (*VS.hlsl) do "%DXSDK_DIR%\Utilities\bin\x86\fxc.exe" /T vs_2_0 /nologo /E main /Fo %%~nf.cso %%f

View file

@ -0,0 +1,9 @@
#!sh
for i in *.vert; do
echo $i
./makeinc_glsl.sh $i
done
for i in *.frag; do
echo $i
./makeinc_glsl.sh $i
done

View file

@ -0,0 +1,7 @@
@echo off
for %%f in (*PS.hlsl) do "%DXSDK_DIR%\Utilities\bin\x86\fxc.exe" /T ps_2_0 /nologo /E main /Fo obj\%%~nf.cso %%f
for %%f in (*VS.hlsl) do "%DXSDK_DIR%\Utilities\bin\x86\fxc.exe" /T vs_2_0 /nologo /E main /Fo obj\%%~nf.cso %%f
"%DXSDK_DIR%\Utilities\bin\x86\fxc.exe" /T vs_2_0 /nologo /E main /DENVMAP /Fo obj\leedsDefault_ENV_VS.cso leedsDefault_VS_x.hlsl
"%DXSDK_DIR%\Utilities\bin\x86\fxc.exe" /T ps_2_0 /nologo /E main /DPASS_ADD /Fo obj\leedsDefault_ADD_PS.cso leedsDefault_PS_x.hlsl
"%DXSDK_DIR%\Utilities\bin\x86\fxc.exe" /T ps_2_0 /nologo /E main /DPASS_BLEND /Fo obj\leedsDefault_BLEND_PS.cso leedsDefault_PS_x.hlsl

View file

@ -0,0 +1,6 @@
#!sh
ext=${1##*.}
name=${1%.*}
(echo "const char *${name}_${ext}_src =";\
sed 's/..*/"&\\n"/' $1;\
echo ';') > obj/${name}_${ext}.inc

View file

@ -1,4 +1,5 @@
#!sh #!sh
cd obj
for i in *cso; do for i in *cso; do
(echo -n 'static ' (echo -n 'static '
xxd -i $i | grep -v '_len = ') > ${i%cso}inc xxd -i $i | grep -v '_len = ') > ${i%cso}inc

View file

@ -19,9 +19,10 @@ static unsigned char colourfilterLCS_PS_cso[] = {
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0,
0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0,
0x00, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80,
0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04,
0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xff, 0xa0,
0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80,
0xff, 0xff, 0x00, 0x00 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80,
0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00
}; };

Binary file not shown.

View file

@ -0,0 +1,47 @@
static unsigned char leedsDefault_ADD_PS_cso[] = {
0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x47, 0x00, 0x43, 0x54, 0x41, 0x42,
0x1c, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff,
0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0xde, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
0x01, 0x00, 0x06, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x9c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00,
0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x00, 0xbc, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x02, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xd5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x0a, 0x00,
0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f,
0x72, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x00, 0xab, 0x01, 0x00, 0x03, 0x00,
0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x64, 0x69, 0x66, 0x66, 0x54, 0x65, 0x78, 0x00, 0x04, 0x00, 0x0c, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x65, 0x6e, 0x76, 0x54, 0x65, 0x78, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x66, 0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x66, 0x78, 0x70,
0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30,
0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28,
0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64,
0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20,
0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31,
0x31, 0x00, 0xab, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80,
0x00, 0x00, 0x07, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80,
0x01, 0x00, 0x03, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80,
0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90,
0x00, 0x08, 0x0f, 0xa0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90,
0x01, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80,
0x01, 0x00, 0xe4, 0xb0, 0x01, 0x08, 0xe4, 0xa0, 0x42, 0x00, 0x00, 0x03,
0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0,
0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80,
0x02, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80,
0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x05, 0x00, 0x00, 0x03,
0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80,
0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xe4, 0x90, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80,
0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02,
0x01, 0x00, 0x17, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x12, 0x00, 0x00, 0x04,
0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x01, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x07, 0x80,
0x02, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80,
0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x80,
0xff, 0xff, 0x00, 0x00
};

Binary file not shown.

View file

@ -0,0 +1,53 @@
static unsigned char leedsDefault_BLEND_PS_cso[] = {
0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x47, 0x00, 0x43, 0x54, 0x41, 0x42,
0x1c, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff,
0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0xde, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
0x01, 0x00, 0x06, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x9c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00,
0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x00, 0xbc, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x02, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xd5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x0a, 0x00,
0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f,
0x72, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x00, 0xab, 0x01, 0x00, 0x03, 0x00,
0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x64, 0x69, 0x66, 0x66, 0x54, 0x65, 0x78, 0x00, 0x04, 0x00, 0x0c, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x65, 0x6e, 0x76, 0x54, 0x65, 0x78, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x66, 0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x66, 0x78, 0x70,
0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30,
0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28,
0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64,
0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20,
0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31,
0x31, 0x00, 0xab, 0xab, 0x51, 0x00, 0x00, 0x05, 0x03, 0x00, 0x0f, 0xa0,
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80,
0x00, 0x00, 0x07, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80,
0x01, 0x00, 0x03, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80,
0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90,
0x00, 0x08, 0x0f, 0xa0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90,
0x01, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80,
0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, 0x42, 0x00, 0x00, 0x03,
0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xb0, 0x01, 0x08, 0xe4, 0xa0,
0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xe4, 0x90, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80,
0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02,
0x00, 0x00, 0x17, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x12, 0x00, 0x00, 0x04,
0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x00, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80,
0x00, 0x00, 0xff, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xaa, 0xb0,
0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, 0x80,
0x02, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, 0x08, 0x80,
0x02, 0x00, 0x00, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x08, 0x80,
0x01, 0x00, 0xff, 0x80, 0x03, 0x00, 0xff, 0x81, 0x03, 0x00, 0x00, 0xa0,
0x04, 0x00, 0x00, 0x04, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80,
0x01, 0x00, 0xff, 0x80, 0x02, 0x00, 0x00, 0x80, 0x12, 0x00, 0x00, 0x04,
0x03, 0x00, 0x07, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80,
0x03, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00
};

View file

@ -1,4 +1,4 @@
static unsigned char leedsVehicle_VS_cso[] = { static unsigned char leedsDefault_ENV_VS_cso[] = {
0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x8d, 0x00, 0x43, 0x54, 0x41, 0x42, 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x8d, 0x00, 0x43, 0x54, 0x41, 0x42,
0x1c, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, 0x1c, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff,
0x0a, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,

View file

@ -1,31 +1,47 @@
const char *leedsVehicle_blend_frag_src = const char *leedsDefault_frag_src =
"uniform sampler2D tex0;\n" "uniform sampler2D tex0;\n"
"uniform sampler2D tex1;\n" "uniform sampler2D tex1;\n"
"uniform float u_fxparams;\n" "uniform float u_fxparams;\n"
"uniform vec4 u_colorscale;\n"
"#define shininess (u_fxparams)\n" "#define shininess (u_fxparams)\n"
"FSIN vec4 v_color;\n" "FSIN vec4 v_color;\n"
"FSIN vec2 v_tex0;\n" "FSIN vec2 v_tex0;\n"
"#if defined(PASS_BLEND) || defined(PASS_ADD)\n"
"FSIN vec2 v_tex1;\n" "FSIN vec2 v_tex1;\n"
"#endif\n"
"FSIN float v_fog;\n" "FSIN float v_fog;\n"
"void\n" "void\n"
"main(void)\n" "main(void)\n"
"{\n" "{\n"
" vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" " vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y))*u_colorscale;\n"
" pass1.rgb = clamp(pass1.rgb, 0.0, 1.0);\n"
" pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);\n"
" vec4 color;\n"
"#if defined(PASS_BLEND) || defined(PASS_ADD)\n"
" vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n" " vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n"
" pass2.a *= shininess;\n" " pass2.a *= shininess;\n"
" pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);\n"
" pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);\n" " pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);\n"
" // We simulate drawing this in two passes.\n" " // We simulate drawing this in two passes.\n"
"#if defined(PASS_ADD)\n"
" // First pass with standard blending, second with addition\n"
" // We premultiply alpha so render state should be one.\n"
" color.rgb = pass1.rgb*pass1.a + pass2.rgb*pass2.a;\n"
" color.a = pass1.a;\n"
"#elif defined(PASS_BLEND)\n"
" // We premultiply alpha so render state should be one.\n" " // We premultiply alpha so render state should be one.\n"
" vec4 color;\n"
" color.rgb = pass1.rgb*pass1.a*(1.0-pass2.a) + pass2.rgb*pass2.a;\n" " color.rgb = pass1.rgb*pass1.a*(1.0-pass2.a) + pass2.rgb*pass2.a;\n"
" color.a = pass1.a*(1.0-pass2.a) + pass2.a;\n" " color.a = pass1.a*(1.0-pass2.a) + pass2.a;\n"
"#endif\n"
"#else\n"
" color = pass1;\n"
"#endif\n"
" DoAlphaTest(color.a);\n" " DoAlphaTest(color.a);\n"

View file

@ -0,0 +1,53 @@
const char *leedsDefault_vert_src =
"#ifdef ENVMAP\n"
"uniform mat4 u_texMatrix;\n"
"#endif\n"
"#ifdef SKIN\n"
"uniform mat4 u_boneMatrices[64];\n"
"#endif\n"
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
"VSOUT vec4 v_color;\n"
"VSOUT vec2 v_tex0;\n"
"#ifdef ENVMAP\n"
"VSOUT vec2 v_tex1;\n"
"#endif\n"
"VSOUT float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
"#ifdef SKIN\n"
" vec3 SkinVertex = vec3(0.0, 0.0, 0.0);\n"
" vec3 SkinNormal = vec3(0.0, 0.0, 0.0);\n"
" for(int i = 0; i < 4; i++){\n"
" SkinVertex += (u_boneMatrices[int(in_indices[i])] * vec4(in_pos, 1.0)).xyz * in_weights[i];\n"
" SkinNormal += (mat3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];\n"
" }\n"
" vec4 Vertex = u_world * vec4(SkinVertex, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * SkinNormal;\n"
"#else\n"
" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * in_normal;\n"
"#endif\n"
" v_tex0 = in_tex0;\n"
"#ifdef ENVMAP\n"
" v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy;\n"
"#endif\n"
" v_color = in_color;\n"
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
" // PS2 clamps before material color\n"
" // PSP clamps after...maybe another constant for this?\n"
" v_color = clamp(v_color, 0.0, 1.0);\n"
" v_color *= u_matColor;\n"
" v_fog = DoFog(gl_Position.w);\n"
"}\n"
;

Binary file not shown.

View file

@ -7,11 +7,11 @@ static unsigned char leedsVehicle_mobile_PS_cso[] = {
0xac, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x00, 0xac, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x00,
0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xd0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00,
0x01, 0x00, 0x06, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe9, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x0e, 0x00, 0xe9, 0x00, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, 0x01, 0x00, 0x12, 0x00,
0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x0a, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x0e, 0x00, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x64, 0x69, 0x66, 0x66, 0x54, 0x65, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x69, 0x66, 0x66, 0x54, 0x65, 0x78, 0x00,
0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x65, 0x6e, 0x76, 0x54, 0x65, 0x78, 0x00, 0xab, 0x00, 0x00, 0x00, 0x00, 0x65, 0x6e, 0x76, 0x54, 0x65, 0x78, 0x00, 0xab,
@ -27,7 +27,7 @@ static unsigned char leedsVehicle_mobile_PS_cso[] = {
0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70,
0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35,
0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05,
0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0xbf, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0xbf,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05,
0x05, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x30, 0x40, 0x00, 0x00, 0x80, 0x3e, 0x05, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x30, 0x40, 0x00, 0x00, 0x80, 0x3e,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02,
@ -38,13 +38,13 @@ static unsigned char leedsVehicle_mobile_PS_cso[] = {
0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x1f, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x90, 0x01, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x90, 0x01, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03,
0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0,
0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, 0x80, 0x04, 0x00, 0xe4, 0xa0,
0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x81, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x81,
0x02, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x03, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x03, 0x80,
0x01, 0x00, 0xe4, 0xb0, 0x04, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0xd2, 0xa0, 0x01, 0x00, 0xe4, 0xb0, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xd2, 0xa0,
0x42, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x42, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x01, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x07, 0x80, 0x01, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x07, 0x80,
0x02, 0x00, 0x55, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe4, 0xa0,
0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, 0x02, 0x00, 0xaa, 0x80, 0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, 0x02, 0x00, 0xaa, 0x80,
0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03,
0x03, 0x00, 0x08, 0x80, 0x02, 0x00, 0x00, 0xb0, 0x02, 0x00, 0x00, 0xb0, 0x03, 0x00, 0x08, 0x80, 0x02, 0x00, 0x00, 0xb0, 0x02, 0x00, 0x00, 0xb0,
@ -53,7 +53,7 @@ static unsigned char leedsVehicle_mobile_PS_cso[] = {
0x03, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x55, 0xa0, 0x03, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x55, 0xa0,
0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x03, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x03, 0x00, 0xff, 0x80,
0x02, 0x00, 0x55, 0xb0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x02, 0x00, 0x55, 0xb0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x08, 0x80,
0x03, 0x00, 0xff, 0x80, 0x01, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0xff, 0x80, 0x02, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03,
0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90,
0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x07, 0x80, 0x03, 0x00, 0xff, 0x80, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x07, 0x80, 0x03, 0x00, 0xff, 0x80,
0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x12, 0x00, 0x00, 0x04,

Some files were not shown because too many files have changed in this diff Show more